@babylonjs/materials 7.34.4 → 7.35.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/cell/cellMaterial.js.map +1 -1
  2. package/custom/customMaterial.js.map +1 -1
  3. package/custom/pbrCustomMaterial.js.map +1 -1
  4. package/fire/fireMaterial.js.map +1 -1
  5. package/fur/furMaterial.js.map +1 -1
  6. package/gradient/gradientMaterial.js.map +1 -1
  7. package/grid/grid.fragment.d.ts +2 -0
  8. package/grid/grid.fragment.js +4 -0
  9. package/grid/grid.fragment.js.map +1 -1
  10. package/grid/grid.vertex.d.ts +2 -0
  11. package/grid/grid.vertex.js +4 -0
  12. package/grid/grid.vertex.js.map +1 -1
  13. package/grid/gridMaterial.js +15 -6
  14. package/grid/gridMaterial.js.map +1 -1
  15. package/lava/lavaMaterial.js.map +1 -1
  16. package/legacy/legacy-cell.js.map +1 -1
  17. package/legacy/legacy-custom.js.map +1 -1
  18. package/legacy/legacy-fire.js.map +1 -1
  19. package/legacy/legacy-fur.js.map +1 -1
  20. package/legacy/legacy-gradient.js.map +1 -1
  21. package/legacy/legacy-grid.js.map +1 -1
  22. package/legacy/legacy-lava.js.map +1 -1
  23. package/legacy/legacy-mix.js.map +1 -1
  24. package/legacy/legacy-normal.js.map +1 -1
  25. package/legacy/legacy-shadowOnly.js.map +1 -1
  26. package/legacy/legacy-simple.js.map +1 -1
  27. package/legacy/legacy-sky.js.map +1 -1
  28. package/legacy/legacy-terrain.js.map +1 -1
  29. package/legacy/legacy-triPlanar.js.map +1 -1
  30. package/legacy/legacy-water.js.map +1 -1
  31. package/legacy/legacy.js.map +1 -1
  32. package/mix/mixMaterial.js.map +1 -1
  33. package/normal/normalMaterial.js.map +1 -1
  34. package/package.json +2 -2
  35. package/shadowOnly/shadowOnlyMaterial.js.map +1 -1
  36. package/simple/simpleMaterial.js.map +1 -1
  37. package/sky/skyMaterial.js.map +1 -1
  38. package/terrain/terrainMaterial.js.map +1 -1
  39. package/triPlanar/triPlanarMaterial.js.map +1 -1
  40. package/water/waterMaterial.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"cellMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/cell/cellMaterial.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;AAG/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;AAGpD,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;IA4B7C;QACI,KAAK,EAAE,CAAC;QA5BL,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,cAAS,GAAG,KAAK,CAAC;QAClB,QAAG,GAAG,KAAK,CAA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,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,UAAU;IACH,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,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;AArTW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDAClB;AAG5B;IADN,iBAAiB,CAAC,SAAS,CAAC;kDACa;AAGnC;IADN,SAAS,CAAC,kBAAkB,CAAC;uDACY;AAEnC;IADN,gBAAgB,CAAC,kCAAkC,CAAC;sDACpB;AAGzB;IADP,SAAS,CAAC,iBAAiB,CAAC;sDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;qDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;4DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;2DACd;AAmSzC,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 { 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\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\n\r\nimport \"./cell.fragment\";\r\nimport \"./cell.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 CellMaterialDefines 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 POINTSIZE = false;\r\n public FOG = 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 NDOTL = true;\r\n public CUSTOMUSERLIGHTING = true;\r\n public CELLBASIC = true;\r\n public DEPTHPREPASS = 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 CellMaterial 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(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"computeHighLevel\")\r\n public _computeHighLevel: boolean = false;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public computeHighLevel: boolean;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new CellMaterialDefines();\r\n }\r\n\r\n const defines = <CellMaterialDefines>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 // High level\r\n defines.CELLBASIC = !this.computeHighLevel;\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 const shaderName = \"cell\";\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 \"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: this.maxSimultaneousLights,\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 - 1 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <CellMaterialDefines>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\r\n // Clip plane\r\n bindClipPlane(this._activeEffect, 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, this._maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._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 override 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 override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return this._diffuseTexture === texture;\r\n }\r\n\r\n public override 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 override getClassName(): string {\r\n return \"CellMaterial\";\r\n }\r\n\r\n public override clone(name: string): CellMaterial {\r\n return SerializationHelper.Clone<CellMaterial>(() => new CellMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.CellMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): CellMaterial {\r\n return SerializationHelper.Parse(() => new CellMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CellMaterial\", CellMaterial);\r\n"]}
