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:
parent
47dd16f5a9
commit
bdcd9b7c49
@ -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
|
||||
])
|
||||
]);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user