You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
601 B
JavaScript
26 lines
601 B
JavaScript
import {Shape} from "./Shape";
|
|
import {Group} from "three";
|
|
import {uuidv4} from "./util";
|
|
|
|
export class ShapeCollection {
|
|
constructor({shapes = [], name = ""}, filePrefix = "") {
|
|
this.id = uuidv4();
|
|
this.shapes = shapes.map((s) => new Shape(s, filePrefix));
|
|
this.group = null;
|
|
}
|
|
|
|
getGroup() {
|
|
if (this.group) {
|
|
return this.group;
|
|
}
|
|
|
|
// Create group for all shapes
|
|
this.group = new Group();
|
|
|
|
for (let shape of this.shapes) {
|
|
this.group.add(shape.getMesh())
|
|
}
|
|
|
|
return this.group
|
|
}
|
|
} |