diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/src/components/publics/PublicPreview.svelte b/src/components/publics/PublicPreview.svelte index 8934b83..503540c 100644 --- a/src/components/publics/PublicPreview.svelte +++ b/src/components/publics/PublicPreview.svelte @@ -22,9 +22,8 @@ import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js"; import { OrbitControls } from "three/addons/controls/OrbitControls.js"; import {onDestroy, onMount} from "svelte"; - import { CollectionEntry } from "astro:content"; - export let pub: CollectionEntry<"publics">; + export let file: string; export let fov: number = 60; export let near: number = 1 export let far: number = 1000; @@ -41,10 +40,6 @@ let observer: ResizeObserver; onMount(() => { - if (!pub.data["3d"]) { - return; - } - scene = new THREE.Scene(); scene.background = new THREE.Color(0x171717); camera = new THREE.PerspectiveCamera(fov, 1, near, far); @@ -57,8 +52,8 @@ const loader = new GLTFLoader(); - loader.load(`/3d/${pub.id}.glb`, (gltf) => { - scene.add(gltf.scene); + loader.load(`/3d/${file}.glb`, (gltf) => { + let s = scene.add(gltf.scene); let cube_bbox = new THREE.Box3(); cube_bbox.setFromObject(gltf.scene); @@ -69,9 +64,7 @@ camera.position.set(0, center.y, distance); controls.update(); - }, undefined, (e) => { - console.error(e); - }); + }, undefined, console.log); div.append(renderer.domElement); diff --git a/src/components/publics/XRayPreview.svelte b/src/components/publics/XRayPreview.svelte index 1676343..b458e98 100644 --- a/src/components/publics/XRayPreview.svelte +++ b/src/components/publics/XRayPreview.svelte @@ -20,19 +20,29 @@ -