@babylonjs/materials 6.45.0 → 6.46.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cell/cellMaterial.js +2 -1
- package/cell/cellMaterial.js.map +1 -1
- package/fire/fireMaterial.js +2 -1
- package/fire/fireMaterial.js.map +1 -1
- package/fur/furMaterial.js +2 -1
- package/fur/furMaterial.js.map +1 -1
- package/gradient/gradientMaterial.js +2 -1
- package/gradient/gradientMaterial.js.map +1 -1
- package/grid/gridMaterial.js +2 -1
- package/grid/gridMaterial.js.map +1 -1
- package/lava/lavaMaterial.js +2 -1
- package/lava/lavaMaterial.js.map +1 -1
- package/mix/mixMaterial.js +2 -1
- package/mix/mixMaterial.js.map +1 -1
- package/normal/normalMaterial.js +2 -1
- package/normal/normalMaterial.js.map +1 -1
- package/package.json +2 -2
- package/shadowOnly/shadowOnlyMaterial.js +1 -1
- package/shadowOnly/shadowOnlyMaterial.js.map +1 -1
- package/simple/simpleMaterial.js +2 -1
- package/simple/simpleMaterial.js.map +1 -1
- package/sky/skyMaterial.js +2 -1
- package/sky/skyMaterial.js.map +1 -1
- package/terrain/terrainMaterial.js +2 -1
- package/terrain/terrainMaterial.js.map +1 -1
- package/triPlanar/triPlanarMaterial.js +2 -1
- package/triPlanar/triPlanarMaterial.js.map +1 -1
- package/water/waterMaterial.js +2 -1
- package/water/waterMaterial.js.map +1 -1
package/grid/gridMaterial.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gridMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/grid/gridMaterial.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2CAA6B;AAEnJ,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAC1D,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EA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sB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper, serializeAsVector3 } from \"core/Misc/decorators\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector4, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\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 type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\n\r\nimport \"./grid.fragment\";\r\nimport \"./grid.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass GridMaterialDefines extends MaterialDefines {\r\n public OPACITY = false;\r\n public ANTIALIAS = false;\r\n public TRANSPARENT = false;\r\n public FOG = false;\r\n public PREMULTIPLYALPHA = false;\r\n public MAX_LINE = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public INSTANCES = false;\r\n public THIN_INSTANCES = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * The grid materials allows you to wrap any shape with a grid.\r\n * Colors are customizable.\r\n */\r\nexport class GridMaterial extends PushMaterial {\r\n /**\r\n * Main color of the grid (e.g. between lines)\r\n */\r\n @serializeAsColor3()\r\n public mainColor = Color3.Black();\r\n\r\n /**\r\n * Color of the grid lines.\r\n */\r\n @serializeAsColor3()\r\n public lineColor = Color3.Teal();\r\n\r\n /**\r\n * The scale of the grid compared to unit.\r\n */\r\n @serialize()\r\n public gridRatio = 1.0;\r\n\r\n /**\r\n * Allows setting an offset for the grid lines.\r\n */\r\n @serializeAsVector3()\r\n public gridOffset = Vector3.Zero();\r\n\r\n /**\r\n * The frequency of thicker lines.\r\n */\r\n @serialize()\r\n public majorUnitFrequency = 10;\r\n\r\n /**\r\n * The visibility of minor units in the grid.\r\n */\r\n @serialize()\r\n public minorUnitVisibility = 0.33;\r\n\r\n /**\r\n * The grid opacity outside of the lines.\r\n */\r\n @serialize()\r\n public opacity = 1.0;\r\n\r\n /**\r\n * Whether to antialias the grid\r\n */\r\n @serialize()\r\n public antialias = true;\r\n\r\n /**\r\n * Determine RBG output is premultiplied by alpha value.\r\n */\r\n @serialize()\r\n public preMultiplyAlpha = false;\r\n\r\n /**\r\n * Determines if the max line value will be used instead of the sum wherever grid lines intersect.\r\n */\r\n @serialize()\r\n public useMaxLine = false;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: BaseTexture;\r\n /**\r\n * Texture to define opacity of the grid\r\n */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: BaseTexture;\r\n\r\n private _gridControl: Vector4 = new Vector4(this.gridRatio, this.majorUnitFrequency, this.minorUnitVisibility, this.opacity);\r\n\r\n /**\r\n * constructor\r\n * @param name The name given to the material in order to identify it afterwards.\r\n * @param scene The scene the material is used in.\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * @returns whether or not the grid requires alpha blending.\r\n */\r\n public needAlphaBlending(): boolean {\r\n return this.opacity < 1.0 || (this._opacityTexture && this._opacityTexture.isReady());\r\n }\r\n\r\n public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return mesh.visibility < 1.0 || this.needAlphaBlending();\r\n }\r\n\r\n public 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 GridMaterialDefines();\r\n }\r\n\r\n const defines = <GridMaterialDefines>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 if (defines.TRANSPARENT !== this.opacity < 1.0) {\r\n defines.TRANSPARENT = !defines.TRANSPARENT;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.PREMULTIPLYALPHA != this.preMultiplyAlpha) {\r\n defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.MAX_LINE !== this.useMaxLine) {\r\n defines.MAX_LINE = !defines.MAX_LINE;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.ANTIALIAS !== this.antialias) {\r\n defines.ANTIALIAS = !defines.ANTIALIAS;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.OPACITY = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, false, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, scene.getEngine(), this, defines, !!useInstances);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Attributes\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n const attribs = [VertexBuffer.PositionKind, VertexBuffer.NormalKind];\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Defines\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene\r\n .getEngine()\r\n .createEffect(\r\n \"grid\",\r\n attribs,\r\n [\r\n \"projection\",\r\n \"mainColor\",\r\n \"lineColor\",\r\n \"gridControl\",\r\n \"gridOffset\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"world\",\r\n \"view\",\r\n \"opacityMatrix\",\r\n \"vOpacityInfos\",\r\n \"visibility\",\r\n \"logarithmicDepthConstant\",\r\n ],\r\n [\"opacitySampler\"],\r\n join,\r\n undefined,\r\n this.onCompiled,\r\n this.onError\r\n ),\r\n defines,\r\n this._materialContext\r\n );\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 bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GridMaterialDefines>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 this._activeEffect.setFloat(\"visibility\", mesh.visibility);\r\n\r\n // Matrices\r\n if (!defines.INSTANCES || defines.THIN_INSTANCE) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n this._activeEffect.setMatrix(\"projection\", scene.getProjectionMatrix());\r\n\r\n // Uniforms\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n this._activeEffect.setColor3(\"mainColor\", this.mainColor);\r\n this._activeEffect.setColor3(\"lineColor\", this.lineColor);\r\n\r\n this._activeEffect.setVector3(\"gridOffset\", this.gridOffset);\r\n\r\n this._gridControl.x = this.gridRatio;\r\n this._gridControl.y = Math.round(this.majorUnitFrequency);\r\n this._gridControl.z = this.minorUnitVisibility;\r\n this._gridControl.w = this.opacity;\r\n this._activeEffect.setVector4(\"gridControl\", this._gridControl);\r\n\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n this._activeEffect.setFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n this._activeEffect.setMatrix(\"opacityMatrix\", this._opacityTexture.getTextureMatrix());\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 // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Dispose the material and its associated resources.\r\n * @param forceDisposeEffect will also dispose the used effect when true\r\n */\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): GridMaterial {\r\n return SerializationHelper.Clone(() => new GridMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GridMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"GridMaterial\";\r\n }\r\n\r\n public static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial {\r\n return SerializationHelper.Parse(() => new GridMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GridMaterial\", GridMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"gridMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/grid/gridMaterial.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,2CAA6B;AAC9H,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAC1D,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,mDAAqC;AAC7D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAKnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,qBAAqB,GACxB,8DAAgD;AAEjD,MAAM,mBAAoB,SAAQ,eAAe;IAe7C;QACI,KAAK,EAAE,CAAC;QAfL,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAClB,gBAAW,GAAG,KAAK,CAAC;QACpB,QAAG,GAAG,KAAK,CAAC;QACZ,qBAAgB,GAAG,KAAK,CAAC;QACzB,aAAQ,GAAG,KAAK,CAAC;QACjB,QAAG,GAAG,KAAK,CAAC;QACZ,QAAG,GAAG,KAAK,CAAC;QACZ,cA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C1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACJ;AAjSU;IADN,iBAAiB,EAAE;+CACc;AAM3B;IADN,iBAAiB,EAAE;+CACa;AAM1B;IADN,SAAS,EAAE;+CACW;AAMhB;IADN,kBAAkB,EAAE;gDACc;AAM5B;IADN,SAAS,EAAE;wDACmB;AAMxB;IADN,SAAS,EAAE;yDACsB;AAM3B;IADN,SAAS,EAAE;6CACS;AAMd;IADN,SAAS,EAAE;+CACY;AAMjB;IADN,SAAS,EAAE;sDACoB;AAMzB;IADN,SAAS,EAAE;gDACc;AAGlB;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACA;AAK9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDAClB;AAqOvC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, serializeAsVector3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector4, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\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 type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\n\r\nimport \"./grid.fragment\";\r\nimport \"./grid.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass GridMaterialDefines extends MaterialDefines {\r\n public OPACITY = false;\r\n public ANTIALIAS = false;\r\n public TRANSPARENT = false;\r\n public FOG = false;\r\n public PREMULTIPLYALPHA = false;\r\n public MAX_LINE = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public INSTANCES = false;\r\n public THIN_INSTANCES = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * The grid materials allows you to wrap any shape with a grid.\r\n * Colors are customizable.\r\n */\r\nexport class GridMaterial extends PushMaterial {\r\n /**\r\n * Main color of the grid (e.g. between lines)\r\n */\r\n @serializeAsColor3()\r\n public mainColor = Color3.Black();\r\n\r\n /**\r\n * Color of the grid lines.\r\n */\r\n @serializeAsColor3()\r\n public lineColor = Color3.Teal();\r\n\r\n /**\r\n * The scale of the grid compared to unit.\r\n */\r\n @serialize()\r\n public gridRatio = 1.0;\r\n\r\n /**\r\n * Allows setting an offset for the grid lines.\r\n */\r\n @serializeAsVector3()\r\n public gridOffset = Vector3.Zero();\r\n\r\n /**\r\n * The frequency of thicker lines.\r\n */\r\n @serialize()\r\n public majorUnitFrequency = 10;\r\n\r\n /**\r\n * The visibility of minor units in the grid.\r\n */\r\n @serialize()\r\n public minorUnitVisibility = 0.33;\r\n\r\n /**\r\n * The grid opacity outside of the lines.\r\n */\r\n @serialize()\r\n public opacity = 1.0;\r\n\r\n /**\r\n * Whether to antialias the grid\r\n */\r\n @serialize()\r\n public antialias = true;\r\n\r\n /**\r\n * Determine RBG output is premultiplied by alpha value.\r\n */\r\n @serialize()\r\n public preMultiplyAlpha = false;\r\n\r\n /**\r\n * Determines if the max line value will be used instead of the sum wherever grid lines intersect.\r\n */\r\n @serialize()\r\n public useMaxLine = false;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: BaseTexture;\r\n /**\r\n * Texture to define opacity of the grid\r\n */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: BaseTexture;\r\n\r\n private _gridControl: Vector4 = new Vector4(this.gridRatio, this.majorUnitFrequency, this.minorUnitVisibility, this.opacity);\r\n\r\n /**\r\n * constructor\r\n * @param name The name given to the material in order to identify it afterwards.\r\n * @param scene The scene the material is used in.\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * @returns whether or not the grid requires alpha blending.\r\n */\r\n public needAlphaBlending(): boolean {\r\n return this.opacity < 1.0 || (this._opacityTexture && this._opacityTexture.isReady());\r\n }\r\n\r\n public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return mesh.visibility < 1.0 || this.needAlphaBlending();\r\n }\r\n\r\n public 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 GridMaterialDefines();\r\n }\r\n\r\n const defines = <GridMaterialDefines>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 if (defines.TRANSPARENT !== this.opacity < 1.0) {\r\n defines.TRANSPARENT = !defines.TRANSPARENT;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.PREMULTIPLYALPHA != this.preMultiplyAlpha) {\r\n defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.MAX_LINE !== this.useMaxLine) {\r\n defines.MAX_LINE = !defines.MAX_LINE;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.ANTIALIAS !== this.antialias) {\r\n defines.ANTIALIAS = !defines.ANTIALIAS;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.OPACITY = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, false, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, scene.getEngine(), this, defines, !!useInstances);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Attributes\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n const attribs = [VertexBuffer.PositionKind, VertexBuffer.NormalKind];\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Defines\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene\r\n .getEngine()\r\n .createEffect(\r\n \"grid\",\r\n attribs,\r\n [\r\n \"projection\",\r\n \"mainColor\",\r\n \"lineColor\",\r\n \"gridControl\",\r\n \"gridOffset\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"world\",\r\n \"view\",\r\n \"opacityMatrix\",\r\n \"vOpacityInfos\",\r\n \"visibility\",\r\n \"logarithmicDepthConstant\",\r\n ],\r\n [\"opacitySampler\"],\r\n join,\r\n undefined,\r\n this.onCompiled,\r\n this.onError\r\n ),\r\n defines,\r\n this._materialContext\r\n );\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 bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GridMaterialDefines>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 this._activeEffect.setFloat(\"visibility\", mesh.visibility);\r\n\r\n // Matrices\r\n if (!defines.INSTANCES || defines.THIN_INSTANCE) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n this._activeEffect.setMatrix(\"projection\", scene.getProjectionMatrix());\r\n\r\n // Uniforms\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n this._activeEffect.setColor3(\"mainColor\", this.mainColor);\r\n this._activeEffect.setColor3(\"lineColor\", this.lineColor);\r\n\r\n this._activeEffect.setVector3(\"gridOffset\", this.gridOffset);\r\n\r\n this._gridControl.x = this.gridRatio;\r\n this._gridControl.y = Math.round(this.majorUnitFrequency);\r\n this._gridControl.z = this.minorUnitVisibility;\r\n this._gridControl.w = this.opacity;\r\n this._activeEffect.setVector4(\"gridControl\", this._gridControl);\r\n\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n this._activeEffect.setFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n this._activeEffect.setMatrix(\"opacityMatrix\", this._opacityTexture.getTextureMatrix());\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 // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Dispose the material and its associated resources.\r\n * @param forceDisposeEffect will also dispose the used effect when true\r\n */\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): GridMaterial {\r\n return SerializationHelper.Clone(() => new GridMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GridMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"GridMaterial\";\r\n }\r\n\r\n public static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial {\r\n return SerializationHelper.Parse(() => new GridMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GridMaterial\", GridMaterial);\r\n"]}
|
package/lava/lavaMaterial.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
2
|
-
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3
|
2
|
+
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
3
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
4
5
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
5
6
|
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
package/lava/lavaMaterial.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lavaMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/lava/lavaMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAE/H,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAI/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,aAAa,EAAE,0CAA4B;AAEpD,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAC7F,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GACjC,8DAAgD;AAEjD,MAAM,mBAAoB,SAAQ,eAAe;IAmE7C;QACI,KAAK,EAAE,CAAC;QAnEL,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,cAAS,GAAG,KAAK,CAAC;QAClB,iBAAY,GAAG,KAAK,CAAC;QACrB,cA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M,SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY;QACf,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,UAAU;IACH,MAAM,CAAC,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACJ;AAjXW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDAClB;AAG5B;IADN,kBAAkB,EAAE;kDACY;AAG1B;IADN,iBAAiB,EAAE;8CACI;AAGjB;IADN,SAAS,EAAE;2CACa;AAGlB;IADN,SAAS,EAAE;iDACmB;AAGxB;IADN,SAAS,EAAE;uDACyB;AAG9B;IADN,SAAS,EAAE;gDACqB;AAK1B;IADN,iBAAiB,EAAE;kDACsB;AAGlC;IADP,SAAS,CAAC,iBAAiB,CAAC;sDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;qDACnB;AAGxB;IADP,SAAS,CAAC,OAAO,CAAC;4CACI;AAEhB;IADN,gBAAgB,CAAC,gCAAgC,CAAC;2CAC7B;AAGd;IADP,SAAS,CAAC,uBAAuB,CAAC;4DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;2DACd;AA2UzC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\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 { 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 \"./lava.fragment\";\r\nimport \"./lava.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 LavaMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 LIGHT0 = false;\r\n public LIGHT1 = false;\r\n public LIGHT2 = false;\r\n public LIGHT3 = false;\r\n public SPOTLIGHT0 = false;\r\n public SPOTLIGHT1 = false;\r\n public SPOTLIGHT2 = false;\r\n public SPOTLIGHT3 = false;\r\n public HEMILIGHT0 = false;\r\n public HEMILIGHT1 = false;\r\n public HEMILIGHT2 = false;\r\n public HEMILIGHT3 = false;\r\n public DIRLIGHT0 = false;\r\n public DIRLIGHT1 = false;\r\n public DIRLIGHT2 = false;\r\n public DIRLIGHT3 = false;\r\n public POINTLIGHT0 = false;\r\n public POINTLIGHT1 = false;\r\n public POINTLIGHT2 = false;\r\n public POINTLIGHT3 = false;\r\n public SHADOW0 = false;\r\n public SHADOW1 = false;\r\n public SHADOW2 = false;\r\n public SHADOW3 = false;\r\n public SHADOWS = false;\r\n public SHADOWESM0 = false;\r\n public SHADOWESM1 = false;\r\n public SHADOWESM2 = false;\r\n public SHADOWESM3 = false;\r\n public SHADOWPOISSON0 = false;\r\n public SHADOWPOISSON1 = false;\r\n public SHADOWPOISSON2 = false;\r\n public SHADOWPOISSON3 = false;\r\n public SHADOWPCF0 = false;\r\n public SHADOWPCF1 = false;\r\n public SHADOWPCF2 = false;\r\n public SHADOWPCF3 = false;\r\n public SHADOWPCSS0 = false;\r\n public SHADOWPCSS1 = false;\r\n public SHADOWPCSS2 = false;\r\n public SHADOWPCSS3 = 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 UNLIT = 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 LavaMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsTexture()\r\n public noiseTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public fogColor: Color3;\r\n\r\n @serialize()\r\n public speed: number = 1;\r\n\r\n @serialize()\r\n public movingSpeed: number = 1;\r\n\r\n @serialize()\r\n public lowFrequencySpeed: number = 1;\r\n\r\n @serialize()\r\n public fogDensity: number = 0.15;\r\n\r\n private _lastTime: number = 0;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\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(\"unlit\")\r\n private _unlit = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public unlit: 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 private _scaledDiffuse = new Color3();\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public 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 LavaMaterialDefines();\r\n }\r\n\r\n const defines = <LavaMaterialDefines>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 (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\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 = true;\r\n\r\n 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);\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 = \"lava\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n \"time\",\r\n \"speed\",\r\n \"movingSpeed\",\r\n \"fogColor\",\r\n \"fogDensity\",\r\n \"lowFrequencySpeed\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n\r\n const samplers = [\"diffuseSampler\", \"noiseTexture\"];\r\n const uniformBuffers: string[] = [];\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 bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <LavaMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n defines.UNLIT = this._unlit;\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.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this.diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this.diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n if (this.noiseTexture) {\r\n this._activeEffect.setTexture(\"noiseTexture\", this.noiseTexture);\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._scaledDiffuse, this.alpha * mesh.visibility);\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines);\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._lastTime += scene.getEngine().getDeltaTime();\r\n this._activeEffect.setFloat(\"time\", (this._lastTime * this.speed) / 1000);\r\n\r\n if (!this.fogColor) {\r\n this.fogColor = Color3.Black();\r\n }\r\n this._activeEffect.setColor3(\"fogColor\", this.fogColor);\r\n this._activeEffect.setFloat(\"fogDensity\", this.fogDensity);\r\n\r\n this._activeEffect.setFloat(\"lowFrequencySpeed\", this.lowFrequencySpeed);\r\n this._activeEffect.setFloat(\"movingSpeed\", this.movingSpeed);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n if (this.noiseTexture && this.noiseTexture.animations && this.noiseTexture.animations.length > 0) {\r\n results.push(this.noiseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n if (this.noiseTexture) {\r\n this.noiseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): LavaMaterial {\r\n return SerializationHelper.Clone(() => new LavaMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.LavaMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"LavaMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial {\r\n return SerializationHelper.Parse(() => new LavaMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.LavaMaterial\", LavaMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"lavaMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/lava/lavaMaterial.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;AAI/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,aAAa,EAAE,0CAA4B;AAEpD,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAC7F,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GACjC,8DAAgD;AAEjD,MAAM,mBAAoB,SAAQ,eAAe;IAmE7C;QACI,KAAK,EAAE,CAAC;QAnEL,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAA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,CAAC;2DACd;AA2UzC,aAAa,CAAC,sBAAsB,EAAE,YAAY,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 { 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 \"./lava.fragment\";\r\nimport \"./lava.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 LavaMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 LIGHT0 = false;\r\n public LIGHT1 = false;\r\n public LIGHT2 = false;\r\n public LIGHT3 = false;\r\n public SPOTLIGHT0 = false;\r\n public SPOTLIGHT1 = false;\r\n public SPOTLIGHT2 = false;\r\n public SPOTLIGHT3 = false;\r\n public HEMILIGHT0 = false;\r\n public HEMILIGHT1 = false;\r\n public HEMILIGHT2 = false;\r\n public HEMILIGHT3 = false;\r\n public DIRLIGHT0 = false;\r\n public DIRLIGHT1 = false;\r\n public DIRLIGHT2 = false;\r\n public DIRLIGHT3 = false;\r\n public POINTLIGHT0 = false;\r\n public POINTLIGHT1 = false;\r\n public POINTLIGHT2 = false;\r\n public POINTLIGHT3 = false;\r\n public SHADOW0 = false;\r\n public SHADOW1 = false;\r\n public SHADOW2 = false;\r\n public SHADOW3 = false;\r\n public SHADOWS = false;\r\n public SHADOWESM0 = false;\r\n public SHADOWESM1 = false;\r\n public SHADOWESM2 = false;\r\n public SHADOWESM3 = false;\r\n public SHADOWPOISSON0 = false;\r\n public SHADOWPOISSON1 = false;\r\n public SHADOWPOISSON2 = false;\r\n public SHADOWPOISSON3 = false;\r\n public SHADOWPCF0 = false;\r\n public SHADOWPCF1 = false;\r\n public SHADOWPCF2 = false;\r\n public SHADOWPCF3 = false;\r\n public SHADOWPCSS0 = false;\r\n public SHADOWPCSS1 = false;\r\n public SHADOWPCSS2 = false;\r\n public SHADOWPCSS3 = 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 UNLIT = 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 LavaMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsTexture()\r\n public noiseTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public fogColor: Color3;\r\n\r\n @serialize()\r\n public speed: number = 1;\r\n\r\n @serialize()\r\n public movingSpeed: number = 1;\r\n\r\n @serialize()\r\n public lowFrequencySpeed: number = 1;\r\n\r\n @serialize()\r\n public fogDensity: number = 0.15;\r\n\r\n private _lastTime: number = 0;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\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(\"unlit\")\r\n private _unlit = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public unlit: 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 private _scaledDiffuse = new Color3();\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public 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 LavaMaterialDefines();\r\n }\r\n\r\n const defines = <LavaMaterialDefines>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 (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\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 = true;\r\n\r\n 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);\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 = \"lava\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n \"time\",\r\n \"speed\",\r\n \"movingSpeed\",\r\n \"fogColor\",\r\n \"fogDensity\",\r\n \"lowFrequencySpeed\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n\r\n const samplers = [\"diffuseSampler\", \"noiseTexture\"];\r\n const uniformBuffers: string[] = [];\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 bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <LavaMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n defines.UNLIT = this._unlit;\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.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this.diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this.diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n if (this.noiseTexture) {\r\n this._activeEffect.setTexture(\"noiseTexture\", this.noiseTexture);\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._scaledDiffuse, this.alpha * mesh.visibility);\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines);\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._lastTime += scene.getEngine().getDeltaTime();\r\n this._activeEffect.setFloat(\"time\", (this._lastTime * this.speed) / 1000);\r\n\r\n if (!this.fogColor) {\r\n this.fogColor = Color3.Black();\r\n }\r\n this._activeEffect.setColor3(\"fogColor\", this.fogColor);\r\n this._activeEffect.setFloat(\"fogDensity\", this.fogDensity);\r\n\r\n this._activeEffect.setFloat(\"lowFrequencySpeed\", this.lowFrequencySpeed);\r\n this._activeEffect.setFloat(\"movingSpeed\", this.movingSpeed);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n if (this.noiseTexture && this.noiseTexture.animations && this.noiseTexture.animations.length > 0) {\r\n results.push(this.noiseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n if (this.noiseTexture) {\r\n this.noiseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): LavaMaterial {\r\n return SerializationHelper.Clone(() => new LavaMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.LavaMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"LavaMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial {\r\n return SerializationHelper.Parse(() => new LavaMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.LavaMaterial\", LavaMaterial);\r\n"]}
|
package/mix/mixMaterial.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
2
|
-
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3
|
2
|
+
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
3
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
4
5
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
5
6
|
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
package/mix/mixMaterial.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mixMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/mix/mixMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAE/H,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAK/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EA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AkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAOzB;IADN,iBAAiB,EAAE;iDACsB;AAGnC;IADN,iBAAiB,EAAE;kDACuB;AAGpC;IADN,SAAS,EAAE;kDACc;AAGlB;IADP,SAAS,CAAC,iBAAiB,CAAC;qDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;oDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;2DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;0DACd;AAwdzC,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\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 \"./mix.fragment\";\r\nimport \"./mix.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 MixMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 MIXMAP2 = 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 MixMaterial extends PushMaterial {\r\n /**\r\n * Mix textures\r\n */\r\n\r\n @serializeAsTexture(\"mixTexture1\")\r\n private _mixTexture1: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture1: BaseTexture;\r\n\r\n @serializeAsTexture(\"mixTexture2\")\r\n private _mixTexture2: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture2: BaseTexture;\r\n\r\n /**\r\n * Diffuse textures\r\n */\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(\"diffuseTexture4\")\r\n private _diffuseTexture4: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture4: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture5: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture5: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture6: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture6: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture7: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture7: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture4\")\r\n private _diffuseTexture8: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture8: Texture;\r\n\r\n /**\r\n * Uniforms\r\n */\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 needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public 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 MixMaterialDefines();\r\n }\r\n\r\n const defines = <MixMaterialDefines>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._mixTexture1 || !this._mixTexture1.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\r\n defines.DIFFUSE = true;\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 if (!this._diffuseTexture4 || !this._diffuseTexture4.isReady()) {\r\n return false;\r\n }\r\n\r\n if (this._mixTexture2) {\r\n if (!this._mixTexture2.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.MIXMAP2 = true;\r\n\r\n if (!this._diffuseTexture5 || !this._diffuseTexture5.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture6 || !this._diffuseTexture6.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture7 || !this._diffuseTexture7.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture8 || !this._diffuseTexture8.isReady()) {\r\n return false;\r\n }\r\n }\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 = \"mix\";\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 \"logarithmicDepthConstant\",\r\n \"diffuse1Infos\",\r\n \"diffuse2Infos\",\r\n \"diffuse3Infos\",\r\n \"diffuse4Infos\",\r\n \"diffuse5Infos\",\r\n \"diffuse6Infos\",\r\n \"diffuse7Infos\",\r\n \"diffuse8Infos\",\r\n ];\r\n const samplers = [\r\n \"mixMap1Sampler\",\r\n \"mixMap2Sampler\",\r\n \"diffuse1Sampler\",\r\n \"diffuse2Sampler\",\r\n \"diffuse3Sampler\",\r\n \"diffuse4Sampler\",\r\n \"diffuse5Sampler\",\r\n \"diffuse6Sampler\",\r\n \"diffuse7Sampler\",\r\n \"diffuse8Sampler\",\r\n ];\r\n\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 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 bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <MixMaterialDefines>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._mixTexture1) {\r\n this._activeEffect.setTexture(\"mixMap1Sampler\", this._mixTexture1);\r\n this._activeEffect.setFloat2(\"vTextureInfos\", this._mixTexture1.coordinatesIndex, this._mixTexture1.level);\r\n this._activeEffect.setMatrix(\"textureMatrix\", this._mixTexture1.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 if (this._diffuseTexture4) {\r\n this._activeEffect.setTexture(\"diffuse4Sampler\", this._diffuseTexture4);\r\n this._activeEffect.setFloat2(\"diffuse4Infos\", this._diffuseTexture4.uScale, this._diffuseTexture4.vScale);\r\n }\r\n }\r\n }\r\n\r\n if (this._mixTexture2) {\r\n this._activeEffect.setTexture(\"mixMap2Sampler\", this._mixTexture2);\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture5) {\r\n this._activeEffect.setTexture(\"diffuse5Sampler\", this._diffuseTexture5);\r\n this._activeEffect.setFloat2(\"diffuse5Infos\", this._diffuseTexture5.uScale, this._diffuseTexture5.vScale);\r\n }\r\n if (this._diffuseTexture6) {\r\n this._activeEffect.setTexture(\"diffuse6Sampler\", this._diffuseTexture6);\r\n this._activeEffect.setFloat2(\"diffuse6Infos\", this._diffuseTexture6.uScale, this._diffuseTexture6.vScale);\r\n }\r\n if (this._diffuseTexture7) {\r\n this._activeEffect.setTexture(\"diffuse7Sampler\", this._diffuseTexture7);\r\n this._activeEffect.setFloat2(\"diffuse7Infos\", this._diffuseTexture7.uScale, this._diffuseTexture7.vScale);\r\n }\r\n if (this._diffuseTexture8) {\r\n this._activeEffect.setTexture(\"diffuse8Sampler\", this._diffuseTexture8);\r\n this._activeEffect.setFloat2(\"diffuse8Infos\", this._diffuseTexture8.uScale, this._diffuseTexture8.vScale);\r\n }\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 getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._mixTexture1 && this._mixTexture1.animations && this._mixTexture1.animations.length > 0) {\r\n results.push(this._mixTexture1);\r\n }\r\n\r\n if (this._mixTexture2 && this._mixTexture2.animations && this._mixTexture2.animations.length > 0) {\r\n results.push(this._mixTexture2);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n // Mix map 1\r\n if (this._mixTexture1) {\r\n activeTextures.push(this._mixTexture1);\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._diffuseTexture4) {\r\n activeTextures.push(this._diffuseTexture4);\r\n }\r\n\r\n // Mix map 2\r\n if (this._mixTexture2) {\r\n activeTextures.push(this._mixTexture2);\r\n }\r\n\r\n if (this._diffuseTexture5) {\r\n activeTextures.push(this._diffuseTexture5);\r\n }\r\n\r\n if (this._diffuseTexture6) {\r\n activeTextures.push(this._diffuseTexture6);\r\n }\r\n\r\n if (this._diffuseTexture7) {\r\n activeTextures.push(this._diffuseTexture7);\r\n }\r\n\r\n if (this._diffuseTexture8) {\r\n activeTextures.push(this._diffuseTexture8);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n // Mix map 1\r\n if (this._mixTexture1 === 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._diffuseTexture4 === texture) {\r\n return true;\r\n }\r\n\r\n // Mix map 2\r\n if (this._mixTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture5 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture6 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture7 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture8 === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._mixTexture1) {\r\n this._mixTexture1.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): MixMaterial {\r\n return SerializationHelper.Clone(() => new MixMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.MixMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"MixMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): MixMaterial {\r\n return SerializationHelper.Parse(() => new MixMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MixMaterial\", MixMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"mixMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/mix/mixMaterial.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,aAAa,EAAE,0CAA4B;AAEpD,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAC7F,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EAC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AE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAGxB;IADP,kBAAkB,CAAC,iBAAiB,CAAC;qDACJ;AAE3B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACrB;AAOzB;IADN,iBAAiB,EAAE;iDACsB;AAGnC;IADN,iBAAiB,EAAE;kDACuB;AAGpC;IADN,SAAS,EAAE;kDACc;AAGlB;IADP,SAAS,CAAC,iBAAiB,CAAC;qDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;oDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;2DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;0DACd;AAwdzC,aAAa,CAAC,qBAAqB,EAAE,WAAW,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 \"./mix.fragment\";\r\nimport \"./mix.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 MixMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 MIXMAP2 = 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 MixMaterial extends PushMaterial {\r\n /**\r\n * Mix textures\r\n */\r\n\r\n @serializeAsTexture(\"mixTexture1\")\r\n private _mixTexture1: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture1: BaseTexture;\r\n\r\n @serializeAsTexture(\"mixTexture2\")\r\n private _mixTexture2: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public mixTexture2: BaseTexture;\r\n\r\n /**\r\n * Diffuse textures\r\n */\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(\"diffuseTexture4\")\r\n private _diffuseTexture4: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture4: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture1\")\r\n private _diffuseTexture5: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture5: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture2\")\r\n private _diffuseTexture6: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture6: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture3\")\r\n private _diffuseTexture7: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture7: Texture;\r\n\r\n @serializeAsTexture(\"diffuseTexture4\")\r\n private _diffuseTexture8: Texture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture8: Texture;\r\n\r\n /**\r\n * Uniforms\r\n */\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 needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public 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 MixMaterialDefines();\r\n }\r\n\r\n const defines = <MixMaterialDefines>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._mixTexture1 || !this._mixTexture1.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\r\n defines.DIFFUSE = true;\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 if (!this._diffuseTexture4 || !this._diffuseTexture4.isReady()) {\r\n return false;\r\n }\r\n\r\n if (this._mixTexture2) {\r\n if (!this._mixTexture2.isReady()) {\r\n return false;\r\n }\r\n\r\n defines.MIXMAP2 = true;\r\n\r\n if (!this._diffuseTexture5 || !this._diffuseTexture5.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture6 || !this._diffuseTexture6.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture7 || !this._diffuseTexture7.isReady()) {\r\n return false;\r\n }\r\n if (!this._diffuseTexture8 || !this._diffuseTexture8.isReady()) {\r\n return false;\r\n }\r\n }\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 = \"mix\";\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 \"logarithmicDepthConstant\",\r\n \"diffuse1Infos\",\r\n \"diffuse2Infos\",\r\n \"diffuse3Infos\",\r\n \"diffuse4Infos\",\r\n \"diffuse5Infos\",\r\n \"diffuse6Infos\",\r\n \"diffuse7Infos\",\r\n \"diffuse8Infos\",\r\n ];\r\n const samplers = [\r\n \"mixMap1Sampler\",\r\n \"mixMap2Sampler\",\r\n \"diffuse1Sampler\",\r\n \"diffuse2Sampler\",\r\n \"diffuse3Sampler\",\r\n \"diffuse4Sampler\",\r\n \"diffuse5Sampler\",\r\n \"diffuse6Sampler\",\r\n \"diffuse7Sampler\",\r\n \"diffuse8Sampler\",\r\n ];\r\n\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 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 bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <MixMaterialDefines>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._mixTexture1) {\r\n this._activeEffect.setTexture(\"mixMap1Sampler\", this._mixTexture1);\r\n this._activeEffect.setFloat2(\"vTextureInfos\", this._mixTexture1.coordinatesIndex, this._mixTexture1.level);\r\n this._activeEffect.setMatrix(\"textureMatrix\", this._mixTexture1.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 if (this._diffuseTexture4) {\r\n this._activeEffect.setTexture(\"diffuse4Sampler\", this._diffuseTexture4);\r\n this._activeEffect.setFloat2(\"diffuse4Infos\", this._diffuseTexture4.uScale, this._diffuseTexture4.vScale);\r\n }\r\n }\r\n }\r\n\r\n if (this._mixTexture2) {\r\n this._activeEffect.setTexture(\"mixMap2Sampler\", this._mixTexture2);\r\n\r\n if (MaterialFlags.DiffuseTextureEnabled) {\r\n if (this._diffuseTexture5) {\r\n this._activeEffect.setTexture(\"diffuse5Sampler\", this._diffuseTexture5);\r\n this._activeEffect.setFloat2(\"diffuse5Infos\", this._diffuseTexture5.uScale, this._diffuseTexture5.vScale);\r\n }\r\n if (this._diffuseTexture6) {\r\n this._activeEffect.setTexture(\"diffuse6Sampler\", this._diffuseTexture6);\r\n this._activeEffect.setFloat2(\"diffuse6Infos\", this._diffuseTexture6.uScale, this._diffuseTexture6.vScale);\r\n }\r\n if (this._diffuseTexture7) {\r\n this._activeEffect.setTexture(\"diffuse7Sampler\", this._diffuseTexture7);\r\n this._activeEffect.setFloat2(\"diffuse7Infos\", this._diffuseTexture7.uScale, this._diffuseTexture7.vScale);\r\n }\r\n if (this._diffuseTexture8) {\r\n this._activeEffect.setTexture(\"diffuse8Sampler\", this._diffuseTexture8);\r\n this._activeEffect.setFloat2(\"diffuse8Infos\", this._diffuseTexture8.uScale, this._diffuseTexture8.vScale);\r\n }\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 getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._mixTexture1 && this._mixTexture1.animations && this._mixTexture1.animations.length > 0) {\r\n results.push(this._mixTexture1);\r\n }\r\n\r\n if (this._mixTexture2 && this._mixTexture2.animations && this._mixTexture2.animations.length > 0) {\r\n results.push(this._mixTexture2);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n // Mix map 1\r\n if (this._mixTexture1) {\r\n activeTextures.push(this._mixTexture1);\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._diffuseTexture4) {\r\n activeTextures.push(this._diffuseTexture4);\r\n }\r\n\r\n // Mix map 2\r\n if (this._mixTexture2) {\r\n activeTextures.push(this._mixTexture2);\r\n }\r\n\r\n if (this._diffuseTexture5) {\r\n activeTextures.push(this._diffuseTexture5);\r\n }\r\n\r\n if (this._diffuseTexture6) {\r\n activeTextures.push(this._diffuseTexture6);\r\n }\r\n\r\n if (this._diffuseTexture7) {\r\n activeTextures.push(this._diffuseTexture7);\r\n }\r\n\r\n if (this._diffuseTexture8) {\r\n activeTextures.push(this._diffuseTexture8);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n // Mix map 1\r\n if (this._mixTexture1 === 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._diffuseTexture4 === texture) {\r\n return true;\r\n }\r\n\r\n // Mix map 2\r\n if (this._mixTexture2 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture5 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture6 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture7 === texture) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture8 === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._mixTexture1) {\r\n this._mixTexture1.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): MixMaterial {\r\n return SerializationHelper.Clone(() => new MixMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.MixMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"MixMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): MixMaterial {\r\n return SerializationHelper.Parse(() => new MixMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MixMaterial\", MixMaterial);\r\n"]}
|
package/normal/normalMaterial.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
2
|
-
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3
|
2
|
+
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
3
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
4
5
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
5
6
|
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"normalMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normalMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAE/H,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAI/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,aAAa,EAAE,0CAA4B;AAEpD,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAC7F,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,yBAAy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AAC;IACtC,CAAC;IAEM,KAAK,CAAC,IAAY;QACrB,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5F,CAAC;IAEM,SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,wBAAwB,CAAC;QAC1D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY;QACf,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,UAAU;IACH,MAAM,CAAC,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACJ;AAtTW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;uDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;sDAClB;AAG5B;IADN,iBAAiB,EAAE;oDACsB;AAGlC;IADP,SAAS,CAAC,iBAAiB,CAAC;wDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;uDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;8DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;6DACd;AAySzC,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\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 { 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 \"./normal.fragment\";\r\nimport \"./normal.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 NormalMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 LIGHT0 = false;\r\n public LIGHT1 = false;\r\n public LIGHT2 = false;\r\n public LIGHT3 = false;\r\n public SPOTLIGHT0 = false;\r\n public SPOTLIGHT1 = false;\r\n public SPOTLIGHT2 = false;\r\n public SPOTLIGHT3 = false;\r\n public HEMILIGHT0 = false;\r\n public HEMILIGHT1 = false;\r\n public HEMILIGHT2 = false;\r\n public HEMILIGHT3 = false;\r\n public DIRLIGHT0 = false;\r\n public DIRLIGHT1 = false;\r\n public DIRLIGHT2 = false;\r\n public DIRLIGHT3 = false;\r\n public POINTLIGHT0 = false;\r\n public POINTLIGHT1 = false;\r\n public POINTLIGHT2 = false;\r\n public POINTLIGHT3 = false;\r\n public SHADOW0 = false;\r\n public SHADOW1 = false;\r\n public SHADOW2 = false;\r\n public SHADOW3 = false;\r\n public SHADOWS = false;\r\n public SHADOWESM0 = false;\r\n public SHADOWESM1 = false;\r\n public SHADOWESM2 = false;\r\n public SHADOWESM3 = false;\r\n public SHADOWPOISSON0 = false;\r\n public SHADOWPOISSON1 = false;\r\n public SHADOWPOISSON2 = false;\r\n public SHADOWPOISSON3 = false;\r\n public SHADOWPCF0 = false;\r\n public SHADOWPCF1 = false;\r\n public SHADOWPCF2 = false;\r\n public SHADOWPCF3 = false;\r\n public SHADOWPCSS0 = false;\r\n public SHADOWPCSS1 = false;\r\n public SHADOWPCSS2 = false;\r\n public SHADOWPCSS3 = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public LIGHTING = 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 NormalMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\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 needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return this.needAlphaBlending() || mesh.visibility < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public 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 NormalMaterialDefines();\r\n }\r\n\r\n const defines = <NormalMaterialDefines>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 (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\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 = true;\r\n 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 defines.LIGHTING = !this._disableLighting;\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\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);\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"normal\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers = [\"diffuseSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\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: 4 },\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 bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <NormalMaterialDefines>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.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this.diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this.diffuseTexture.getTextureMatrix());\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 // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines);\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 getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): NormalMaterial {\r\n return SerializationHelper.Clone(() => new NormalMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.NormalMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"NormalMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial {\r\n return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NormalMaterial\", NormalMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"normalMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normalMaterial.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;AAI/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,aAAa,EAAE,0CAA4B;AAEpD,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAC7F,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GACjC,8DAAgD;AAEjD,MAAM,qBAAsB,SAAQ,eAAe;IAgE/C;QACI,KAAK,EAAE,CAAC;Q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F,CAAC;IAEM,SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,wBAAwB,CAAC;QAC1D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY;QACf,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,UAAU;IACH,MAAM,CAAC,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACJ;AAtTW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;uDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;sDAClB;AAG5B;IADN,iBAAiB,EAAE;oDACsB;AAGlC;IADP,SAAS,CAAC,iBAAiB,CAAC;wDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;uDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;8DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;6DACd;AAySzC,aAAa,CAAC,wBAAwB,EAAE,cAAc,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 { 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 \"./normal.fragment\";\r\nimport \"./normal.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 NormalMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 LIGHT0 = false;\r\n public LIGHT1 = false;\r\n public LIGHT2 = false;\r\n public LIGHT3 = false;\r\n public SPOTLIGHT0 = false;\r\n public SPOTLIGHT1 = false;\r\n public SPOTLIGHT2 = false;\r\n public SPOTLIGHT3 = false;\r\n public HEMILIGHT0 = false;\r\n public HEMILIGHT1 = false;\r\n public HEMILIGHT2 = false;\r\n public HEMILIGHT3 = false;\r\n public DIRLIGHT0 = false;\r\n public DIRLIGHT1 = false;\r\n public DIRLIGHT2 = false;\r\n public DIRLIGHT3 = false;\r\n public POINTLIGHT0 = false;\r\n public POINTLIGHT1 = false;\r\n public POINTLIGHT2 = false;\r\n public POINTLIGHT3 = false;\r\n public SHADOW0 = false;\r\n public SHADOW1 = false;\r\n public SHADOW2 = false;\r\n public SHADOW3 = false;\r\n public SHADOWS = false;\r\n public SHADOWESM0 = false;\r\n public SHADOWESM1 = false;\r\n public SHADOWESM2 = false;\r\n public SHADOWESM3 = false;\r\n public SHADOWPOISSON0 = false;\r\n public SHADOWPOISSON1 = false;\r\n public SHADOWPOISSON2 = false;\r\n public SHADOWPOISSON3 = false;\r\n public SHADOWPCF0 = false;\r\n public SHADOWPCF1 = false;\r\n public SHADOWPCF2 = false;\r\n public SHADOWPCF3 = false;\r\n public SHADOWPCSS0 = false;\r\n public SHADOWPCSS1 = false;\r\n public SHADOWPCSS2 = false;\r\n public SHADOWPCSS3 = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public LIGHTING = 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 NormalMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\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 needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return this.needAlphaBlending() || mesh.visibility < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public 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 NormalMaterialDefines();\r\n }\r\n\r\n const defines = <NormalMaterialDefines>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 (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\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 = true;\r\n 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 defines.LIGHTING = !this._disableLighting;\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\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);\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"normal\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers = [\"diffuseSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\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: 4 },\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 bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <NormalMaterialDefines>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.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this.diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this.diffuseTexture.getTextureMatrix());\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 // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines);\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 getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): NormalMaterial {\r\n return SerializationHelper.Clone(() => new NormalMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.NormalMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"NormalMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial {\r\n return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NormalMaterial\", NormalMaterial);\r\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/materials",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.46.0",
|
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": "^6.
|
21
|
+
"@babylonjs/core": "^6.46.0",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/materials": "^1.0.0"
|
24
24
|
},
|