mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
fix polyhedron
This commit is contained in:
parent
f8cc0fb429
commit
a90e9f663c
@ -4,10 +4,12 @@ import Geometry from './Geometry.js';
|
||||
export default {
|
||||
extends: Geometry,
|
||||
props: {
|
||||
vertices: Array,
|
||||
indices: Array,
|
||||
radius: { type: Number, default: 1 },
|
||||
detail: { type: Number, default: 0 },
|
||||
},
|
||||
created() {
|
||||
this.parent.geometry = new PolyhedronBufferGeometry(this.radius, this.detail);
|
||||
this.parent.geometry = new PolyhedronBufferGeometry(this.vertices, this.indices, this.radius, this.detail);
|
||||
},
|
||||
};
|
||||
|
@ -5,13 +5,15 @@ import Mesh from './Mesh.js';
|
||||
export default {
|
||||
extends: Mesh,
|
||||
props: {
|
||||
vertices: Array,
|
||||
indices: Array,
|
||||
radius: { type: Number, default: 1 },
|
||||
detail: { type: Number, default: 0 },
|
||||
},
|
||||
created() {
|
||||
this.createGeometry();
|
||||
|
||||
const watchProps = ['radius', 'detail'];
|
||||
const watchProps = ['vertices', 'indices', 'radius', 'detail'];
|
||||
watchProps.forEach(prop => {
|
||||
watch(() => this[prop], () => {
|
||||
this.refreshGeometry();
|
||||
@ -20,7 +22,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
createGeometry() {
|
||||
this.geometry = new PolyhedronBufferGeometry(this.radius, this.detail);
|
||||
this.geometry = new PolyhedronBufferGeometry(this.vertices, this.indices, this.radius, this.detail);
|
||||
},
|
||||
},
|
||||
__hmrId: 'Polyhedron',
|
||||
|
Loading…
Reference in New Issue
Block a user