Files
moon-gaming/games/New folder/Extensions/3D/DirectionalLight.js
T
2023-11-23 20:37:33 +00:00

3 lines
1.5 KiB
JavaScript

var gdjs;(function(i){i.PixiFiltersTools.registerFilterCreator("Scene3D::DirectionalLight",new class{makeFilter(o,r){return typeof THREE=="undefined"?new i.PixiFiltersTools.EmptyFilter:new class{constructor(){this._isEnabled=!1;this.top="Y-";this.elevation=45;this.rotation=0;this.light=new THREE.DirectionalLight,this.light.position.set(1,0,0),this.rotationObject=new THREE.Group,this.rotationObject.add(this.light),this.updateRotation()}isEnabled(t){return this._isEnabled}setEnabled(t,e){return this._isEnabled===e?!0:e?this.applyEffect(t):this.removeEffect(t)}applyEffect(t){const e=t.get3DRendererObject();return e?(e.add(this.rotationObject),this._isEnabled=!0,!0):!1}removeEffect(t){const e=t.get3DRendererObject();return e?(e.remove(this.rotationObject),this._isEnabled=!1,!0):!1}updatePreRender(t){}updateDoubleParameter(t,e){t==="intensity"?this.light.intensity=e:t==="elevation"?(this.elevation=e,this.updateRotation()):t==="rotation"&&(this.rotation=e,this.updateRotation())}updateStringParameter(t,e){t==="color"&&(this.light.color=new THREE.Color(i.PixiFiltersTools.rgbOrHexToHexNumber(e))),t==="top"&&(this.top=e,this.updateRotation())}updateBooleanParameter(t,e){}updateRotation(){this.top==="Z+"?(this.rotationObject.rotation.z=i.toRad(this.rotation),this.rotationObject.rotation.y=-i.toRad(this.elevation)):(this.rotationObject.rotation.y=i.toRad(this.rotation)-90,this.rotationObject.rotation.z=-i.toRad(this.elevation))}}}})})(gdjs||(gdjs={}));
//# sourceMappingURL=DirectionalLight.js.map