1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 12:22:03 +08:00

gltf import test

This commit is contained in:
Yang 2022-03-30 17:28:03 +08:00
parent 47dd16f5a9
commit bdcd9b7c49

View File

@ -1,40 +1,33 @@
import { defineComponent, h } from "vue"; import { defineComponent, h } from "vue";
import { PerspectiveCamera, Renderer, Scene } from "../../core"; import { PerspectiveCamera, Renderer, Scene } from "../../core";
import { PointLight } from "../../lights"; import { AmbientLight } from "../../lights";
import { LambertMaterial } from "../../materials"; import { GltfModel } from "../../models";
import { Box } from "../../meshes";
export default defineComponent({ export default defineComponent({
name: "YangArchvizComponent", name: "YangArchvizComponent",
components: { props: {
PerspectiveCamera, gltfUrl : String
Renderer,
Scene,
PointLight,
LambertMaterial,
Box,
}, },
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, { return () =>h( Renderer, {
resize : "window" , resize : "window" ,
alpha : true
}, () => }, () =>
[ [
h( PerspectiveCamera, {
position: { z: 10 }
}),
h( Scene , {}, () => h( Scene , {}, () =>
[ [
h( PointLight, { h( AmbientLight ),
position: { y: 50, z: 50 } gltfVNode
}),
h( Box, {
size : 1,
rotation : { y: Math.PI / 4, z: Math.PI / 4 },
}, () =>
[
h( LambertMaterial )
])
]) ])
]); ]);
}, },