mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 12:22:03 +08:00
38 lines
683 B
JavaScript
38 lines
683 B
JavaScript
|
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 [];
|
||
|
},
|
||
|
};
|