@babylonjs/materials 7.34.0 → 7.34.2
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/materials",
|
3
|
-
"version": "7.34.
|
3
|
+
"version": "7.34.2",
|
4
4
|
"main": "index.js",
|
5
5
|
"module": "index.js",
|
6
6
|
"types": "index.d.ts",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
|
-
"@babylonjs/core": "^7.34.
|
21
|
+
"@babylonjs/core": "^7.34.2",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/materials": "^1.0.0"
|
24
24
|
},
|
@@ -222,6 +222,7 @@ export class TerrainMaterial extends PushMaterial {
|
|
222
222
|
this._activeEffect = effect;
|
223
223
|
// Matrices
|
224
224
|
this.bindOnlyWorldMatrix(world);
|
225
|
+
this._activeEffect.setMatrix("view", scene.getViewMatrix());
|
225
226
|
this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
|
226
227
|
// Bones
|
227
228
|
BindBonesParameters(mesh, this._activeEffect);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"terrainMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/terrain/terrainMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AAC1G,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAK/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,mDAAqC;AAC7D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAInD,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,OAAO,EAAE,a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gBAAgB,CAAC,kCAAkC,CAAC;wDACrB;AAGxB;IADP,kBAAkB,CAAC,cAAc,CAAC;sDACJ;AAExB;IADN,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAGrB;IADP,kBAAkB,CAAC,cAAc,CAAC;sDACJ;AAExB;IADN,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAGrB;IADP,kBAAkB,CAAC,cAAc,CAAC;sDACJ;AAExB;IADN,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAGtB;IADN,iBAAiB,EAAE;qDACsB;AAGnC;IADN,iBAAiB,EAAE;sDACuB;AAGpC;IADN,SAAS,EAAE;sDACc;AAGlB;IADP,SAAS,CAAC,iBAAiB,CAAC;yDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;wDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;+DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;8DACd;AAuZzC,aAAa,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from \"core/Misc/decorators\";\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 { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"core/Materials/materialFlags\";\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\n\r\nimport \"./terrain.fragment\";\r\nimport \"./terrain.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\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 TerrainMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public BUMP = false;\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 ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public SPECULARTERM = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = 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 TerrainMaterial extends PushMaterial {\r\n @serializeAsTexture(\"mixTexture\")\r\n private _mixTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture1: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture2: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture3: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture1\")\r\n private _bumpTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture1: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture2\")\r\n private _bumpTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture2: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture3\")\r\n private _bumpTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture3: Texture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serializeAsColor3()\r\n public specularColor = new Color3(0, 0, 0);\r\n\r\n @serialize()\r\n public specularPower = 64;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\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 // 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 TerrainMaterialDefines();\r\n }\r\n\r\n const defines = <TerrainMaterialDefines>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 // Textures\r\n if (scene.texturesEnabled) {\r\n if (!this.mixTexture || !this.mixTexture.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needUVs = true;\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this.diffuseTexture1 || !this.diffuseTexture1.isReady()) {\r\n return false;\r\n }\r\n if (!this.diffuseTexture2 || !this.diffuseTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this.diffuseTexture3 || !this.diffuseTexture3.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.DIFFUSE = true;\r\n }\r\n\r\n if (this.bumpTexture1 && this.bumpTexture2 && this.bumpTexture3 && MaterialFlags.BumpTextureEnabled) {\r\n if (!this.bumpTexture1.isReady()) {\r\n return false;\r\n }\r\n if (!this.bumpTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this.bumpTexture3.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needNormals = true;\r\n defines.BUMP = true;\r\n }\r\n }\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\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, this.maxSimultaneousLights);\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 if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"terrain\";\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 \"vDiffuseColor\",\r\n \"vSpecularColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vTextureInfos\",\r\n \"mBones\",\r\n \"textureMatrix\",\r\n \"diffuse1Infos\",\r\n \"diffuse2Infos\",\r\n \"diffuse3Infos\",\r\n ];\r\n const samplers = [\r\n \"textureSampler\",\r\n \"diffuse1Sampler\",\r\n \"diffuse2Sampler\",\r\n \"diffuse3Sampler\",\r\n \"bump1Sampler\",\r\n \"bump2Sampler\",\r\n \"bump3Sampler\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\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: this.maxSimultaneousLights },\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 = <TerrainMaterialDefines>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._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Textures\r\n if (this.mixTexture) {\r\n this._activeEffect.setTexture(\"textureSampler\", this._mixTexture);\r\n this._activeEffect.setFloat2(\"vTextureInfos\", this._mixTexture.coordinatesIndex, this._mixTexture.level);\r\n this._activeEffect.setMatrix(\"textureMatrix\", this._mixTexture.getTextureMatrix());\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture1) {\r\n this._activeEffect.setTexture(\"diffuse1Sampler\", this._diffuseTexture1);\r\n this._activeEffect.setFloat2(\"diffuse1Infos\", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);\r\n }\r\n if (this._diffuseTexture2) {\r\n this._activeEffect.setTexture(\"diffuse2Sampler\", this._diffuseTexture2);\r\n this._activeEffect.setFloat2(\"diffuse2Infos\", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);\r\n }\r\n if (this._diffuseTexture3) {\r\n this._activeEffect.setTexture(\"diffuse3Sampler\", this._diffuseTexture3);\r\n this._activeEffect.setFloat2(\"diffuse3Infos\", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);\r\n }\r\n }\r\n\r\n if (MaterialFlags.BumpTextureEnabled && scene.getEngine().getCaps().standardDerivatives) {\r\n if (this._bumpTexture1) {\r\n this._activeEffect.setTexture(\"bump1Sampler\", this._bumpTexture1);\r\n }\r\n if (this._bumpTexture2) {\r\n this._activeEffect.setTexture(\"bump2Sampler\", this._bumpTexture2);\r\n }\r\n if (this._bumpTexture3) {\r\n this._activeEffect.setTexture(\"bump3Sampler\", this._bumpTexture3);\r\n }\r\n }\r\n }\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 // 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 this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (defines.SPECULARTERM) {\r\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\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 getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {\r\n results.push(this.mixTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public override getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._mixTexture) {\r\n activeTextures.push(this._mixTexture);\r\n }\r\n\r\n if (this._diffuseTexture1) {\r\n activeTextures.push(this._diffuseTexture1);\r\n }\r\n\r\n if (this._diffuseTexture2) {\r\n activeTextures.push(this._diffuseTexture2);\r\n }\r\n\r\n if (this._diffuseTexture3) {\r\n activeTextures.push(this._diffuseTexture3);\r\n }\r\n\r\n if (this._bumpTexture1) {\r\n activeTextures.push(this._bumpTexture1);\r\n }\r\n\r\n if (this._bumpTexture2) {\r\n activeTextures.push(this._bumpTexture2);\r\n }\r\n\r\n if (this._bumpTexture3) {\r\n activeTextures.push(this._bumpTexture3);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._mixTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n if (this.mixTexture) {\r\n this.mixTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): TerrainMaterial {\r\n return SerializationHelper.Clone(() => new TerrainMaterial(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.TerrainMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"TerrainMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial {\r\n return SerializationHelper.Parse(() => new TerrainMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.TerrainMaterial\", TerrainMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"terrainMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/terrain/terrainMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AAC1G,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAK/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,mDAAqC;AAC7D,OAAO,EAAE,YAAY,E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DACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;yDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;wDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;yDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;wDACrB;AAGxB;IADP,kBAAkB,CAAC,cAAc,CAAC;sDACJ;AAExB;IADN,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAGrB;IADP,kBAAkB,CAAC,cAAc,CAAC;sDACJ;AAExB;IADN,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAGrB;IADP,kBAAkB,CAAC,cAAc,CAAC;sDACJ;AAExB;IADN,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAGtB;IADN,iBAAiB,EAAE;qDACsB;AAGnC;IADN,iBAAiB,EAAE;sDACuB;AAGpC;IADN,SAAS,EAAE;sDACc;AAGlB;IADP,SAAS,CAAC,iBAAiB,CAAC;yDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;wDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;+DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;8DACd;AAwZzC,aAAa,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from \"core/Misc/decorators\";\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 { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"core/Materials/materialFlags\";\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\n\r\nimport \"./terrain.fragment\";\r\nimport \"./terrain.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\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 TerrainMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public BUMP = false;\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 ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public SPECULARTERM = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = 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 TerrainMaterial extends PushMaterial {\r\n @serializeAsTexture(\"mixTexture\")\r\n private _mixTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture1: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture2: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture3: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture1\")\r\n private _bumpTexture1: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture1: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture2\")\r\n private _bumpTexture2: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture2: Texture;\r\n\r\n @serializeAsTexture(\"bumpTexture3\")\r\n private _bumpTexture3: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture3: Texture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serializeAsColor3()\r\n public specularColor = new Color3(0, 0, 0);\r\n\r\n @serialize()\r\n public specularPower = 64;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\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 // 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 TerrainMaterialDefines();\r\n }\r\n\r\n const defines = <TerrainMaterialDefines>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 // Textures\r\n if (scene.texturesEnabled) {\r\n if (!this.mixTexture || !this.mixTexture.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needUVs = true;\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this.diffuseTexture1 || !this.diffuseTexture1.isReady()) {\r\n return false;\r\n }\r\n if (!this.diffuseTexture2 || !this.diffuseTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this.diffuseTexture3 || !this.diffuseTexture3.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.DIFFUSE = true;\r\n }\r\n\r\n if (this.bumpTexture1 && this.bumpTexture2 && this.bumpTexture3 && MaterialFlags.BumpTextureEnabled) {\r\n if (!this.bumpTexture1.isReady()) {\r\n return false;\r\n }\r\n if (!this.bumpTexture2.isReady()) {\r\n return false;\r\n }\r\n if (!this.bumpTexture3.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._needNormals = true;\r\n defines.BUMP = true;\r\n }\r\n }\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\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, this.maxSimultaneousLights);\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 if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"terrain\";\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 \"vDiffuseColor\",\r\n \"vSpecularColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vTextureInfos\",\r\n \"mBones\",\r\n \"textureMatrix\",\r\n \"diffuse1Infos\",\r\n \"diffuse2Infos\",\r\n \"diffuse3Infos\",\r\n ];\r\n const samplers = [\r\n \"textureSampler\",\r\n \"diffuse1Sampler\",\r\n \"diffuse2Sampler\",\r\n \"diffuse3Sampler\",\r\n \"bump1Sampler\",\r\n \"bump2Sampler\",\r\n \"bump3Sampler\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\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: this.maxSimultaneousLights },\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 = <TerrainMaterialDefines>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._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Textures\r\n if (this.mixTexture) {\r\n this._activeEffect.setTexture(\"textureSampler\", this._mixTexture);\r\n this._activeEffect.setFloat2(\"vTextureInfos\", this._mixTexture.coordinatesIndex, this._mixTexture.level);\r\n this._activeEffect.setMatrix(\"textureMatrix\", this._mixTexture.getTextureMatrix());\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture1) {\r\n this._activeEffect.setTexture(\"diffuse1Sampler\", this._diffuseTexture1);\r\n this._activeEffect.setFloat2(\"diffuse1Infos\", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);\r\n }\r\n if (this._diffuseTexture2) {\r\n this._activeEffect.setTexture(\"diffuse2Sampler\", this._diffuseTexture2);\r\n this._activeEffect.setFloat2(\"diffuse2Infos\", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);\r\n }\r\n if (this._diffuseTexture3) {\r\n this._activeEffect.setTexture(\"diffuse3Sampler\", this._diffuseTexture3);\r\n this._activeEffect.setFloat2(\"diffuse3Infos\", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);\r\n }\r\n }\r\n\r\n if (MaterialFlags.BumpTextureEnabled && scene.getEngine().getCaps().standardDerivatives) {\r\n if (this._bumpTexture1) {\r\n this._activeEffect.setTexture(\"bump1Sampler\", this._bumpTexture1);\r\n }\r\n if (this._bumpTexture2) {\r\n this._activeEffect.setTexture(\"bump2Sampler\", this._bumpTexture2);\r\n }\r\n if (this._bumpTexture3) {\r\n this._activeEffect.setTexture(\"bump3Sampler\", this._bumpTexture3);\r\n }\r\n }\r\n }\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 // 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 this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (defines.SPECULARTERM) {\r\n this._activeEffect.setColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\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 getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {\r\n results.push(this.mixTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public override getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._mixTexture) {\r\n activeTextures.push(this._mixTexture);\r\n }\r\n\r\n if (this._diffuseTexture1) {\r\n activeTextures.push(this._diffuseTexture1);\r\n }\r\n\r\n if (this._diffuseTexture2) {\r\n activeTextures.push(this._diffuseTexture2);\r\n }\r\n\r\n if (this._diffuseTexture3) {\r\n activeTextures.push(this._diffuseTexture3);\r\n }\r\n\r\n if (this._bumpTexture1) {\r\n activeTextures.push(this._bumpTexture1);\r\n }\r\n\r\n if (this._bumpTexture2) {\r\n activeTextures.push(this._bumpTexture2);\r\n }\r\n\r\n if (this._bumpTexture3) {\r\n activeTextures.push(this._bumpTexture3);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._mixTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture1 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture3 === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n if (this.mixTexture) {\r\n this.mixTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): TerrainMaterial {\r\n return SerializationHelper.Clone(() => new TerrainMaterial(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.TerrainMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"TerrainMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial {\r\n return SerializationHelper.Parse(() => new TerrainMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.TerrainMaterial\", TerrainMaterial);\r\n"]}
|