1
+ {"version":3,"file":"cellMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/cell/cellMaterial.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;AAG/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,E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IAED,UAAU;IACH,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,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;AArTW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDAClB;AAG5B;IADN,iBAAiB,CAAC,SAAS,CAAC;kDACa;AAGnC;IADN,SAAS,CAAC,kBAAkB,CAAC;uDACY;AAEnC;IADN,gBAAgB,CAAC,kCAAkC,CAAC;sDACpB;AAGzB;IADP,SAAS,CAAC,iBAAiB,CAAC;sDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;qDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;4DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;2DACd;AAmSzC,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 { 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\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\n\r\nimport \"./cell.fragment\";\r\nimport \"./cell.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 CellMaterialDefines 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 POINTSIZE = false;\r\n public FOG = 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 NDOTL = true;\r\n public CUSTOMUSERLIGHTING = true;\r\n public CELLBASIC = true;\r\n public DEPTHPREPASS = 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 CellMaterial 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(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"computeHighLevel\")\r\n public _computeHighLevel: boolean = false;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public computeHighLevel: boolean;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new CellMaterialDefines();\r\n }\r\n\r\n const defines = <CellMaterialDefines>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 // High level\r\n defines.CELLBASIC = !this.computeHighLevel;\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 const shaderName = \"cell\";\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 \"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: this.maxSimultaneousLights,\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 - 1 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <CellMaterialDefines>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\r\n // Clip plane\r\n bindClipPlane(this._activeEffect, 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, this._maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._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 override 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 override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return this._diffuseTexture === texture;\r\n }\r\n\r\n public override 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 override getClassName(): string {\r\n return \"CellMaterial\";\r\n }\r\n\r\n public override clone(name: string): CellMaterial {\r\n return SerializationHelper.Clone<CellMaterial>(() => new CellMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.CellMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): CellMaterial {\r\n return SerializationHelper.Parse(() => new CellMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CellMaterial\", CellMaterial);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"customMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/custom/customMaterial.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AAGnE,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AAIvD,mDAAqC;AACrC,qDAAuC;AAEvC;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAU9B,gBAAe,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC3B,gBAAe,CAAC;CAuEnB;AAED;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,gBAAgB;IA2ChD;;;;OAIG;IACI,eAAe,CAAC,IAAsB,EAAE,MAAc;QACzD,IAAI,IAAI,CAAC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/Materials/Textures/texture\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport type { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\n\r\nimport \"core/Shaders/default.vertex\";\r\nimport \"core/Shaders/default.fragment\";\r\n\r\n/**\r\n * Structure of a custom shader\r\n */\r\nexport class CustomShaderStructure {\r\n /**\r\n * Fragment store\r\n */\r\n public FragmentStore: string;\r\n /**\r\n * Vertex store\r\n */\r\n public VertexStore: string;\r\n\r\n constructor() {}\r\n}\r\n\r\n/**\r\n * Parts of a shader\r\n */\r\nexport class ShaderSpecialParts {\r\n constructor() {}\r\n\r\n /**\r\n * Beginning of the fragment shader\r\n */\r\n public Fragment_Begin: string;\r\n /**\r\n * Variable definitions of the fragment shader\r\n */\r\n public Fragment_Definitions: string;\r\n /**\r\n * Beginning of the fragment main function\r\n */\r\n public Fragment_MainBegin: string;\r\n /**\r\n * End of the fragment main function\r\n */\r\n public Fragment_MainEnd: string;\r\n\r\n /**\r\n * Diffuse color calculation\r\n */\r\n public Fragment_Custom_Diffuse: string;\r\n /**\r\n * Before lightning computations\r\n */\r\n public Fragment_Before_Lights: string;\r\n /**\r\n * Before fog computations\r\n */\r\n public Fragment_Before_Fog: string;\r\n /**\r\n * Alpha calculations\r\n */\r\n public Fragment_Custom_Alpha: string;\r\n /**\r\n * Before frag color is assigned\r\n */\r\n public Fragment_Before_FragColor: string;\r\n /**\r\n * Beginning of the vertex shader\r\n */\r\n public Vertex_Begin: string;\r\n /**\r\n * Variable definitions of the vertex shader\r\n */\r\n public Vertex_Definitions: string;\r\n /**\r\n * Start of the main function of the vertex shader\r\n */\r\n public Vertex_MainBegin: string;\r\n\r\n /**\r\n * Before the world position computation\r\n */\r\n public Vertex_Before_PositionUpdated: string;\r\n\r\n /**\r\n * Before the normal computation\r\n */\r\n public Vertex_Before_NormalUpdated: string;\r\n\r\n /**\r\n * After the world position has been computed\r\n */\r\n public Vertex_After_WorldPosComputed: string;\r\n\r\n /**\r\n * Main end of the vertex shader\r\n */\r\n public Vertex_MainEnd: string;\r\n}\r\n\r\n/**\r\n * Customized material\r\n */\r\nexport class CustomMaterial extends StandardMaterial {\r\n /**\r\n * Index for each created shader\r\n */\r\n public static ShaderIndexer = 1;\r\n /**\r\n * Custom shader structure\r\n */\r\n public CustomParts: ShaderSpecialParts;\r\n /**\r\n * Name of the shader\r\n */\r\n public _createdShaderName: string;\r\n /**\r\n * List of custom uniforms\r\n */\r\n public _customUniform: string[];\r\n /**\r\n * Names of the new uniforms\r\n */\r\n public _newUniforms: string[];\r\n /**\r\n * Instances of the new uniform objects\r\n */\r\n public _newUniformInstances: { [name: string]: any };\r\n /**\r\n * Instances of the new sampler objects\r\n */\r\n public _newSamplerInstances: { [name: string]: Texture };\r\n /**\r\n * List of the custom attributes\r\n */\r\n public _customAttributes: string[];\r\n\r\n /**\r\n * Fragment shader string\r\n */\r\n public FragmentShader: string;\r\n /**\r\n * Vertex shader string\r\n */\r\n public VertexShader: string;\r\n\r\n /**\r\n * Runs after the material is bound to a mesh\r\n * @param mesh mesh bound\r\n * @param effect bound effect used to render\r\n */\r\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\r\n if (this._newUniformInstances) {\r\n for (const el in this._newUniformInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"vec2\") {\r\n effect.setVector2(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"vec3\") {\r\n if (this._newUniformInstances[el] instanceof Color3) {\r\n effect.setColor3(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector3(ea[1], this._newUniformInstances[el]);\r\n }\r\n } else if (ea[0] == \"vec4\") {\r\n if (this._newUniformInstances[el] instanceof Color4) {\r\n effect.setDirectColor4(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n }\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"mat4\") {\r\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"float\") {\r\n effect.setFloat(ea[1], this._newUniformInstances[el]);\r\n }\r\n }\r\n }\r\n if (this._newSamplerInstances) {\r\n for (const el in this._newSamplerInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"sampler2D\" && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\r\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public ReviewUniform(name: string, arr: string[]): string[] {\r\n if (name == \"uniform\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") == -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n if (name == \"sampler\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") != -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n /**\r\n * Builds the material\r\n * @param shaderName name of the shader\r\n * @param uniforms list of uniforms\r\n * @param uniformBuffers list of uniform buffers\r\n * @param samplers list of samplers\r\n * @param defines list of defines\r\n * @param attributes list of attributes\r\n * @returns the shader name\r\n */\r\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[]): string {\r\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\r\n attributes.push(...this._customAttributes);\r\n }\r\n\r\n this.ReviewUniform(\"uniform\", uniforms);\r\n this.ReviewUniform(\"sampler\", samplers);\r\n\r\n const name = this._createdShaderName;\r\n\r\n if (Effect.ShadersStore[name + \"VertexShader\"] && Effect.ShadersStore[name + \"PixelShader\"]) {\r\n return name;\r\n }\r\n Effect.ShadersStore[name + \"VertexShader\"] = this._injectCustomCode(this.VertexShader, \"vertex\");\r\n Effect.ShadersStore[name + \"PixelShader\"] = this._injectCustomCode(this.FragmentShader, \"fragment\");\r\n\r\n return name;\r\n }\r\n\r\n protected _injectCustomCode(code: string, shaderType: string): string {\r\n const customCode = this._getCustomCode(shaderType);\r\n\r\n for (const point in customCode) {\r\n const injectedCode = customCode[point];\r\n\r\n if (injectedCode && injectedCode.length > 0) {\r\n const fullPointName = \"#define \" + point;\r\n code = code.replace(fullPointName, \"\\n\" + injectedCode + \"\\n\" + fullPointName);\r\n }\r\n }\r\n\r\n return code;\r\n }\r\n\r\n protected _getCustomCode(shaderType: string): { [pointName: string]: string } {\r\n if (shaderType === \"vertex\") {\r\n return {\r\n CUSTOM_VERTEX_BEGIN: this.CustomParts.Vertex_Begin,\r\n CUSTOM_VERTEX_DEFINITIONS: (this._customUniform?.join(\"\\n\") || \"\") + (this.CustomParts.Vertex_Definitions || \"\"),\r\n CUSTOM_VERTEX_MAIN_BEGIN: this.CustomParts.Vertex_MainBegin,\r\n CUSTOM_VERTEX_UPDATE_POSITION: this.CustomParts.Vertex_Before_PositionUpdated,\r\n CUSTOM_VERTEX_UPDATE_NORMAL: this.CustomParts.Vertex_Before_NormalUpdated,\r\n CUSTOM_VERTEX_MAIN_END: this.CustomParts.Vertex_MainEnd,\r\n CUSTOM_VERTEX_UPDATE_WORLDPOS: this.CustomParts.Vertex_After_WorldPosComputed,\r\n };\r\n }\r\n return {\r\n CUSTOM_FRAGMENT_BEGIN: this.CustomParts.Fragment_Begin,\r\n CUSTOM_FRAGMENT_DEFINITIONS: (this._customUniform?.join(\"\\n\") || \"\") + (this.CustomParts.Fragment_Definitions || \"\"),\r\n CUSTOM_FRAGMENT_MAIN_BEGIN: this.CustomParts.Fragment_MainBegin,\r\n CUSTOM_FRAGMENT_UPDATE_DIFFUSE: this.CustomParts.Fragment_Custom_Diffuse,\r\n CUSTOM_FRAGMENT_UPDATE_ALPHA: this.CustomParts.Fragment_Custom_Alpha,\r\n CUSTOM_FRAGMENT_BEFORE_LIGHTS: this.CustomParts.Fragment_Before_Lights,\r\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: this.CustomParts.Fragment_Before_FragColor,\r\n CUSTOM_FRAGMENT_MAIN_END: this.CustomParts.Fragment_MainEnd,\r\n CUSTOM_FRAGMENT_BEFORE_FOG: this.CustomParts.Fragment_Before_Fog,\r\n };\r\n }\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene, true);\r\n this.CustomParts = new ShaderSpecialParts();\r\n this.customShaderNameResolve = this.Builder;\r\n\r\n this.FragmentShader = Effect.ShadersStore[\"defaultPixelShader\"];\r\n this.VertexShader = Effect.ShadersStore[\"defaultVertexShader\"];\r\n\r\n CustomMaterial.ShaderIndexer++;\r\n this._createdShaderName = \"custom_\" + CustomMaterial.ShaderIndexer;\r\n }\r\n\r\n protected override _afterBind(mesh?: Mesh, effect: Nullable<Effect> = null, subMesh?: SubMesh): void {\r\n if (!effect) {\r\n return;\r\n }\r\n this.AttachAfterBind(mesh, effect);\r\n try {\r\n super._afterBind(mesh, effect, subMesh);\r\n } catch (e) {}\r\n }\r\n\r\n /**\r\n * Adds a new uniform to the shader\r\n * @param name the name of the uniform to add\r\n * @param kind the type of the uniform to add\r\n * @param param the value of the uniform to add\r\n * @returns the current material\r\n */\r\n public AddUniform(name: string, kind: string, param: any): CustomMaterial {\r\n if (!this._customUniform) {\r\n this._customUniform = new Array();\r\n this._newUniforms = new Array();\r\n this._newSamplerInstances = {};\r\n this._newUniformInstances = {};\r\n }\r\n if (param) {\r\n if (kind.indexOf(\"sampler\") != -1) {\r\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\r\n } else {\r\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\r\n }\r\n }\r\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\r\n this._newUniforms.push(name);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a custom attribute\r\n * @param name the name of the attribute\r\n * @returns the current material\r\n */\r\n public AddAttribute(name: string): CustomMaterial {\r\n if (!this._customAttributes) {\r\n this._customAttributes = [];\r\n }\r\n\r\n this._customAttributes.push(name);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Begin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Begin(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Definitions portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Definitions(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_MainBegin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_MainBegin(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_MainEnd portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_MainEnd(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_MainEnd = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_Diffuse portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Custom_Diffuse = shaderPart.replace(\"result\", \"diffuseColor\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_Alpha portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_Alpha(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_Lights portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_Lights(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Before_Lights = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_Fog portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_Fog(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Before_Fog = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_FragColor portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_FragColor(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Begin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Begin(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Definitions portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Definitions(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_MainBegin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_MainBegin(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Before_PositionUpdated portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Before_NormalUpdated portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_After_WorldPosComputed portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_After_WorldPosComputed(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_MainEnd portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_MainEnd(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_MainEnd = shaderPart;\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CustomMaterial\", CustomMaterial);\r\n"]}
1
+ {"version":3,"file":"customMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/custom/customMaterial.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AAGnE,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AAIvD,mDAAqC;AACrC,qDAAuC;AAEvC;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAU9B,gBAAe,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC3B,gBAAe,CAAC;CAuEnB;AAED;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,g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,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,6BAA6B,CAAC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;;AA3YD;;GAEG;AACW,4BAAa,GAAG,CAAC,CAAC;AA2YpC,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport type { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\n\r\nimport \"core/Shaders/default.vertex\";\r\nimport \"core/Shaders/default.fragment\";\r\n\r\n/**\r\n * Structure of a custom shader\r\n */\r\nexport class CustomShaderStructure {\r\n /**\r\n * Fragment store\r\n */\r\n public FragmentStore: string;\r\n /**\r\n * Vertex store\r\n */\r\n public VertexStore: string;\r\n\r\n constructor() {}\r\n}\r\n\r\n/**\r\n * Parts of a shader\r\n */\r\nexport class ShaderSpecialParts {\r\n constructor() {}\r\n\r\n /**\r\n * Beginning of the fragment shader\r\n */\r\n public Fragment_Begin: string;\r\n /**\r\n * Variable definitions of the fragment shader\r\n */\r\n public Fragment_Definitions: string;\r\n /**\r\n * Beginning of the fragment main function\r\n */\r\n public Fragment_MainBegin: string;\r\n /**\r\n * End of the fragment main function\r\n */\r\n public Fragment_MainEnd: string;\r\n\r\n /**\r\n * Diffuse color calculation\r\n */\r\n public Fragment_Custom_Diffuse: string;\r\n /**\r\n * Before lightning computations\r\n */\r\n public Fragment_Before_Lights: string;\r\n /**\r\n * Before fog computations\r\n */\r\n public Fragment_Before_Fog: string;\r\n /**\r\n * Alpha calculations\r\n */\r\n public Fragment_Custom_Alpha: string;\r\n /**\r\n * Before frag color is assigned\r\n */\r\n public Fragment_Before_FragColor: string;\r\n /**\r\n * Beginning of the vertex shader\r\n */\r\n public Vertex_Begin: string;\r\n /**\r\n * Variable definitions of the vertex shader\r\n */\r\n public Vertex_Definitions: string;\r\n /**\r\n * Start of the main function of the vertex shader\r\n */\r\n public Vertex_MainBegin: string;\r\n\r\n /**\r\n * Before the world position computation\r\n */\r\n public Vertex_Before_PositionUpdated: string;\r\n\r\n /**\r\n * Before the normal computation\r\n */\r\n public Vertex_Before_NormalUpdated: string;\r\n\r\n /**\r\n * After the world position has been computed\r\n */\r\n public Vertex_After_WorldPosComputed: string;\r\n\r\n /**\r\n * Main end of the vertex shader\r\n */\r\n public Vertex_MainEnd: string;\r\n}\r\n\r\n/**\r\n * Customized material\r\n */\r\nexport class CustomMaterial extends StandardMaterial {\r\n /**\r\n * Index for each created shader\r\n */\r\n public static ShaderIndexer = 1;\r\n /**\r\n * Custom shader structure\r\n */\r\n public CustomParts: ShaderSpecialParts;\r\n /**\r\n * Name of the shader\r\n */\r\n public _createdShaderName: string;\r\n /**\r\n * List of custom uniforms\r\n */\r\n public _customUniform: string[];\r\n /**\r\n * Names of the new uniforms\r\n */\r\n public _newUniforms: string[];\r\n /**\r\n * Instances of the new uniform objects\r\n */\r\n public _newUniformInstances: { [name: string]: any };\r\n /**\r\n * Instances of the new sampler objects\r\n */\r\n public _newSamplerInstances: { [name: string]: Texture };\r\n /**\r\n * List of the custom attributes\r\n */\r\n public _customAttributes: string[];\r\n\r\n /**\r\n * Fragment shader string\r\n */\r\n public FragmentShader: string;\r\n /**\r\n * Vertex shader string\r\n */\r\n public VertexShader: string;\r\n\r\n /**\r\n * Runs after the material is bound to a mesh\r\n * @param mesh mesh bound\r\n * @param effect bound effect used to render\r\n */\r\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\r\n if (this._newUniformInstances) {\r\n for (const el in this._newUniformInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"vec2\") {\r\n effect.setVector2(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"vec3\") {\r\n if (this._newUniformInstances[el] instanceof Color3) {\r\n effect.setColor3(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector3(ea[1], this._newUniformInstances[el]);\r\n }\r\n } else if (ea[0] == \"vec4\") {\r\n if (this._newUniformInstances[el] instanceof Color4) {\r\n effect.setDirectColor4(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n }\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"mat4\") {\r\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"float\") {\r\n effect.setFloat(ea[1], this._newUniformInstances[el]);\r\n }\r\n }\r\n }\r\n if (this._newSamplerInstances) {\r\n for (const el in this._newSamplerInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"sampler2D\" && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\r\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public ReviewUniform(name: string, arr: string[]): string[] {\r\n if (name == \"uniform\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") == -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n if (name == \"sampler\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") != -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n /**\r\n * Builds the material\r\n * @param shaderName name of the shader\r\n * @param uniforms list of uniforms\r\n * @param uniformBuffers list of uniform buffers\r\n * @param samplers list of samplers\r\n * @param defines list of defines\r\n * @param attributes list of attributes\r\n * @returns the shader name\r\n */\r\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[]): string {\r\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\r\n attributes.push(...this._customAttributes);\r\n }\r\n\r\n this.ReviewUniform(\"uniform\", uniforms);\r\n this.ReviewUniform(\"sampler\", samplers);\r\n\r\n const name = this._createdShaderName;\r\n\r\n if (Effect.ShadersStore[name + \"VertexShader\"] && Effect.ShadersStore[name + \"PixelShader\"]) {\r\n return name;\r\n }\r\n Effect.ShadersStore[name + \"VertexShader\"] = this._injectCustomCode(this.VertexShader, \"vertex\");\r\n Effect.ShadersStore[name + \"PixelShader\"] = this._injectCustomCode(this.FragmentShader, \"fragment\");\r\n\r\n return name;\r\n }\r\n\r\n protected _injectCustomCode(code: string, shaderType: string): string {\r\n const customCode = this._getCustomCode(shaderType);\r\n\r\n for (const point in customCode) {\r\n const injectedCode = customCode[point];\r\n\r\n if (injectedCode && injectedCode.length > 0) {\r\n const fullPointName = \"#define \" + point;\r\n code = code.replace(fullPointName, \"\\n\" + injectedCode + \"\\n\" + fullPointName);\r\n }\r\n }\r\n\r\n return code;\r\n }\r\n\r\n protected _getCustomCode(shaderType: string): { [pointName: string]: string } {\r\n if (shaderType === \"vertex\") {\r\n return {\r\n CUSTOM_VERTEX_BEGIN: this.CustomParts.Vertex_Begin,\r\n CUSTOM_VERTEX_DEFINITIONS: (this._customUniform?.join(\"\\n\") || \"\") + (this.CustomParts.Vertex_Definitions || \"\"),\r\n CUSTOM_VERTEX_MAIN_BEGIN: this.CustomParts.Vertex_MainBegin,\r\n CUSTOM_VERTEX_UPDATE_POSITION: this.CustomParts.Vertex_Before_PositionUpdated,\r\n CUSTOM_VERTEX_UPDATE_NORMAL: this.CustomParts.Vertex_Before_NormalUpdated,\r\n CUSTOM_VERTEX_MAIN_END: this.CustomParts.Vertex_MainEnd,\r\n CUSTOM_VERTEX_UPDATE_WORLDPOS: this.CustomParts.Vertex_After_WorldPosComputed,\r\n };\r\n }\r\n return {\r\n CUSTOM_FRAGMENT_BEGIN: this.CustomParts.Fragment_Begin,\r\n CUSTOM_FRAGMENT_DEFINITIONS: (this._customUniform?.join(\"\\n\") || \"\") + (this.CustomParts.Fragment_Definitions || \"\"),\r\n CUSTOM_FRAGMENT_MAIN_BEGIN: this.CustomParts.Fragment_MainBegin,\r\n CUSTOM_FRAGMENT_UPDATE_DIFFUSE: this.CustomParts.Fragment_Custom_Diffuse,\r\n CUSTOM_FRAGMENT_UPDATE_ALPHA: this.CustomParts.Fragment_Custom_Alpha,\r\n CUSTOM_FRAGMENT_BEFORE_LIGHTS: this.CustomParts.Fragment_Before_Lights,\r\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: this.CustomParts.Fragment_Before_FragColor,\r\n CUSTOM_FRAGMENT_MAIN_END: this.CustomParts.Fragment_MainEnd,\r\n CUSTOM_FRAGMENT_BEFORE_FOG: this.CustomParts.Fragment_Before_Fog,\r\n };\r\n }\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene, true);\r\n this.CustomParts = new ShaderSpecialParts();\r\n this.customShaderNameResolve = this.Builder;\r\n\r\n this.FragmentShader = Effect.ShadersStore[\"defaultPixelShader\"];\r\n this.VertexShader = Effect.ShadersStore[\"defaultVertexShader\"];\r\n\r\n CustomMaterial.ShaderIndexer++;\r\n this._createdShaderName = \"custom_\" + CustomMaterial.ShaderIndexer;\r\n }\r\n\r\n protected override _afterBind(mesh?: Mesh, effect: Nullable<Effect> = null, subMesh?: SubMesh): void {\r\n if (!effect) {\r\n return;\r\n }\r\n this.AttachAfterBind(mesh, effect);\r\n try {\r\n super._afterBind(mesh, effect, subMesh);\r\n } catch (e) {}\r\n }\r\n\r\n /**\r\n * Adds a new uniform to the shader\r\n * @param name the name of the uniform to add\r\n * @param kind the type of the uniform to add\r\n * @param param the value of the uniform to add\r\n * @returns the current material\r\n */\r\n public AddUniform(name: string, kind: string, param: any): CustomMaterial {\r\n if (!this._customUniform) {\r\n this._customUniform = new Array();\r\n this._newUniforms = new Array();\r\n this._newSamplerInstances = {};\r\n this._newUniformInstances = {};\r\n }\r\n if (param) {\r\n if (kind.indexOf(\"sampler\") != -1) {\r\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\r\n } else {\r\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\r\n }\r\n }\r\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\r\n this._newUniforms.push(name);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a custom attribute\r\n * @param name the name of the attribute\r\n * @returns the current material\r\n */\r\n public AddAttribute(name: string): CustomMaterial {\r\n if (!this._customAttributes) {\r\n this._customAttributes = [];\r\n }\r\n\r\n this._customAttributes.push(name);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Begin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Begin(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Definitions portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Definitions(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_MainBegin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_MainBegin(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_MainEnd portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_MainEnd(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_MainEnd = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_Diffuse portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Custom_Diffuse = shaderPart.replace(\"result\", \"diffuseColor\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_Alpha portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_Alpha(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_Lights portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_Lights(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Before_Lights = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_Fog portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_Fog(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Before_Fog = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_FragColor portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_FragColor(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Begin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Begin(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Definitions portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Definitions(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_MainBegin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_MainBegin(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Before_PositionUpdated portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Before_NormalUpdated portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_After_WorldPosComputed portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_After_WorldPosComputed(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_MainEnd portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_MainEnd(shaderPart: string): CustomMaterial {\r\n this.CustomParts.Vertex_MainEnd = shaderPart;\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CustomMaterial\", CustomM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AkB,GAAG,UAAU,CAAC;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,UAAkB;QACtC,IAAI,CAAC,WAAW,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,6BAA6B,CAAC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,UAAkB;QACjD,IAAI,CAAC,WAAW,CAAC,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,6BAA6B,CAAC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;;AAtcD;;GAEG;AACW,+BAAa,GAAG,CAAC,CAAC;AAscpC,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport type { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { ShaderCodeInliner } from \"core/Engines/Processors/shaderCodeInliner\";\r\nimport type { ICustomShaderNameResolveOptions } from \"core/Materials/material\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\n\r\nimport \"core/Shaders/pbr.vertex\";\r\nimport \"core/Shaders/pbr.fragment\";\r\n\r\n/**\r\n * Albedo parts of the shader\r\n */\r\nexport class ShaderAlbedoParts {\r\n constructor() {}\r\n\r\n /**\r\n * Beginning of the fragment shader\r\n */\r\n public Fragment_Begin: string;\r\n /**\r\n * Fragment definitions\r\n */\r\n public Fragment_Definitions: string;\r\n /**\r\n * Beginning of the main function\r\n */\r\n public Fragment_MainBegin: string;\r\n /**\r\n * End of main function\r\n */\r\n public Fragment_MainEnd: string;\r\n\r\n /**\r\n * Albedo color\r\n */\r\n public Fragment_Custom_Albedo: string;\r\n /**\r\n * Lights\r\n */\r\n public Fragment_Before_Lights: string;\r\n /**\r\n * Metallic and roughness\r\n */\r\n public Fragment_Custom_MetallicRoughness: string;\r\n /**\r\n * Microsurface\r\n */\r\n public Fragment_Custom_MicroSurface: string;\r\n /**\r\n * Fog computations\r\n */\r\n public Fragment_Before_Fog: string;\r\n /**\r\n * Alpha\r\n */\r\n public Fragment_Custom_Alpha: string;\r\n /**\r\n * Color composition\r\n */\r\n public Fragment_Before_FinalColorComposition: string;\r\n /**\r\n * Fragment color\r\n */\r\n public Fragment_Before_FragColor: string;\r\n\r\n /**\r\n * Beginning of vertex shader\r\n */\r\n public Vertex_Begin: string;\r\n /**\r\n * Vertex definitions\r\n */\r\n public Vertex_Definitions: string;\r\n /**\r\n * Vertex main begin\r\n */\r\n public Vertex_MainBegin: string;\r\n\r\n /**\r\n * Vertex before position updated\r\n */\r\n public Vertex_Before_PositionUpdated: string;\r\n\r\n /**\r\n * Vertex before normal updated\r\n */\r\n public Vertex_Before_NormalUpdated: string;\r\n\r\n /**\r\n * Vertex after world pos computed\r\n */\r\n public Vertex_After_WorldPosComputed: string;\r\n\r\n /**\r\n * Vertex main end\r\n */\r\n public Vertex_MainEnd: string;\r\n}\r\n\r\n/**\r\n * @deprecated use ShaderAlbedoParts instead.\r\n */\r\nexport const ShaderAlebdoParts = ShaderAlbedoParts;\r\n\r\nexport class PBRCustomMaterial extends PBRMaterial {\r\n /**\r\n * Index for each created shader\r\n */\r\n public static ShaderIndexer = 1;\r\n /**\r\n * Custom shader structure\r\n */\r\n public CustomParts: ShaderAlbedoParts;\r\n /**\r\n * Name of the shader\r\n */\r\n _createdShaderName: string;\r\n /**\r\n * List of custom uniforms\r\n */\r\n _customUniform: string[];\r\n /**\r\n * Names of the new uniforms\r\n */\r\n _newUniforms: string[];\r\n /**\r\n * Instances of the new uniform objects\r\n */\r\n _newUniformInstances: { [name: string]: any };\r\n /**\r\n * Instances of the new sampler objects\r\n */\r\n _newSamplerInstances: { [name: string]: Texture };\r\n /**\r\n * List of the custom attributes\r\n */\r\n _customAttributes: string[];\r\n\r\n /**\r\n * Fragment shader string\r\n */\r\n public FragmentShader: string;\r\n /**\r\n * Vertex shader string\r\n */\r\n public VertexShader: string;\r\n\r\n /**\r\n * Runs after the material is bound to a mesh\r\n * @param mesh mesh bound\r\n * @param effect bound effect used to render\r\n */\r\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\r\n if (this._newUniformInstances) {\r\n for (const el in this._newUniformInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"vec2\") {\r\n effect.setVector2(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"vec3\") {\r\n if (this._newUniformInstances[el] instanceof Color3) {\r\n effect.setColor3(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector3(ea[1], this._newUniformInstances[el]);\r\n }\r\n } else if (ea[0] == \"vec4\") {\r\n if (this._newUniformInstances[el] instanceof Color4) {\r\n effect.setDirectColor4(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n }\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"mat4\") {\r\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"float\") {\r\n effect.setFloat(ea[1], this._newUniformInstances[el]);\r\n }\r\n }\r\n }\r\n if (this._newSamplerInstances) {\r\n for (const el in this._newSamplerInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"sampler2D\" && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\r\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public ReviewUniform(name: string, arr: string[]): string[] {\r\n if (name == \"uniform\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") == -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n if (name == \"sampler\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") != -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n /**\r\n * Builds the material\r\n * @param shaderName name of the shader\r\n * @param uniforms list of uniforms\r\n * @param uniformBuffers list of uniform buffers\r\n * @param samplers list of samplers\r\n * @param defines list of defines\r\n * @param attributes list of attributes\r\n * @param options options to compile the shader\r\n * @returns the shader name\r\n */\r\n public Builder(\r\n shaderName: string,\r\n uniforms: string[],\r\n uniformBuffers: string[],\r\n samplers: string[],\r\n defines: MaterialDefines | string[],\r\n attributes?: string[],\r\n options?: ICustomShaderNameResolveOptions\r\n ): string {\r\n if (options) {\r\n const currentProcessing = options.processFinalCode;\r\n options.processFinalCode = (type: string, code: string) => {\r\n if (type === \"vertex\") {\r\n return currentProcessing ? currentProcessing(type, code) : code;\r\n }\r\n const sci = new ShaderCodeInliner(code);\r\n sci.inlineToken = \"#define pbr_inline\";\r\n sci.processCode();\r\n return currentProcessing ? currentProcessing(type, sci.code) : sci.code;\r\n };\r\n }\r\n\r\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\r\n attributes.push(...this._customAttributes);\r\n }\r\n\r\n this.ReviewUniform(\"uniform\", uniforms);\r\n this.ReviewUniform(\"sampler\", samplers);\r\n\r\n const name = this._createdShaderName;\r\n\r\n if (Effect.ShadersStore[name + \"VertexShader\"] && Effect.ShadersStore[name + \"PixelShader\"]) {\r\n return name;\r\n }\r\n Effect.ShadersStore[name + \"VertexShader\"] = this._injectCustomCode(this.VertexShader, \"vertex\");\r\n Effect.ShadersStore[name + \"PixelShader\"] = this._injectCustomCode(this.FragmentShader, \"fragment\");\r\n\r\n return name;\r\n }\r\n\r\n protected _injectCustomCode(code: string, shaderType: string): string {\r\n const customCode = this._getCustomCode(shaderType);\r\n\r\n for (const point in customCode) {\r\n const injectedCode = customCode[point];\r\n\r\n if (injectedCode && injectedCode.length > 0) {\r\n const fullPointName = \"#define \" + point;\r\n code = code.replace(fullPointName, \"\\n\" + injectedCode + \"\\n\" + fullPointName);\r\n }\r\n }\r\n\r\n return code;\r\n }\r\n\r\n protected _getCustomCode(shaderType: string): { [pointName: string]: string } {\r\n if (shaderType === \"vertex\") {\r\n return {\r\n CUSTOM_VERTEX_BEGIN: this.CustomParts.Vertex_Begin,\r\n CUSTOM_VERTEX_DEFINITIONS: (this._customUniform?.join(\"\\n\") || \"\") + (this.CustomParts.Vertex_Definitions || \"\"),\r\n CUSTOM_VERTEX_MAIN_BEGIN: this.CustomParts.Vertex_MainBegin,\r\n CUSTOM_VERTEX_UPDATE_POSITION: this.CustomParts.Vertex_Before_PositionUpdated,\r\n CUSTOM_VERTEX_UPDATE_NORMAL: this.CustomParts.Vertex_Before_NormalUpdated,\r\n CUSTOM_VERTEX_MAIN_END: this.CustomParts.Vertex_MainEnd,\r\n CUSTOM_VERTEX_UPDATE_WORLDPOS: this.CustomParts.Vertex_After_WorldPosComputed,\r\n };\r\n }\r\n return {\r\n CUSTOM_FRAGMENT_BEGIN: this.CustomParts.Fragment_Begin,\r\n CUSTOM_FRAGMENT_MAIN_BEGIN: this.CustomParts.Fragment_MainBegin,\r\n CUSTOM_FRAGMENT_DEFINITIONS: (this._customUniform?.join(\"\\n\") || \"\") + (this.CustomParts.Fragment_Definitions || \"\"),\r\n CUSTOM_FRAGMENT_UPDATE_ALBEDO: this.CustomParts.Fragment_Custom_Albedo,\r\n CUSTOM_FRAGMENT_UPDATE_ALPHA: this.CustomParts.Fragment_Custom_Alpha,\r\n CUSTOM_FRAGMENT_BEFORE_LIGHTS: this.CustomParts.Fragment_Before_Lights,\r\n CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS: this.CustomParts.Fragment_Custom_MetallicRoughness,\r\n CUSTOM_FRAGMENT_UPDATE_MICROSURFACE: this.CustomParts.Fragment_Custom_MicroSurface,\r\n CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION: this.CustomParts.Fragment_Before_FinalColorComposition,\r\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: this.CustomParts.Fragment_Before_FragColor,\r\n CUSTOM_FRAGMENT_MAIN_END: this.CustomParts.Fragment_MainEnd,\r\n CUSTOM_FRAGMENT_BEFORE_FOG: this.CustomParts.Fragment_Before_Fog,\r\n };\r\n }\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene, true);\r\n this.CustomParts = new ShaderAlbedoParts();\r\n this.customShaderNameResolve = this.Builder;\r\n\r\n this.FragmentShader = Effect.ShadersStore[\"pbrPixelShader\"];\r\n this.VertexShader = Effect.ShadersStore[\"pbrVertexShader\"];\r\n\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g, Effect.IncludesShadersStore[\"pbrBlockAlbedoOpacity\"]);\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore[\"pbrBlockReflectivity\"]);\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore[\"pbrBlockFinalColorComposition\"]);\r\n\r\n PBRCustomMaterial.ShaderIndexer++;\r\n this._createdShaderName = \"custompbr_\" + PBRCustomMaterial.ShaderIndexer;\r\n }\r\n\r\n protected override _afterBind(mesh?: Mesh, effect: Nullable<Effect> = null, subMesh?: SubMesh): void {\r\n if (!effect) {\r\n return;\r\n }\r\n this.AttachAfterBind(mesh, effect);\r\n try {\r\n super._afterBind(mesh, effect, subMesh);\r\n } catch (e) {}\r\n }\r\n\r\n /**\r\n * Adds a new uniform to the shader\r\n * @param name the name of the uniform to add\r\n * @param kind the type of the uniform to add\r\n * @param param the value of the uniform to add\r\n * @returns the current material\r\n */\r\n public AddUniform(name: string, kind: string, param: any): PBRCustomMaterial {\r\n if (!this._customUniform) {\r\n this._customUniform = new Array();\r\n this._newUniforms = new Array();\r\n this._newSamplerInstances = {};\r\n this._newUniformInstances = {};\r\n }\r\n if (param) {\r\n if (kind.indexOf(\"sampler\") != -1) {\r\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\r\n } else {\r\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\r\n }\r\n }\r\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\r\n this._newUniforms.push(name);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a custom attribute\r\n * @param name the name of the attribute\r\n * @returns the current material\r\n */\r\n public AddAttribute(name: string): PBRCustomMaterial {\r\n if (!this._customAttributes) {\r\n this._customAttributes = [];\r\n }\r\n\r\n this._customAttributes.push(name);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Begin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Begin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Definitions portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Definitions(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_MainBegin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_MainBegin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_Albedo portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace(\"result\", \"surfaceAlbedo\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_Alpha portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_Lights portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_Lights = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_MetallicRoughness portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_MicroSurface portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_Fog portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_Fog = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_FinalColorComposition portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_FinalColorComposition = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_FragColor portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_MainEnd portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_MainEnd(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_MainEnd = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Begin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Begin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Definitions portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Definitions(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_MainBegin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_MainBegin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Before_PositionUpdated portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Before_NormalUpdated portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_After_WorldPosComputed portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_MainEnd portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_MainEnd(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_MainEnd = shaderPart;\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PBRCustomMaterial\", PBRCustomMaterial);\r\n"]}
1
+ {"version":3,"file":"pbrCustomMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/custom/pbrCustomMaterial.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAG7D,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,iBAAiB,EAAE,gEAAkD;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AAIvD,+CAAiC;AACjC,i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I,kBAAkB,CAAC,UAAkB;QACxC,IAAI,CAAC,WAAW,CAAC,kBAAkB,GAAG,UAAU,CAAC;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,UAAkB;QACtC,IAAI,CAAC,WAAW,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,6BAA6B,CAAC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,UAAkB;QACjD,IAAI,CAAC,WAAW,CAAC,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,6BAA6B,CAAC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;;AAtcD;;GAEG;AACW,+BAAa,GAAG,CAAC,CAAC;AAscpC,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport type { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { ShaderCodeInliner } from \"core/Engines/Processors/shaderCodeInliner\";\r\nimport type { ICustomShaderNameResolveOptions } from \"core/Materials/material\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\n\r\nimport \"core/Shaders/pbr.vertex\";\r\nimport \"core/Shaders/pbr.fragment\";\r\n\r\n/**\r\n * Albedo parts of the shader\r\n */\r\nexport class ShaderAlbedoParts {\r\n constructor() {}\r\n\r\n /**\r\n * Beginning of the fragment shader\r\n */\r\n public Fragment_Begin: string;\r\n /**\r\n * Fragment definitions\r\n */\r\n public Fragment_Definitions: string;\r\n /**\r\n * Beginning of the main function\r\n */\r\n public Fragment_MainBegin: string;\r\n /**\r\n * End of main function\r\n */\r\n public Fragment_MainEnd: string;\r\n\r\n /**\r\n * Albedo color\r\n */\r\n public Fragment_Custom_Albedo: string;\r\n /**\r\n * Lights\r\n */\r\n public Fragment_Before_Lights: string;\r\n /**\r\n * Metallic and roughness\r\n */\r\n public Fragment_Custom_MetallicRoughness: string;\r\n /**\r\n * Microsurface\r\n */\r\n public Fragment_Custom_MicroSurface: string;\r\n /**\r\n * Fog computations\r\n */\r\n public Fragment_Before_Fog: string;\r\n /**\r\n * Alpha\r\n */\r\n public Fragment_Custom_Alpha: string;\r\n /**\r\n * Color composition\r\n */\r\n public Fragment_Before_FinalColorComposition: string;\r\n /**\r\n * Fragment color\r\n */\r\n public Fragment_Before_FragColor: string;\r\n\r\n /**\r\n * Beginning of vertex shader\r\n */\r\n public Vertex_Begin: string;\r\n /**\r\n * Vertex definitions\r\n */\r\n public Vertex_Definitions: string;\r\n /**\r\n * Vertex main begin\r\n */\r\n public Vertex_MainBegin: string;\r\n\r\n /**\r\n * Vertex before position updated\r\n */\r\n public Vertex_Before_PositionUpdated: string;\r\n\r\n /**\r\n * Vertex before normal updated\r\n */\r\n public Vertex_Before_NormalUpdated: string;\r\n\r\n /**\r\n * Vertex after world pos computed\r\n */\r\n public Vertex_After_WorldPosComputed: string;\r\n\r\n /**\r\n * Vertex main end\r\n */\r\n public Vertex_MainEnd: string;\r\n}\r\n\r\n/**\r\n * @deprecated use ShaderAlbedoParts instead.\r\n */\r\nexport const ShaderAlebdoParts = ShaderAlbedoParts;\r\n\r\nexport class PBRCustomMaterial extends PBRMaterial {\r\n /**\r\n * Index for each created shader\r\n */\r\n public static ShaderIndexer = 1;\r\n /**\r\n * Custom shader structure\r\n */\r\n public CustomParts: ShaderAlbedoParts;\r\n /**\r\n * Name of the shader\r\n */\r\n _createdShaderName: string;\r\n /**\r\n * List of custom uniforms\r\n */\r\n _customUniform: string[];\r\n /**\r\n * Names of the new uniforms\r\n */\r\n _newUniforms: string[];\r\n /**\r\n * Instances of the new uniform objects\r\n */\r\n _newUniformInstances: { [name: string]: any };\r\n /**\r\n * Instances of the new sampler objects\r\n */\r\n _newSamplerInstances: { [name: string]: Texture };\r\n /**\r\n * List of the custom attributes\r\n */\r\n _customAttributes: string[];\r\n\r\n /**\r\n * Fragment shader string\r\n */\r\n public FragmentShader: string;\r\n /**\r\n * Vertex shader string\r\n */\r\n public VertexShader: string;\r\n\r\n /**\r\n * Runs after the material is bound to a mesh\r\n * @param mesh mesh bound\r\n * @param effect bound effect used to render\r\n */\r\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\r\n if (this._newUniformInstances) {\r\n for (const el in this._newUniformInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"vec2\") {\r\n effect.setVector2(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"vec3\") {\r\n if (this._newUniformInstances[el] instanceof Color3) {\r\n effect.setColor3(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector3(ea[1], this._newUniformInstances[el]);\r\n }\r\n } else if (ea[0] == \"vec4\") {\r\n if (this._newUniformInstances[el] instanceof Color4) {\r\n effect.setDirectColor4(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n }\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"mat4\") {\r\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"float\") {\r\n effect.setFloat(ea[1], this._newUniformInstances[el]);\r\n }\r\n }\r\n }\r\n if (this._newSamplerInstances) {\r\n for (const el in this._newSamplerInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"sampler2D\" && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\r\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public ReviewUniform(name: string, arr: string[]): string[] {\r\n if (name == \"uniform\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") == -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n if (name == \"sampler\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") != -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n /**\r\n * Builds the material\r\n * @param shaderName name of the shader\r\n * @param uniforms list of uniforms\r\n * @param uniformBuffers list of uniform buffers\r\n * @param samplers list of samplers\r\n * @param defines list of defines\r\n * @param attributes list of attributes\r\n * @param options options to compile the shader\r\n * @returns the shader name\r\n */\r\n public Builder(\r\n shaderName: string,\r\n uniforms: string[],\r\n uniformBuffers: string[],\r\n samplers: string[],\r\n defines: MaterialDefines | string[],\r\n attributes?: string[],\r\n options?: ICustomShaderNameResolveOptions\r\n ): string {\r\n if (options) {\r\n const currentProcessing = options.processFinalCode;\r\n options.processFinalCode = (type: string, code: string) => {\r\n if (type === \"vertex\") {\r\n return currentProcessing ? currentProcessing(type, code) : code;\r\n }\r\n const sci = new ShaderCodeInliner(code);\r\n sci.inlineToken = \"#define pbr_inline\";\r\n sci.processCode();\r\n return currentProcessing ? currentProcessing(type, sci.code) : sci.code;\r\n };\r\n }\r\n\r\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\r\n attributes.push(...this._customAttributes);\r\n }\r\n\r\n this.ReviewUniform(\"uniform\", uniforms);\r\n this.ReviewUniform(\"sampler\", samplers);\r\n\r\n const name = this._createdShaderName;\r\n\r\n if (Effect.ShadersStore[name + \"VertexShader\"] && Effect.ShadersStore[name + \"PixelShader\"]) {\r\n return name;\r\n }\r\n Effect.ShadersStore[name + \"VertexShader\"] = this._injectCustomCode(this.VertexShader, \"vertex\");\r\n Effect.ShadersStore[name + \"PixelShader\"] = this._injectCustomCode(this.FragmentShader, \"fragment\");\r\n\r\n return name;\r\n }\r\n\r\n protected _injectCustomCode(code: string, shaderType: string): string {\r\n const customCode = this._getCustomCode(shaderType);\r\n\r\n for (const point in customCode) {\r\n const injectedCode = customCode[point];\r\n\r\n if (injectedCode && injectedCode.length > 0) {\r\n const fullPointName = \"#define \" + point;\r\n code = code.replace(fullPointName, \"\\n\" + injectedCode + \"\\n\" + fullPointName);\r\n }\r\n }\r\n\r\n return code;\r\n }\r\n\r\n protected _getCustomCode(shaderType: string): { [pointName: string]: string } {\r\n if (shaderType === \"vertex\") {\r\n return {\r\n CUSTOM_VERTEX_BEGIN: this.CustomParts.Vertex_Begin,\r\n CUSTOM_VERTEX_DEFINITIONS: (this._customUniform?.join(\"\\n\") || \"\") + (this.CustomParts.Vertex_Definitions || \"\"),\r\n CUSTOM_VERTEX_MAIN_BEGIN: this.CustomParts.Vertex_MainBegin,\r\n CUSTOM_VERTEX_UPDATE_POSITION: this.CustomParts.Vertex_Before_PositionUpdated,\r\n CUSTOM_VERTEX_UPDATE_NORMAL: this.CustomParts.Vertex_Before_NormalUpdated,\r\n CUSTOM_VERTEX_MAIN_END: this.CustomParts.Vertex_MainEnd,\r\n CUSTOM_VERTEX_UPDATE_WORLDPOS: this.CustomParts.Vertex_After_WorldPosComputed,\r\n };\r\n }\r\n return {\r\n CUSTOM_FRAGMENT_BEGIN: this.CustomParts.Fragment_Begin,\r\n CUSTOM_FRAGMENT_MAIN_BEGIN: this.CustomParts.Fragment_MainBegin,\r\n CUSTOM_FRAGMENT_DEFINITIONS: (this._customUniform?.join(\"\\n\") || \"\") + (this.CustomParts.Fragment_Definitions || \"\"),\r\n CUSTOM_FRAGMENT_UPDATE_ALBEDO: this.CustomParts.Fragment_Custom_Albedo,\r\n CUSTOM_FRAGMENT_UPDATE_ALPHA: this.CustomParts.Fragment_Custom_Alpha,\r\n CUSTOM_FRAGMENT_BEFORE_LIGHTS: this.CustomParts.Fragment_Before_Lights,\r\n CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS: this.CustomParts.Fragment_Custom_MetallicRoughness,\r\n CUSTOM_FRAGMENT_UPDATE_MICROSURFACE: this.CustomParts.Fragment_Custom_MicroSurface,\r\n CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION: this.CustomParts.Fragment_Before_FinalColorComposition,\r\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: this.CustomParts.Fragment_Before_FragColor,\r\n CUSTOM_FRAGMENT_MAIN_END: this.CustomParts.Fragment_MainEnd,\r\n CUSTOM_FRAGMENT_BEFORE_FOG: this.CustomParts.Fragment_Before_Fog,\r\n };\r\n }\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene, true);\r\n this.CustomParts = new ShaderAlbedoParts();\r\n this.customShaderNameResolve = this.Builder;\r\n\r\n this.FragmentShader = Effect.ShadersStore[\"pbrPixelShader\"];\r\n this.VertexShader = Effect.ShadersStore[\"pbrVertexShader\"];\r\n\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g, Effect.IncludesShadersStore[\"pbrBlockAlbedoOpacity\"]);\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore[\"pbrBlockReflectivity\"]);\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore[\"pbrBlockFinalColorComposition\"]);\r\n\r\n PBRCustomMaterial.ShaderIndexer++;\r\n this._createdShaderName = \"custompbr_\" + PBRCustomMaterial.ShaderIndexer;\r\n }\r\n\r\n protected override _afterBind(mesh?: Mesh, effect: Nullable<Effect> = null, subMesh?: SubMesh): void {\r\n if (!effect) {\r\n return;\r\n }\r\n this.AttachAfterBind(mesh, effect);\r\n try {\r\n super._afterBind(mesh, effect, subMesh);\r\n } catch (e) {}\r\n }\r\n\r\n /**\r\n * Adds a new uniform to the shader\r\n * @param name the name of the uniform to add\r\n * @param kind the type of the uniform to add\r\n * @param param the value of the uniform to add\r\n * @returns the current material\r\n */\r\n public AddUniform(name: string, kind: string, param: any): PBRCustomMaterial {\r\n if (!this._customUniform) {\r\n this._customUniform = new Array();\r\n this._newUniforms = new Array();\r\n this._newSamplerInstances = {};\r\n this._newUniformInstances = {};\r\n }\r\n if (param) {\r\n if (kind.indexOf(\"sampler\") != -1) {\r\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\r\n } else {\r\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\r\n }\r\n }\r\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\r\n this._newUniforms.push(name);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a custom attribute\r\n * @param name the name of the attribute\r\n * @returns the current material\r\n */\r\n public AddAttribute(name: string): PBRCustomMaterial {\r\n if (!this._customAttributes) {\r\n this._customAttributes = [];\r\n }\r\n\r\n this._customAttributes.push(name);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Begin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Begin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Definitions portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Definitions(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_MainBegin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_MainBegin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_Albedo portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace(\"result\", \"surfaceAlbedo\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_Alpha portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_Lights portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_Lights = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_MetallicRoughness portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Custom_MicroSurface portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_Fog portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_Fog = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_FinalColorComposition portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_FinalColorComposition = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_Before_FragColor portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Fragment_MainEnd portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Fragment_MainEnd(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_MainEnd = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Begin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Begin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Definitions portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Definitions(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_MainBegin portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_MainBegin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Before_PositionUpdated portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_Before_NormalUpdated portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_After_WorldPosComputed portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the code on Vertex_MainEnd portion\r\n * @param shaderPart the code string\r\n * @returns the current material\r\n */\r\n public Vertex_MainEnd(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_MainEnd = shaderPart;\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PBRCustomMaterial\", PBRCustomMaterial);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fireMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/fire/fireMaterial.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;AAC/C,O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EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,QAAQ,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAClD,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAEtC,IAAI,MAAM,CAAC,eAAe,EAAE;YACxB,QAAQ,CAAC,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SACpF;QAED,IAAI,MAAM,CAAC,kBAAkB,EAAE;YAC3B,QAAQ,CAAC,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SAC1F;QAED,IAAI,MAAM,CAAC,eAAe,EAAE;YACxB,QAAQ,CAAC,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SACpF;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAtXW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACU;AAExC;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACR;AAGrC;IADP,kBAAkB,CAAC,mBAAmB,CAAC;wDACU;AAE3C;IADN,gBAAgB,CAAC,kCAAkC,CAAC;uDACL;AAGxC;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACU;AAExC;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACR;AAGtC;IADN,iBAAiB,CAAC,SAAS,CAAC;kDACa;AAGnC;IADN,SAAS,EAAE;2CACO;AAsWvB,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 { Tags } from \"core/Misc/tags\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\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\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\n\r\nimport \"./fire.fragment\";\r\nimport \"./fire.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 BindLogDepth,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass FireMaterialDefines 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 UV1 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public BonesPerMesh = 0;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class FireMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: Nullable<BaseTexture>;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: Nullable<BaseTexture>;\r\n\r\n @serializeAsTexture(\"distortionTexture\")\r\n private _distortionTexture: Nullable<BaseTexture>;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public distortionTexture: Nullable<BaseTexture>;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: Nullable<BaseTexture>;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: Nullable<BaseTexture>;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize()\r\n public speed = 1.0;\r\n\r\n private _scaledDiffuse = new Color3();\r\n private _lastTime: number = 0;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return false;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FireMaterialDefines();\r\n }\r\n\r\n const defines = <FireMaterialDefines>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 (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 defines.ALPHATEST = this._opacityTexture ? true : false;\r\n\r\n // Misc.\r\n if (defines._areMiscDirty) {\r\n defines.POINTSIZE = this.pointsCloud || scene.forcePointsCloud;\r\n defines.FOG = scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE && this.fogEnabled;\r\n defines.LOGARITHMICDEPTH = this._useLogarithmicDepth;\r\n }\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, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n 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.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\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 = \"fire\";\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n // Fire\r\n \"time\",\r\n \"speed\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: [],\r\n samplers: [\r\n \"diffuseSampler\",\r\n // Fire\r\n \"distortionSampler\",\r\n \"opacitySampler\",\r\n ],\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: null,\r\n maxSimultaneousLights: 4,\r\n transformFeedbackVaryings: null,\r\n },\r\n engine\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 override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FireMaterialDefines>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 this._activeEffect.setTexture(\"distortionSampler\", this._distortionTexture);\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n\r\n // Clip plane\r\n bindClipPlane(this._activeEffect, 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 // 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 // Time\r\n this._lastTime += scene.getEngine().getDeltaTime();\r\n this._activeEffect.setFloat(\"time\", this._lastTime);\r\n\r\n // Speed\r\n this._activeEffect.setFloat(\"speed\", this.speed);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n if (this._distortionTexture && this._distortionTexture.animations && this._distortionTexture.animations.length > 0) {\r\n results.push(this._distortionTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public override getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n if (this._distortionTexture) {\r\n activeTextures.push(this._distortionTexture);\r\n }\r\n\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._distortionTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FireMaterial\";\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n if (this._distortionTexture) {\r\n this._distortionTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): FireMaterial {\r\n return SerializationHelper.Clone<FireMaterial>(() => new FireMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FireMaterial\";\r\n serializationObject.diffuseColor = this.diffuseColor.asArray();\r\n serializationObject.speed = this.speed;\r\n\r\n if (this._diffuseTexture) {\r\n serializationObject._diffuseTexture = this._diffuseTexture.serialize();\r\n }\r\n\r\n if (this._distortionTexture) {\r\n serializationObject._distortionTexture = this._distortionTexture.serialize();\r\n }\r\n\r\n if (this._opacityTexture) {\r\n serializationObject._opacityTexture = this._opacityTexture.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): FireMaterial {\r\n const material = new FireMaterial(source.name, scene);\r\n\r\n material.diffuseColor = Color3.FromArray(source.diffuseColor);\r\n material.speed = source.speed;\r\n\r\n material.alpha = source.alpha;\r\n\r\n material.id = source.id;\r\n\r\n Tags.AddTagsTo(material, source.tags);\r\n material.backFaceCulling = source.backFaceCulling;\r\n material.wireframe = source.wireframe;\r\n\r\n if (source._diffuseTexture) {\r\n material._diffuseTexture = Texture.Parse(source._diffuseTexture, scene, rootUrl);\r\n }\r\n\r\n if (source._distortionTexture) {\r\n material._distortionTexture = Texture.Parse(source._distortionTexture, scene, rootUrl);\r\n }\r\n\r\n if (source._opacityTexture) {\r\n material._opacityTexture = Texture.Parse(source._opacityTexture, scene, rootUrl);\r\n }\r\n\r\n return material;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FireMaterial\", FireMaterial);\r\n"]}
1
+ {"version":3,"file":"fireMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/fire/fireMaterial.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;AAC/C,OAAO,EAAE,IAAI,EAAE,qCAAuB;AAEtC,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,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;AAGpD,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAA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AAS,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,QAAQ,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAClD,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAEtC,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;YACzB,QAAQ,CAAC,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACrF,CAAC;QAED,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAC5B,QAAQ,CAAC,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC3F,CAAC;QAED,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;YACzB,QAAQ,CAAC,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACrF,CAAC;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAtXW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACU;AAExC;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACR;AAGrC;IADP,kBAAkB,CAAC,mBAAmB,CAAC;wDACU;AAE3C;IADN,gBAAgB,CAAC,kCAAkC,CAAC;uDACL;AAGxC;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACU;AAExC;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDACR;AAGtC;IADN,iBAAiB,CAAC,SAAS,CAAC;kDACa;AAGnC;IADN,SAAS,EAAE;2CACO;AAsWvB,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 { Tags } from \"core/Misc/tags\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\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\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\n\r\nimport \"./fire.fragment\";\r\nimport \"./fire.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 BindLogDepth,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass FireMaterialDefines 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 UV1 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public BonesPerMesh = 0;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class FireMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: Nullable<BaseTexture>;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: Nullable<BaseTexture>;\r\n\r\n @serializeAsTexture(\"distortionTexture\")\r\n private _distortionTexture: Nullable<BaseTexture>;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public distortionTexture: Nullable<BaseTexture>;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: Nullable<BaseTexture>;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: Nullable<BaseTexture>;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize()\r\n public speed = 1.0;\r\n\r\n private _scaledDiffuse = new Color3();\r\n private _lastTime: number = 0;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return false;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FireMaterialDefines();\r\n }\r\n\r\n const defines = <FireMaterialDefines>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 (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 defines.ALPHATEST = this._opacityTexture ? true : false;\r\n\r\n // Misc.\r\n if (defines._areMiscDirty) {\r\n defines.POINTSIZE = this.pointsCloud || scene.forcePointsCloud;\r\n defines.FOG = scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE && this.fogEnabled;\r\n defines.LOGARITHMICDEPTH = this._useLogarithmicDepth;\r\n }\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, false, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n 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.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\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 = \"fire\";\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n // Fire\r\n \"time\",\r\n \"speed\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: [],\r\n samplers: [\r\n \"diffuseSampler\",\r\n // Fire\r\n \"distortionSampler\",\r\n \"opacitySampler\",\r\n ],\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: null,\r\n maxSimultaneousLights: 4,\r\n transformFeedbackVaryings: null,\r\n },\r\n engine\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 override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FireMaterialDefines>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 this._activeEffect.setTexture(\"distortionSampler\", this._distortionTexture);\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n\r\n // Clip plane\r\n bindClipPlane(this._activeEffect, 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 // 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 // Time\r\n this._lastTime += scene.getEngine().getDeltaTime();\r\n this._activeEffect.setFloat(\"time\", this._lastTime);\r\n\r\n // Speed\r\n this._activeEffect.setFloat(\"speed\", this.speed);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n if (this._distortionTexture && this._distortionTexture.animations && this._distortionTexture.animations.length > 0) {\r\n results.push(this._distortionTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public override getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n if (this._distortionTexture) {\r\n activeTextures.push(this._distortionTexture);\r\n }\r\n\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._distortionTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FireMaterial\";\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n if (this._distortionTexture) {\r\n this._distortionTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): FireMaterial {\r\n return SerializationHelper.Clone<FireMaterial>(() => new FireMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FireMaterial\";\r\n serializationObject.diffuseColor = this.diffuseColor.asArray();\r\n serializationObject.speed = this.speed;\r\n\r\n if (this._diffuseTexture) {\r\n serializationObject._diffuseTexture = this._diffuseTexture.serialize();\r\n }\r\n\r\n if (this._distortionTexture) {\r\n serializationObject._distortionTexture = this._distortionTexture.serialize();\r\n }\r\n\r\n if (this._opacityTexture) {\r\n serializationObject._opacityTexture = this._opacityTexture.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): FireMaterial {\r\n const material = new FireMaterial(source.name, scene);\r\n\r\n material.diffuseColor = Color3.FromArray(source.diffuseColor);\r\n material.speed = source.speed;\r\n\r\n material.alpha = source.alpha;\r\n\r\n material.id = source.id;\r\n\r\n Tags.AddTagsTo(material, source.tags);\r\n material.backFaceCulling = source.backFaceCulling;\r\n material.wireframe = source.wireframe;\r\n\r\n if (source._diffuseTexture) {\r\n material._diffuseTexture = Texture.Parse(source._diffuseTexture, scene, rootUrl);\r\n }\r\n\r\n if (source._distortionTexture) {\r\n material._distortionTexture = Texture.Parse(source._distortionTexture, scene, rootUrl);\r\n }\r\n\r\n if (source._opacityTexture) {\r\n material._opacityTexture = Texture.Parse(source._opacityTexture, scene, rootUrl);\r\n }\r\n\r\n return material;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FireMaterial\", FireMaterial);\r\n"]}