@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
2 lines (1 loc) • 2.29 kB
JavaScript
import{math as s}from"../../core/math/math.js";import{Vec3 as t}from"../../core/math/vec3.js";import{SHADOW_PCF3 as e}from"../constants.js";class i{constructor(s,i,l){this._areaLightsEnabled=!1,this._cells=new t(10,3,10),this._maxLightsPerCell=255,this._shadowsEnabled=!0,this._shadowType=e,this._shadowAtlasResolution=2048,this._cookiesEnabled=!1,this._cookieAtlasResolution=2048,this.debugLayer=void 0,this.atlasSplit=null,this._supportsAreaLights=s,this._maxTextureSize=i,this._dirtyLightsFnc=l}applySettings(s){var e,i,l,h,a,o,n;this.shadowsEnabled=null!=(e=s.lightingShadowsEnabled)?e:this.shadowsEnabled,this.cookiesEnabled=null!=(i=s.lightingCookiesEnabled)?i:this.cookiesEnabled,this.areaLightsEnabled=null!=(l=s.lightingAreaLightsEnabled)?l:this.areaLightsEnabled,this.shadowAtlasResolution=null!=(h=s.lightingShadowAtlasResolution)?h:this.shadowAtlasResolution,this.cookieAtlasResolution=null!=(a=s.lightingCookieAtlasResolution)?a:this.cookieAtlasResolution,this.maxLightsPerCell=null!=(o=s.lightingMaxLightsPerCell)?o:this.maxLightsPerCell,this.shadowType=null!=(n=s.lightingShadowType)?n:this.shadowType,s.lightingCells&&(this.cell=new t(s.lightingCells))}set cells(s){this._cells.copy(s)}get cells(){return this._cells}set maxLightsPerCell(t){this._maxLightsPerCell=s.clamp(t,1,255)}get maxLightsPerCell(){return this._maxLightsPerCell}set cookieAtlasResolution(t){this._cookieAtlasResolution=s.clamp(t,32,this._maxTextureSize)}get cookieAtlasResolution(){return this._cookieAtlasResolution}set shadowAtlasResolution(t){this._shadowAtlasResolution=s.clamp(t,32,this._maxTextureSize)}get shadowAtlasResolution(){return this._shadowAtlasResolution}set shadowType(s){this._shadowType!==s&&(this._shadowType=s,this._dirtyLightsFnc())}get shadowType(){return this._shadowType}set cookiesEnabled(s){this._cookiesEnabled!==s&&(this._cookiesEnabled=s,this._dirtyLightsFnc())}get cookiesEnabled(){return this._cookiesEnabled}set areaLightsEnabled(s){this._supportsAreaLights&&this._areaLightsEnabled!==s&&(this._areaLightsEnabled=s,this._dirtyLightsFnc())}get areaLightsEnabled(){return this._areaLightsEnabled}set shadowsEnabled(s){this._shadowsEnabled!==s&&(this._shadowsEnabled=s,this._dirtyLightsFnc())}get shadowsEnabled(){return this._shadowsEnabled}}export{i as LightingParams};