File size: 1,570 Bytes
ebcc4b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<script lang="ts">
	import Robots from "@/components/3d/elements/robot/Robots.svelte";
	import Computes from "@/components/3d/elements/compute/Computes.svelte";
	import Videos from "@/components/3d/elements/video/Videos.svelte";
	import { PerfMonitor } from "@threlte/extras";
	import { T, Canvas } from "@threlte/core";
	import Floor from '@/components/3d/Floor.svelte'
	import { Gizmo, OrbitControls } from "@threlte/extras";
	import { dev } from "$app/environment";

	let { data } = $props();
</script>

<Canvas>
	<T.Scene>
		<T.PerspectiveCamera position.x={-15} position.y={15} position.z={15} fov={20} makeDefault>
			<OrbitControls
				enableDamping
				dampingFactor={0.05}
				enableZoom
				minDistance={15}
				maxDistance={40}
				minPolarAngle={Math.PI / 6}
				maxPolarAngle={Math.PI / 2}
				target={[0, 1, 0]}
			>
				<Gizmo />
			</OrbitControls>
		</T.PerspectiveCamera>

		<!-- Lighting setup -->
		<T.AmbientLight intensity={0.4} />
		<T.DirectionalLight
			position={[2, 20, 5]}
			intensity={1}
			castShadow
			shadow.mapSize.width={1024}
			shadow.mapSize.height={1024}
		/>
		<T.DirectionalLight
			position={[-2, 20, -5]}
			intensity={1}
			castShadow
			shadow.mapSize.width={1024}
			shadow.mapSize.height={1024}
		/>

		<Floor />

		<!-- Robot component now gets robots from robotManager -->
		<Robots workspaceId={data.workspaceId} />

		<Videos workspaceId={data.workspaceId} />

		<Computes workspaceId={data.workspaceId} />
	</T.Scene>
	{#if dev}
		<PerfMonitor anchorX="right" anchorY="bottom" logsPerSecond={30} />
	{/if}
</Canvas>