@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
3 lines (2 loc) • 2.88 kB
JavaScript
import{l as t,aL as e,V as i,M as s,aM as n,q as r,s as o}from"./index-BPURObVq.esm.min.js";let a=(()=>{var a;let f,h=n,u=[];return a=class extends h{get shadowAngle(){return this._shadowAngle}set shadowAngle(t){this._shadowAngle=t,this.forceProjectionMatrixCompute()}get direction(){return this._direction}set direction(t){const e=this.needCube();if(this._direction=t,this.needCube()!==e&&this._shadowGenerators){const t=this._shadowGenerators.values();for(let e=t.next();!0!==e.done;e=t.next()){e.value.recreateShadowMap()}}}constructor(e,i,s,n){super(e,s,n),this._shadowAngle=(t(this,u),Math.PI/2),this.position=i}getClassName(){return"PointLight"}getTypeID(){return e.LIGHTTYPEID_POINTLIGHT}needCube(){return!this.direction}getShadowDirection(t){if(this.direction)return super.getShadowDirection(t);switch(t){case 0:return new i(1,0,0);case 1:return new i(-1,0,0);case 2:return new i(0,-1,0);case 3:return new i(0,1,0);case 4:return new i(0,0,1);case 5:return new i(0,0,-1)}return i.Zero()}_setDefaultShadowProjectionMatrix(t,e,i){const n=this.getScene().activeCamera,r=this.getDepthMinZ(n),o=this.getDepthMaxZ(n),a=this.getScene().getEngine().useReverseDepthBuffer;s.PerspectiveFovLHToRef(this.shadowAngle,1,a?o:r,a?r:o,t,!0,this._scene.getEngine().isNDCHalfZRange,void 0,a)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}transferToEffect(t,e){const i=this._scene.floatingOriginOffset;return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x-i.x,this.transformedPosition.y-i.y,this.transformedPosition.z-i.z,0,e):this._uniformBuffer.updateFloat4("vLightData",this.position.x-i.x,this.position.y-i.y,this.position.z-i.z,0,e),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,e),this}transferToNodeMaterialEffect(t,e){const i=this._scene.floatingOriginOffset;return this.computeTransformedInformation()?t.setFloat3(e,this.transformedPosition.x-i.x,this.transformedPosition.y-i.y,this.transformedPosition.z-i.z):t.setFloat3(e,this.position.x-i.x,this.position.y-i.y,this.position.z-i.z),this}prepareLightSpecificDefines(t,e){t["POINTLIGHT"+e]=!0}},(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;f=[o()],r(a,null,f,{kind:"getter",name:"shadowAngle",static:!1,private:!1,access:{has:t=>"shadowAngle"in t,get:t=>t.shadowAngle},metadata:t},null,u),t&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),a})();export{a as P};
//# sourceMappingURL=pointLight.pure-BNtejoTr.esm.min.js.map