UNPKG

polygonjs-engine

Version:

node-based webgl 3D engine https://polygonjs.com

49 lines (48 loc) 1.66 kB
import {TypedObjNode} from "./_Base"; import {Group as Group2} from "three/src/objects/Group"; import {TransformedParamConfig, TransformController as TransformController2} from "./utils/TransformController"; import {FlagsControllerD} from "../utils/FlagsController"; import {AxesHelper as AxesHelper2} from "three/src/helpers/AxesHelper"; import {NodeParamsConfig} from "../utils/params/ParamsConfig"; import {HierarchyController as HierarchyController2} from "./utils/HierarchyController"; class NullObjParamConfig extends TransformedParamConfig(NodeParamsConfig) { } const ParamsConfig2 = new NullObjParamConfig(); export class NullObjNode extends TypedObjNode { constructor() { super(...arguments); this.params_config = ParamsConfig2; this.hierarchy_controller = new HierarchyController2(this); this.transform_controller = new TransformController2(this); this.flags = new FlagsControllerD(this); this._helper = new AxesHelper2(1); } static type() { return "null"; } create_object() { const group = new Group2(); group.matrixAutoUpdate = false; return group; } initializeNode() { this.hierarchy_controller.initializeNode(); this.transform_controller.initializeNode(); this._updateHelperHierarchy(); this._helper.matrixAutoUpdate = false; this.flags.display.add_hook(() => { this._updateHelperHierarchy(); }); } _updateHelperHierarchy() { if (this.flags.display.active()) { this.object.add(this._helper); } else { this.object.remove(this._helper); } } cook() { this.transform_controller.update(); this.cookController.end_cook(); } }