@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
39 lines (38 loc) • 1.46 kB
JavaScript
"use strict";
import { BaseLightTransformedObjNode } from "./_BaseLightTransformed";
import { TransformedParamConfig } from "./utils/TransformController";
import { NodeParamsConfig } from "../utils/params/ParamsConfig";
import { AreaLightParamConfig, CoreRectAreaLightHelper } from "../../../core/lights/AreaLight";
import { AreaLightSopOperation } from "../../operations/sop/AreaLight";
import { isBooleanTrue } from "../../../core/Type";
import { LightType } from "../../poly/registers/nodes/types/Light";
class AreaLightObjParamsConfig extends AreaLightParamConfig(TransformedParamConfig(NodeParamsConfig)) {
}
const ParamsConfig = new AreaLightObjParamsConfig();
export class AreaLightObjNode extends BaseLightTransformedObjNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return LightType.AREA;
}
_operation() {
return this.__operation__ = this.__operation__ || new AreaLightSopOperation(this._scene, this.states, this);
}
createLight() {
return this._operation().createLight();
}
updateLightParams() {
this._operation().updateLightParams(this.light, this.pv);
if (isBooleanTrue(this.pv.showHelper)) {
this._helper = this._helper || new CoreRectAreaLightHelper(this.light, this.name());
this.light.add(this._helper);
this._helper.update();
} else {
if (this._helper) {
this.light.remove(this._helper);
}
}
}
}