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 './lights/index.js';
export * from './materials/index.js'; export * from './materials/index.js';
export * from './meshes/index.js'; export * from './meshes/index.js';
export * from './models/index.js';
export * from './effects/index.js'; export * from './effects/index.js';
// export * from './components/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', 'Scene',
'Group', 'Group',
'BoxGeometry',
'CircleGeometry',
'ConeGeometry',
'CylinderGeometry',
'DodecahedronGeometry',
'IcosahedronGeometry',
'LatheGeometry',
'OctahedronGeometry',
'PolyhedronGeometry',
'RingGeometry',
'SphereGeometry',
'TetrahedronGeometry',
'TorusGeometry',
'TorusKnotGeometry',
'TubeGeometry',
'AmbientLight', 'AmbientLight',
'DirectionalLight', 'DirectionalLight',
'HemisphereLight', 'HemisphereLight',
@ -47,24 +31,25 @@ export const TroisJSVuePlugin = {
'Texture', 'Texture',
'CubeTexture', 'CubeTexture',
'Box',
'Circle',
'Cone',
'Cylinder',
'Dodecahedron',
'Icosahedron',
'Mesh', 'Mesh',
'Lathe',
'Octahedron', 'Box', 'BoxGeometry',
'Circle', 'CircleGeometry',
'Cone', 'ConeGeometry',
'Cylinder', 'CylinderGeometry',
'Dodecahedron', 'DodecahedronGeometry',
'Icosahedron', 'IcosahedronGeometry',
'Lathe', 'LatheGeometry',
'Octahedron', 'OctahedronGeometry',
'Plane', 'Plane',
'Polyhedron', 'Polyhedron', 'PolyhedronGeometry',
'Ring', 'Ring', 'RingGeometry',
'Sphere', 'Sphere', 'SphereGeometry',
'Tetrahedron', 'Tetrahedron', 'TetrahedronGeometry',
'Text', 'Text',
'Torus', 'Torus', 'TorusGeometry',
'TorusKnot', 'TorusKnot', 'TorusKnotGeometry',
'Tube', 'Tube', 'TubeGeometry',
'Gem', 'Gem',
'Image', 'Image',
@ -73,6 +58,8 @@ export const TroisJSVuePlugin = {
'RefractionMesh', 'RefractionMesh',
'Sprite', 'Sprite',
'GLTFModel',
'BokehPass', 'BokehPass',
'EffectComposer', 'EffectComposer',
'FilmPass', 'FilmPass',