var gdjs;(function(e){const d=!1;e.PixiFiltersTools.registerFilterCreator("Scene3D::DirectionalLight",new class{makeFilter(u,c){return typeof THREE=="undefined"?new e.PixiFiltersTools.EmptyFilter:new class{constructor(){this._top="Z+";this._elevation=45;this._rotation=0;this._shadowMapSize=1024;this._minimumShadowBias=0;this._distanceFromCamera=1500;this._frustumSize=4e3;this._isEnabled=!1;this._shadowMapDirty=!0;this._shadowCameraDirty=!0;this._light=new THREE.DirectionalLight,d?this._shadowCameraHelper=new THREE.CameraHelper(this._light.shadow.camera):this._shadowCameraHelper=null,this._light.shadow.camera.updateProjectionMatrix()}_updateShadowCamera(){!this._shadowCameraDirty||(this._shadowCameraDirty=!1,this._light.shadow.camera.near=1,this._light.shadow.camera.far=this._distanceFromCamera+1e4,this._light.shadow.camera.right=this._frustumSize/2,this._light.shadow.camera.left=-this._frustumSize/2,this._light.shadow.camera.top=this._frustumSize/2,this._light.shadow.camera.bottom=-this._frustumSize/2)}_updateShadowMapSize(){!this._shadowMapDirty||(this._shadowMapDirty=!1,this._light.shadow.mapSize.set(this._shadowMapSize,this._shadowMapSize),this._light.shadow.map?.dispose(),this._light.shadow.map=null,this._light.shadow.needsUpdate=!0)}isEnabled(t){return this._isEnabled}setEnabled(t,i){return this._isEnabled===i?!0:i?this.applyEffect(t):this.removeEffect(t)}applyEffect(t){const i=t.get3DRendererObject();return i?(i.add(this._light),i.add(this._light.target),this._shadowCameraHelper&&i.add(this._shadowCameraHelper),this._isEnabled=!0,!0):!1}removeEffect(t){const i=t.get3DRendererObject();return i?(i.remove(this._light),i.remove(this._light.target),this._shadowCameraHelper&&i.remove(this._shadowCameraHelper),this._isEnabled=!1,!0):!1}updatePreRender(t){this._updateShadowCamera(),this._updateShadowMapSize();const i=this._shadowMapSize<1024?2:this._shadowMapSize<2048?1.25:1;if(this._light.shadow.bias=-this._minimumShadowBias*i,!t.getRuntimeLayer)return;const s=t.getRuntimeLayer(),_=s.getCameraX(),f=s.getCameraY(),m=s.getCameraZ(s.getInitialCamera3DFieldOfView()),a=Math.floor(_/100)*100,o=Math.floor(f/100)*100,r=Math.floor(m/100)*100;if(this._top==="Y-"){const h=a+this._distanceFromCamera*Math.cos(e.toRad(-this._rotation+90))*Math.cos(e.toRad(this._elevation)),n=o-this._distanceFromCamera*Math.sin(e.toRad(this._elevation)),l=r+this._distanceFromCamera*Math.sin(e.toRad(-this._rotation+90))*Math.cos(e.toRad(this._elevation));this._light.position.set(h,n,l),this._light.target.position.set(a,o,r)}else{const h=a+this._distanceFromCamera*Math.cos(e.toRad(this._rotation))*Math.cos(e.toRad(this._elevation)),n=o+this._distanceFromCamera*Math.sin(e.toRad(this._rotation))*Math.cos(e.toRad(this._elevation)),l=r+this._distanceFromCamera*Math.sin(e.toRad(this._elevation));this._light.position.set(h,n,l),this._light.target.position.set(a,o,r)}}updateDoubleParameter(t,i){t==="intensity"?this._light.intensity=i:t==="elevation"?this._elevation=i:t==="rotation"?this._rotation=i:t==="distanceFromCamera"?this._distanceFromCamera=i:t==="frustumSize"?this._frustumSize=i:t==="minimumShadowBias"&&(this._minimumShadowBias=i)}getDoubleParameter(t){return t==="intensity"?this._light.intensity:t==="elevation"?this._elevation:t==="rotation"?this._rotation:t==="distanceFromCamera"?this._distanceFromCamera:t==="frustumSize"?this._frustumSize:t==="minimumShadowBias"?this._minimumShadowBias:0}updateStringParameter(t,i){t==="color"&&(this._light.color=new THREE.Color(e.rgbOrHexStringToNumber(i))),t==="top"&&(this._top=i),t==="shadowQuality"&&(i==="low"&&this._shadowMapSize!==512&&(this._shadowMapSize=512,this._shadowMapDirty=!0),i==="medium"&&this._shadowMapSize!==1024&&(this._shadowMapSize=1024,this._shadowMapDirty=!0),i==="high"&&this._shadowMapSize!==2048&&(this._shadowMapSize=2048,this._shadowMapDirty=!0))}updateColorParameter(t,i){t==="color"&&this._light.color.setHex(i)}getColorParameter(t){return t==="color"?this._light.color.getHex():0}updateBooleanParameter(t,i){t==="isCastingShadow"&&(this._light.castShadow=i)}getNetworkSyncData(){return{i:this._light.intensity,c:this._light.color.getHex(),e:this._elevation,r:this._rotation,t:this._top}}updateFromNetworkSyncData(t){this._light.intensity=t.i,this._light.color.setHex(t.c),this._elevation=t.e,this._rotation=t.r,this._top=t.t}}}})})(gdjs||(gdjs={}));
//# sourceMappingURL=DirectionalLight.js.map
