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

add GLTFModel (wip)

This commit is contained in:
Kevin Levron 2021-03-13 00:52:40 +01:00
parent a4eb25654c
commit e5c2b3f947
4 changed files with 36 additions and 31 deletions

View File

@ -3,6 +3,7 @@ export * from './geometries/index.js';
export * from './lights/index.js';
export * from './materials/index.js';
export * from './meshes/index.js';
export * from './models/index.js';
export * from './effects/index.js';
// export * from './components/index.js';

16
src/models/GLTF.js Normal file
View File

@ -0,0 +1,16 @@
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
import Object3D from '../core/Object3D.js';
export default {
extends: Object3D,
props: {
src: String,
cameraPosition: Object,
},
created() {
const loader = new GLTFLoader();
loader.load(this.src, (gltf) => {
this.initObject3D(gltf.scene);
});
},
};

1
src/models/index.js Normal file
View File

@ -0,0 +1 @@
export { default as GLTFModel } from './GLTF.js';

View File

@ -11,22 +11,6 @@ export const TroisJSVuePlugin = {
'Scene',
'Group',
'BoxGeometry',
'CircleGeometry',
'ConeGeometry',
'CylinderGeometry',
'DodecahedronGeometry',
'IcosahedronGeometry',
'LatheGeometry',
'OctahedronGeometry',
'PolyhedronGeometry',
'RingGeometry',
'SphereGeometry',
'TetrahedronGeometry',
'TorusGeometry',
'TorusKnotGeometry',
'TubeGeometry',
'AmbientLight',
'DirectionalLight',
'HemisphereLight',
@ -47,24 +31,25 @@ export const TroisJSVuePlugin = {
'Texture',
'CubeTexture',
'Box',
'Circle',
'Cone',
'Cylinder',
'Dodecahedron',
'Icosahedron',
'Mesh',
'Lathe',
'Octahedron',
'Box', 'BoxGeometry',
'Circle', 'CircleGeometry',
'Cone', 'ConeGeometry',
'Cylinder', 'CylinderGeometry',
'Dodecahedron', 'DodecahedronGeometry',
'Icosahedron', 'IcosahedronGeometry',
'Lathe', 'LatheGeometry',
'Octahedron', 'OctahedronGeometry',
'Plane',
'Polyhedron',
'Ring',
'Sphere',
'Tetrahedron',
'Polyhedron', 'PolyhedronGeometry',
'Ring', 'RingGeometry',
'Sphere', 'SphereGeometry',
'Tetrahedron', 'TetrahedronGeometry',
'Text',
'Torus',
'TorusKnot',
'Tube',
'Torus', 'TorusGeometry',
'TorusKnot', 'TorusKnotGeometry',
'Tube', 'TubeGeometry',
'Gem',
'Image',
@ -73,6 +58,8 @@ export const TroisJSVuePlugin = {
'RefractionMesh',
'Sprite',
'GLTFModel',
'BokehPass',
'EffectComposer',
'FilmPass',