diff --git a/src/index.js b/src/index.js index 77eb814..c648fae 100644 --- a/src/index.js +++ b/src/index.js @@ -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'; diff --git a/src/models/GLTF.js b/src/models/GLTF.js new file mode 100644 index 0000000..ddb9c83 --- /dev/null +++ b/src/models/GLTF.js @@ -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); + }); + }, +}; diff --git a/src/models/index.js b/src/models/index.js new file mode 100644 index 0000000..29b7256 --- /dev/null +++ b/src/models/index.js @@ -0,0 +1 @@ +export { default as GLTFModel } from './GLTF.js'; diff --git a/src/plugin.js b/src/plugin.js index bf1a574..7685ca6 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -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',