1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 12:22:03 +08:00
trois/src/meshes/Tetrahedron.js

28 lines
614 B
JavaScript
Raw Normal View History

2020-09-28 20:48:39 +08:00
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',
};