web-ifc-viewer
Version:
28 lines • 964 B
JavaScript
import { GridHelper } from 'three';
import { IfcComponent } from '../../base-types';
import { disposeMeshRecursively } from '../../utils/ThreeUtils';
export class IfcGrid extends IfcComponent {
constructor(context) {
super(context);
this.context = context;
}
dispose() {
if (this.grid) {
disposeMeshRecursively(this.grid);
}
this.grid = null;
}
setGrid(size, divisions, colorCenterLine, colorGrid) {
if (this.grid) {
if (this.grid.parent)
this.grid.removeFromParent();
this.grid.geometry.dispose();
}
this.grid = new GridHelper(size, divisions, colorCenterLine, colorGrid);
this.grid.renderOrder = 0;
const scene = this.context.getScene();
scene.add(this.grid);
this.context.renderer.postProduction.excludedItems.add(this.grid);
}
}
//# sourceMappingURL=grid.js.map