diff --git a/src/geometries/PolyhedronGeometry.js b/src/geometries/PolyhedronGeometry.js index 1b62c66..a3a4dbb 100644 --- a/src/geometries/PolyhedronGeometry.js +++ b/src/geometries/PolyhedronGeometry.js @@ -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); }, }; diff --git a/src/meshes/Polyhedron.js b/src/meshes/Polyhedron.js index 87672ae..bb9b526 100644 --- a/src/meshes/Polyhedron.js +++ b/src/meshes/Polyhedron.js @@ -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',