mirror of
https://github.com/troisjs/trois.git
synced 2024-11-25 04:42:01 +08:00
23 lines
536 B
JavaScript
23 lines
536 B
JavaScript
|
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 [];
|
||
|
},
|
||
|
};
|