1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 12:22:03 +08:00
trois/src/plugin.js
2021-03-07 00:48:06 +01:00

99 lines
1.8 KiB
JavaScript

import { createApp as _createApp } from 'vue';
import * as TROIS from './index.js';
export const TroisJSVuePlugin = {
install: (app) => {
const comps = [
'Camera',
'OrthographicCamera',
'PerspectiveCamera',
'Renderer',
'Scene',
'Group',
'BoxGeometry',
'CircleGeometry',
'ConeGeometry',
'CylinderGeometry',
'DodecahedronGeometry',
'IcosahedronGeometry',
'LatheGeometry',
'OctahedronGeometry',
'PolyhedronGeometry',
'RingGeometry',
'SphereGeometry',
'TetrahedronGeometry',
'TorusGeometry',
'TorusKnotGeometry',
'TubeGeometry',
'AmbientLight',
'DirectionalLight',
'PointLight',
'RectAreaLight',
'SpotLight',
'BasicMaterial',
'LambertMaterial',
'MatcapMaterial',
'PhongMaterial',
'PhysicalMaterial',
'ShaderMaterial',
'StandardMaterial',
'SubSurfaceMaterial',
'ToonMaterial',
'Texture',
'CubeTexture',
'Box',
'Circle',
'Cone',
'Cylinder',
'Dodecahedron',
'Icosahedron',
'Mesh',
'Lathe',
'Octahedron',
'Plane',
'Polyhedron',
'Ring',
'Sphere',
'Tetrahedron',
'Text',
'Torus',
'TorusKnot',
'Tube',
'Gem',
'Image',
'InstancedMesh',
'MirrorMesh',
'RefractionMesh',
'Sprite',
'BokehPass',
'EffectComposer',
'FilmPass',
'FXAAPass',
'HalftonePass',
'RenderPass',
'SAOPass',
'SMAAPass',
'TiltShiftPass',
'UnrealBloomPass',
'ZoomBlurPass',
'GLTFViewer',
];
comps.forEach(comp => {
app.component(comp, TROIS[comp]);
});
},
};
export function createApp(params) {
return _createApp(params).use(TroisJSVuePlugin);
};