babylonjs-materials 9.23.0 → 9.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.shadowOnlyMaterial.js +1 -1
- package/babylon.shadowOnlyMaterial.js.map +1 -1
- package/babylon.shadowOnlyMaterial.min.js +1 -1
- package/babylon.shadowOnlyMaterial.min.js.map +1 -1
- package/babylon.skyMaterial.js +1 -1
- package/babylon.skyMaterial.js.map +1 -1
- package/babylon.skyMaterial.min.js +1 -1
- package/babylon.skyMaterial.min.js.map +1 -1
- package/babylon.waterMaterial.js +1 -1
- package/babylon.waterMaterial.js.map +1 -1
- package/babylon.waterMaterial.min.js +1 -1
- package/babylon.waterMaterial.min.js.map +1 -1
- package/babylonjs.materials.d.ts +63 -0
- package/babylonjs.materials.es5.js +574 -562
- package/babylonjs.materials.js +1 -1
- package/babylonjs.materials.js.map +1 -1
- package/babylonjs.materials.min.js +1 -1
- package/babylonjs.materials.min.js.map +1 -1
- package/babylonjs.materials.module.d.ts +126 -0
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,n){"use strict";class i extends n.MaterialDefines{constructor(){super(),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}class t extends n.PushMaterial{constructor(e,i,t=!1){super(e,i,void 0,t),this._needAlphaBlending=!0,this.shadowColor=n.Color3.Black()}needAlphaBlending(){return this._needAlphaBlending}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}get activeLight(){return this._activeLight}set activeLight(e){this._activeLight=e}_getFirstShadowLightForMesh(e){for(const n of e.lightSources)if(n.shadowEnabled)return n;return null}isReadyForSubMesh(e,a,o){var r;const s=a._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===o)return!0;a.materialDefines||(a.materialDefines=new i);const l=a.materialDefines,d=this.getScene();if(this._isReadyForSubMesh(a))return!0;const c=d.getEngine();if(this._activeLight)for(const n of e.lightSources)if(n.shadowEnabled){if(this._activeLight===n)break;const i=e.lightSources.indexOf(this._activeLight);-1!==i&&(e.lightSources.splice(i,1),e.lightSources.splice(0,0,this._activeLight));break}n.PrepareDefinesForFrameBoundValues(d,c,this,l,!!o),n.PrepareDefinesForMisc(e,d,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),l,void 0,void 0,void 0,this._isVertexOutputInvariant),l._needNormals=n.PrepareDefinesForLights(d,e,l,!1,1);const h=null===(r=this._getFirstShadowLightForMesh(e))||void 0===r?void 0:r.getShadowGenerator();if(this._needAlphaBlending=!0,h&&h.getClassName&&"CascadedShadowGenerator"===h.getClassName()){const e=h;this._needAlphaBlending=!e.autoCalcDepthBounds}if(n.PrepareDefinesForAttributes(e,l,!1,!0),l.isDirty){l.markAsProcessed(),d.resetCachedMaterial();const i=new n.EffectFallbacks;l.FOG&&i.addFallback(1,"FOG"),n.HandleFallbacksForShadows(l,i,1),l.NUM_BONE_INFLUENCERS>0&&i.addCPUSkinningFallback(0,e),l.IMAGEPROCESSINGPOSTPROCESS=d.imageProcessingConfiguration.applyByPostProcess;const o=[n.VertexBuffer.PositionKind];l.NORMAL&&o.push(n.VertexBuffer.NormalKind),n.PrepareAttributesForBones(o,e,l,i),n.PrepareAttributesForInstances(o,l);const r="shadowOnly",s=l.toString(),h=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","logarithmicDepthConstant"],f=[],g=["Scene"];n.AddClipPlaneUniforms(h),n.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:g,samplers:f,defines:l,maxSimultaneousLights:1,shaderLanguage:this._shaderLanguage}),a.setEffect(d.getEngine().createEffect(r,{attributes:o,uniformsNames:h,uniformBuffersNames:g,samplers:f,defines:s,fallbacks:i,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:t._ShaderLoader.getLoadCallback(this._shaderLanguage)},c),l,this._materialContext)}return!(!a.effect||!a.effect.isReady()||(l._renderId=d.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!o,0))}bindForSubMesh(e,i,t){const a=this.getScene(),o=t.materialDefines;if(!o)return;const r=t.effect;if(r){if(this._activeEffect=r,this.bindOnlyWorldMatrix(e),this.bindViewProjection(r),n.BindBonesParameters(i,this._activeEffect),this._mustRebind(a,r,t)&&(n.BindClipPlane(r,this,a),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),this._useLogarithmicDepth&&n.BindLogDepth(o,r,a),a.bindEyePosition(r)),a.lightsEnabled){n.BindLights(a,i,this._activeEffect,o,1);const e=this._getFirstShadowLightForMesh(i);e&&(e._renderId=-1)}(a.fogEnabled&&i.applyFog&&a.fogMode!==n.Scene.FOGMODE_NONE||o.SHADOWCSM0)&&this.bindView(r),n.BindFogParameters(a,i,this._activeEffect),this._afterBind(i,this._activeEffect,t)}}clone(e){return n.SerializationHelper.Clone(()=>new t(e,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.ShadowOnlyMaterial",e}getClassName(){return"ShadowOnlyMaterial"}static Parse(e,i,a){return n.SerializationHelper.Parse(()=>new t(e.name,i),e,i,a)}}t._ShaderLoader=new n._ShaderImportLoader(()=>[Promise.resolve().then(function(){return d}),Promise.resolve().then(function(){return g})],()=>[Promise.resolve().then(function(){return v}),Promise.resolve().then(function(){return P})]),n.RegisterClass("BABYLON.ShadowOnlyMaterial",t);var a={__proto__:null,ShadowOnlyMaterial:t};const o="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==o)for(const e in a)o.BABYLON[e]=a[e];const r="shadowOnlyVertexShader",s="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";n.ShaderStore.ShadersStore[r]||(n.ShaderStore.ShadersStore[r]=s);const l=[n.bonesDeclaration,n.bakedVertexAnimationDeclaration,n.instancesDeclaration,n.sceneVertexDeclaration,n.sceneUboDeclaration,n.clipPlaneVertexDeclaration,n.logDepthDeclaration,n.fogVertexDeclaration,n.lightFragmentDeclaration,n.lightUboDeclaration,n.instancesVertex,n.bonesVertex,n.bakedVertexAnimation,n.clipPlaneVertex,n.logDepthVertex,n.fogVertex,n.shadowsVertex];for(const e of l)n.ShaderStore.IncludesShadersStore[e.name]||(n.ShaderStore.IncludesShadersStore[e.name]=e.shader);var d={__proto__:null,shadowOnlyVertexShader:{name:r,shader:s}};const c="shadowOnlyPixelShader",h="precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";n.ShaderStore.ShadersStore[c]||(n.ShaderStore.ShadersStore[c]=h);const f=[n.sceneFragmentDeclaration,n.sceneUboDeclaration,n.helperFunctions,n.lightFragmentDeclaration,n.lightUboDeclaration,n.lightsFragmentFunctions,n.shadowsFragmentFunctions,n.clipPlaneFragmentDeclaration,n.logDepthDeclaration,n.fogFragmentDeclaration,n.clipPlaneFragment,n.lightFragment,n.logDepthFragment,n.fogFragment,n.imageProcessingCompatibility];for(const e of f)n.ShaderStore.IncludesShadersStore[e.name]||(n.ShaderStore.IncludesShadersStore[e.name]=e.shader);var g={__proto__:null,shadowOnlyPixelShader:{name:c,shader:h}};const u="shadowOnlyVertexShader",S="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n";n.ShaderStore.ShadersStoreWGSL[u]||(n.ShaderStore.ShadersStoreWGSL[u]=S);const m=[n.bonesDeclarationWGSL,n.bakedVertexAnimationDeclarationWGSL,n.instancesDeclarationWGSL,n.sceneUboDeclarationWGSL,n.clipPlaneVertexDeclarationWGSL,n.logDepthDeclarationWGSL,n.fogVertexDeclarationWGSL,n.lightVxFragmentDeclarationWGSL,n.lightVxUboDeclarationWGSL,n.instancesVertexWGSL,n.bonesVertexWGSL,n.bakedVertexAnimationWGSL,n.clipPlaneVertexWGSL,n.logDepthVertexWGSL,n.fogVertexWGSL,n.shadowsVertexWGSL];for(const e of m)n.ShaderStore.IncludesShadersStoreWGSL[e.name]||(n.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var v={__proto__:null,shadowOnlyVertexShaderWGSL:{name:u,shader:S}};const p="shadowOnlyPixelShader",_="#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";n.ShaderStore.ShadersStoreWGSL[p]||(n.ShaderStore.ShadersStoreWGSL[p]=_);const L=[n.sceneUboDeclarationWGSL,n.helperFunctionsWGSL,n.lightUboDeclarationWGSL,n.lightsFragmentFunctionsWGSL,n.shadowsFragmentFunctionsWGSL,n.clipPlaneFragmentDeclarationWGSL,n.logDepthDeclarationWGSL,n.fogFragmentDeclarationWGSL,n.clipPlaneFragmentWGSL,n.lightFragmentWGSL,n.logDepthFragmentWGSL,n.fogFragmentWGSL];for(const e of L)n.ShaderStore.IncludesShadersStoreWGSL[e.name]||(n.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var P={__proto__:null,shadowOnlyPixelShaderWGSL:{name:p,shader:_}};e.ShadowOnlyMaterial=t});
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,n){"use strict";class i extends n.MaterialDefines{constructor(e){super(e),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}class t extends n.PushMaterial{constructor(e,i,t=!1){super(e,i,void 0,t),this._needAlphaBlending=!0,this.shadowColor=n.Color3.Black()}_createUniformBuffer(){super._createUniformBuffer(),this._uniformBuffer.useUbo&&(this._uniformBuffer.dispose(),this._uniformBuffer=new n.UniformBuffer(this.getScene().getEngine(),void 0,void 0,this.name,!0),this._uniformBufferLayoutBuilt=!1)}needAlphaBlending(){return this._needAlphaBlending}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}get activeLight(){return this._activeLight}set activeLight(e){this._activeLight=e}_getFirstShadowLightForMesh(e){for(const n of e.lightSources)if(n.shadowEnabled)return n;return null}isReadyForSubMesh(e,a,o){var r;this._uniformBufferLayoutBuilt||this.buildUniformLayout();const s=a._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===o)return!0;a.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),a.materialDefines=new i(this._eventInfo.defineNames));const l=a.materialDefines,d=this.getScene();if(this._isReadyForSubMesh(a))return!0;const c=d.getEngine();if(this._activeLight)for(const n of e.lightSources)if(n.shadowEnabled){if(this._activeLight===n)break;const i=e.lightSources.indexOf(this._activeLight);-1!==i&&(e.lightSources.splice(i,1),e.lightSources.splice(0,0,this._activeLight));break}n.PrepareDefinesForFrameBoundValues(d,c,this,l,!!o),n.PrepareDefinesForMisc(e,d,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),l,void 0,void 0,void 0,this._isVertexOutputInvariant),l._needNormals=n.PrepareDefinesForLights(d,e,l,!1,1);const f=null===(r=this._getFirstShadowLightForMesh(e))||void 0===r?void 0:r.getShadowGenerator();if(this._needAlphaBlending=!0,f&&f.getClassName&&"CascadedShadowGenerator"===f.getClassName()){const e=f;this._needAlphaBlending=!e.autoCalcDepthBounds}if(this._eventInfo.defines=l,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),n.PrepareDefinesForAttributes(e,l,!1,!0),this._callbackPluginEventPrepareDefines(this._eventInfo),this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=l,this._eventInfo.subMesh=a,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(l.isDirty){l.markAsProcessed(),d.resetCachedMaterial();const i=new n.EffectFallbacks;l.FOG&&i.addFallback(1,"FOG"),n.HandleFallbacksForShadows(l,i,1),l.NUM_BONE_INFLUENCERS>0&&i.addCPUSkinningFallback(0,e),l.IMAGEPROCESSINGPOSTPROCESS=d.imageProcessingConfiguration.applyByPostProcess;const o=[n.VertexBuffer.PositionKind];l.NORMAL&&o.push(n.VertexBuffer.NormalKind),n.PrepareAttributesForBones(o,e,l,i),n.PrepareAttributesForInstances(o,l);const r="shadowOnly",s=l.toString(),f=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","logarithmicDepthConstant"],h=[],u=["Scene","Material"],g={maxSimultaneousLights:1};n.AddClipPlaneUniforms(f),n.PrepareUniformsAndSamplersList({uniformsNames:f,uniformBuffersNames:u,samplers:h,defines:l,maxSimultaneousLights:1,shaderLanguage:this._shaderLanguage}),this._eventInfo.fallbacks=i,this._eventInfo.fallbackRank=0,this._eventInfo.defines=l,this._eventInfo.uniforms=f,this._eventInfo.attributes=o,this._eventInfo.samplers=h,this._eventInfo.uniformBuffersNames=u,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._eventInfo.indexParameters=g,this._callbackPluginEventGeneric(128,this._eventInfo),a.setEffect(d.getEngine().createEffect(r,{attributes:o,uniformsNames:f,uniformBuffersNames:u,samplers:h,defines:s,fallbacks:i,onCompiled:this.onCompiled,onError:this.onError,indexParameters:g,processCodeAfterIncludes:this._eventInfo.customCode,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:t._ShaderLoader.getLoadCallback(this._shaderLanguage)},c),l,this._materialContext)}return!(!a.effect||!a.effect.isReady()||(l._renderId=d.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!o,0))}bindForSubMesh(e,i,t){const a=this.getScene(),o=t.materialDefines;if(!o)return;const r=t.effect;if(r){if(this._activeEffect=r,this._uniformBuffer.bindToEffect(r,"Material"),this.bindOnlyWorldMatrix(e),this.bindViewProjection(r),this._eventInfo.subMesh=t,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),n.BindBonesParameters(i,this._activeEffect),this._mustRebind(a,r,t)&&(n.BindClipPlane(r,this,a),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),this._useLogarithmicDepth&&n.BindLogDepth(o,r,a),a.bindEyePosition(r),this._eventInfo.subMesh=t,this._callbackPluginEventBindForSubMesh(this._eventInfo)),a.lightsEnabled){n.BindLights(a,i,this._activeEffect,o,1);const e=this._getFirstShadowLightForMesh(i);e&&(e._renderId=-1)}(a.fogEnabled&&i.applyFog&&a.fogMode!==n.Scene.FOGMODE_NONE||o.SHADOWCSM0)&&this.bindView(r),n.BindFogParameters(a,i,this._activeEffect),this._afterBind(i,this._activeEffect,t),this._uniformBuffer.update()}}clone(e){return n.SerializationHelper.Clone(()=>new t(e,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.ShadowOnlyMaterial",e}getClassName(){return"ShadowOnlyMaterial"}static Parse(e,i,a){return n.SerializationHelper.Parse(()=>new t(e.name,i),e,i,a)}}t._ShaderLoader=new n._ShaderImportLoader(()=>[Promise.resolve().then(function(){return d}),Promise.resolve().then(function(){return u})],()=>[Promise.resolve().then(function(){return _}),Promise.resolve().then(function(){return I})]),n.RegisterClass("BABYLON.ShadowOnlyMaterial",t);var a={__proto__:null,ShadowOnlyMaterial:t};const o="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==o)for(const e in a)o.BABYLON[e]=a[e];const r="shadowOnlyVertexShader",s="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";n.ShaderStore.ShadersStore[r]||(n.ShaderStore.ShadersStore[r]=s);const l=[n.bonesDeclaration,n.bakedVertexAnimationDeclaration,n.instancesDeclaration,n.sceneVertexDeclaration,n.sceneUboDeclaration,n.clipPlaneVertexDeclaration,n.logDepthDeclaration,n.fogVertexDeclaration,n.lightFragmentDeclaration,n.lightUboDeclaration,n.instancesVertex,n.bonesVertex,n.bakedVertexAnimation,n.clipPlaneVertex,n.logDepthVertex,n.fogVertex,n.shadowsVertex];for(const e of l)n.ShaderStore.IncludesShadersStore[e.name]||(n.ShaderStore.IncludesShadersStore[e.name]=e.shader);var d={__proto__:null,shadowOnlyVertexShader:{name:r,shader:s}};const c="shadowOnlyPixelShader",f="precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;\n#define ADDITIONAL_FRAGMENT_DECLARATION\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\n#define CUSTOM_FRAGMENT_BEFORE_LIGHT_COMPOSITION\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";n.ShaderStore.ShadersStore[c]||(n.ShaderStore.ShadersStore[c]=f);const h=[n.sceneFragmentDeclaration,n.sceneUboDeclaration,n.helperFunctions,n.lightFragmentDeclaration,n.lightUboDeclaration,n.lightsFragmentFunctions,n.shadowsFragmentFunctions,n.clipPlaneFragmentDeclaration,n.logDepthDeclaration,n.fogFragmentDeclaration,n.clipPlaneFragment,n.lightFragment,n.logDepthFragment,n.fogFragment,n.imageProcessingCompatibility];for(const e of h)n.ShaderStore.IncludesShadersStore[e.name]||(n.ShaderStore.IncludesShadersStore[e.name]=e.shader);var u={__proto__:null,shadowOnlyPixelShader:{name:c,shader:f}};const g="shadowOnlyVertexShader",S="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n";n.ShaderStore.ShadersStoreWGSL[g]||(n.ShaderStore.ShadersStoreWGSL[g]=S);const m=[n.bonesDeclarationWGSL,n.bakedVertexAnimationDeclarationWGSL,n.instancesDeclarationWGSL,n.sceneUboDeclarationWGSL,n.clipPlaneVertexDeclarationWGSL,n.logDepthDeclarationWGSL,n.fogVertexDeclarationWGSL,n.lightVxFragmentDeclarationWGSL,n.lightVxUboDeclarationWGSL,n.instancesVertexWGSL,n.bonesVertexWGSL,n.bakedVertexAnimationWGSL,n.clipPlaneVertexWGSL,n.logDepthVertexWGSL,n.fogVertexWGSL,n.shadowsVertexWGSL];for(const e of m)n.ShaderStore.IncludesShadersStoreWGSL[e.name]||(n.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var _={__proto__:null,shadowOnlyVertexShaderWGSL:{name:g,shader:S}};const v="shadowOnlyPixelShader",p="#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;\n#define ADDITIONAL_UBO_DECLARATION\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\n#define CUSTOM_FRAGMENT_BEFORE_LIGHT_COMPOSITION\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";n.ShaderStore.ShadersStoreWGSL[v]||(n.ShaderStore.ShadersStoreWGSL[v]=p);const L=[n.sceneUboDeclarationWGSL,n.helperFunctionsWGSL,n.lightUboDeclarationWGSL,n.lightsFragmentFunctionsWGSL,n.shadowsFragmentFunctionsWGSL,n.clipPlaneFragmentDeclarationWGSL,n.logDepthDeclarationWGSL,n.fogFragmentDeclarationWGSL,n.clipPlaneFragmentWGSL,n.lightFragmentWGSL,n.logDepthFragmentWGSL,n.fogFragmentWGSL];for(const e of L)n.ShaderStore.IncludesShadersStoreWGSL[e.name]||(n.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var I={__proto__:null,shadowOnlyPixelShaderWGSL:{name:v,shader:p}};e.ShadowOnlyMaterial=t});
|
|
2
2
|
//# sourceMappingURL=babylon.shadowOnlyMaterial.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babylon.shadowOnlyMaterial.min.js","sources":["file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnlyMaterial.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/legacy/legacy-shadowOnly.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnly.vertex.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnly.fragment.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/wgsl/shadowOnly.vertex.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/wgsl/shadowOnly.fragment.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { type Nullable } from \"core/types\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { type Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { type IShadowLight } from \"core/Lights/shadowLight\";\r\nimport { type IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { type SubMesh } from \"core/Meshes/subMesh\";\r\nimport { type Mesh } from \"core/Meshes/mesh\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { _ShaderImportLoader } from \"core/Misc/shaderImportLoader\";\r\n\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { type CascadedShadowGenerator } from \"core/Lights/Shadows/cascadedShadowGenerator\";\r\nimport { AddClipPlaneUniforms, BindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport {\r\n BindBonesParameters,\r\n BindFogParameters,\r\n BindLights,\r\n BindLogDepth,\r\n HandleFallbacksForShadows,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForLights,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass ShadowOnlyMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class ShadowOnlyMaterial extends PushMaterial {\r\n private _activeLight: IShadowLight;\r\n private _needAlphaBlending = true;\r\n private static readonly _ShaderLoader = /*#__PURE__*/ new _ShaderImportLoader(\r\n () => [import(\"./shadowOnly.vertex\"), import(\"./shadowOnly.fragment\")],\r\n () => [import(\"./wgsl/shadowOnly.vertex\"), import(\"./wgsl/shadowOnly.fragment\")]\r\n );\r\n\r\n /**\r\n * Instantiates a ShadowOnly Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n */\r\n constructor(name: string, scene?: Scene, forceGLSL = false) {\r\n super(name, scene, undefined, forceGLSL);\r\n }\r\n\r\n public shadowColor = Color3.Black();\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this._needAlphaBlending;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public get activeLight(): IShadowLight {\r\n return this._activeLight;\r\n }\r\n\r\n public set activeLight(light: IShadowLight) {\r\n this._activeLight = light;\r\n }\r\n\r\n private _getFirstShadowLightForMesh(mesh: AbstractMesh): Nullable<IShadowLight> {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n return light as IShadowLight;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new ShadowOnlyMaterialDefines();\r\n }\r\n\r\n const defines = <ShadowOnlyMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Ensure that active light is the first shadow light\r\n if (this._activeLight) {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n if (this._activeLight === light) {\r\n break; // We are good\r\n }\r\n\r\n const lightPosition = mesh.lightSources.indexOf(this._activeLight);\r\n\r\n if (lightPosition !== -1) {\r\n mesh.lightSources.splice(lightPosition, 1);\r\n mesh.lightSources.splice(0, 0, this._activeLight);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n PrepareDefinesForMisc(\r\n mesh,\r\n scene,\r\n this._useLogarithmicDepth,\r\n this.pointsCloud,\r\n this.fogEnabled,\r\n this.needAlphaTestingForMesh(mesh),\r\n defines,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._isVertexOutputInvariant\r\n );\r\n\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, 1);\r\n\r\n const shadowGenerator = this._getFirstShadowLightForMesh(mesh)?.getShadowGenerator();\r\n\r\n this._needAlphaBlending = true;\r\n\r\n if (shadowGenerator && (shadowGenerator as any).getClassName && (shadowGenerator as any).getClassName() === \"CascadedShadowGenerator\") {\r\n const csg = shadowGenerator as CascadedShadowGenerator;\r\n\r\n this._needAlphaBlending = !csg.autoCalcDepthBounds;\r\n }\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks, 1);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"shadowOnly\";\r\n const join = defines.toString();\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"alpha\",\r\n \"shadowColor\",\r\n \"mBones\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers: string[] = [];\r\n\r\n const uniformBuffers: string[] = [\"Scene\"];\r\n\r\n AddClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 1,\r\n shaderLanguage: this._shaderLanguage,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 1 },\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: ShadowOnlyMaterial._ShaderLoader.getLoadCallback(this._shaderLanguage),\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <ShadowOnlyMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this.bindViewProjection(effect);\r\n\r\n // Bones\r\n BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Clip plane\r\n BindClipPlane(effect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n this._activeEffect.setFloat(\"alpha\", this.alpha);\r\n this._activeEffect.setColor3(\"shadowColor\", this.shadowColor);\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n }\r\n\r\n // Lights\r\n if (scene.lightsEnabled) {\r\n BindLights(scene, mesh, this._activeEffect, defines, 1);\r\n\r\n const light = this._getFirstShadowLightForMesh(mesh);\r\n\r\n if (light) {\r\n // Make sure the uniforms for this light will be rebound for other materials using this light when rendering the current frame.\r\n // Indeed, there is an optimization in Light that binds the light uniforms only once per frame for a given light (if using ubo).\r\n // Doing this way assumes that all uses of this light are the same, meaning all parameters passed to Light._bindLlight\r\n // are the same, notably useSpecular. However, isReadyForSubMesh (see above) is passing false for this parameter, which may not be\r\n // the value the other materials may pass.\r\n light._renderId = -1;\r\n }\r\n }\r\n\r\n // View\r\n if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) || defines[\"SHADOWCSM0\"]) {\r\n this.bindView(effect);\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override clone(name: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Clone<ShadowOnlyMaterial>(() => new ShadowOnlyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.ShadowOnlyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"ShadowOnlyMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ShadowOnlyMaterial\", ShadowOnlyMaterial);\r\n","/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nimport * as MatLib from \"materials/shadowOnly/index\";\r\n\r\n/**\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nconst GlobalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\r\nif (typeof GlobalObject !== \"undefined\") {\r\n for (const key in MatLib) {\r\n (<any>GlobalObject).BABYLON[key] = (<any>MatLib)[key];\r\n }\r\n}\r\n\r\nexport * from \"materials/shadowOnly/index\";\r\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { bonesDeclaration } from \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport { bakedVertexAnimationDeclaration } from \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport { instancesDeclaration } from \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport { sceneVertexDeclaration } from \"core/Shaders/ShadersInclude/sceneVertexDeclaration\";\nimport { sceneUboDeclaration } from \"core/Shaders/ShadersInclude/sceneUboDeclaration\";\nimport { clipPlaneVertexDeclaration } from \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport { logDepthDeclaration } from \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport { fogVertexDeclaration } from \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport { lightFragmentDeclaration } from \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport { instancesVertex } from \"core/Shaders/ShadersInclude/instancesVertex\";\nimport { bonesVertex } from \"core/Shaders/ShadersInclude/bonesVertex\";\nimport { bakedVertexAnimation } from \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport { clipPlaneVertex } from \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport { logDepthVertex } from \"core/Shaders/ShadersInclude/logDepthVertex\";\nimport { fogVertex } from \"core/Shaders/ShadersInclude/fogVertex\";\nimport { shadowsVertex } from \"core/Shaders/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [bonesDeclaration, bakedVertexAnimationDeclaration, instancesDeclaration, sceneVertexDeclaration, sceneUboDeclaration, clipPlaneVertexDeclaration, logDepthDeclaration, fogVertexDeclaration, lightFragmentDeclaration, lightUboDeclaration, instancesVertex, bonesVertex, bakedVertexAnimation, clipPlaneVertex, logDepthVertex, fogVertex, shadowsVertex];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyVertexShader = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { sceneFragmentDeclaration } from \"core/Shaders/ShadersInclude/sceneFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"core/Shaders/ShadersInclude/sceneUboDeclaration\";\nimport { helperFunctions } from \"core/Shaders/ShadersInclude/helperFunctions\";\nimport { lightFragmentDeclaration } from \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctions } from \"core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctions } from \"core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclaration } from \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclaration } from \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclaration } from \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragment } from \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport { lightFragment } from \"core/Shaders/ShadersInclude/lightFragment\";\nimport { logDepthFragment } from \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport { fogFragment } from \"core/Shaders/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibility } from \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [sceneFragmentDeclaration, sceneUboDeclaration, helperFunctions, lightFragmentDeclaration, lightUboDeclaration, lightsFragmentFunctions, shadowsFragmentFunctions, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, clipPlaneFragment, lightFragment, logDepthFragment, fogFragment, imageProcessingCompatibility];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyPixelShader = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { bonesDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/bonesDeclaration\";\nimport { bakedVertexAnimationDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport { instancesDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/instancesDeclaration\";\nimport { sceneUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/sceneUboDeclaration\";\nimport { clipPlaneVertexDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogVertexDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogVertexDeclaration\";\nimport { lightVxFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration\";\nimport { lightVxUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightVxUboDeclaration\";\nimport { instancesVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/instancesVertex\";\nimport { bonesVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/bonesVertex\";\nimport { bakedVertexAnimationWGSL } from \"core/ShadersWGSL/ShadersInclude/bakedVertexAnimation\";\nimport { clipPlaneVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneVertex\";\nimport { logDepthVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthVertex\";\nimport { fogVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/fogVertex\";\nimport { shadowsVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [bonesDeclarationWGSL, bakedVertexAnimationDeclarationWGSL, instancesDeclarationWGSL, sceneUboDeclarationWGSL, clipPlaneVertexDeclarationWGSL, logDepthDeclarationWGSL, fogVertexDeclarationWGSL, lightVxFragmentDeclarationWGSL, lightVxUboDeclarationWGSL, instancesVertexWGSL, bonesVertexWGSL, bakedVertexAnimationWGSL, clipPlaneVertexWGSL, logDepthVertexWGSL, fogVertexWGSL, shadowsVertexWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyVertexShaderWGSL = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { sceneUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/sceneUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [sceneUboDeclarationWGSL, helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyPixelShaderWGSL = { name, shader };\n"],"names":["ShadowOnlyMaterialDefines","MaterialDefines","constructor","super","this","CLIPPLANE","CLIPPLANE2","CLIPPLANE3","CLIPPLANE4","CLIPPLANE5","CLIPPLANE6","POINTSIZE","FOG","NORMAL","NUM_BONE_INFLUENCERS","BonesPerMesh","INSTANCES","IMAGEPROCESSINGPOSTPROCESS","SKIPFINALCOLORCLAMP","LOGARITHMICDEPTH","rebuild","ShadowOnlyMaterial","PushMaterial","name","scene","forceGLSL","undefined","_needAlphaBlending","shadowColor","Color3","Black","needAlphaBlending","needAlphaTesting","getAlphaTestTexture","activeLight","_activeLight","light","_getFirstShadowLightForMesh","mesh","lightSources","shadowEnabled","isReadyForSubMesh","subMesh","useInstances","drawWrapper","_drawWrapper","isFrozen","effect","_wasPreviouslyReady","_wasPreviouslyUsingInstances","materialDefines","defines","getScene","_isReadyForSubMesh","engine","getEngine","lightPosition","indexOf","splice","PrepareDefinesForFrameBoundValues","PrepareDefinesForMisc","_useLogarithmicDepth","pointsCloud","fogEnabled","needAlphaTestingForMesh","_isVertexOutputInvariant","_needNormals","PrepareDefinesForLights","shadowGenerator","_a","getShadowGenerator","getClassName","csg","autoCalcDepthBounds","PrepareDefinesForAttributes","isDirty","markAsProcessed","resetCachedMaterial","fallbacks","EffectFallbacks","addFallback","HandleFallbacksForShadows","addCPUSkinningFallback","imageProcessingConfiguration","applyByPostProcess","attribs","VertexBuffer","PositionKind","push","NormalKind","PrepareAttributesForBones","PrepareAttributesForInstances","shaderName","join","toString","uniforms","samplers","uniformBuffers","AddClipPlaneUniforms","PrepareUniformsAndSamplersList","uniformsNames","uniformBuffersNames","maxSimultaneousLights","shaderLanguage","_shaderLanguage","setEffect","createEffect","attributes","onCompiled","onError","indexParameters","extraInitializationsAsync","_ShaderLoader","getLoadCallback","_materialContext","isReady","_renderId","getRenderId","bindForSubMesh","world","_activeEffect","bindOnlyWorldMatrix","bindViewProjection","BindBonesParameters","_mustRebind","BindClipPlane","setFloat","pointSize","alpha","setColor3","BindLogDepth","bindEyePosition","lightsEnabled","BindLights","applyFog","fogMode","Scene","FOGMODE_NONE","bindView","BindFogParameters","_afterBind","clone","SerializationHelper","Clone","serialize","serializationObject","customType","Parse","source","rootUrl","_ShaderImportLoader","Promise","resolve","then","shadowOnly_vertex$1","shadowOnly_fragment$1","shadowOnly_fragment","RegisterClass","GlobalObject","global","window","key","MatLib","BABYLON","shader","ShaderStore","ShadersStore","includes","bonesDeclaration","bakedVertexAnimationDeclaration","instancesDeclaration","sceneVertexDeclaration","sceneUboDeclaration","clipPlaneVertexDeclaration","logDepthDeclaration","fogVertexDeclaration","lightFragmentDeclaration","lightUboDeclaration","instancesVertex","bonesVertex","bakedVertexAnimation","clipPlaneVertex","logDepthVertex","fogVertex","shadowsVertex","inc","IncludesShadersStore","sceneFragmentDeclaration","helperFunctions","lightsFragmentFunctions","shadowsFragmentFunctions","clipPlaneFragmentDeclaration","fogFragmentDeclaration","clipPlaneFragment","lightFragment","logDepthFragment","fogFragment","imageProcessingCompatibility","ShadersStoreWGSL","bonesDeclarationWGSL","bakedVertexAnimationDeclarationWGSL","instancesDeclarationWGSL","sceneUboDeclarationWGSL","clipPlaneVertexDeclarationWGSL","logDepthDeclarationWGSL","fogVertexDeclarationWGSL","lightVxFragmentDeclarationWGSL","lightVxUboDeclarationWGSL","instancesVertexWGSL","bonesVertexWGSL","bakedVertexAnimationWGSL","clipPlaneVertexWGSL","logDepthVertexWGSL","fogVertexWGSL","shadowsVertexWGSL","IncludesShadersStoreWGSL","helperFunctionsWGSL","lightUboDeclarationWGSL","lightsFragmentFunctionsWGSL","shadowsFragmentFunctionsWGSL","clipPlaneFragmentDeclarationWGSL","fogFragm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K,MAAQkK,EAAIrB,oDAKpB,CAAA7I,KAAEA,EAAI6I,OAAEA,IClD7C,MAAM7I,EAAO,yBACP6I,EAAS,gwCA4CVC,EAAAA,YAAYiC,iBAAiB/K,KAC9B8I,cAAYiC,iBAAiB/K,GAAQ6I,GAEzC,MAAMG,EAAW,CAACgC,EAAAA,qBAAsBC,EAAAA,oCAAqCC,EAAAA,yBAA0BC,0BAAyBC,EAAAA,+BAAgCC,EAAAA,wBAAyBC,EAAAA,yBAA0BC,EAAAA,+BAAgCC,EAAAA,0BAA2BC,EAAAA,oBAAqBC,kBAAiBC,EAAAA,yBAA0BC,EAAAA,oBAAqBC,EAAAA,mBAAoBC,EAAAA,cAAeC,qBACtY,IAAK,MAAM7B,KAAOlB,EACTF,EAAAA,YAAYkD,yBAAyB9B,EAAIlK,QAC1C8I,EAAAA,YAAYkD,yBAAyB9B,EAAIlK,MAAQkK,EAAIrB,yDAKnB,CAAA7I,KAAEA,EAAI6I,OAAEA,IC5DlD,MAAM7I,EAAO,wBACP6I,EAAS,wvCAoCVC,EAAAA,YAAYiC,iBAAiB/K,KAC9B8I,cAAYiC,iBAAiB/K,GAAQ6I,GAEzC,MAAMG,EAAW,CAACmC,EAAAA,wBAAyBc,EAAAA,oBAAqBC,EAAAA,wBAAyBC,EAAAA,4BAA6BC,EAAAA,6BAA8BC,mCAAkChB,EAAAA,wBAAyBiB,EAAAA,2BAA4BC,EAAAA,sBAAuBC,EAAAA,kBAAmBC,EAAAA,qBAAsBC,EAAAA,iBAC3S,IAAK,MAAMxC,KAAOlB,EACTF,EAAAA,YAAYkD,yBAAyB9B,EAAIlK,QAC1C8I,EAAAA,YAAYkD,yBAAyB9B,EAAIlK,MAAQkK,EAAIrB,wDAKpB,CAAE7I,OAAM6I"}
|
|
1
|
+
{"version":3,"file":"babylon.shadowOnlyMaterial.min.js","sources":["file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnlyMaterial.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/legacy/legacy-shadowOnly.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnly.vertex.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnly.fragment.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/wgsl/shadowOnly.vertex.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/wgsl/shadowOnly.fragment.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { type Nullable } from \"core/types\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { type Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { type IShadowLight } from \"core/Lights/shadowLight\";\r\nimport { type IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { MaterialPluginEvent } from \"core/Materials/materialPluginEvent\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { UniformBuffer } from \"core/Materials/uniformBuffer\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { type SubMesh } from \"core/Meshes/subMesh\";\r\nimport { type Mesh } from \"core/Meshes/mesh\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { _ShaderImportLoader } from \"core/Misc/shaderImportLoader\";\r\n\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { type CascadedShadowGenerator } from \"core/Lights/Shadows/cascadedShadowGenerator\";\r\nimport { AddClipPlaneUniforms, BindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport {\r\n BindBonesParameters,\r\n BindFogParameters,\r\n BindLights,\r\n BindLogDepth,\r\n HandleFallbacksForShadows,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForLights,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass ShadowOnlyMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor(externalProperties?: { [name: string]: { type: string; default: any } }) {\r\n super(externalProperties);\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * A transparent \"shadow catcher\" material: it renders only shadow strength into its alpha channel\r\n * (over {@link ShadowOnlyMaterial.shadowColor | shadowColor}, black by default), so shadows can be\r\n * composited over an arbitrary background.\r\n *\r\n * It can receive IBL shadows (via `IblShadowsRenderPipeline.addShadowReceivingMaterial` /\r\n * the Frame Graph IBL shadows task). Because the material has a single alpha output channel, IBL\r\n * shadows are received as **monochrome**: a colored IBL shadow is reduced to its luminance rather\r\n * than preserving per-channel hue.\r\n */\r\nexport class ShadowOnlyMaterial extends PushMaterial {\r\n private _activeLight: IShadowLight;\r\n private _needAlphaBlending = true;\r\n private static readonly _ShaderLoader = /*#__PURE__*/ new _ShaderImportLoader(\r\n () => [import(\"./shadowOnly.vertex\"), import(\"./shadowOnly.fragment\")],\r\n () => [import(\"./wgsl/shadowOnly.vertex\"), import(\"./wgsl/shadowOnly.fragment\")]\r\n );\r\n\r\n /**\r\n * Instantiates a ShadowOnly Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n */\r\n constructor(name: string, scene?: Scene, forceGLSL = false) {\r\n super(name, scene, undefined, forceGLSL);\r\n }\r\n\r\n /**\r\n * @internal\r\n * Force the material uniform buffer into \"no UBO\" (individual uniform) mode so that any attached\r\n * material plugin (e.g. IBLShadowsPluginMaterial) binds its uniforms directly on the effect. This\r\n * lets ShadowOnlyMaterial host plugins without declaring a dedicated \"Material\" uniform block in its\r\n * shaders (its own uniforms - alpha/shadowColor/... - stay individual uniforms). The base class only\r\n * does this on WebGPU (\"leftovers UBO\"); we extend it to every backend.\r\n */\r\n public override _createUniformBuffer(): void {\r\n super._createUniformBuffer();\r\n // The base leaves a real UBO in place on WebGL2 (useUbo === true); re-create it as no-UBO so\r\n // the plugin's uniforms are set individually on the effect (no shader-side \"Material\" block).\r\n if (this._uniformBuffer.useUbo) {\r\n this._uniformBuffer.dispose();\r\n this._uniformBuffer = new UniformBuffer(this.getScene().getEngine(), undefined, undefined, this.name, true);\r\n this._uniformBufferLayoutBuilt = false;\r\n }\r\n }\r\n\r\n /**\r\n * The color the shadow is rendered with (black by default). Only its RGB is used; shadow\r\n * strength is written to the material's alpha channel.\r\n */\r\n public shadowColor = Color3.Black();\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this._needAlphaBlending;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public get activeLight(): IShadowLight {\r\n return this._activeLight;\r\n }\r\n\r\n public set activeLight(light: IShadowLight) {\r\n this._activeLight = light;\r\n }\r\n\r\n private _getFirstShadowLightForMesh(mesh: AbstractMesh): Nullable<IShadowLight> {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n return light as IShadowLight;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (!this._uniformBufferLayoutBuilt) {\r\n this.buildUniformLayout();\r\n }\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n this._callbackPluginEventGeneric(MaterialPluginEvent.GetDefineNames, this._eventInfo);\r\n subMesh.materialDefines = new ShadowOnlyMaterialDefines(this._eventInfo.defineNames);\r\n }\r\n\r\n const defines = <ShadowOnlyMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Ensure that active light is the first shadow light\r\n if (this._activeLight) {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n if (this._activeLight === light) {\r\n break; // We are good\r\n }\r\n\r\n const lightPosition = mesh.lightSources.indexOf(this._activeLight);\r\n\r\n if (lightPosition !== -1) {\r\n mesh.lightSources.splice(lightPosition, 1);\r\n mesh.lightSources.splice(0, 0, this._activeLight);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n PrepareDefinesForMisc(\r\n mesh,\r\n scene,\r\n this._useLogarithmicDepth,\r\n this.pointsCloud,\r\n this.fogEnabled,\r\n this.needAlphaTestingForMesh(mesh),\r\n defines,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._isVertexOutputInvariant\r\n );\r\n\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, 1);\r\n\r\n const shadowGenerator = this._getFirstShadowLightForMesh(mesh)?.getShadowGenerator();\r\n\r\n this._needAlphaBlending = true;\r\n\r\n if (shadowGenerator && (shadowGenerator as any).getClassName && (shadowGenerator as any).getClassName() === \"CascadedShadowGenerator\") {\r\n const csg = shadowGenerator as CascadedShadowGenerator;\r\n\r\n this._needAlphaBlending = !csg.autoCalcDepthBounds;\r\n }\r\n\r\n // External config\r\n this._eventInfo.defines = defines;\r\n this._eventInfo.mesh = mesh;\r\n this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // External config\r\n this._callbackPluginEventPrepareDefines(this._eventInfo);\r\n\r\n // Plugin readiness\r\n this._eventInfo.isReadyForSubMesh = true;\r\n this._eventInfo.defines = defines;\r\n this._eventInfo.subMesh = subMesh;\r\n this._callbackPluginEventIsReadyForSubMesh(this._eventInfo);\r\n if (!this._eventInfo.isReadyForSubMesh) {\r\n return false;\r\n }\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks, 1);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"shadowOnly\";\r\n const join = defines.toString();\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"alpha\",\r\n \"shadowColor\",\r\n \"mBones\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers: string[] = [];\r\n\r\n const uniformBuffers: string[] = [\"Scene\", \"Material\"];\r\n\r\n const indexParameters = { maxSimultaneousLights: 1 };\r\n\r\n AddClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 1,\r\n shaderLanguage: this._shaderLanguage,\r\n });\r\n\r\n // External config\r\n this._eventInfo.fallbacks = fallbacks;\r\n this._eventInfo.fallbackRank = 0;\r\n this._eventInfo.defines = defines;\r\n this._eventInfo.uniforms = uniforms;\r\n this._eventInfo.attributes = attribs;\r\n this._eventInfo.samplers = samplers;\r\n this._eventInfo.uniformBuffersNames = uniformBuffers;\r\n this._eventInfo.customCode = undefined;\r\n this._eventInfo.mesh = mesh;\r\n this._eventInfo.indexParameters = indexParameters;\r\n this._callbackPluginEventGeneric(MaterialPluginEvent.PrepareEffect, this._eventInfo);\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters,\r\n processCodeAfterIncludes: this._eventInfo.customCode,\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: ShadowOnlyMaterial._ShaderLoader.getLoadCallback(this._shaderLanguage),\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <ShadowOnlyMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Binding unconditionally\r\n this._uniformBuffer.bindToEffect(effect, \"Material\");\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this.bindViewProjection(effect);\r\n\r\n this._eventInfo.subMesh = subMesh;\r\n this._callbackPluginEventHardBindForSubMesh(this._eventInfo);\r\n\r\n // Bones\r\n BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Clip plane\r\n BindClipPlane(effect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n this._activeEffect.setFloat(\"alpha\", this.alpha);\r\n this._activeEffect.setColor3(\"shadowColor\", this.shadowColor);\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n\r\n this._eventInfo.subMesh = subMesh;\r\n this._callbackPluginEventBindForSubMesh(this._eventInfo);\r\n }\r\n\r\n // Lights\r\n if (scene.lightsEnabled) {\r\n BindLights(scene, mesh, this._activeEffect, defines, 1);\r\n\r\n const light = this._getFirstShadowLightForMesh(mesh);\r\n\r\n if (light) {\r\n // Make sure the uniforms for this light will be rebound for other materials using this light when rendering the current frame.\r\n // Indeed, there is an optimization in Light that binds the light uniforms only once per frame for a given light (if using ubo).\r\n // Doing this way assumes that all uses of this light are the same, meaning all parameters passed to Light._bindLlight\r\n // are the same, notably useSpecular. However, isReadyForSubMesh (see above) is passing false for this parameter, which may not be\r\n // the value the other materials may pass.\r\n light._renderId = -1;\r\n }\r\n }\r\n\r\n // View\r\n if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) || defines[\"SHADOWCSM0\"]) {\r\n this.bindView(effect);\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n this._uniformBuffer.update();\r\n }\r\n\r\n public override clone(name: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Clone<ShadowOnlyMaterial>(() => new ShadowOnlyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.ShadowOnlyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"ShadowOnlyMaterial\";\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a ShadowOnly material from parsed material data.\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new ShadowOnly material\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ShadowOnlyMaterial\", ShadowOnlyMaterial);\r\n","/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nimport * as MatLib from \"materials/shadowOnly/index\";\r\n\r\n/**\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nconst GlobalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\r\nif (typeof GlobalObject !== \"undefined\") {\r\n for (const key in MatLib) {\r\n (<any>GlobalObject).BABYLON[key] = (<any>MatLib)[key];\r\n }\r\n}\r\n\r\nexport * from \"materials/shadowOnly/index\";\r\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { bonesDeclaration } from \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport { bakedVertexAnimationDeclaration } from \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport { instancesDeclaration } from \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport { sceneVertexDeclaration } from \"core/Shaders/ShadersInclude/sceneVertexDeclaration\";\nimport { sceneUboDeclaration } from \"core/Shaders/ShadersInclude/sceneUboDeclaration\";\nimport { clipPlaneVertexDeclaration } from \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport { logDepthDeclaration } from \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport { fogVertexDeclaration } from \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport { lightFragmentDeclaration } from \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport { instancesVertex } from \"core/Shaders/ShadersInclude/instancesVertex\";\nimport { bonesVertex } from \"core/Shaders/ShadersInclude/bonesVertex\";\nimport { bakedVertexAnimation } from \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport { clipPlaneVertex } from \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport { logDepthVertex } from \"core/Shaders/ShadersInclude/logDepthVertex\";\nimport { fogVertex } from \"core/Shaders/ShadersInclude/fogVertex\";\nimport { shadowsVertex } from \"core/Shaders/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [bonesDeclaration, bakedVertexAnimationDeclaration, instancesDeclaration, sceneVertexDeclaration, sceneUboDeclaration, clipPlaneVertexDeclaration, logDepthDeclaration, fogVertexDeclaration, lightFragmentDeclaration, lightUboDeclaration, instancesVertex, bonesVertex, bakedVertexAnimation, clipPlaneVertex, logDepthVertex, fogVertex, shadowsVertex];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyVertexShader = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { sceneFragmentDeclaration } from \"core/Shaders/ShadersInclude/sceneFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"core/Shaders/ShadersInclude/sceneUboDeclaration\";\nimport { helperFunctions } from \"core/Shaders/ShadersInclude/helperFunctions\";\nimport { lightFragmentDeclaration } from \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctions } from \"core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctions } from \"core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclaration } from \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclaration } from \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclaration } from \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragment } from \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport { lightFragment } from \"core/Shaders/ShadersInclude/lightFragment\";\nimport { logDepthFragment } from \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport { fogFragment } from \"core/Shaders/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibility } from \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;\n#define ADDITIONAL_FRAGMENT_DECLARATION\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\n#define CUSTOM_FRAGMENT_BEFORE_LIGHT_COMPOSITION\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [sceneFragmentDeclaration, sceneUboDeclaration, helperFunctions, lightFragmentDeclaration, lightUboDeclaration, lightsFragmentFunctions, shadowsFragmentFunctions, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, clipPlaneFragment, lightFragment, logDepthFragment, fogFragment, imageProcessingCompatibility];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyPixelShader = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { bonesDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/bonesDeclaration\";\nimport { bakedVertexAnimationDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport { instancesDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/instancesDeclaration\";\nimport { sceneUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/sceneUboDeclaration\";\nimport { clipPlaneVertexDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogVertexDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogVertexDeclaration\";\nimport { lightVxFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration\";\nimport { lightVxUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightVxUboDeclaration\";\nimport { instancesVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/instancesVertex\";\nimport { bonesVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/bonesVertex\";\nimport { bakedVertexAnimationWGSL } from \"core/ShadersWGSL/ShadersInclude/bakedVertexAnimation\";\nimport { clipPlaneVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneVertex\";\nimport { logDepthVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthVertex\";\nimport { fogVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/fogVertex\";\nimport { shadowsVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [bonesDeclarationWGSL, bakedVertexAnimationDeclarationWGSL, instancesDeclarationWGSL, sceneUboDeclarationWGSL, clipPlaneVertexDeclarationWGSL, logDepthDeclarationWGSL, fogVertexDeclarationWGSL, lightVxFragmentDeclarationWGSL, lightVxUboDeclarationWGSL, instancesVertexWGSL, bonesVertexWGSL, bakedVertexAnimationWGSL, clipPlaneVertexWGSL, logDepthVertexWGSL, fogVertexWGSL, shadowsVertexWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyVertexShaderWGSL = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { sceneUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/sceneUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;\n#define ADDITIONAL_UBO_DECLARATION\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\n#define CUSTOM_FRAGMENT_BEFORE_LIGHT_COMPOSITION\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [sceneUboDeclarationWGSL, helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyPixelShaderWGSL = { name, shader };\n"],"names":["ShadowOnlyMaterialDefines","MaterialDefines","constructor","externalProperties","super","this","CLIPPLANE","CLIPPLANE2","CLIPPLANE3","CLIPPLANE4","CLIPPLANE5","CLIPPLANE6","POINTSIZE","FOG","NORMAL","NUM_BONE_INFLUENCERS","BonesPerMesh","INSTANCES","IMAGEPROCESSINGPOSTPROCESS","SKIPFINALCOLORCLAMP","LOGARITHMICDEPTH","rebuild","ShadowOnlyMaterial","PushMaterial","name","scene","forceGLSL","undefined","_needAlphaBlending","shadowColor","Color3","Black","_createUniformBuffer","_uniformBuffer","useUbo","dispose","UniformBuffer","getScene","getEngine","_uniformBufferLayoutBuilt","needAlphaBlending","needAlphaTesting","getAlphaTestTexture","activeLight","_activeLight","light","_getFirstShadowLightForMesh","mesh","lightSources","shadowEnabled","isReadyForSubMesh","subMesh","useInstances","buildUniformLayout","drawWrapper","_drawWrapper","isFrozen","effect","_wasPreviouslyReady","_wasPreviouslyUsingInstances","materialDefines","_callbackPluginEventGeneric","_eventInfo","defineNames","defines","_isReadyForSubMesh","engine","lightPosition","indexOf","splice","PrepareDefinesForFrameBoundValues","PrepareDefinesForMisc","_useLogarithmicDepth","pointsCloud","fogEnabled","needAlphaTestingForMesh","_isVertexOutputInvariant","_needNormals","PrepareDefinesForLights","shadowGenerator","_a","getShadowGenerator","getClassName","csg","autoCalcDepthBounds","_callbackPluginEventPrepareDefinesBeforeAttributes","PrepareDefinesForAttributes","_callbackPluginEventPrepareDefines","_callbackPluginEventIsReadyForSubMesh","isDirty","markAsProcessed","resetCachedMaterial","fallbacks","EffectFallbacks","addFallback","HandleFallbacksForShadows","addCPUSkinningFallback","imageProcessingConfiguration","applyByPostProcess","attribs","VertexBuffer","PositionKind","push","NormalKind","PrepareAttributesForBones","PrepareAttributesForInstances","shaderName","join","toString","uniforms","samplers","uniformBuffers","indexParameters","maxSimultaneousLights","AddClipPlaneUniforms","PrepareUniformsAndSamplersList","uniformsNames","uniformBuffersNames","shaderLanguage","_shaderLanguage","fallbackRank","attributes","customCode","setEffect","createEffect","onCompiled","onError","processCodeAfterIncludes","extraInitializationsAsync","_ShaderLoader","getLoadCallback","_materialContext","isReady","_renderId","getRenderId","bindForSubMesh","world","_activeEffect","bindToEffect","bindOnlyWorldMatrix","bindViewProjection","_callbackPluginEventHardBindForSubMesh","BindBonesParameters","_mustRebind","BindClipPlane","setFloat","pointSize","alpha","setColor3","BindLogDepth","bindEyePosition","_callbackPluginEventBindForSubMesh","lightsEnabled","BindLights","applyFog","fogMode","Scene","FOGMODE_NONE","bindView","BindFogParameters","_afterBind","update","clone","SerializationHelper","Clone","serialize","serializationObject","customType","Parse","source","rootUrl","_ShaderImportLoader","Promise","resolve","then","shadowOnly_vertex$1","shadowOnly_fragment$1","shadowOnly_fragment","RegisterClass","GlobalObject","global","window","key","MatLib","BABYLON","shader","ShaderStore","ShadersStore","includes","bonesDeclaration","bakedVertexAnimationDeclaration","instancesDeclaration","sceneVertexDeclaration","sceneUboDeclaration","clipPlaneVertexDeclaration","logDepthDeclaration","fogVertexDeclaration","lightFragmentDeclaration","lightUboDeclaration","instancesVertex","bonesVertex","bakedVertexAnimation","clipPlaneVertex","logDepthVertex","fogVertex","shadowsVertex","inc","IncludesShadersStore","sceneFragmentDeclaration","helperFunctions","lightsFragmentFunctions","shadowsFragmentFunctions","clipPlaneFragmentDeclaration","fogFragmentDeclaration","clipPlaneFragment","lightFragment","logDepthFragment","fogFragment","imageProcessingCompatibility","ShadersStoreWGSL","bonesDeclarationWGSL","bakedVertexAnimationDeclarationWGSL","instancesDeclarationWGSL","sceneUboDeclarationWGSL","clipPlaneVertexDeclarationWGSL","logDepthDeclarationWGSL","fogVertexDeclarationWGSL","lightVxFragmentDeclarationWGSL","lightVxUboDeclarationWGSL","instancesVertexWGSL","bonesVertexWGSL","bakedVertexAnimationWGSL","clipPlaneVertexWGSL","logDepthVertexWGSL","fogVertexWGSL","shadowsVertexWGSL","IncludesShadersStoreWGSL","helperFunctionsWGSL","lightUboDeclarationWGSL","lightsFragmentFunctionsWGSL","shadowsFragmentFunctionsWGSL","clipPlaneFragmentDeclarationWGSL","fogFragmentDeclarationWGSL","clipPlaneFragmentWGSL","lightFragmentWGSL","logDepthFragmentWGSL","fogFragmentWGSL"],"mappings":"sSAsCA,MAAMA,UAAkCC,EAAAA,gBAiBpC,WAAAC,CAAYC,GACRC,MAAMD,GAjBHE,KAAAC,WAAY,EACZD,KAAAE,YAAa,EACbF,KAAAG,YAAa,EACbH,KAAAI,YAAa,EACbJ,KAAAK,YAAa,EACbL,KAAAM,YAAa,EACbN,KAAAO,WAAY,EACZP,KAAAQ,KAAM,EACNR,KAAAS,QAAS,EACTT,KAAAU,qBAAuB,EACvBV,KAAAW,aAAe,EACfX,KAAAY,WAAY,EACZZ,KAAAa,4BAA6B,EAC7Bb,KAAAc,qBAAsB,EACtBd,KAAAe,kBAAmB,EAItBf,KAAKgB,SACT,EAaE,MAAOC,UAA2BC,EAAAA,aAcpC,WAAAr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OlB,EACTF,EAAAA,YAAYkD,yBAAyB9B,EAAItL,QAC1CkK,EAAAA,YAAYkD,yBAAyB9B,EAAItL,MAAQsL,EAAIrB,yDAKnB,CAAAjK,KAAEA,EAAIiK,OAAEA,IC5DlD,MAAMjK,EAAO,wBACPiK,EAAS,g1CAuCVC,EAAAA,YAAYiC,iBAAiBnM,KAC9BkK,cAAYiC,iBAAiBnM,GAAQiK,GAEzC,MAAMG,EAAW,CAACmC,EAAAA,wBAAyBc,EAAAA,oBAAqBC,EAAAA,wBAAyBC,EAAAA,4BAA6BC,EAAAA,6BAA8BC,mCAAkChB,EAAAA,wBAAyBiB,EAAAA,2BAA4BC,EAAAA,sBAAuBC,EAAAA,kBAAmBC,EAAAA,qBAAsBC,EAAAA,iBAC3S,IAAK,MAAMxC,KAAOlB,EACTF,EAAAA,YAAYkD,yBAAyB9B,EAAItL,QAC1CkK,EAAAA,YAAYkD,yBAAyB9B,EAAItL,MAAQsL,EAAIrB,wDAKpB,CAAEjK,OAAMiK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,n){"use strict";class i extends n.MaterialDefines{constructor(){super(),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}class t extends n.PushMaterial{constructor(e,i,t=!1){super(e,i,void 0,t),this._needAlphaBlending=!0,this.shadowColor=n.Color3.Black()}needAlphaBlending(){return this._needAlphaBlending}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}get activeLight(){return this._activeLight}set activeLight(e){this._activeLight=e}_getFirstShadowLightForMesh(e){for(const n of e.lightSources)if(n.shadowEnabled)return n;return null}isReadyForSubMesh(e,a,o){var r;const s=a._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===o)return!0;a.materialDefines||(a.materialDefines=new i);const l=a.materialDefines,d=this.getScene();if(this._isReadyForSubMesh(a))return!0;const c=d.getEngine();if(this._activeLight)for(const n of e.lightSources)if(n.shadowEnabled){if(this._activeLight===n)break;const i=e.lightSources.indexOf(this._activeLight);-1!==i&&(e.lightSources.splice(i,1),e.lightSources.splice(0,0,this._activeLight));break}n.PrepareDefinesForFrameBoundValues(d,c,this,l,!!o),n.PrepareDefinesForMisc(e,d,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),l,void 0,void 0,void 0,this._isVertexOutputInvariant),l._needNormals=n.PrepareDefinesForLights(d,e,l,!1,1);const h=null===(r=this._getFirstShadowLightForMesh(e))||void 0===r?void 0:r.getShadowGenerator();if(this._needAlphaBlending=!0,h&&h.getClassName&&"CascadedShadowGenerator"===h.getClassName()){const e=h;this._needAlphaBlending=!e.autoCalcDepthBounds}if(n.PrepareDefinesForAttributes(e,l,!1,!0),l.isDirty){l.markAsProcessed(),d.resetCachedMaterial();const i=new n.EffectFallbacks;l.FOG&&i.addFallback(1,"FOG"),n.HandleFallbacksForShadows(l,i,1),l.NUM_BONE_INFLUENCERS>0&&i.addCPUSkinningFallback(0,e),l.IMAGEPROCESSINGPOSTPROCESS=d.imageProcessingConfiguration.applyByPostProcess;const o=[n.VertexBuffer.PositionKind];l.NORMAL&&o.push(n.VertexBuffer.NormalKind),n.PrepareAttributesForBones(o,e,l,i),n.PrepareAttributesForInstances(o,l);const r="shadowOnly",s=l.toString(),h=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","logarithmicDepthConstant"],f=[],g=["Scene"];n.AddClipPlaneUniforms(h),n.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:g,samplers:f,defines:l,maxSimultaneousLights:1,shaderLanguage:this._shaderLanguage}),a.setEffect(d.getEngine().createEffect(r,{attributes:o,uniformsNames:h,uniformBuffersNames:g,samplers:f,defines:s,fallbacks:i,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:t._ShaderLoader.getLoadCallback(this._shaderLanguage)},c),l,this._materialContext)}return!(!a.effect||!a.effect.isReady()||(l._renderId=d.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!o,0))}bindForSubMesh(e,i,t){const a=this.getScene(),o=t.materialDefines;if(!o)return;const r=t.effect;if(r){if(this._activeEffect=r,this.bindOnlyWorldMatrix(e),this.bindViewProjection(r),n.BindBonesParameters(i,this._activeEffect),this._mustRebind(a,r,t)&&(n.BindClipPlane(r,this,a),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),this._useLogarithmicDepth&&n.BindLogDepth(o,r,a),a.bindEyePosition(r)),a.lightsEnabled){n.BindLights(a,i,this._activeEffect,o,1);const e=this._getFirstShadowLightForMesh(i);e&&(e._renderId=-1)}(a.fogEnabled&&i.applyFog&&a.fogMode!==n.Scene.FOGMODE_NONE||o.SHADOWCSM0)&&this.bindView(r),n.BindFogParameters(a,i,this._activeEffect),this._afterBind(i,this._activeEffect,t)}}clone(e){return n.SerializationHelper.Clone(()=>new t(e,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.ShadowOnlyMaterial",e}getClassName(){return"ShadowOnlyMaterial"}static Parse(e,i,a){return n.SerializationHelper.Parse(()=>new t(e.name,i),e,i,a)}}t._ShaderLoader=new n._ShaderImportLoader(()=>[Promise.resolve().then(function(){return d}),Promise.resolve().then(function(){return g})],()=>[Promise.resolve().then(function(){return v}),Promise.resolve().then(function(){return P})]),n.RegisterClass("BABYLON.ShadowOnlyMaterial",t);var a={__proto__:null,ShadowOnlyMaterial:t};const o="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==o)for(const e in a)o.BABYLON[e]=a[e];const r="shadowOnlyVertexShader",s="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";n.ShaderStore.ShadersStore[r]||(n.ShaderStore.ShadersStore[r]=s);const l=[n.bonesDeclaration,n.bakedVertexAnimationDeclaration,n.instancesDeclaration,n.sceneVertexDeclaration,n.sceneUboDeclaration,n.clipPlaneVertexDeclaration,n.logDepthDeclaration,n.fogVertexDeclaration,n.lightFragmentDeclaration,n.lightUboDeclaration,n.instancesVertex,n.bonesVertex,n.bakedVertexAnimation,n.clipPlaneVertex,n.logDepthVertex,n.fogVertex,n.shadowsVertex];for(const e of l)n.ShaderStore.IncludesShadersStore[e.name]||(n.ShaderStore.IncludesShadersStore[e.name]=e.shader);var d={__proto__:null,shadowOnlyVertexShader:{name:r,shader:s}};const c="shadowOnlyPixelShader",h="precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";n.ShaderStore.ShadersStore[c]||(n.ShaderStore.ShadersStore[c]=h);const f=[n.sceneFragmentDeclaration,n.sceneUboDeclaration,n.helperFunctions,n.lightFragmentDeclaration,n.lightUboDeclaration,n.lightsFragmentFunctions,n.shadowsFragmentFunctions,n.clipPlaneFragmentDeclaration,n.logDepthDeclaration,n.fogFragmentDeclaration,n.clipPlaneFragment,n.lightFragment,n.logDepthFragment,n.fogFragment,n.imageProcessingCompatibility];for(const e of f)n.ShaderStore.IncludesShadersStore[e.name]||(n.ShaderStore.IncludesShadersStore[e.name]=e.shader);var g={__proto__:null,shadowOnlyPixelShader:{name:c,shader:h}};const u="shadowOnlyVertexShader",S="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n";n.ShaderStore.ShadersStoreWGSL[u]||(n.ShaderStore.ShadersStoreWGSL[u]=S);const m=[n.bonesDeclarationWGSL,n.bakedVertexAnimationDeclarationWGSL,n.instancesDeclarationWGSL,n.sceneUboDeclarationWGSL,n.clipPlaneVertexDeclarationWGSL,n.logDepthDeclarationWGSL,n.fogVertexDeclarationWGSL,n.lightVxFragmentDeclarationWGSL,n.lightVxUboDeclarationWGSL,n.instancesVertexWGSL,n.bonesVertexWGSL,n.bakedVertexAnimationWGSL,n.clipPlaneVertexWGSL,n.logDepthVertexWGSL,n.fogVertexWGSL,n.shadowsVertexWGSL];for(const e of m)n.ShaderStore.IncludesShadersStoreWGSL[e.name]||(n.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var v={__proto__:null,shadowOnlyVertexShaderWGSL:{name:u,shader:S}};const p="shadowOnlyPixelShader",_="#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";n.ShaderStore.ShadersStoreWGSL[p]||(n.ShaderStore.ShadersStoreWGSL[p]=_);const L=[n.sceneUboDeclarationWGSL,n.helperFunctionsWGSL,n.lightUboDeclarationWGSL,n.lightsFragmentFunctionsWGSL,n.shadowsFragmentFunctionsWGSL,n.clipPlaneFragmentDeclarationWGSL,n.logDepthDeclarationWGSL,n.fogFragmentDeclarationWGSL,n.clipPlaneFragmentWGSL,n.lightFragmentWGSL,n.logDepthFragmentWGSL,n.fogFragmentWGSL];for(const e of L)n.ShaderStore.IncludesShadersStoreWGSL[e.name]||(n.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var P={__proto__:null,shadowOnlyPixelShaderWGSL:{name:p,shader:_}};e.ShadowOnlyMaterial=t});
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,n){"use strict";class i extends n.MaterialDefines{constructor(e){super(e),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}class t extends n.PushMaterial{constructor(e,i,t=!1){super(e,i,void 0,t),this._needAlphaBlending=!0,this.shadowColor=n.Color3.Black()}_createUniformBuffer(){super._createUniformBuffer(),this._uniformBuffer.useUbo&&(this._uniformBuffer.dispose(),this._uniformBuffer=new n.UniformBuffer(this.getScene().getEngine(),void 0,void 0,this.name,!0),this._uniformBufferLayoutBuilt=!1)}needAlphaBlending(){return this._needAlphaBlending}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}get activeLight(){return this._activeLight}set activeLight(e){this._activeLight=e}_getFirstShadowLightForMesh(e){for(const n of e.lightSources)if(n.shadowEnabled)return n;return null}isReadyForSubMesh(e,a,o){var r;this._uniformBufferLayoutBuilt||this.buildUniformLayout();const s=a._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===o)return!0;a.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),a.materialDefines=new i(this._eventInfo.defineNames));const l=a.materialDefines,d=this.getScene();if(this._isReadyForSubMesh(a))return!0;const c=d.getEngine();if(this._activeLight)for(const n of e.lightSources)if(n.shadowEnabled){if(this._activeLight===n)break;const i=e.lightSources.indexOf(this._activeLight);-1!==i&&(e.lightSources.splice(i,1),e.lightSources.splice(0,0,this._activeLight));break}n.PrepareDefinesForFrameBoundValues(d,c,this,l,!!o),n.PrepareDefinesForMisc(e,d,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),l,void 0,void 0,void 0,this._isVertexOutputInvariant),l._needNormals=n.PrepareDefinesForLights(d,e,l,!1,1);const f=null===(r=this._getFirstShadowLightForMesh(e))||void 0===r?void 0:r.getShadowGenerator();if(this._needAlphaBlending=!0,f&&f.getClassName&&"CascadedShadowGenerator"===f.getClassName()){const e=f;this._needAlphaBlending=!e.autoCalcDepthBounds}if(this._eventInfo.defines=l,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),n.PrepareDefinesForAttributes(e,l,!1,!0),this._callbackPluginEventPrepareDefines(this._eventInfo),this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=l,this._eventInfo.subMesh=a,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(l.isDirty){l.markAsProcessed(),d.resetCachedMaterial();const i=new n.EffectFallbacks;l.FOG&&i.addFallback(1,"FOG"),n.HandleFallbacksForShadows(l,i,1),l.NUM_BONE_INFLUENCERS>0&&i.addCPUSkinningFallback(0,e),l.IMAGEPROCESSINGPOSTPROCESS=d.imageProcessingConfiguration.applyByPostProcess;const o=[n.VertexBuffer.PositionKind];l.NORMAL&&o.push(n.VertexBuffer.NormalKind),n.PrepareAttributesForBones(o,e,l,i),n.PrepareAttributesForInstances(o,l);const r="shadowOnly",s=l.toString(),f=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","logarithmicDepthConstant"],h=[],u=["Scene","Material"],g={maxSimultaneousLights:1};n.AddClipPlaneUniforms(f),n.PrepareUniformsAndSamplersList({uniformsNames:f,uniformBuffersNames:u,samplers:h,defines:l,maxSimultaneousLights:1,shaderLanguage:this._shaderLanguage}),this._eventInfo.fallbacks=i,this._eventInfo.fallbackRank=0,this._eventInfo.defines=l,this._eventInfo.uniforms=f,this._eventInfo.attributes=o,this._eventInfo.samplers=h,this._eventInfo.uniformBuffersNames=u,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._eventInfo.indexParameters=g,this._callbackPluginEventGeneric(128,this._eventInfo),a.setEffect(d.getEngine().createEffect(r,{attributes:o,uniformsNames:f,uniformBuffersNames:u,samplers:h,defines:s,fallbacks:i,onCompiled:this.onCompiled,onError:this.onError,indexParameters:g,processCodeAfterIncludes:this._eventInfo.customCode,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:t._ShaderLoader.getLoadCallback(this._shaderLanguage)},c),l,this._materialContext)}return!(!a.effect||!a.effect.isReady()||(l._renderId=d.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!o,0))}bindForSubMesh(e,i,t){const a=this.getScene(),o=t.materialDefines;if(!o)return;const r=t.effect;if(r){if(this._activeEffect=r,this._uniformBuffer.bindToEffect(r,"Material"),this.bindOnlyWorldMatrix(e),this.bindViewProjection(r),this._eventInfo.subMesh=t,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),n.BindBonesParameters(i,this._activeEffect),this._mustRebind(a,r,t)&&(n.BindClipPlane(r,this,a),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),this._useLogarithmicDepth&&n.BindLogDepth(o,r,a),a.bindEyePosition(r),this._eventInfo.subMesh=t,this._callbackPluginEventBindForSubMesh(this._eventInfo)),a.lightsEnabled){n.BindLights(a,i,this._activeEffect,o,1);const e=this._getFirstShadowLightForMesh(i);e&&(e._renderId=-1)}(a.fogEnabled&&i.applyFog&&a.fogMode!==n.Scene.FOGMODE_NONE||o.SHADOWCSM0)&&this.bindView(r),n.BindFogParameters(a,i,this._activeEffect),this._afterBind(i,this._activeEffect,t),this._uniformBuffer.update()}}clone(e){return n.SerializationHelper.Clone(()=>new t(e,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.ShadowOnlyMaterial",e}getClassName(){return"ShadowOnlyMaterial"}static Parse(e,i,a){return n.SerializationHelper.Parse(()=>new t(e.name,i),e,i,a)}}t._ShaderLoader=new n._ShaderImportLoader(()=>[Promise.resolve().then(function(){return d}),Promise.resolve().then(function(){return u})],()=>[Promise.resolve().then(function(){return _}),Promise.resolve().then(function(){return I})]),n.RegisterClass("BABYLON.ShadowOnlyMaterial",t);var a={__proto__:null,ShadowOnlyMaterial:t};const o="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==o)for(const e in a)o.BABYLON[e]=a[e];const r="shadowOnlyVertexShader",s="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";n.ShaderStore.ShadersStore[r]||(n.ShaderStore.ShadersStore[r]=s);const l=[n.bonesDeclaration,n.bakedVertexAnimationDeclaration,n.instancesDeclaration,n.sceneVertexDeclaration,n.sceneUboDeclaration,n.clipPlaneVertexDeclaration,n.logDepthDeclaration,n.fogVertexDeclaration,n.lightFragmentDeclaration,n.lightUboDeclaration,n.instancesVertex,n.bonesVertex,n.bakedVertexAnimation,n.clipPlaneVertex,n.logDepthVertex,n.fogVertex,n.shadowsVertex];for(const e of l)n.ShaderStore.IncludesShadersStore[e.name]||(n.ShaderStore.IncludesShadersStore[e.name]=e.shader);var d={__proto__:null,shadowOnlyVertexShader:{name:r,shader:s}};const c="shadowOnlyPixelShader",f="precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;\n#define ADDITIONAL_FRAGMENT_DECLARATION\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\n#define CUSTOM_FRAGMENT_BEFORE_LIGHT_COMPOSITION\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";n.ShaderStore.ShadersStore[c]||(n.ShaderStore.ShadersStore[c]=f);const h=[n.sceneFragmentDeclaration,n.sceneUboDeclaration,n.helperFunctions,n.lightFragmentDeclaration,n.lightUboDeclaration,n.lightsFragmentFunctions,n.shadowsFragmentFunctions,n.clipPlaneFragmentDeclaration,n.logDepthDeclaration,n.fogFragmentDeclaration,n.clipPlaneFragment,n.lightFragment,n.logDepthFragment,n.fogFragment,n.imageProcessingCompatibility];for(const e of h)n.ShaderStore.IncludesShadersStore[e.name]||(n.ShaderStore.IncludesShadersStore[e.name]=e.shader);var u={__proto__:null,shadowOnlyPixelShader:{name:c,shader:f}};const g="shadowOnlyVertexShader",S="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n";n.ShaderStore.ShadersStoreWGSL[g]||(n.ShaderStore.ShadersStoreWGSL[g]=S);const m=[n.bonesDeclarationWGSL,n.bakedVertexAnimationDeclarationWGSL,n.instancesDeclarationWGSL,n.sceneUboDeclarationWGSL,n.clipPlaneVertexDeclarationWGSL,n.logDepthDeclarationWGSL,n.fogVertexDeclarationWGSL,n.lightVxFragmentDeclarationWGSL,n.lightVxUboDeclarationWGSL,n.instancesVertexWGSL,n.bonesVertexWGSL,n.bakedVertexAnimationWGSL,n.clipPlaneVertexWGSL,n.logDepthVertexWGSL,n.fogVertexWGSL,n.shadowsVertexWGSL];for(const e of m)n.ShaderStore.IncludesShadersStoreWGSL[e.name]||(n.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var _={__proto__:null,shadowOnlyVertexShaderWGSL:{name:g,shader:S}};const v="shadowOnlyPixelShader",p="#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;\n#define ADDITIONAL_UBO_DECLARATION\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\n#define CUSTOM_FRAGMENT_BEFORE_LIGHT_COMPOSITION\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";n.ShaderStore.ShadersStoreWGSL[v]||(n.ShaderStore.ShadersStoreWGSL[v]=p);const L=[n.sceneUboDeclarationWGSL,n.helperFunctionsWGSL,n.lightUboDeclarationWGSL,n.lightsFragmentFunctionsWGSL,n.shadowsFragmentFunctionsWGSL,n.clipPlaneFragmentDeclarationWGSL,n.logDepthDeclarationWGSL,n.fogFragmentDeclarationWGSL,n.clipPlaneFragmentWGSL,n.lightFragmentWGSL,n.logDepthFragmentWGSL,n.fogFragmentWGSL];for(const e of L)n.ShaderStore.IncludesShadersStoreWGSL[e.name]||(n.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var I={__proto__:null,shadowOnlyPixelShaderWGSL:{name:v,shader:p}};e.ShadowOnlyMaterial=t});
|
|
2
2
|
//# sourceMappingURL=babylon.shadowOnlyMaterial.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babylon.shadowOnlyMaterial.min.js","sources":["file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnlyMaterial.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/legacy/legacy-shadowOnly.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnly.vertex.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnly.fragment.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/wgsl/shadowOnly.vertex.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/wgsl/shadowOnly.fragment.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { type Nullable } from \"core/types\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { type Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { type IShadowLight } from \"core/Lights/shadowLight\";\r\nimport { type IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { type SubMesh } from \"core/Meshes/subMesh\";\r\nimport { type Mesh } from \"core/Meshes/mesh\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { _ShaderImportLoader } from \"core/Misc/shaderImportLoader\";\r\n\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { type CascadedShadowGenerator } from \"core/Lights/Shadows/cascadedShadowGenerator\";\r\nimport { AddClipPlaneUniforms, BindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport {\r\n BindBonesParameters,\r\n BindFogParameters,\r\n BindLights,\r\n BindLogDepth,\r\n HandleFallbacksForShadows,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForLights,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass ShadowOnlyMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class ShadowOnlyMaterial extends PushMaterial {\r\n private _activeLight: IShadowLight;\r\n private _needAlphaBlending = true;\r\n private static readonly _ShaderLoader = /*#__PURE__*/ new _ShaderImportLoader(\r\n () => [import(\"./shadowOnly.vertex\"), import(\"./shadowOnly.fragment\")],\r\n () => [import(\"./wgsl/shadowOnly.vertex\"), import(\"./wgsl/shadowOnly.fragment\")]\r\n );\r\n\r\n /**\r\n * Instantiates a ShadowOnly Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n */\r\n constructor(name: string, scene?: Scene, forceGLSL = false) {\r\n super(name, scene, undefined, forceGLSL);\r\n }\r\n\r\n public shadowColor = Color3.Black();\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this._needAlphaBlending;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public get activeLight(): IShadowLight {\r\n return this._activeLight;\r\n }\r\n\r\n public set activeLight(light: IShadowLight) {\r\n this._activeLight = light;\r\n }\r\n\r\n private _getFirstShadowLightForMesh(mesh: AbstractMesh): Nullable<IShadowLight> {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n return light as IShadowLight;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new ShadowOnlyMaterialDefines();\r\n }\r\n\r\n const defines = <ShadowOnlyMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Ensure that active light is the first shadow light\r\n if (this._activeLight) {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n if (this._activeLight === light) {\r\n break; // We are good\r\n }\r\n\r\n const lightPosition = mesh.lightSources.indexOf(this._activeLight);\r\n\r\n if (lightPosition !== -1) {\r\n mesh.lightSources.splice(lightPosition, 1);\r\n mesh.lightSources.splice(0, 0, this._activeLight);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n PrepareDefinesForMisc(\r\n mesh,\r\n scene,\r\n this._useLogarithmicDepth,\r\n this.pointsCloud,\r\n this.fogEnabled,\r\n this.needAlphaTestingForMesh(mesh),\r\n defines,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._isVertexOutputInvariant\r\n );\r\n\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, 1);\r\n\r\n const shadowGenerator = this._getFirstShadowLightForMesh(mesh)?.getShadowGenerator();\r\n\r\n this._needAlphaBlending = true;\r\n\r\n if (shadowGenerator && (shadowGenerator as any).getClassName && (shadowGenerator as any).getClassName() === \"CascadedShadowGenerator\") {\r\n const csg = shadowGenerator as CascadedShadowGenerator;\r\n\r\n this._needAlphaBlending = !csg.autoCalcDepthBounds;\r\n }\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks, 1);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"shadowOnly\";\r\n const join = defines.toString();\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"alpha\",\r\n \"shadowColor\",\r\n \"mBones\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers: string[] = [];\r\n\r\n const uniformBuffers: string[] = [\"Scene\"];\r\n\r\n AddClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 1,\r\n shaderLanguage: this._shaderLanguage,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 1 },\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: ShadowOnlyMaterial._ShaderLoader.getLoadCallback(this._shaderLanguage),\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <ShadowOnlyMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this.bindViewProjection(effect);\r\n\r\n // Bones\r\n BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Clip plane\r\n BindClipPlane(effect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n this._activeEffect.setFloat(\"alpha\", this.alpha);\r\n this._activeEffect.setColor3(\"shadowColor\", this.shadowColor);\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n }\r\n\r\n // Lights\r\n if (scene.lightsEnabled) {\r\n BindLights(scene, mesh, this._activeEffect, defines, 1);\r\n\r\n const light = this._getFirstShadowLightForMesh(mesh);\r\n\r\n if (light) {\r\n // Make sure the uniforms for this light will be rebound for other materials using this light when rendering the current frame.\r\n // Indeed, there is an optimization in Light that binds the light uniforms only once per frame for a given light (if using ubo).\r\n // Doing this way assumes that all uses of this light are the same, meaning all parameters passed to Light._bindLlight\r\n // are the same, notably useSpecular. However, isReadyForSubMesh (see above) is passing false for this parameter, which may not be\r\n // the value the other materials may pass.\r\n light._renderId = -1;\r\n }\r\n }\r\n\r\n // View\r\n if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) || defines[\"SHADOWCSM0\"]) {\r\n this.bindView(effect);\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override clone(name: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Clone<ShadowOnlyMaterial>(() => new ShadowOnlyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.ShadowOnlyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"ShadowOnlyMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ShadowOnlyMaterial\", ShadowOnlyMaterial);\r\n","/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nimport * as MatLib from \"materials/shadowOnly/index\";\r\n\r\n/**\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nconst GlobalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\r\nif (typeof GlobalObject !== \"undefined\") {\r\n for (const key in MatLib) {\r\n (<any>GlobalObject).BABYLON[key] = (<any>MatLib)[key];\r\n }\r\n}\r\n\r\nexport * from \"materials/shadowOnly/index\";\r\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { bonesDeclaration } from \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport { bakedVertexAnimationDeclaration } from \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport { instancesDeclaration } from \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport { sceneVertexDeclaration } from \"core/Shaders/ShadersInclude/sceneVertexDeclaration\";\nimport { sceneUboDeclaration } from \"core/Shaders/ShadersInclude/sceneUboDeclaration\";\nimport { clipPlaneVertexDeclaration } from \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport { logDepthDeclaration } from \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport { fogVertexDeclaration } from \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport { lightFragmentDeclaration } from \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport { instancesVertex } from \"core/Shaders/ShadersInclude/instancesVertex\";\nimport { bonesVertex } from \"core/Shaders/ShadersInclude/bonesVertex\";\nimport { bakedVertexAnimation } from \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport { clipPlaneVertex } from \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport { logDepthVertex } from \"core/Shaders/ShadersInclude/logDepthVertex\";\nimport { fogVertex } from \"core/Shaders/ShadersInclude/fogVertex\";\nimport { shadowsVertex } from \"core/Shaders/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [bonesDeclaration, bakedVertexAnimationDeclaration, instancesDeclaration, sceneVertexDeclaration, sceneUboDeclaration, clipPlaneVertexDeclaration, logDepthDeclaration, fogVertexDeclaration, lightFragmentDeclaration, lightUboDeclaration, instancesVertex, bonesVertex, bakedVertexAnimation, clipPlaneVertex, logDepthVertex, fogVertex, shadowsVertex];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyVertexShader = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { sceneFragmentDeclaration } from \"core/Shaders/ShadersInclude/sceneFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"core/Shaders/ShadersInclude/sceneUboDeclaration\";\nimport { helperFunctions } from \"core/Shaders/ShadersInclude/helperFunctions\";\nimport { lightFragmentDeclaration } from \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctions } from \"core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctions } from \"core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclaration } from \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclaration } from \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclaration } from \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragment } from \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport { lightFragment } from \"core/Shaders/ShadersInclude/lightFragment\";\nimport { logDepthFragment } from \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport { fogFragment } from \"core/Shaders/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibility } from \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [sceneFragmentDeclaration, sceneUboDeclaration, helperFunctions, lightFragmentDeclaration, lightUboDeclaration, lightsFragmentFunctions, shadowsFragmentFunctions, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, clipPlaneFragment, lightFragment, logDepthFragment, fogFragment, imageProcessingCompatibility];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyPixelShader = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { bonesDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/bonesDeclaration\";\nimport { bakedVertexAnimationDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport { instancesDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/instancesDeclaration\";\nimport { sceneUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/sceneUboDeclaration\";\nimport { clipPlaneVertexDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogVertexDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogVertexDeclaration\";\nimport { lightVxFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration\";\nimport { lightVxUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightVxUboDeclaration\";\nimport { instancesVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/instancesVertex\";\nimport { bonesVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/bonesVertex\";\nimport { bakedVertexAnimationWGSL } from \"core/ShadersWGSL/ShadersInclude/bakedVertexAnimation\";\nimport { clipPlaneVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneVertex\";\nimport { logDepthVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthVertex\";\nimport { fogVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/fogVertex\";\nimport { shadowsVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [bonesDeclarationWGSL, bakedVertexAnimationDeclarationWGSL, instancesDeclarationWGSL, sceneUboDeclarationWGSL, clipPlaneVertexDeclarationWGSL, logDepthDeclarationWGSL, fogVertexDeclarationWGSL, lightVxFragmentDeclarationWGSL, lightVxUboDeclarationWGSL, instancesVertexWGSL, bonesVertexWGSL, bakedVertexAnimationWGSL, clipPlaneVertexWGSL, logDepthVertexWGSL, fogVertexWGSL, shadowsVertexWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyVertexShaderWGSL = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { sceneUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/sceneUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [sceneUboDeclarationWGSL, helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyPixelShaderWGSL = { name, shader };\n"],"names":["ShadowOnlyMaterialDefines","MaterialDefines","constructor","super","this","CLIPPLANE","CLIPPLANE2","CLIPPLANE3","CLIPPLANE4","CLIPPLANE5","CLIPPLANE6","POINTSIZE","FOG","NORMAL","NUM_BONE_INFLUENCERS","BonesPerMesh","INSTANCES","IMAGEPROCESSINGPOSTPROCESS","SKIPFINALCOLORCLAMP","LOGARITHMICDEPTH","rebuild","ShadowOnlyMaterial","PushMaterial","name","scene","forceGLSL","undefined","_needAlphaBlending","shadowColor","Color3","Black","needAlphaBlending","needAlphaTesting","getAlphaTestTexture","activeLight","_activeLight","light","_getFirstShadowLightForMesh","mesh","lightSources","shadowEnabled","isReadyForSubMesh","subMesh","useInstances","drawWrapper","_drawWrapper","isFrozen","effect","_wasPreviouslyReady","_wasPreviouslyUsingInstances","materialDefines","defines","getScene","_isReadyForSubMesh","engine","getEngine","lightPosition","indexOf","splice","PrepareDefinesForFrameBoundValues","PrepareDefinesForMisc","_useLogarithmicDepth","pointsCloud","fogEnabled","needAlphaTestingForMesh","_isVertexOutputInvariant","_needNormals","PrepareDefinesForLights","shadowGenerator","_a","getShadowGenerator","getClassName","csg","autoCalcDepthBounds","PrepareDefinesForAttributes","isDirty","markAsProcessed","resetCachedMaterial","fallbacks","EffectFallbacks","addFallback","HandleFallbacksForShadows","addCPUSkinningFallback","imageProcessingConfiguration","applyByPostProcess","attribs","VertexBuffer","PositionKind","push","NormalKind","PrepareAttributesForBones","PrepareAttributesForInstances","shaderName","join","toString","uniforms","samplers","uniformBuffers","AddClipPlaneUniforms","PrepareUniformsAndSamplersList","uniformsNames","uniformBuffersNames","maxSimultaneousLights","shaderLanguage","_shaderLanguage","setEffect","createEffect","attributes","onCompiled","onError","indexParameters","extraInitializationsAsync","_ShaderLoader","getLoadCallback","_materialContext","isReady","_renderId","getRenderId","bindForSubMesh","world","_activeEffect","bindOnlyWorldMatrix","bindViewProjection","BindBonesParameters","_mustRebind","BindClipPlane","setFloat","pointSize","alpha","setColor3","BindLogDepth","bindEyePosition","lightsEnabled","BindLights","applyFog","fogMode","Scene","FOGMODE_NONE","bindView","BindFogParameters","_afterBind","clone","SerializationHelper","Clone","serialize","serializationObject","customType","Parse","source","rootUrl","_ShaderImportLoader","Promise","resolve","then","shadowOnly_vertex$1","shadowOnly_fragment$1","shadowOnly_fragment","RegisterClass","GlobalObject","global","window","key","MatLib","BABYLON","shader","ShaderStore","ShadersStore","includes","bonesDeclaration","bakedVertexAnimationDeclaration","instancesDeclaration","sceneVertexDeclaration","sceneUboDeclaration","clipPlaneVertexDeclaration","logDepthDeclaration","fogVertexDeclaration","lightFragmentDeclaration","lightUboDeclaration","instancesVertex","bonesVertex","bakedVertexAnimation","clipPlaneVertex","logDepthVertex","fogVertex","shadowsVertex","inc","IncludesShadersStore","sceneFragmentDeclaration","helperFunctions","lightsFragmentFunctions","shadowsFragmentFunctions","clipPlaneFragmentDeclaration","fogFragmentDeclaration","clipPlaneFragment","lightFragment","logDepthFragment","fogFragment","imageProcessingCompatibility","ShadersStoreWGSL","bonesDeclarationWGSL","bakedVertexAnimationDeclarationWGSL","instancesDeclarationWGSL","sceneUboDeclarationWGSL","clipPlaneVertexDeclarationWGSL","logDepthDeclarationWGSL","fogVertexDeclarationWGSL","lightVxFragmentDeclarationWGSL","lightVxUboDeclarationWGSL","instancesVertexWGSL","bonesVertexWGSL","bakedVertexAnimationWGSL","clipPlaneVertexWGSL","logDepthVertexWGSL","fogVertexWGSL","shadowsVertexWGSL","IncludesShadersStoreWGSL","helperFunctionsWGSL","lightUboDeclarationWGSL","lightsFragmentFunctionsWGSL","shadowsFragmentFunctionsWGSL","clipPlaneFragmentDeclarationWGSL","fogFragmentDeclarationWGSL","clipPlaneFragmentWGSL","l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7I,KAAEA,EAAI6I,OAAEA,IClD7C,MAAM7I,EAAO,yBACP6I,EAAS,gwCA4CVC,EAAAA,YAAYiC,iBAAiB/K,KAC9B8I,cAAYiC,iBAAiB/K,GAAQ6I,GAEzC,MAAMG,EAAW,CAACgC,EAAAA,qBAAsBC,EAAAA,oCAAqCC,EAAAA,yBAA0BC,0BAAyBC,EAAAA,+BAAgCC,EAAAA,wBAAyBC,EAAAA,yBAA0BC,EAAAA,+BAAgCC,EAAAA,0BAA2BC,EAAAA,oBAAqBC,kBAAiBC,EAAAA,yBAA0BC,EAAAA,oBAAqBC,EAAAA,mBAAoBC,EAAAA,cAAeC,qBACtY,IAAK,MAAM7B,KAAOlB,EACTF,EAAAA,YAAYkD,yBAAyB9B,EAAIlK,QAC1C8I,EAAAA,YAAYkD,yBAAyB9B,EAAIlK,MAAQkK,EAAIrB,yDAKnB,CAAA7I,KAAEA,EAAI6I,OAAEA,IC5DlD,MAAM7I,EAAO,wBACP6I,EAAS,wvCAoCVC,EAAAA,YAAYiC,iBAAiB/K,KAC9B8I,cAAYiC,iBAAiB/K,GAAQ6I,GAEzC,MAAMG,EAAW,CAACmC,EAAAA,wBAAyBc,EAAAA,oBAAqBC,EAAAA,wBAAyBC,EAAAA,4BAA6BC,EAAAA,6BAA8BC,mCAAkChB,EAAAA,wBAAyBiB,EAAAA,2BAA4BC,EAAAA,sBAAuBC,EAAAA,kBAAmBC,EAAAA,qBAAsBC,EAAAA,iBAC3S,IAAK,MAAMxC,KAAOlB,EACTF,EAAAA,YAAYkD,yBAAyB9B,EAAIlK,QAC1C8I,EAAAA,YAAYkD,yBAAyB9B,EAAIlK,MAAQkK,EAAIrB,wDAKpB,CAAE7I,OAAM6I"}
|
|
1
|
+
{"version":3,"file":"babylon.shadowOnlyMaterial.min.js","sources":["file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnlyMaterial.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/legacy/legacy-shadowOnly.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnly.vertex.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/shadowOnly.fragment.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/wgsl/shadowOnly.vertex.ts","file:///home/vsts/work/1/s/packages/dev/materials/src/shadowOnly/wgsl/shadowOnly.fragment.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { type Nullable } from \"core/types\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { type Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { type IShadowLight } from \"core/Lights/shadowLight\";\r\nimport { type IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { MaterialPluginEvent } from \"core/Materials/materialPluginEvent\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { UniformBuffer } from \"core/Materials/uniformBuffer\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { type SubMesh } from \"core/Meshes/subMesh\";\r\nimport { type Mesh } from \"core/Meshes/mesh\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { _ShaderImportLoader } from \"core/Misc/shaderImportLoader\";\r\n\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { type CascadedShadowGenerator } from \"core/Lights/Shadows/cascadedShadowGenerator\";\r\nimport { AddClipPlaneUniforms, BindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport {\r\n BindBonesParameters,\r\n BindFogParameters,\r\n BindLights,\r\n BindLogDepth,\r\n HandleFallbacksForShadows,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForLights,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass ShadowOnlyMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor(externalProperties?: { [name: string]: { type: string; default: any } }) {\r\n super(externalProperties);\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * A transparent \"shadow catcher\" material: it renders only shadow strength into its alpha channel\r\n * (over {@link ShadowOnlyMaterial.shadowColor | shadowColor}, black by default), so shadows can be\r\n * composited over an arbitrary background.\r\n *\r\n * It can receive IBL shadows (via `IblShadowsRenderPipeline.addShadowReceivingMaterial` /\r\n * the Frame Graph IBL shadows task). Because the material has a single alpha output channel, IBL\r\n * shadows are received as **monochrome**: a colored IBL shadow is reduced to its luminance rather\r\n * than preserving per-channel hue.\r\n */\r\nexport class ShadowOnlyMaterial extends PushMaterial {\r\n private _activeLight: IShadowLight;\r\n private _needAlphaBlending = true;\r\n private static readonly _ShaderLoader = /*#__PURE__*/ new _ShaderImportLoader(\r\n () => [import(\"./shadowOnly.vertex\"), import(\"./shadowOnly.fragment\")],\r\n () => [import(\"./wgsl/shadowOnly.vertex\"), import(\"./wgsl/shadowOnly.fragment\")]\r\n );\r\n\r\n /**\r\n * Instantiates a ShadowOnly Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n */\r\n constructor(name: string, scene?: Scene, forceGLSL = false) {\r\n super(name, scene, undefined, forceGLSL);\r\n }\r\n\r\n /**\r\n * @internal\r\n * Force the material uniform buffer into \"no UBO\" (individual uniform) mode so that any attached\r\n * material plugin (e.g. IBLShadowsPluginMaterial) binds its uniforms directly on the effect. This\r\n * lets ShadowOnlyMaterial host plugins without declaring a dedicated \"Material\" uniform block in its\r\n * shaders (its own uniforms - alpha/shadowColor/... - stay individual uniforms). The base class only\r\n * does this on WebGPU (\"leftovers UBO\"); we extend it to every backend.\r\n */\r\n public override _createUniformBuffer(): void {\r\n super._createUniformBuffer();\r\n // The base leaves a real UBO in place on WebGL2 (useUbo === true); re-create it as no-UBO so\r\n // the plugin's uniforms are set individually on the effect (no shader-side \"Material\" block).\r\n if (this._uniformBuffer.useUbo) {\r\n this._uniformBuffer.dispose();\r\n this._uniformBuffer = new UniformBuffer(this.getScene().getEngine(), undefined, undefined, this.name, true);\r\n this._uniformBufferLayoutBuilt = false;\r\n }\r\n }\r\n\r\n /**\r\n * The color the shadow is rendered with (black by default). Only its RGB is used; shadow\r\n * strength is written to the material's alpha channel.\r\n */\r\n public shadowColor = Color3.Black();\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this._needAlphaBlending;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public get activeLight(): IShadowLight {\r\n return this._activeLight;\r\n }\r\n\r\n public set activeLight(light: IShadowLight) {\r\n this._activeLight = light;\r\n }\r\n\r\n private _getFirstShadowLightForMesh(mesh: AbstractMesh): Nullable<IShadowLight> {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n return light as IShadowLight;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (!this._uniformBufferLayoutBuilt) {\r\n this.buildUniformLayout();\r\n }\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n this._callbackPluginEventGeneric(MaterialPluginEvent.GetDefineNames, this._eventInfo);\r\n subMesh.materialDefines = new ShadowOnlyMaterialDefines(this._eventInfo.defineNames);\r\n }\r\n\r\n const defines = <ShadowOnlyMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Ensure that active light is the first shadow light\r\n if (this._activeLight) {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n if (this._activeLight === light) {\r\n break; // We are good\r\n }\r\n\r\n const lightPosition = mesh.lightSources.indexOf(this._activeLight);\r\n\r\n if (lightPosition !== -1) {\r\n mesh.lightSources.splice(lightPosition, 1);\r\n mesh.lightSources.splice(0, 0, this._activeLight);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n PrepareDefinesForMisc(\r\n mesh,\r\n scene,\r\n this._useLogarithmicDepth,\r\n this.pointsCloud,\r\n this.fogEnabled,\r\n this.needAlphaTestingForMesh(mesh),\r\n defines,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._isVertexOutputInvariant\r\n );\r\n\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, 1);\r\n\r\n const shadowGenerator = this._getFirstShadowLightForMesh(mesh)?.getShadowGenerator();\r\n\r\n this._needAlphaBlending = true;\r\n\r\n if (shadowGenerator && (shadowGenerator as any).getClassName && (shadowGenerator as any).getClassName() === \"CascadedShadowGenerator\") {\r\n const csg = shadowGenerator as CascadedShadowGenerator;\r\n\r\n this._needAlphaBlending = !csg.autoCalcDepthBounds;\r\n }\r\n\r\n // External config\r\n this._eventInfo.defines = defines;\r\n this._eventInfo.mesh = mesh;\r\n this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, true);\r\n\r\n // External config\r\n this._callbackPluginEventPrepareDefines(this._eventInfo);\r\n\r\n // Plugin readiness\r\n this._eventInfo.isReadyForSubMesh = true;\r\n this._eventInfo.defines = defines;\r\n this._eventInfo.subMesh = subMesh;\r\n this._callbackPluginEventIsReadyForSubMesh(this._eventInfo);\r\n if (!this._eventInfo.isReadyForSubMesh) {\r\n return false;\r\n }\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks, 1);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"shadowOnly\";\r\n const join = defines.toString();\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"alpha\",\r\n \"shadowColor\",\r\n \"mBones\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers: string[] = [];\r\n\r\n const uniformBuffers: string[] = [\"Scene\", \"Material\"];\r\n\r\n const indexParameters = { maxSimultaneousLights: 1 };\r\n\r\n AddClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 1,\r\n shaderLanguage: this._shaderLanguage,\r\n });\r\n\r\n // External config\r\n this._eventInfo.fallbacks = fallbacks;\r\n this._eventInfo.fallbackRank = 0;\r\n this._eventInfo.defines = defines;\r\n this._eventInfo.uniforms = uniforms;\r\n this._eventInfo.attributes = attribs;\r\n this._eventInfo.samplers = samplers;\r\n this._eventInfo.uniformBuffersNames = uniformBuffers;\r\n this._eventInfo.customCode = undefined;\r\n this._eventInfo.mesh = mesh;\r\n this._eventInfo.indexParameters = indexParameters;\r\n this._callbackPluginEventGeneric(MaterialPluginEvent.PrepareEffect, this._eventInfo);\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters,\r\n processCodeAfterIncludes: this._eventInfo.customCode,\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: ShadowOnlyMaterial._ShaderLoader.getLoadCallback(this._shaderLanguage),\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <ShadowOnlyMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Binding unconditionally\r\n this._uniformBuffer.bindToEffect(effect, \"Material\");\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this.bindViewProjection(effect);\r\n\r\n this._eventInfo.subMesh = subMesh;\r\n this._callbackPluginEventHardBindForSubMesh(this._eventInfo);\r\n\r\n // Bones\r\n BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Clip plane\r\n BindClipPlane(effect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n this._activeEffect.setFloat(\"alpha\", this.alpha);\r\n this._activeEffect.setColor3(\"shadowColor\", this.shadowColor);\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n\r\n this._eventInfo.subMesh = subMesh;\r\n this._callbackPluginEventBindForSubMesh(this._eventInfo);\r\n }\r\n\r\n // Lights\r\n if (scene.lightsEnabled) {\r\n BindLights(scene, mesh, this._activeEffect, defines, 1);\r\n\r\n const light = this._getFirstShadowLightForMesh(mesh);\r\n\r\n if (light) {\r\n // Make sure the uniforms for this light will be rebound for other materials using this light when rendering the current frame.\r\n // Indeed, there is an optimization in Light that binds the light uniforms only once per frame for a given light (if using ubo).\r\n // Doing this way assumes that all uses of this light are the same, meaning all parameters passed to Light._bindLlight\r\n // are the same, notably useSpecular. However, isReadyForSubMesh (see above) is passing false for this parameter, which may not be\r\n // the value the other materials may pass.\r\n light._renderId = -1;\r\n }\r\n }\r\n\r\n // View\r\n if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) || defines[\"SHADOWCSM0\"]) {\r\n this.bindView(effect);\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n this._uniformBuffer.update();\r\n }\r\n\r\n public override clone(name: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Clone<ShadowOnlyMaterial>(() => new ShadowOnlyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.ShadowOnlyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"ShadowOnlyMaterial\";\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a ShadowOnly material from parsed material data.\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new ShadowOnly material\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ShadowOnlyMaterial\", ShadowOnlyMaterial);\r\n","/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nimport * as MatLib from \"materials/shadowOnly/index\";\r\n\r\n/**\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nconst GlobalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\r\nif (typeof GlobalObject !== \"undefined\") {\r\n for (const key in MatLib) {\r\n (<any>GlobalObject).BABYLON[key] = (<any>MatLib)[key];\r\n }\r\n}\r\n\r\nexport * from \"materials/shadowOnly/index\";\r\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { bonesDeclaration } from \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport { bakedVertexAnimationDeclaration } from \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport { instancesDeclaration } from \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport { sceneVertexDeclaration } from \"core/Shaders/ShadersInclude/sceneVertexDeclaration\";\nimport { sceneUboDeclaration } from \"core/Shaders/ShadersInclude/sceneUboDeclaration\";\nimport { clipPlaneVertexDeclaration } from \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport { logDepthDeclaration } from \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport { fogVertexDeclaration } from \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport { lightFragmentDeclaration } from \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport { instancesVertex } from \"core/Shaders/ShadersInclude/instancesVertex\";\nimport { bonesVertex } from \"core/Shaders/ShadersInclude/bonesVertex\";\nimport { bakedVertexAnimation } from \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport { clipPlaneVertex } from \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport { logDepthVertex } from \"core/Shaders/ShadersInclude/logDepthVertex\";\nimport { fogVertex } from \"core/Shaders/ShadersInclude/fogVertex\";\nimport { shadowsVertex } from \"core/Shaders/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<__decl__sceneVertex>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [bonesDeclaration, bakedVertexAnimationDeclaration, instancesDeclaration, sceneVertexDeclaration, sceneUboDeclaration, clipPlaneVertexDeclaration, logDepthDeclaration, fogVertexDeclaration, lightFragmentDeclaration, lightUboDeclaration, instancesVertex, bonesVertex, bakedVertexAnimation, clipPlaneVertex, logDepthVertex, fogVertex, shadowsVertex];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyVertexShader = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { sceneFragmentDeclaration } from \"core/Shaders/ShadersInclude/sceneFragmentDeclaration\";\nimport { sceneUboDeclaration } from \"core/Shaders/ShadersInclude/sceneUboDeclaration\";\nimport { helperFunctions } from \"core/Shaders/ShadersInclude/helperFunctions\";\nimport { lightFragmentDeclaration } from \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport { lightUboDeclaration } from \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctions } from \"core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctions } from \"core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclaration } from \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclaration } from \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclaration } from \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragment } from \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport { lightFragment } from \"core/Shaders/ShadersInclude/lightFragment\";\nimport { logDepthFragment } from \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport { fogFragment } from \"core/Shaders/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibility } from \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `precision highp float;\n#include<__decl__sceneFragment>\nuniform float alpha;uniform vec3 shadowColor;\n#define ADDITIONAL_FRAGMENT_DECLARATION\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying float vViewDepth;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0..1]\n#define CUSTOM_FRAGMENT_BEFORE_LIGHT_COMPOSITION\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [sceneFragmentDeclaration, sceneUboDeclaration, helperFunctions, lightFragmentDeclaration, lightUboDeclaration, lightsFragmentFunctions, shadowsFragmentFunctions, clipPlaneFragmentDeclaration, logDepthDeclaration, fogFragmentDeclaration, clipPlaneFragment, lightFragment, logDepthFragment, fogFragment, imageProcessingCompatibility];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyPixelShader = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { bonesDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/bonesDeclaration\";\nimport { bakedVertexAnimationDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport { instancesDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/instancesDeclaration\";\nimport { sceneUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/sceneUboDeclaration\";\nimport { clipPlaneVertexDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogVertexDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogVertexDeclaration\";\nimport { lightVxFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration\";\nimport { lightVxUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightVxUboDeclaration\";\nimport { instancesVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/instancesVertex\";\nimport { bonesVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/bonesVertex\";\nimport { bakedVertexAnimationWGSL } from \"core/ShadersWGSL/ShadersInclude/bakedVertexAnimation\";\nimport { clipPlaneVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneVertex\";\nimport { logDepthVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthVertex\";\nimport { fogVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/fogVertex\";\nimport { shadowsVertexWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=scene.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [bonesDeclarationWGSL, bakedVertexAnimationDeclarationWGSL, instancesDeclarationWGSL, sceneUboDeclarationWGSL, clipPlaneVertexDeclarationWGSL, logDepthDeclarationWGSL, fogVertexDeclarationWGSL, lightVxFragmentDeclarationWGSL, lightVxUboDeclarationWGSL, instancesVertexWGSL, bonesVertexWGSL, bakedVertexAnimationWGSL, clipPlaneVertexWGSL, logDepthVertexWGSL, fogVertexWGSL, shadowsVertexWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyVertexShaderWGSL = { name, shader };\n","// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { sceneUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/sceneUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `#include<sceneUboDeclaration>\nuniform alpha: f32;uniform shadowColor: vec3f;\n#define ADDITIONAL_UBO_DECLARATION\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..1]\n#define CUSTOM_FRAGMENT_BEFORE_LIGHT_COMPOSITION\nvar color: vec4f= vec4f(uniforms.shadowColor,(1.0-clamp(shadow,0.,1.))*uniforms.alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [sceneUboDeclarationWGSL, helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const shadowOnlyPixelShaderWGSL = { name, shader };\n"],"names":["ShadowOnlyMaterialDefines","MaterialDefines","constructor","externalProperties","super","this","CLIPPLANE","CLIPPLANE2","CLIPPLANE3","CLIPPLANE4","CLIPPLANE5","CLIPPLANE6","POINTSIZE","FOG","NORMAL","NUM_BONE_INFLUENCERS","BonesPerMesh","INSTANCES","IMAGEPROCESSINGPOSTPROCESS","SKIPFINALCOLORCLAMP","LOGARITHMICDEPTH","rebuild","ShadowOnlyMaterial","PushMaterial","name","scene","forceGLSL","undefined","_needAlphaBlending","shadowColor","Color3","Black","_createUniformBuffer","_uniformBuffer","useUbo","dispose","UniformBuffer","getScene","getEngine","_uniformBufferLayoutBuilt","needAlphaBlending","needAlphaTesting","getAlphaTestTexture","activeLight","_activeLight","light","_getFirstShadowLightForMesh","mesh","lightSources","shadowEnabled","isReadyForSubMesh","subMesh","useInstances","buildUniformLayout","drawWrapper","_drawWrapper","isFrozen","effect","_wasPreviouslyReady","_wasPreviouslyUsingInstances","materialDefines","_callbackPluginEventGeneric","_eventInfo","defineNames","defines","_isReadyForSubMesh","engine","lightPosition","indexOf","splice","PrepareDefinesForFrameBoundValues","PrepareDefinesForMisc","_useLogarithmicDepth","pointsCloud","fogEnabled","needAlphaTestingForMesh","_isVertexOutputInvariant","_needNormals","PrepareDefinesForLights","shadowGenerator","_a","getShadowGenerator","getClassName","csg","autoCalcDepthBounds","_callbackPluginEventPrepareDefinesBeforeAttributes","PrepareDefinesForAttributes","_callbackPluginEventPrepareDefines","_callbackPluginEventIsReadyForSubMesh","isDirty","markAsProcessed","resetCachedMaterial","fallbacks","EffectFallbacks","addFallback","HandleFallbacksForShadows","addCPUSkinningFallback","imageProcessingConfiguration","applyByPostProcess","attribs","VertexBuffer","PositionKind","push","NormalKind","PrepareAttributesForBones","PrepareAttributesForInstances","shaderName","join","toString","uniforms","samplers","uniformBuffers","indexParameters","maxSimultaneousLights","AddClipPlaneUniforms","PrepareUniformsAndSamplersList","uniformsNames","uniformBuffersNames","shaderLanguage","_shaderLanguage","fallbackRank","attributes","customCode","setEffect","createEffect","onCompiled","onError","processCodeAfterIncludes","extraInitializationsAsync","_ShaderLoader","getLoadCallback","_materialContext","isReady","_renderId","getRenderId","bindForSubMesh","world","_activeEffect","bindToEffect","bindOnlyWorldMatrix","bindViewProjection","_callbackPluginEventHardBindForSubMesh","BindBonesParameters","_mustRebind","BindClipPlane","setFloat","pointSize","alpha","setColor3","BindLogDepth","bindEyePosition","_callbackPluginEventBindForSubMesh","lightsEnabled","BindLights","applyFog","fogMode","Scene","FOGMODE_NONE","bindView","BindFogParameters","_afterBind","update","clone","SerializationHelper","Clone","serialize","serializationObject","customType","Parse","source","rootUrl","_ShaderImportLoader","Promise","resolve","then","shadowOnly_vertex$1","shadowOnly_fragment$1","shadowOnly_fragment","RegisterClass","GlobalObject","global","window","key","MatLib","BABYLON","shader","ShaderStore","ShadersStore","includes","bonesDeclaration","bakedVertexAnimationDeclaration","instancesDeclaration","sceneVertexDeclaration","sceneUboDeclaration","clipPlaneVertexDeclaration","logDepthDeclaration","fogVertexDeclaration","lightFragmentDeclaration","lightUboDeclaration","instancesVertex","bonesVertex","bakedVertexAnimation","clipPlaneVertex","logDepthVertex","fogVertex","shadowsVertex","inc","IncludesShadersStore","sceneFragmentDeclaration","helperFunctions","lightsFragmentFunctions","shadowsFragmentFunctions","clipPlaneFragmentDeclaration","fogFragmentDeclaration","clipPlaneFragment","lightFragment","logDepthFragment","fogFragment","imageProcessingCompatibility","ShadersStoreWGSL","bonesDeclarationWGSL","bakedVertexAnimationDeclarationWGSL","instancesDeclarationWGSL","sceneUboDeclarationWGSL","clipPlaneVertexDeclarationWGSL","logDepthDeclarationWGSL","fogVertexDeclarationWGSL","lightVxFragmentDeclarationWGSL","lightVxUboDeclarationWGSL","instancesVertexWGSL","bonesVertexWGSL","bakedVertexAnimationWGSL","clipPlaneVertexWGSL","logDepthVertexWGSL","fogVertexWGSL","shadowsVertexWGSL","IncludesShadersStoreWGSL","helperFunctionsWGSL","lightUboDeclarationWGSL","lightsFragmentFunctionsWGSL","shadowsFragmentFunctionsWGSL","clipPlaneFragmentDeclarationWGSL","fogFragmentDeclarationWGSL","clipPlaneFragmentWGSL","lightFragmentWGSL","logDepthFragmentWGSL","fogFragmentWGSL"],"mappings":"sSAsCA,MAAMA,UAAkCC,EAAAA,gBAiBpC,WAAAC,CAAYC,GACRC,MAAMD,GAjBHE,KAAAC,WAAY,EACZD,KAAAE,YAAa,EACbF,KAAAG,YAAa,EACbH,KAAAI,YAAa,EACbJ,KAAAK,YAAa,EACbL,KAAAM,YAAa,EACbN,KAAAO,WAAY,EACZP,KAAAQ,KAAM,EACNR,KAAAS,QAAS,EACTT,KAAAU,qBAAuB,EACvBV,KAAAW,aAAe,EACfX,KAAAY,WAAY,EACZZ,KAAAa,4BAA6B,EAC7Bb,KAAAc,qBAAsB,EACtBd,KAAAe,kBAAmB,EAItBf,KAAKgB,SACT,EAaE,MAAOC,UAA2BC,EAAAA,aAcpC,WAAArB,CAAYsB,EAAcC,EAAeC,GAAY,G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