controls for camera / guides / scans / levels
This commit is contained in:
@@ -4,7 +4,9 @@ import { CeilingSystem, ItemSystem, SlabSystem, WallSystem } from '@pascal-app/c
|
||||
import { Bvh, Environment } from '@react-three/drei'
|
||||
import { Canvas, extend, type ThreeToJSXElements } from '@react-three/fiber'
|
||||
import * as THREE from 'three/webgpu'
|
||||
import { GuideSystem } from '../../systems/guide/guide-system'
|
||||
import { LevelSystem } from '../../systems/level/level-system'
|
||||
import { ScanSystem } from '../../systems/scan/scan-system'
|
||||
import { SceneRenderer } from '../renderers/scene-renderer'
|
||||
import PostProcessing from './post-processing'
|
||||
import { ViewerCamera } from './viewer-camera'
|
||||
@@ -42,6 +44,9 @@ const Viewer: React.FC<ViewerProps> = ({ children }) => {
|
||||
|
||||
{/* Default Systems */}
|
||||
<LevelSystem />
|
||||
<GuideSystem />
|
||||
<ScanSystem />
|
||||
{/* Core systems */}
|
||||
<CeilingSystem />
|
||||
<ItemSystem />
|
||||
<SlabSystem />
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { sceneRegistry } from '@pascal-app/core'
|
||||
import { useEffect } from 'react'
|
||||
import useViewer from '../../store/use-viewer'
|
||||
|
||||
export const GuideSystem = () => {
|
||||
const showGuides = useViewer((state) => state.showGuides)
|
||||
|
||||
useEffect(() => {
|
||||
const guides = sceneRegistry.byType.guide || new Set()
|
||||
guides.forEach((guideId) => {
|
||||
const node = sceneRegistry.nodes.get(guideId)
|
||||
if (node) {
|
||||
node.visible = showGuides
|
||||
}
|
||||
})
|
||||
}, [showGuides])
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { sceneRegistry } from '@pascal-app/core'
|
||||
import { useEffect } from 'react'
|
||||
import useViewer from '../../store/use-viewer'
|
||||
|
||||
export const ScanSystem = () => {
|
||||
const showScans = useViewer((state) => state.showScans)
|
||||
|
||||
useEffect(() => {
|
||||
const scans = sceneRegistry.byType.scan || new Set()
|
||||
scans.forEach((scanId) => {
|
||||
const node = sceneRegistry.nodes.get(scanId)
|
||||
if (node) {
|
||||
node.visible = showScans
|
||||
}
|
||||
})
|
||||
}, [showScans])
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user