babylonjs-materials 9.17.1 → 9.18.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.cellMaterial.js +1 -1
- package/babylon.cellMaterial.js.map +1 -1
- package/babylon.cellMaterial.min.js +1 -1
- package/babylon.cellMaterial.min.js.map +1 -1
- package/babylon.fireMaterial.js +1 -1
- package/babylon.fireMaterial.js.map +1 -1
- package/babylon.fireMaterial.min.js +1 -1
- package/babylon.fireMaterial.min.js.map +1 -1
- package/babylon.furMaterial.js +1 -1
- package/babylon.furMaterial.js.map +1 -1
- package/babylon.furMaterial.min.js +1 -1
- package/babylon.furMaterial.min.js.map +1 -1
- package/babylon.gradientMaterial.js +1 -1
- package/babylon.gradientMaterial.js.map +1 -1
- package/babylon.gradientMaterial.min.js +1 -1
- package/babylon.gradientMaterial.min.js.map +1 -1
- package/babylon.lavaMaterial.js +1 -1
- package/babylon.lavaMaterial.js.map +1 -1
- package/babylon.lavaMaterial.min.js +1 -1
- package/babylon.lavaMaterial.min.js.map +1 -1
- package/babylon.mixMaterial.js +1 -1
- package/babylon.mixMaterial.js.map +1 -1
- package/babylon.mixMaterial.min.js +1 -1
- package/babylon.mixMaterial.min.js.map +1 -1
- package/babylon.normalMaterial.js +1 -1
- package/babylon.normalMaterial.js.map +1 -1
- package/babylon.normalMaterial.min.js +1 -1
- package/babylon.normalMaterial.min.js.map +1 -1
- package/babylon.simpleMaterial.js +1 -1
- package/babylon.simpleMaterial.js.map +1 -1
- package/babylon.simpleMaterial.min.js +1 -1
- package/babylon.simpleMaterial.min.js.map +1 -1
- package/babylon.terrainMaterial.js +1 -1
- package/babylon.terrainMaterial.js.map +1 -1
- package/babylon.terrainMaterial.min.js +1 -1
- package/babylon.terrainMaterial.min.js.map +1 -1
- package/babylon.triPlanarMaterial.js +1 -1
- package/babylon.triPlanarMaterial.js.map +1 -1
- package/babylon.triPlanarMaterial.min.js +1 -1
- package/babylon.triPlanarMaterial.min.js.map +1 -1
- 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/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,t){"use strict";function i(e,t,i,r,n,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,f=r.kind,u="getter"===f?"get":"setter"===f?"set":"value",l=!t&&e?r.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),c=!1,m=i.length-1;m>=0;m--){var p={};for(var v in r)p[v]="access"===v?{}:r[v];for(var v in r.access)p.access[v]=r.access[v];p.addInitializer=function(e){if(c)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var h=(0,i[m])("accessor"===f?{get:d.get,set:d.set}:d[u],p);if("accessor"===f){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(o=s(h.get))&&(d.get=o),(o=s(h.set))&&(d.set=o),(o=s(h.init))&&n.unshift(o)}else(o=s(h))&&("field"===f?n.unshift(o):d[u]=o)}l&&Object.defineProperty(l,r.name,d),c=!0}function r(e,t,i){for(var r=arguments.length>2,n=0;n<t.length;n++)i=r?t[n].call(e,i):t[n].call(e);return r?i:void 0}function n(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)}function a(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,i):n?n.value=i:t.set(e,i),i}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;class s extends t.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.BUMP=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let o=(()=>{var e,o,f,u,l,d,c,p,v,h;let S,g,T,C,_,E,P,I,D,A,N,y,F,M,V,O,R,U,w,W,G,B=t.PushMaterial,k=[],z=[],H=[],X=[],j=[],K=[],Y=[],Z=[],q=[],J=[],Q=[],$=[],ee=[],te=[],ie=[],re=[],ne=[],ae=[],se=[],oe=[],fe=[],ue=[],le=[],de=[],ce=[],me=[],pe=[],ve=[],he=[],xe=[],Se=[],ge=[],Te=[],be=[],Ce=[],_e=[],Ee=[],Le=[],Pe=[],Ie=[],De=[],Ae=[];return e=class extends B{get mixTexture(){return n(this,o,"f")}set mixTexture(e){a(this,o,e,"f")}get diffuseTexture1(){return n(this,f,"f")}set diffuseTexture1(e){a(this,f,e,"f")}get diffuseTexture2(){return n(this,u,"f")}set diffuseTexture2(e){a(this,u,e,"f")}get diffuseTexture3(){return n(this,l,"f")}set diffuseTexture3(e){a(this,l,e,"f")}get bumpTexture1(){return n(this,d,"f")}set bumpTexture1(e){a(this,d,e,"f")}get bumpTexture2(){return n(this,c,"f")}set bumpTexture2(e){a(this,c,e,"f")}get bumpTexture3(){return n(this,p,"f")}set bumpTexture3(e){a(this,p,e,"f")}get disableLighting(){return n(this,v,"f")}set disableLighting(e){a(this,v,e,"f")}get maxSimultaneousLights(){return n(this,h,"f")}set maxSimultaneousLights(e){a(this,h,e,"f")}constructor(e,i,n=!1){super(e,i,void 0,n),this._mixTexture=r(this,k,void 0),o.set(this,(r(this,z),r(this,H,void 0))),this._diffuseTexture1=(r(this,X),r(this,j,void 0)),f.set(this,(r(this,K),r(this,Y,void 0))),this._diffuseTexture2=(r(this,Z),r(this,q,void 0)),u.set(this,(r(this,J),r(this,Q,void 0))),this._diffuseTexture3=(r(this,$),r(this,ee,void 0)),l.set(this,(r(this,te),r(this,ie,void 0))),this._bumpTexture1=(r(this,re),r(this,ne,void 0)),d.set(this,(r(this,ae),r(this,se,void 0))),this._bumpTexture2=(r(this,oe),r(this,fe,void 0)),c.set(this,(r(this,ue),r(this,le,void 0))),this._bumpTexture3=(r(this,de),r(this,ce,void 0)),p.set(this,(r(this,me),r(this,pe,void 0))),this.diffuseColor=(r(this,ve),r(this,he,new t.Color3(1,1,1))),this.specularColor=(r(this,xe),r(this,Se,new t.Color3(0,0,0))),this.specularPower=(r(this,ge),r(this,Te,64)),this._disableLighting=(r(this,be),r(this,Ce,!1)),v.set(this,(r(this,_e),r(this,Ee,void 0))),this._maxSimultaneousLights=(r(this,Le),r(this,Pe,4)),h.set(this,(r(this,Ie),r(this,De,void 0))),this._shadersLoaded=(r(this,Ae),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,i,r){const n=i._drawWrapper;if(this.isFrozen&&n.effect&&n._wasPreviouslyReady&&n._wasPreviouslyUsingInstances===r)return!0;i.materialDefines||(i.materialDefines=new s);const a=i.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(i))return!0;const f=o.getEngine();if(o.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(a._needUVs=!0,t.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture1||!this.diffuseTexture1.isReady())return!1;if(!this.diffuseTexture2||!this.diffuseTexture2.isReady())return!1;if(!this.diffuseTexture3||!this.diffuseTexture3.isReady())return!1;a.DIFFUSE=!0}if(this.bumpTexture1&&this.bumpTexture2&&this.bumpTexture3&&t.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture1.isReady())return!1;if(!this.bumpTexture2.isReady())return!1;if(!this.bumpTexture3.isReady())return!1;a._needNormals=!0,a.BUMP=!0}}if(t.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),a,void 0,void 0,void 0,this._isVertexOutputInvariant),a._needNormals=t.PrepareDefinesForLights(o,e,a,!1,this._maxSimultaneousLights,this._disableLighting),t.PrepareDefinesForFrameBoundValues(o,f,this,a,!!r),t.PrepareDefinesForAttributes(e,a,!0,!0),a.isDirty){a.markAsProcessed(),o.resetCachedMaterial();const r=new t.EffectFallbacks;a.FOG&&r.addFallback(1,"FOG"),t.HandleFallbacksForShadows(a,r,this.maxSimultaneousLights),a.NUM_BONE_INFLUENCERS>0&&r.addCPUSkinningFallback(0,e),a.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const n=[t.VertexBuffer.PositionKind];a.NORMAL&&n.push(t.VertexBuffer.NormalKind),a.UV1&&n.push(t.VertexBuffer.UVKind),a.UV2&&n.push(t.VertexBuffer.UV2Kind),a.VERTEXCOLOR&&n.push(t.VertexBuffer.ColorKind),t.PrepareAttributesForBones(n,e,a,r),t.PrepareAttributesForInstances(n,a);const s="terrain",u=a.toString(),l=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],d=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],c=[];t.AddClipPlaneUniforms(l),t.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:d,defines:a,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),i.setEffect(o.getEngine().createEffect(s,{attributes:n,uniformsNames:l,uniformBuffersNames:c,samplers:d,defines:u,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>{return e=this,t=void 0,r=function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return m}),Promise.resolve().then(function(){return x})]):yield Promise.all([Promise.resolve().then(function(){return b}),Promise.resolve().then(function(){return L})]),this._shadersLoaded=!0},new((i=void 0)||(i=Promise))(function(n,a){function s(e){try{f(r.next(e))}catch(e){a(e)}}function o(e){try{f(r.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,o)}f((r=r.apply(e,t||[])).next())});var e,t,i,r}},f),a,this._materialContext)}if(a.AREALIGHTUSED)for(let t=0;t<e.lightSources.length;t++)if(!e.lightSources[t]._isReady())return!1;return!(!i.effect||!i.effect.isReady()||(a._renderId=o.getRenderId(),n._wasPreviouslyReady=!0,n._wasPreviouslyUsingInstances=!!r,0))}bindForSubMesh(e,i,r){const n=this.getScene(),a=r.materialDefines;if(!a)return;const s=r.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",n.getViewMatrix()),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),t.BindBonesParameters(i,this._activeEffect),this._mustRebind(n,s,r)&&(this.mixTexture&&(this._activeEffect.setTexture("textureSampler",this._mixTexture),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture.coordinatesIndex,this._mixTexture.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture.getTextureMatrix()),t.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale))),t.MaterialFlags.BumpTextureEnabled&&n.getEngine().getCaps().standardDerivatives&&(this._bumpTexture1&&this._activeEffect.setTexture("bump1Sampler",this._bumpTexture1),this._bumpTexture2&&this._activeEffect.setTexture("bump2Sampler",this._bumpTexture2),this._bumpTexture3&&this._activeEffect.setTexture("bump3Sampler",this._bumpTexture3))),t.BindClipPlane(s,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&t.BindLogDepth(a,s,n),n.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&t.BindLights(n,i,this._activeEffect,a,this.maxSimultaneousLights),n.fogEnabled&&i.applyFog&&n.fogMode!==t.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),t.BindFogParameters(n,i,this._activeEffect),this._afterBind(i,this._activeEffect,r))}getAnimatables(){const e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._mixTexture&&e.push(this._mixTexture),this._diffuseTexture1&&e.push(this._diffuseTexture1),this._diffuseTexture2&&e.push(this._diffuseTexture2),this._diffuseTexture3&&e.push(this._diffuseTexture3),this._bumpTexture1&&e.push(this._bumpTexture1),this._bumpTexture2&&e.push(this._bumpTexture2),this._bumpTexture3&&e.push(this._bumpTexture3),e}hasTexture(e){return!!super.hasTexture(e)||this._mixTexture===e||this._diffuseTexture1===e||this._diffuseTexture2===e||this._diffuseTexture3===e||this._bumpTexture1===e||this._bumpTexture2===e||this._bumpTexture3===e}dispose(e){this.mixTexture&&this.mixTexture.dispose(),super.dispose(e)}clone(i){return t.SerializationHelper.Clone(()=>new e(i,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.TerrainMaterial",e}getClassName(){return"TerrainMaterial"}static Parse(i,r,n){return t.SerializationHelper.Parse(()=>new e(i.name,r),i,r,n)}},o=new WeakMap,f=new WeakMap,u=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,p=new WeakMap,v=new WeakMap,h=new WeakMap,(()=>{var r;const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(r=B[Symbol.metadata])&&void 0!==r?r:null):void 0;S=[t.serializeAsTexture("mixTexture")],g=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],T=[t.serializeAsTexture("diffuseTexture1")],C=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],_=[t.serializeAsTexture("diffuseTexture2")],E=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],P=[t.serializeAsTexture("diffuseTexture3")],I=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],D=[t.serializeAsTexture("bumpTexture1")],A=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],N=[t.serializeAsTexture("bumpTexture2")],y=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],F=[t.serializeAsTexture("bumpTexture3")],M=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],V=[t.serializeAsColor3()],O=[t.serializeAsColor3()],R=[t.serialize()],U=[t.serialize("disableLighting")],w=[t.expandToProperty("_markAllSubMeshesAsLightsDirty")],W=[t.serialize("maxSimultaneousLights")],G=[t.expandToProperty("_markAllSubMeshesAsLightsDirty")],i(e,null,g,{kind:"accessor",name:"mixTexture",static:!1,private:!1,access:{has:e=>"mixTexture"in e,get:e=>e.mixTexture,set:(e,t)=>{e.mixTexture=t}},metadata:n},H,X),i(e,null,C,{kind:"accessor",name:"diffuseTexture1",static:!1,private:!1,access:{has:e=>"diffuseTexture1"in e,get:e=>e.diffuseTexture1,set:(e,t)=>{e.diffuseTexture1=t}},metadata:n},Y,Z),i(e,null,E,{kind:"accessor",name:"diffuseTexture2",static:!1,private:!1,access:{has:e=>"diffuseTexture2"in e,get:e=>e.diffuseTexture2,set:(e,t)=>{e.diffuseTexture2=t}},metadata:n},Q,$),i(e,null,I,{kind:"accessor",name:"diffuseTexture3",static:!1,private:!1,access:{has:e=>"diffuseTexture3"in e,get:e=>e.diffuseTexture3,set:(e,t)=>{e.diffuseTexture3=t}},metadata:n},ie,re),i(e,null,A,{kind:"accessor",name:"bumpTexture1",static:!1,private:!1,access:{has:e=>"bumpTexture1"in e,get:e=>e.bumpTexture1,set:(e,t)=>{e.bumpTexture1=t}},metadata:n},se,oe),i(e,null,y,{kind:"accessor",name:"bumpTexture2",static:!1,private:!1,access:{has:e=>"bumpTexture2"in e,get:e=>e.bumpTexture2,set:(e,t)=>{e.bumpTexture2=t}},metadata:n},le,de),i(e,null,M,{kind:"accessor",name:"bumpTexture3",static:!1,private:!1,access:{has:e=>"bumpTexture3"in e,get:e=>e.bumpTexture3,set:(e,t)=>{e.bumpTexture3=t}},metadata:n},pe,ve),i(e,null,w,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,t)=>{e.disableLighting=t}},metadata:n},Ee,Le),i(e,null,G,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,t)=>{e.maxSimultaneousLights=t}},metadata:n},De,Ae),i(null,null,S,{kind:"field",name:"_mixTexture",static:!1,private:!1,access:{has:e=>"_mixTexture"in e,get:e=>e._mixTexture,set:(e,t)=>{e._mixTexture=t}},metadata:n},k,z),i(null,null,T,{kind:"field",name:"_diffuseTexture1",static:!1,private:!1,access:{has:e=>"_diffuseTexture1"in e,get:e=>e._diffuseTexture1,set:(e,t)=>{e._diffuseTexture1=t}},metadata:n},j,K),i(null,null,_,{kind:"field",name:"_diffuseTexture2",static:!1,private:!1,access:{has:e=>"_diffuseTexture2"in e,get:e=>e._diffuseTexture2,set:(e,t)=>{e._diffuseTexture2=t}},metadata:n},q,J),i(null,null,P,{kind:"field",name:"_diffuseTexture3",static:!1,private:!1,access:{has:e=>"_diffuseTexture3"in e,get:e=>e._diffuseTexture3,set:(e,t)=>{e._diffuseTexture3=t}},metadata:n},ee,te),i(null,null,D,{kind:"field",name:"_bumpTexture1",static:!1,private:!1,access:{has:e=>"_bumpTexture1"in e,get:e=>e._bumpTexture1,set:(e,t)=>{e._bumpTexture1=t}},metadata:n},ne,ae),i(null,null,N,{kind:"field",name:"_bumpTexture2",static:!1,private:!1,access:{has:e=>"_bumpTexture2"in e,get:e=>e._bumpTexture2,set:(e,t)=>{e._bumpTexture2=t}},metadata:n},fe,ue),i(null,null,F,{kind:"field",name:"_bumpTexture3",static:!1,private:!1,access:{has:e=>"_bumpTexture3"in e,get:e=>e._bumpTexture3,set:(e,t)=>{e._bumpTexture3=t}},metadata:n},ce,me),i(null,null,V,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,t)=>{e.diffuseColor=t}},metadata:n},he,xe),i(null,null,O,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,t)=>{e.specularColor=t}},metadata:n},Se,ge),i(null,null,R,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,t)=>{e.specularPower=t}},metadata:n},Te,be),i(null,null,U,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,t)=>{e._disableLighting=t}},metadata:n},Ce,_e),i(null,null,W,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,t)=>{e._maxSimultaneousLights=t}},metadata:n},Pe,Ie),n&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),e})();t.RegisterClass("BABYLON.TerrainMaterial",o);var f={__proto__:null,TerrainMaterial:o};const u="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==u)for(const e in f)u.BABYLON[e]=f[e];const l="terrainVertexShader",d="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;uniform textureMatrix: mat4x4f;uniform vTextureInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\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#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vTextureInfos.x==0.)\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";t.ShaderStore.ShadersStoreWGSL[l]||(t.ShaderStore.ShadersStoreWGSL[l]=d);const c=[t.bonesDeclarationWGSL,t.bakedVertexAnimationDeclarationWGSL,t.instancesDeclarationWGSL,t.logDepthDeclarationWGSL,t.clipPlaneVertexDeclarationWGSL,t.fogVertexDeclarationWGSL,t.lightVxFragmentDeclarationWGSL,t.lightVxUboDeclarationWGSL,t.instancesVertexWGSL,t.bonesVertexWGSL,t.bakedVertexAnimationWGSL,t.clipPlaneVertexWGSL,t.logDepthVertexWGSL,t.fogVertexWGSL,t.shadowsVertexWGSL,t.vertexColorMixingWGSL];for(const e of c)t.ShaderStore.IncludesShadersStoreWGSL[e.name]||(t.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var m={__proto__:null,terrainVertexShaderWGSL:{name:l,shader:d}};const p="terrainPixelShader",v="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d<f32>;uniform vTextureInfos: vec2f;var diffuse1SamplerSampler: sampler;var diffuse1Sampler: texture_2d<f32>;var diffuse2SamplerSampler: sampler;var diffuse2Sampler: texture_2d<f32>;var diffuse3SamplerSampler: sampler;var diffuse3Sampler: texture_2d<f32>;uniform diffuse1Infos: vec2f;uniform diffuse2Infos: vec2f;uniform diffuse3Infos: vec2f;\n#endif\n#ifdef BUMP\nvar bump1SamplerSampler: sampler;var bump1Sampler: texture_2d<f32>;var bump2SamplerSampler: sampler;var bump2Sampler: texture_2d<f32>;var bump3SamplerSampler: sampler;var bump3Sampler: texture_2d<f32>;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\nfn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f)->mat3x3f\n{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var binormal: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;var invmax: f32=inverseSqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3x3f(tangent*invmax,binormal*invmax,normal);}\nfn perturbNormal(viewDir: vec3f,mixColor: vec3f)->vec3f\n{var bump1Color: vec3f=textureSample(bump1Sampler,bump1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos).xyz;var bump2Color: vec3f=textureSample(bump2Sampler,bump2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos).xyz;var bump3Color: vec3f=textureSample(bump3Sampler,bump3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos).xyz;bump1Color=bump1Color.rgb*mixColor.r;bump2Color=mix(bump1Color.rgb,bump2Color.rgb,vec3f(mixColor.g));var map: vec3f=mix(bump2Color.rgb,bump3Color.rgb,vec3f(mixColor.b));map=map*255./127.-128./127.;var TBN: mat3x3f=cotangent_frame(fragmentInputs.vNormalW*uniforms.vTextureInfos.y,-viewDir,fragmentInputs.vTextureUV);return normalize(TBN*map);}\n#endif\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(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\nvar alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#include<depthPrePass>\nbaseColor=vec4f(baseColor.rgb*uniforms.vTextureInfos.y,baseColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);diffuse1Color=vec4f(diffuse1Color.rgb*baseColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(baseColor.g)),diffuse2Color.a);baseColor=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(baseColor.b)),baseColor.a);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*baseColor.rgb,vec3f(0.0),vec3f(1.0));var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";t.ShaderStore.ShadersStoreWGSL[p]||(t.ShaderStore.ShadersStoreWGSL[p]=v);const h=[t.helperFunctionsWGSL,t.lightUboDeclarationWGSL,t.lightsFragmentFunctionsWGSL,t.shadowsFragmentFunctionsWGSL,t.clipPlaneFragmentDeclarationWGSL,t.logDepthDeclarationWGSL,t.fogFragmentDeclarationWGSL,t.clipPlaneFragmentWGSL,t.depthPrePassWGSL,t.lightFragmentWGSL,t.logDepthFragmentWGSL,t.fogFragmentWGSL,t.imageProcessingCompatibilityWGSL];for(const e of h)t.ShaderStore.IncludesShadersStoreWGSL[e.name]||(t.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var x={__proto__:null,terrainPixelShaderWGSL:{name:p,shader:v}};const S="terrainVertexShader",g="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\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#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\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#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";t.ShaderStore.ShadersStore[S]||(t.ShaderStore.ShadersStore[S]=g);const T=[t.bonesDeclaration,t.bakedVertexAnimationDeclaration,t.instancesDeclaration,t.logDepthDeclaration,t.clipPlaneVertexDeclaration,t.fogVertexDeclaration,t.lightFragmentDeclaration,t.lightUboDeclaration,t.instancesVertex,t.bonesVertex,t.bakedVertexAnimation,t.clipPlaneVertex,t.logDepthVertex,t.fogVertex,t.shadowsVertex,t.vertexColorMixing];for(const e of T)t.ShaderStore.IncludesShadersStore[e.name]||(t.ShaderStore.IncludesShadersStore[e.name]=e.shader);var b={__proto__:null,terrainVertexShader:{name:S,shader:g}};const C="terrainPixelShader",_="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform sampler2D textureSampler;uniform vec2 vTextureInfos;uniform sampler2D diffuse1Sampler;uniform sampler2D diffuse2Sampler;uniform sampler2D diffuse3Sampler;uniform vec2 diffuse1Infos;uniform vec2 diffuse2Infos;uniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;uniform sampler2D bump2Sampler;uniform sampler2D bump3Sampler;\n#endif\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#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3(tangent*invmax,binormal*invmax,normal);}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{vec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;vec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;vec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;bump1Color.rgb*=mixColor.r;bump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);vec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);map=map*255./127.-128./127.;mat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);return normalize(TBN*map);}\n#endif\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);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vTextureInfos.y;vec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);vec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);vec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);diffuse1Color.rgb*=baseColor.r;diffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);baseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);vec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";t.ShaderStore.ShadersStore[C]||(t.ShaderStore.ShadersStore[C]=_);const E=[t.helperFunctions,t.lightFragmentDeclaration,t.lightUboDeclaration,t.lightsFragmentFunctions,t.shadowsFragmentFunctions,t.clipPlaneFragmentDeclaration,t.logDepthDeclaration,t.fogFragmentDeclaration,t.clipPlaneFragment,t.depthPrePass,t.lightFragment,t.logDepthFragment,t.fogFragment,t.imageProcessingCompatibility];for(const e of E)t.ShaderStore.IncludesShadersStore[e.name]||(t.ShaderStore.IncludesShadersStore[e.name]=e.shader);var L={__proto__:null,terrainPixelShader:{name:C,shader:_}};e.TerrainMaterial=o});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,t){"use strict";function i(e,t,i,r,n,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,f=r.kind,u="getter"===f?"get":"setter"===f?"set":"value",l=!t&&e?r.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),c=!1,m=i.length-1;m>=0;m--){var p={};for(var v in r)p[v]="access"===v?{}:r[v];for(var v in r.access)p.access[v]=r.access[v];p.addInitializer=function(e){if(c)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var h=(0,i[m])("accessor"===f?{get:d.get,set:d.set}:d[u],p);if("accessor"===f){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(o=s(h.get))&&(d.get=o),(o=s(h.set))&&(d.set=o),(o=s(h.init))&&n.unshift(o)}else(o=s(h))&&("field"===f?n.unshift(o):d[u]=o)}l&&Object.defineProperty(l,r.name,d),c=!0}function r(e,t,i){for(var r=arguments.length>2,n=0;n<t.length;n++)i=r?t[n].call(e,i):t[n].call(e);return r?i:void 0}function n(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)}function a(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,i):n?n.value=i:t.set(e,i),i}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;class s extends t.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.BUMP=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let o=(()=>{var e,o,f,u,l,d,c,p,v,h;let S,g,T,C,_,E,P,I,D,A,N,y,F,M,V,O,R,U,w,W,G,B=t.PushMaterial,k=[],z=[],H=[],X=[],j=[],K=[],Y=[],Z=[],q=[],J=[],Q=[],$=[],ee=[],te=[],ie=[],re=[],ne=[],ae=[],se=[],oe=[],fe=[],ue=[],le=[],de=[],ce=[],me=[],pe=[],ve=[],he=[],xe=[],Se=[],ge=[],Te=[],be=[],Ce=[],_e=[],Ee=[],Le=[],Pe=[],Ie=[],De=[],Ae=[];return e=class extends B{get mixTexture(){return n(this,o,"f")}set mixTexture(e){a(this,o,e,"f")}get diffuseTexture1(){return n(this,f,"f")}set diffuseTexture1(e){a(this,f,e,"f")}get diffuseTexture2(){return n(this,u,"f")}set diffuseTexture2(e){a(this,u,e,"f")}get diffuseTexture3(){return n(this,l,"f")}set diffuseTexture3(e){a(this,l,e,"f")}get bumpTexture1(){return n(this,d,"f")}set bumpTexture1(e){a(this,d,e,"f")}get bumpTexture2(){return n(this,c,"f")}set bumpTexture2(e){a(this,c,e,"f")}get bumpTexture3(){return n(this,p,"f")}set bumpTexture3(e){a(this,p,e,"f")}get disableLighting(){return n(this,v,"f")}set disableLighting(e){a(this,v,e,"f")}get maxSimultaneousLights(){return n(this,h,"f")}set maxSimultaneousLights(e){a(this,h,e,"f")}constructor(e,i,n=!1){super(e,i,void 0,n),this._mixTexture=r(this,k,void 0),o.set(this,(r(this,z),r(this,H,void 0))),this._diffuseTexture1=(r(this,X),r(this,j,void 0)),f.set(this,(r(this,K),r(this,Y,void 0))),this._diffuseTexture2=(r(this,Z),r(this,q,void 0)),u.set(this,(r(this,J),r(this,Q,void 0))),this._diffuseTexture3=(r(this,$),r(this,ee,void 0)),l.set(this,(r(this,te),r(this,ie,void 0))),this._bumpTexture1=(r(this,re),r(this,ne,void 0)),d.set(this,(r(this,ae),r(this,se,void 0))),this._bumpTexture2=(r(this,oe),r(this,fe,void 0)),c.set(this,(r(this,ue),r(this,le,void 0))),this._bumpTexture3=(r(this,de),r(this,ce,void 0)),p.set(this,(r(this,me),r(this,pe,void 0))),this.diffuseColor=(r(this,ve),r(this,he,new t.Color3(1,1,1))),this.specularColor=(r(this,xe),r(this,Se,new t.Color3(0,0,0))),this.specularPower=(r(this,ge),r(this,Te,64)),this._disableLighting=(r(this,be),r(this,Ce,!1)),v.set(this,(r(this,_e),r(this,Ee,void 0))),this._maxSimultaneousLights=(r(this,Le),r(this,Pe,4)),h.set(this,(r(this,Ie),r(this,De,void 0))),this._shadersLoaded=(r(this,Ae),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,i,r){const n=i._drawWrapper;if(this.isFrozen&&n.effect&&n._wasPreviouslyReady&&n._wasPreviouslyUsingInstances===r)return!0;i.materialDefines||(i.materialDefines=new s);const a=i.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(i))return!0;const f=o.getEngine();if(o.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(a._needUVs=!0,t.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture1||!this.diffuseTexture1.isReady())return!1;if(!this.diffuseTexture2||!this.diffuseTexture2.isReady())return!1;if(!this.diffuseTexture3||!this.diffuseTexture3.isReady())return!1;a.DIFFUSE=!0}if(this.bumpTexture1&&this.bumpTexture2&&this.bumpTexture3&&t.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture1.isReady())return!1;if(!this.bumpTexture2.isReady())return!1;if(!this.bumpTexture3.isReady())return!1;a._needNormals=!0,a.BUMP=!0}}if(t.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),a,void 0,void 0,void 0,this._isVertexOutputInvariant),a._needNormals=t.PrepareDefinesForLights(o,e,a,!1,this._maxSimultaneousLights,this._disableLighting),t.PrepareDefinesForFrameBoundValues(o,f,this,a,!!r),t.PrepareDefinesForAttributes(e,a,!0,!0),a.isDirty){a.markAsProcessed(),o.resetCachedMaterial();const r=new t.EffectFallbacks;a.FOG&&r.addFallback(1,"FOG"),t.HandleFallbacksForShadows(a,r,this.maxSimultaneousLights),a.NUM_BONE_INFLUENCERS>0&&r.addCPUSkinningFallback(0,e),a.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const n=[t.VertexBuffer.PositionKind];a.NORMAL&&n.push(t.VertexBuffer.NormalKind),a.UV1&&n.push(t.VertexBuffer.UVKind),a.UV2&&n.push(t.VertexBuffer.UV2Kind),a.VERTEXCOLOR&&n.push(t.VertexBuffer.ColorKind),t.PrepareAttributesForBones(n,e,a,r),t.PrepareAttributesForInstances(n,a);const s="terrain",u=a.toString(),l=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],d=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],c=[];t.AddClipPlaneUniforms(l),t.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:d,defines:a,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),i.setEffect(o.getEngine().createEffect(s,{attributes:n,uniformsNames:l,uniformBuffersNames:c,samplers:d,defines:u,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>{return e=this,t=void 0,r=function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return m}),Promise.resolve().then(function(){return x})]):yield Promise.all([Promise.resolve().then(function(){return b}),Promise.resolve().then(function(){return L})]),this._shadersLoaded=!0},new((i=void 0)||(i=Promise))(function(n,a){function s(e){try{f(r.next(e))}catch(e){a(e)}}function o(e){try{f(r.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,o)}f((r=r.apply(e,t||[])).next())});var e,t,i,r}},f),a,this._materialContext)}if(a.AREALIGHTUSED)for(let t=0;t<e.lightSources.length;t++)if(!e.lightSources[t]._isReady())return!1;return!(!i.effect||!i.effect.isReady()||(a._renderId=o.getRenderId(),n._wasPreviouslyReady=!0,n._wasPreviouslyUsingInstances=!!r,0))}bindForSubMesh(e,i,r){const n=this.getScene(),a=r.materialDefines;if(!a)return;const s=r.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",n.getViewMatrix()),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),t.BindBonesParameters(i,this._activeEffect),this._mustRebind(n,s,r)&&(this.mixTexture&&(this._activeEffect.setTexture("textureSampler",this._mixTexture),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture.coordinatesIndex,this._mixTexture.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture.getTextureMatrix()),t.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale))),t.MaterialFlags.BumpTextureEnabled&&n.getEngine().getCaps().standardDerivatives&&(this._bumpTexture1&&this._activeEffect.setTexture("bump1Sampler",this._bumpTexture1),this._bumpTexture2&&this._activeEffect.setTexture("bump2Sampler",this._bumpTexture2),this._bumpTexture3&&this._activeEffect.setTexture("bump3Sampler",this._bumpTexture3))),t.BindClipPlane(s,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&t.BindLogDepth(a,s,n),n.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&t.BindLights(n,i,this._activeEffect,a,this.maxSimultaneousLights),n.fogEnabled&&i.applyFog&&n.fogMode!==t.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),t.BindFogParameters(n,i,this._activeEffect),this._afterBind(i,this._activeEffect,r))}getAnimatables(){const e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._mixTexture&&e.push(this._mixTexture),this._diffuseTexture1&&e.push(this._diffuseTexture1),this._diffuseTexture2&&e.push(this._diffuseTexture2),this._diffuseTexture3&&e.push(this._diffuseTexture3),this._bumpTexture1&&e.push(this._bumpTexture1),this._bumpTexture2&&e.push(this._bumpTexture2),this._bumpTexture3&&e.push(this._bumpTexture3),e}hasTexture(e){return!!super.hasTexture(e)||this._mixTexture===e||this._diffuseTexture1===e||this._diffuseTexture2===e||this._diffuseTexture3===e||this._bumpTexture1===e||this._bumpTexture2===e||this._bumpTexture3===e}dispose(e){this.mixTexture&&this.mixTexture.dispose(),super.dispose(e)}clone(i){return t.SerializationHelper.Clone(()=>new e(i,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.TerrainMaterial",e}getClassName(){return"TerrainMaterial"}static Parse(i,r,n){return t.SerializationHelper.Parse(()=>new e(i.name,r),i,r,n)}},o=new WeakMap,f=new WeakMap,u=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,p=new WeakMap,v=new WeakMap,h=new WeakMap,(()=>{var r;const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(r=B[Symbol.metadata])&&void 0!==r?r:null):void 0;S=[t.serializeAsTexture("mixTexture")],g=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],T=[t.serializeAsTexture("diffuseTexture1")],C=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],_=[t.serializeAsTexture("diffuseTexture2")],E=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],P=[t.serializeAsTexture("diffuseTexture3")],I=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],D=[t.serializeAsTexture("bumpTexture1")],A=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],N=[t.serializeAsTexture("bumpTexture2")],y=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],F=[t.serializeAsTexture("bumpTexture3")],M=[t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],V=[t.serializeAsColor3()],O=[t.serializeAsColor3()],R=[t.serialize()],U=[t.serialize("disableLighting")],w=[t.expandToProperty("_markAllSubMeshesAsLightsDirty")],W=[t.serialize("maxSimultaneousLights")],G=[t.expandToProperty("_markAllSubMeshesAsLightsDirty")],i(e,null,g,{kind:"accessor",name:"mixTexture",static:!1,private:!1,access:{has:e=>"mixTexture"in e,get:e=>e.mixTexture,set:(e,t)=>{e.mixTexture=t}},metadata:n},H,X),i(e,null,C,{kind:"accessor",name:"diffuseTexture1",static:!1,private:!1,access:{has:e=>"diffuseTexture1"in e,get:e=>e.diffuseTexture1,set:(e,t)=>{e.diffuseTexture1=t}},metadata:n},Y,Z),i(e,null,E,{kind:"accessor",name:"diffuseTexture2",static:!1,private:!1,access:{has:e=>"diffuseTexture2"in e,get:e=>e.diffuseTexture2,set:(e,t)=>{e.diffuseTexture2=t}},metadata:n},Q,$),i(e,null,I,{kind:"accessor",name:"diffuseTexture3",static:!1,private:!1,access:{has:e=>"diffuseTexture3"in e,get:e=>e.diffuseTexture3,set:(e,t)=>{e.diffuseTexture3=t}},metadata:n},ie,re),i(e,null,A,{kind:"accessor",name:"bumpTexture1",static:!1,private:!1,access:{has:e=>"bumpTexture1"in e,get:e=>e.bumpTexture1,set:(e,t)=>{e.bumpTexture1=t}},metadata:n},se,oe),i(e,null,y,{kind:"accessor",name:"bumpTexture2",static:!1,private:!1,access:{has:e=>"bumpTexture2"in e,get:e=>e.bumpTexture2,set:(e,t)=>{e.bumpTexture2=t}},metadata:n},le,de),i(e,null,M,{kind:"accessor",name:"bumpTexture3",static:!1,private:!1,access:{has:e=>"bumpTexture3"in e,get:e=>e.bumpTexture3,set:(e,t)=>{e.bumpTexture3=t}},metadata:n},pe,ve),i(e,null,w,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,t)=>{e.disableLighting=t}},metadata:n},Ee,Le),i(e,null,G,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,t)=>{e.maxSimultaneousLights=t}},metadata:n},De,Ae),i(null,null,S,{kind:"field",name:"_mixTexture",static:!1,private:!1,access:{has:e=>"_mixTexture"in e,get:e=>e._mixTexture,set:(e,t)=>{e._mixTexture=t}},metadata:n},k,z),i(null,null,T,{kind:"field",name:"_diffuseTexture1",static:!1,private:!1,access:{has:e=>"_diffuseTexture1"in e,get:e=>e._diffuseTexture1,set:(e,t)=>{e._diffuseTexture1=t}},metadata:n},j,K),i(null,null,_,{kind:"field",name:"_diffuseTexture2",static:!1,private:!1,access:{has:e=>"_diffuseTexture2"in e,get:e=>e._diffuseTexture2,set:(e,t)=>{e._diffuseTexture2=t}},metadata:n},q,J),i(null,null,P,{kind:"field",name:"_diffuseTexture3",static:!1,private:!1,access:{has:e=>"_diffuseTexture3"in e,get:e=>e._diffuseTexture3,set:(e,t)=>{e._diffuseTexture3=t}},metadata:n},ee,te),i(null,null,D,{kind:"field",name:"_bumpTexture1",static:!1,private:!1,access:{has:e=>"_bumpTexture1"in e,get:e=>e._bumpTexture1,set:(e,t)=>{e._bumpTexture1=t}},metadata:n},ne,ae),i(null,null,N,{kind:"field",name:"_bumpTexture2",static:!1,private:!1,access:{has:e=>"_bumpTexture2"in e,get:e=>e._bumpTexture2,set:(e,t)=>{e._bumpTexture2=t}},metadata:n},fe,ue),i(null,null,F,{kind:"field",name:"_bumpTexture3",static:!1,private:!1,access:{has:e=>"_bumpTexture3"in e,get:e=>e._bumpTexture3,set:(e,t)=>{e._bumpTexture3=t}},metadata:n},ce,me),i(null,null,V,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,t)=>{e.diffuseColor=t}},metadata:n},he,xe),i(null,null,O,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,t)=>{e.specularColor=t}},metadata:n},Se,ge),i(null,null,R,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,t)=>{e.specularPower=t}},metadata:n},Te,be),i(null,null,U,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,t)=>{e._disableLighting=t}},metadata:n},Ce,_e),i(null,null,W,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,t)=>{e._maxSimultaneousLights=t}},metadata:n},Pe,Ie),n&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),e})();t.RegisterClass("BABYLON.TerrainMaterial",o);var f={__proto__:null,TerrainMaterial:o};const u="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==u)for(const e in f)u.BABYLON[e]=f[e];const l="terrainVertexShader",d="attribute position: vec3f;\n#ifdef NORMAL\nattribute normal: vec3f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#ifdef VERTEXCOLOR\nattribute color: vec4f;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform view: mat4x4f;uniform viewProjection: mat4x4f;\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;uniform textureMatrix: mat4x4f;uniform vTextureInfos: vec2f;\n#endif\n#ifdef POINTSIZE\nuniform pointSize: f32;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\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#ifdef VERTEXCOLOR\nvar colorUpdated: vec4f=vertexInputs.color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.position=uniforms.viewProjection*worldPos;vertexOutputs.vPositionW= worldPos.xyz;\n#ifdef NORMAL\nvertexOutputs.vNormalW=normalize(( finalWorld* vec4f(vertexInputs.normal,0.0)).xyz);\n#endif\n#ifndef UV1\nvar uv: vec2f= vec2f(0.,0.);\n#else\nvar uv: vec2f=vertexInputs.uv;\n#endif\n#ifndef UV2\nvar uv2: vec2f= vec2f(0.,0.);\n#else\nvar uv2: vec2f=vertexInputs.uv2;\n#endif\n#ifdef DIFFUSE\nif (uniforms.vTextureInfos.x==0.)\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv,1.0,0.0)).xy;}\nelse\n{vertexOutputs.vTextureUV=(uniforms.textureMatrix* vec4f(uv2,1.0,0.0)).xy;}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";t.ShaderStore.ShadersStoreWGSL[l]||(t.ShaderStore.ShadersStoreWGSL[l]=d);const c=[t.bonesDeclarationWGSL,t.bakedVertexAnimationDeclarationWGSL,t.instancesDeclarationWGSL,t.logDepthDeclarationWGSL,t.clipPlaneVertexDeclarationWGSL,t.fogVertexDeclarationWGSL,t.lightVxFragmentDeclarationWGSL,t.lightVxUboDeclarationWGSL,t.instancesVertexWGSL,t.bonesVertexWGSL,t.bakedVertexAnimationWGSL,t.clipPlaneVertexWGSL,t.logDepthVertexWGSL,t.fogVertexWGSL,t.shadowsVertexWGSL,t.vertexColorMixingWGSL];for(const e of c)t.ShaderStore.IncludesShadersStoreWGSL[e.name]||(t.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var m={__proto__:null,terrainVertexShaderWGSL:{name:l,shader:d}};const p="terrainPixelShader",v="uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d<f32>;uniform vTextureInfos: vec2f;var diffuse1SamplerSampler: sampler;var diffuse1Sampler: texture_2d<f32>;var diffuse2SamplerSampler: sampler;var diffuse2Sampler: texture_2d<f32>;var diffuse3SamplerSampler: sampler;var diffuse3Sampler: texture_2d<f32>;uniform diffuse1Infos: vec2f;uniform diffuse2Infos: vec2f;uniform diffuse3Infos: vec2f;\n#endif\n#ifdef BUMP\nvar bump1SamplerSampler: sampler;var bump1Sampler: texture_2d<f32>;var bump2SamplerSampler: sampler;var bump2Sampler: texture_2d<f32>;var bump3SamplerSampler: sampler;var bump3Sampler: texture_2d<f32>;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\nfn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f)->mat3x3f\n{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var binormal: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;var invmax: f32=inverseSqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3x3f(tangent*invmax,binormal*invmax,normal);}\nfn perturbNormal(viewDir: vec3f,mixColor: vec3f)->vec3f\n{var bump1Color: vec3f=textureSample(bump1Sampler,bump1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos).xyz;var bump2Color: vec3f=textureSample(bump2Sampler,bump2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos).xyz;var bump3Color: vec3f=textureSample(bump3Sampler,bump3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos).xyz;bump1Color=bump1Color.rgb*mixColor.r;bump2Color=mix(bump1Color.rgb,bump2Color.rgb,vec3f(mixColor.g));var map: vec3f=mix(bump2Color.rgb,bump3Color.rgb,vec3f(mixColor.b));map=map*255./127.-128./127.;var TBN: mat3x3f=cotangent_frame(fragmentInputs.vNormalW*uniforms.vTextureInfos.y,-viewDir,fragmentInputs.vTextureUV);return normalize(TBN*map);}\n#endif\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(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\nvar alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vTextureInfos.y,baseColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);diffuse1Color=vec4f(diffuse1Color.rgb*baseColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(baseColor.g)),diffuse2Color.a);baseColor=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(baseColor.b)),baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*baseColor.rgb,vec3f(0.0),vec3f(1.0));var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n";t.ShaderStore.ShadersStoreWGSL[p]||(t.ShaderStore.ShadersStoreWGSL[p]=v);const h=[t.helperFunctionsWGSL,t.lightUboDeclarationWGSL,t.lightsFragmentFunctionsWGSL,t.shadowsFragmentFunctionsWGSL,t.clipPlaneFragmentDeclarationWGSL,t.logDepthDeclarationWGSL,t.fogFragmentDeclarationWGSL,t.clipPlaneFragmentWGSL,t.depthPrePassWGSL,t.lightFragmentWGSL,t.logDepthFragmentWGSL,t.fogFragmentWGSL,t.imageProcessingCompatibilityWGSL];for(const e of h)t.ShaderStore.IncludesShadersStoreWGSL[e.name]||(t.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var x={__proto__:null,terrainPixelShaderWGSL:{name:p,shader:v}};const S="terrainVertexShader",g="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\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#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\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#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";t.ShaderStore.ShadersStore[S]||(t.ShaderStore.ShadersStore[S]=g);const T=[t.bonesDeclaration,t.bakedVertexAnimationDeclaration,t.instancesDeclaration,t.logDepthDeclaration,t.clipPlaneVertexDeclaration,t.fogVertexDeclaration,t.lightFragmentDeclaration,t.lightUboDeclaration,t.instancesVertex,t.bonesVertex,t.bakedVertexAnimation,t.clipPlaneVertex,t.logDepthVertex,t.fogVertex,t.shadowsVertex,t.vertexColorMixing];for(const e of T)t.ShaderStore.IncludesShadersStore[e.name]||(t.ShaderStore.IncludesShadersStore[e.name]=e.shader);var b={__proto__:null,terrainVertexShader:{name:S,shader:g}};const C="terrainPixelShader",_="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform sampler2D textureSampler;uniform vec2 vTextureInfos;uniform sampler2D diffuse1Sampler;uniform sampler2D diffuse2Sampler;uniform sampler2D diffuse3Sampler;uniform vec2 diffuse1Infos;uniform vec2 diffuse2Infos;uniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;uniform sampler2D bump2Sampler;uniform sampler2D bump3Sampler;\n#endif\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#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3(tangent*invmax,binormal*invmax,normal);}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{vec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;vec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;vec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;bump1Color.rgb*=mixColor.r;bump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);vec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);map=map*255./127.-128./127.;mat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);return normalize(TBN*map);}\n#endif\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);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vTextureInfos.y;vec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);vec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);vec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);diffuse1Color.rgb*=baseColor.r;diffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);baseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);vec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";t.ShaderStore.ShadersStore[C]||(t.ShaderStore.ShadersStore[C]=_);const E=[t.helperFunctions,t.lightFragmentDeclaration,t.lightUboDeclaration,t.lightsFragmentFunctions,t.shadowsFragmentFunctions,t.clipPlaneFragmentDeclaration,t.logDepthDeclaration,t.fogFragmentDeclaration,t.clipPlaneFragment,t.depthPrePass,t.lightFragment,t.logDepthFragment,t.fogFragment,t.imageProcessingCompatibility];for(const e of E)t.ShaderStore.IncludesShadersStore[e.name]||(t.ShaderStore.IncludesShadersStore[e.name]=e.shader);var L={__proto__:null,terrainPixelShader:{name:C,shader:_}};e.TerrainMaterial=o});
|
|
2
2
|
//# sourceMappingURL=babylon.terrainMaterial.min.js.map
|