UNPKG

@polygonjs/polygonjs

Version:

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

35 lines (34 loc) 1.3 kB
"use strict"; import { BaseLightTransformedObjNode } from "./_BaseLightTransformed"; import { TransformedParamConfig } from "./utils/TransformController"; import { NodeParamsConfig } from "../utils/params/ParamsConfig"; import { LightType } from "../../poly/registers/nodes/types/Light"; import { SpotLightParamConfig } from "../../../core/lights/SpotLight"; import { SpotLightSopOperation } from "../../operations/sop/SpotLight"; class SpotLightObjParamsConfig extends SpotLightParamConfig(TransformedParamConfig(NodeParamsConfig)) { } const ParamsConfig = new SpotLightObjParamsConfig(); export class SpotLightObjNode extends BaseLightTransformedObjNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return LightType.SPOT; } _operation() { return this.__operation__ = this.__operation__ || new SpotLightSopOperation(this._scene, this.states, this); } createLight() { return this._operation().createLight(this.pv); } async updateLightParams() { await this._operation().updateLightParams(this.light, this.pv); } updateShadowParams() { this.light.updateParams(this.pv); this.light.updateHelper(); this.light.updateVolumetric(); this._operation().updateShadowParams(this.light, this.pv); } }