mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 12:22:03 +08:00
28 lines
614 B
JavaScript
28 lines
614 B
JavaScript
import { TetrahedronBufferGeometry } from 'three';
|
|
import { watch } from 'vue';
|
|
import Mesh from './Mesh.js';
|
|
|
|
export default {
|
|
extends: Mesh,
|
|
props: {
|
|
radius: { type: Number, default: 1 },
|
|
detail: { type: Number, default: 0 },
|
|
},
|
|
created() {
|
|
this.createGeometry();
|
|
|
|
const watchProps = ['radius', 'detail'];
|
|
watchProps.forEach(prop => {
|
|
watch(() => this[prop], () => {
|
|
this.refreshGeometry();
|
|
});
|
|
});
|
|
},
|
|
methods: {
|
|
createGeometry() {
|
|
this.geometry = new TetrahedronBufferGeometry(this.radius, this.detail);
|
|
},
|
|
},
|
|
__hmrId: 'Tetrahedron',
|
|
};
|