1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 12:22:03 +08:00
trois/src/geometries/index.js

38 lines
683 B
JavaScript
Raw Normal View History

2020-09-15 06:07:46 +08:00
import { BoxBufferGeometry } from 'three';
export const BoxGeometry = {
inject: ['parent'],
props: {
size: {
type: Number,
},
width: {
type: Number,
default: 1,
},
height: {
type: Number,
default: 1,
},
depth: {
type: Number,
default: 1,
},
},
mounted() {
if (!this.parent) {
console.error('Missing parent Mesh');
return;
}
if (this.size) {
this.parent.geometry = new BoxBufferGeometry(this.size, this.size, this.size);
} else {
this.parent.geometry = new BoxBufferGeometry(this.width, this.height, this.depth);
}
},
render() {
return [];
},
};