Spaces:
Running
Running
File size: 2,201 Bytes
6ce4ca6 8173aa6 6ce4ca6 8173aa6 6ce4ca6 8173aa6 6ce4ca6 8173aa6 6ce4ca6 8173aa6 6ce4ca6 8173aa6 6ce4ca6 8173aa6 6ce4ca6 8173aa6 6ce4ca6 8173aa6 6ce4ca6 8173aa6 67a499d 8173aa6 |
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
<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";
import { onMount } from "svelte";
import Overlay from "@/components/interface/overlay/Overlay.svelte";
let workspaceId = $state("");
onMount(() => {
// Get workspace ID from URL hash or generate new one
const hash = window.location.hash.slice(1); // Remove the # symbol
if (hash && hash.length > 0) {
workspaceId = hash;
} else {
// Generate new workspace ID and update URL
workspaceId = crypto.randomUUID();
window.location.hash = workspaceId;
}
});
</script>
{#if workspaceId}
<Overlay {workspaceId} />
<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={5}
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} />
<Videos {workspaceId} />
<Computes {workspaceId} />
</T.Scene>
{#if dev}
<PerfMonitor anchorX="right" anchorY="bottom" logsPerSecond={30} />
{/if}
</Canvas>
{:else}
<div class="flex h-screen items-center justify-center">
<div class="text-slate-900 dark:text-white">Loading</div>
</div>
{/if}
|