From bdcd9b7c49a8a5495897fad3695a9b9c105b7748 Mon Sep 17 00:00:00 2001 From: Yang Date: Wed, 30 Mar 2022 17:28:03 +0800 Subject: [PATCH] gltf import test --- .../archviz/YangArchvizComponent.ts | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/src/components/archviz/YangArchvizComponent.ts b/src/components/archviz/YangArchvizComponent.ts index 5cb0966..c697777 100644 --- a/src/components/archviz/YangArchvizComponent.ts +++ b/src/components/archviz/YangArchvizComponent.ts @@ -1,40 +1,33 @@ import { defineComponent, h } from "vue"; import { PerspectiveCamera, Renderer, Scene } from "../../core"; -import { PointLight } from "../../lights"; -import { LambertMaterial } from "../../materials"; -import { Box } from "../../meshes"; +import { AmbientLight } from "../../lights"; +import { GltfModel } from "../../models"; export default defineComponent({ name: "YangArchvizComponent", - components: { - PerspectiveCamera, - Renderer, - Scene, - PointLight, - LambertMaterial, - Box, + props: { + gltfUrl : String }, - setup(props, { slots }){ + components: { }, + setup(props, { slots, expose }){ + const url : String = props.gltfUrl ?? ""; + + const gltfProps = { + src : url + } + + //@ts-ignore + const gltfVNode = h( GltfModel, gltfProps ); return () =>h( Renderer, { resize : "window" , + alpha : true }, () => - [ - h( PerspectiveCamera, { - position: { z: 10 } - }), + [ h( Scene , {}, () => - [ - h( PointLight, { - position: { y: 50, z: 50 } - }), - h( Box, { - size : 1, - rotation : { y: Math.PI / 4, z: Math.PI / 4 }, - }, () => - [ - h( LambertMaterial ) - ]) + [ + h( AmbientLight ), + gltfVNode ]) ]); },