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 {
|
export default {
|
||||||
extends: Geometry,
|
extends: Geometry,
|
||||||
props: {
|
props: {
|
||||||
|
vertices: Array,
|
||||||
|
indices: Array,
|
||||||
radius: { type: Number, default: 1 },
|
radius: { type: Number, default: 1 },
|
||||||
detail: { type: Number, default: 0 },
|
detail: { type: Number, default: 0 },
|
||||||
},
|
},
|
||||||
created() {
|
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 {
|
export default {
|
||||||
extends: Mesh,
|
extends: Mesh,
|
||||||
props: {
|
props: {
|
||||||
|
vertices: Array,
|
||||||
|
indices: Array,
|
||||||
radius: { type: Number, default: 1 },
|
radius: { type: Number, default: 1 },
|
||||||
detail: { type: Number, default: 0 },
|
detail: { type: Number, default: 0 },
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.createGeometry();
|
this.createGeometry();
|
||||||
|
|
||||||
const watchProps = ['radius', 'detail'];
|
const watchProps = ['vertices', 'indices', 'radius', 'detail'];
|
||||||
watchProps.forEach(prop => {
|
watchProps.forEach(prop => {
|
||||||
watch(() => this[prop], () => {
|
watch(() => this[prop], () => {
|
||||||
this.refreshGeometry();
|
this.refreshGeometry();
|
||||||
@ -20,7 +22,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
createGeometry() {
|
createGeometry() {
|
||||||
this.geometry = new PolyhedronBufferGeometry(this.radius, this.detail);
|
this.geometry = new PolyhedronBufferGeometry(this.vertices, this.indices, this.radius, this.detail);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
__hmrId: 'Polyhedron',
|
__hmrId: 'Polyhedron',
|
||||||
|
Loading…
Reference in New Issue
Block a user