1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-25 04:42:01 +08:00
trois/src/meshes/Mesh.js

23 lines
536 B
JavaScript
Raw Normal View History

2020-09-14 22:57:11 +08:00
import { Mesh } from 'three';
import { setFromProp } from '../tools.js';
export default {
inject: ['three', 'scene'],
props: {
material: String,
position: Object,
rotation: Object,
scale: Object,
},
mounted() {
this.mesh = new Mesh(this.geometry, this.three.materials[this.material]);
setFromProp(this.mesh.position, this.position);
setFromProp(this.mesh.rotation, this.rotation);
setFromProp(this.mesh.scale, this.scale);
this.scene.add(this.mesh);
},
render() {
return [];
},
};