2021-03-07 06:14:22 +08:00
|
|
|
import { PolyhedronGeometry } from 'three';
|
2020-09-28 21:36:22 +08:00
|
|
|
import Geometry from './Geometry.js';
|
|
|
|
|
2021-03-16 03:39:24 +08:00
|
|
|
export const props = {
|
|
|
|
vertices: Array,
|
|
|
|
indices: Array,
|
|
|
|
radius: { type: Number, default: 1 },
|
|
|
|
detail: { type: Number, default: 0 },
|
|
|
|
};
|
|
|
|
|
|
|
|
export function createGeometry(comp) {
|
|
|
|
return new PolyhedronGeometry(comp.vertices, comp.indices, comp.radius, comp.detail);
|
|
|
|
};
|
|
|
|
|
2020-09-28 21:36:22 +08:00
|
|
|
export default {
|
|
|
|
extends: Geometry,
|
2021-03-16 03:39:24 +08:00
|
|
|
props,
|
2020-10-03 17:00:37 +08:00
|
|
|
methods: {
|
|
|
|
createGeometry() {
|
2021-03-16 03:39:24 +08:00
|
|
|
this.geometry = createGeometry(this);
|
2020-10-03 17:00:37 +08:00
|
|
|
},
|
2020-09-28 21:36:22 +08:00
|
|
|
},
|
|
|
|
};
|