From a90e9f663ca145684eb8227baf9c5eb9d06b81b8 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Mon, 28 Sep 2020 16:56:10 +0200 Subject: [PATCH] fix polyhedron --- src/geometries/PolyhedronGeometry.js | 4 +++- src/meshes/Polyhedron.js | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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',