@babylonjs/materials 6.44.0 → 6.45.1
Sign up to get free protection for your applications and to get access to all the features.
- package/cell/cellMaterial.js +13 -13
- package/cell/cellMaterial.js.map +1 -1
- package/fire/fireMaterial.js +8 -8
- package/fire/fireMaterial.js.map +1 -1
- package/fur/furMaterial.js +13 -13
- package/fur/furMaterial.js.map +1 -1
- package/gradient/gradientMaterial.js +13 -13
- package/gradient/gradientMaterial.js.map +1 -1
- package/grid/gridMaterial.js +7 -7
- package/grid/gridMaterial.js.map +1 -1
- package/lava/lavaMaterial.js +13 -13
- package/lava/lavaMaterial.js.map +1 -1
- package/mix/mixMaterial.js +13 -13
- package/mix/mixMaterial.js.map +1 -1
- package/normal/normalMaterial.js +13 -13
- package/normal/normalMaterial.js.map +1 -1
- package/package.json +2 -2
- package/shadowOnly/shadowOnlyMaterial.js +13 -13
- package/shadowOnly/shadowOnlyMaterial.js.map +1 -1
- package/simple/simpleMaterial.js +13 -13
- package/simple/simpleMaterial.js.map +1 -1
- package/sky/skyMaterial.js +5 -5
- package/sky/skyMaterial.js.map +1 -1
- package/terrain/terrainMaterial.js +13 -13
- package/terrain/terrainMaterial.js.map +1 -1
- package/triPlanar/triPlanarMaterial.js +13 -13
- package/triPlanar/triPlanarMaterial.js.map +1 -1
- package/water/waterMaterial.js +14 -14
- package/water/waterMaterial.js.map +1 -1
package/cell/cellMaterial.js
CHANGED
@@ -2,7 +2,6 @@ import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
3
3
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
4
4
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
5
|
-
import { MaterialHelper } from "@babylonjs/core/Materials/materialHelper.js";
|
6
5
|
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
7
6
|
import { MaterialFlags } from "@babylonjs/core/Materials/materialFlags.js";
|
8
7
|
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
@@ -12,6 +11,7 @@ import "./cell.fragment.js";
|
|
12
11
|
import "./cell.vertex.js";
|
13
12
|
import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
|
14
13
|
import { addClipPlaneUniforms, bindClipPlane } from "@babylonjs/core/Materials/clipPlaneMaterialHelper.js";
|
14
|
+
import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, HandleFallbacksForShadows, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForMisc, PrepareUniformsAndSamplersList, } from "@babylonjs/core/Materials/materialHelper.functions.js";
|
15
15
|
class CellMaterialDefines extends MaterialDefines {
|
16
16
|
constructor() {
|
17
17
|
super();
|
@@ -96,13 +96,13 @@ export class CellMaterial extends PushMaterial {
|
|
96
96
|
// High level
|
97
97
|
defines.CELLBASIC = !this.computeHighLevel;
|
98
98
|
// Misc.
|
99
|
-
|
99
|
+
PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
|
100
100
|
// Lights
|
101
|
-
defines._needNormals =
|
101
|
+
defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
|
102
102
|
// Values that need to be evaluated on every frame
|
103
|
-
|
103
|
+
PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
|
104
104
|
// Attribs
|
105
|
-
|
105
|
+
PrepareDefinesForAttributes(mesh, defines, true, true);
|
106
106
|
// Get correct effect
|
107
107
|
if (defines.isDirty) {
|
108
108
|
defines.markAsProcessed();
|
@@ -112,7 +112,7 @@ export class CellMaterial extends PushMaterial {
|
|
112
112
|
if (defines.FOG) {
|
113
113
|
fallbacks.addFallback(1, "FOG");
|
114
114
|
}
|
115
|
-
|
115
|
+
HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
|
116
116
|
if (defines.NUM_BONE_INFLUENCERS > 0) {
|
117
117
|
fallbacks.addCPUSkinningFallback(0, mesh);
|
118
118
|
}
|
@@ -131,8 +131,8 @@ export class CellMaterial extends PushMaterial {
|
|
131
131
|
if (defines.VERTEXCOLOR) {
|
132
132
|
attribs.push(VertexBuffer.ColorKind);
|
133
133
|
}
|
134
|
-
|
135
|
-
|
134
|
+
PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
|
135
|
+
PrepareAttributesForInstances(attribs, defines);
|
136
136
|
const shaderName = "cell";
|
137
137
|
const join = defines.toString();
|
138
138
|
const uniforms = [
|
@@ -153,7 +153,7 @@ export class CellMaterial extends PushMaterial {
|
|
153
153
|
const samplers = ["diffuseSampler"];
|
154
154
|
const uniformBuffers = [];
|
155
155
|
addClipPlaneUniforms(uniforms);
|
156
|
-
|
156
|
+
PrepareUniformsAndSamplersList({
|
157
157
|
uniformsNames: uniforms,
|
158
158
|
uniformBuffersNames: uniformBuffers,
|
159
159
|
samplers: samplers,
|
@@ -195,7 +195,7 @@ export class CellMaterial extends PushMaterial {
|
|
195
195
|
this.bindOnlyWorldMatrix(world);
|
196
196
|
this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
|
197
197
|
// Bones
|
198
|
-
|
198
|
+
BindBonesParameters(mesh, this._activeEffect);
|
199
199
|
if (this._mustRebind(scene, effect, subMesh)) {
|
200
200
|
// Textures
|
201
201
|
if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
|
@@ -211,21 +211,21 @@ export class CellMaterial extends PushMaterial {
|
|
211
211
|
}
|
212
212
|
// Log. depth
|
213
213
|
if (this._useLogarithmicDepth) {
|
214
|
-
|
214
|
+
BindLogDepth(defines, effect, scene);
|
215
215
|
}
|
216
216
|
scene.bindEyePosition(effect);
|
217
217
|
}
|
218
218
|
this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
|
219
219
|
// Lights
|
220
220
|
if (scene.lightsEnabled && !this.disableLighting) {
|
221
|
-
|
221
|
+
BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights);
|
222
222
|
}
|
223
223
|
// View
|
224
224
|
if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
|
225
225
|
this._activeEffect.setMatrix("view", scene.getViewMatrix());
|
226
226
|
}
|
227
227
|
// Fog
|
228
|
-
|
228
|
+
BindFogParameters(scene, mesh, this._activeEffect);
|
229
229
|
this._afterBind(mesh, this._activeEffect, subMesh);
|
230
230
|
}
|
231
231
|
getAnimatables() {
|
package/cell/cellMaterial.js.map
CHANGED
@@ -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,mBAAmB,EAAE,2CAA6B;AAE/H,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAG/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,cAAc,EAAE,oDAAsC;AAC/D,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;AAE7F,MAAM,mBAAoB,SAAQ,eAAe;IA4B7C;QACI,KAAK,EAAE,CAAC;QA5BL,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KA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\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"core/Materials/materialHelper\";\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\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 needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new 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 MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.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 MaterialHelper.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 MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.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 MaterialHelper.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 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 MaterialHelper.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 MaterialHelper.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 MaterialHelper.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 MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return this._diffuseTexture === texture;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"CellMaterial\";\r\n }\r\n\r\n public clone(name: string): CellMaterial {\r\n return SerializationHelper.Clone<CellMaterial>(() => new CellMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public 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 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,mBAAmB,EAAE,2CAA6B;AAE/H,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAG/C,OAAO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AAM,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, SerializationHelper } from \"core/Misc/decorators\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { 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 needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new 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 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 getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return this._diffuseTexture === texture;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"CellMaterial\";\r\n }\r\n\r\n public clone(name: string): CellMaterial {\r\n return SerializationHelper.Clone<CellMaterial>(() => new CellMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public 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 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"]}
|
package/fire/fireMaterial.js
CHANGED
@@ -4,7 +4,6 @@ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
4
|
import { Tags } from "@babylonjs/core/Misc/tags.js";
|
5
5
|
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
6
6
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
7
|
-
import { MaterialHelper } from "@babylonjs/core/Materials/materialHelper.js";
|
8
7
|
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
9
8
|
import { MaterialFlags } from "@babylonjs/core/Materials/materialFlags.js";
|
10
9
|
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
@@ -14,6 +13,7 @@ import "./fire.fragment.js";
|
|
14
13
|
import "./fire.vertex.js";
|
15
14
|
import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
|
16
15
|
import { addClipPlaneUniforms, bindClipPlane } from "@babylonjs/core/Materials/clipPlaneMaterialHelper.js";
|
16
|
+
import { BindBonesParameters, BindFogParameters, BindLogDepth, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, } from "@babylonjs/core/Materials/materialHelper.functions.js";
|
17
17
|
class FireMaterialDefines extends MaterialDefines {
|
18
18
|
constructor() {
|
19
19
|
super();
|
@@ -96,9 +96,9 @@ export class FireMaterial extends PushMaterial {
|
|
96
96
|
defines.LOGARITHMICDEPTH = this._useLogarithmicDepth;
|
97
97
|
}
|
98
98
|
// Values that need to be evaluated on every frame
|
99
|
-
|
99
|
+
PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
|
100
100
|
// Attribs
|
101
|
-
|
101
|
+
PrepareDefinesForAttributes(mesh, defines, false, true);
|
102
102
|
// Get correct effect
|
103
103
|
if (defines.isDirty) {
|
104
104
|
defines.markAsProcessed();
|
@@ -120,8 +120,8 @@ export class FireMaterial extends PushMaterial {
|
|
120
120
|
if (defines.VERTEXCOLOR) {
|
121
121
|
attribs.push(VertexBuffer.ColorKind);
|
122
122
|
}
|
123
|
-
|
124
|
-
|
123
|
+
PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
|
124
|
+
PrepareAttributesForInstances(attribs, defines);
|
125
125
|
// Legacy browser patch
|
126
126
|
const shaderName = "fire";
|
127
127
|
const uniforms = [
|
@@ -184,7 +184,7 @@ export class FireMaterial extends PushMaterial {
|
|
184
184
|
this.bindOnlyWorldMatrix(world);
|
185
185
|
this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
|
186
186
|
// Bones
|
187
|
-
|
187
|
+
BindBonesParameters(mesh, this._activeEffect);
|
188
188
|
if (this._mustRebind(scene, effect, subMesh)) {
|
189
189
|
// Textures
|
190
190
|
if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
|
@@ -202,7 +202,7 @@ export class FireMaterial extends PushMaterial {
|
|
202
202
|
}
|
203
203
|
// Log. depth
|
204
204
|
if (this._useLogarithmicDepth) {
|
205
|
-
|
205
|
+
BindLogDepth(defines, effect, scene);
|
206
206
|
}
|
207
207
|
scene.bindEyePosition(effect);
|
208
208
|
}
|
@@ -212,7 +212,7 @@ export class FireMaterial extends PushMaterial {
|
|
212
212
|
this._activeEffect.setMatrix("view", scene.getViewMatrix());
|
213
213
|
}
|
214
214
|
// Fog
|
215
|
-
|
215
|
+
BindFogParameters(scene, mesh, this._activeEffect);
|
216
216
|
// Time
|
217
217
|
this._lastTime += scene.getEngine().getDeltaTime();
|
218
218
|
this._activeEffect.setFloat("time", this._lastTime);
|
package/fire/fireMaterial.js.map
CHANGED
@@ -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,mBAAmB,EAAE,2CAA6B;AAE/H,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,cAAc,EAAE,oDAAsC;AAC/D,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;AAE7F,MAAM,mBAAoB,SAAQ,eAAe;IAuB7C;QACI,KAAK,EAAE,CAAC;QAvBL,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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U;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, SerializationHelper } from \"core/Misc/decorators\";\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 { MaterialHelper } from \"core/Materials/materialHelper\";\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\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 needAlphaBlending(): boolean {\r\n return false;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper._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 MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.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 MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.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 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 MaterialHelper.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 MaterialHelper.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 MaterialHelper.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 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 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 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 getClassName(): string {\r\n return \"FireMaterial\";\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n if (this._distortionTexture) {\r\n this._distortionTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FireMaterial {\r\n return SerializationHelper.Clone<FireMaterial>(() => new FireMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public 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 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,mBAAmB,EAAE,2CAA6B;AAE/H,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,Y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S,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, SerializationHelper } from \"core/Misc/decorators\";\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 needAlphaBlending(): boolean {\r\n return false;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper._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 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 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 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 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 getClassName(): string {\r\n return \"FireMaterial\";\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n if (this._distortionTexture) {\r\n this._distortionTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FireMaterial {\r\n return SerializationHelper.Clone<FireMaterial>(() => new FireMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public 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 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"]}
|
package/fur/furMaterial.js
CHANGED
@@ -6,7 +6,6 @@ import { Tags } from "@babylonjs/core/Misc/tags.js";
|
|
6
6
|
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
7
7
|
import { DynamicTexture } from "@babylonjs/core/Materials/Textures/dynamicTexture.js";
|
8
8
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
9
|
-
import { MaterialHelper } from "@babylonjs/core/Materials/materialHelper.js";
|
10
9
|
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
11
10
|
import { MaterialFlags } from "@babylonjs/core/Materials/materialFlags.js";
|
12
11
|
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
@@ -16,6 +15,7 @@ import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
|
|
16
15
|
import "./fur.fragment.js";
|
17
16
|
import "./fur.vertex.js";
|
18
17
|
import { addClipPlaneUniforms, bindClipPlane } from "@babylonjs/core/Materials/clipPlaneMaterialHelper.js";
|
18
|
+
import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, HandleFallbacksForShadows, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForMisc, PrepareUniformsAndSamplersList, } from "@babylonjs/core/Materials/materialHelper.functions.js";
|
19
19
|
class FurMaterialDefines extends MaterialDefines {
|
20
20
|
constructor() {
|
21
21
|
super();
|
@@ -142,13 +142,13 @@ export class FurMaterial extends PushMaterial {
|
|
142
142
|
defines.markAsUnprocessed();
|
143
143
|
}
|
144
144
|
// Misc.
|
145
|
-
|
145
|
+
PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
|
146
146
|
// Lights
|
147
|
-
defines._needNormals =
|
147
|
+
defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
|
148
148
|
// Values that need to be evaluated on every frame
|
149
|
-
|
149
|
+
PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
|
150
150
|
// Attribs
|
151
|
-
|
151
|
+
PrepareDefinesForAttributes(mesh, defines, true, true);
|
152
152
|
// Get correct effect
|
153
153
|
if (defines.isDirty) {
|
154
154
|
defines.markAsProcessed();
|
@@ -158,7 +158,7 @@ export class FurMaterial extends PushMaterial {
|
|
158
158
|
if (defines.FOG) {
|
159
159
|
fallbacks.addFallback(1, "FOG");
|
160
160
|
}
|
161
|
-
|
161
|
+
HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
|
162
162
|
if (defines.NUM_BONE_INFLUENCERS > 0) {
|
163
163
|
fallbacks.addCPUSkinningFallback(0, mesh);
|
164
164
|
}
|
@@ -177,8 +177,8 @@ export class FurMaterial extends PushMaterial {
|
|
177
177
|
if (defines.VERTEXCOLOR) {
|
178
178
|
attribs.push(VertexBuffer.ColorKind);
|
179
179
|
}
|
180
|
-
|
181
|
-
|
180
|
+
PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
|
181
|
+
PrepareAttributesForInstances(attribs, defines);
|
182
182
|
// Legacy browser patch
|
183
183
|
const shaderName = "fur";
|
184
184
|
const join = defines.toString();
|
@@ -209,7 +209,7 @@ export class FurMaterial extends PushMaterial {
|
|
209
209
|
addClipPlaneUniforms(uniforms);
|
210
210
|
const samplers = ["diffuseSampler", "heightTexture", "furTexture"];
|
211
211
|
const uniformBuffers = [];
|
212
|
-
|
212
|
+
PrepareUniformsAndSamplersList({
|
213
213
|
uniformsNames: uniforms,
|
214
214
|
uniformBuffersNames: uniformBuffers,
|
215
215
|
samplers: samplers,
|
@@ -251,7 +251,7 @@ export class FurMaterial extends PushMaterial {
|
|
251
251
|
this.bindOnlyWorldMatrix(world);
|
252
252
|
this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
|
253
253
|
// Bones
|
254
|
-
|
254
|
+
BindBonesParameters(mesh, this._activeEffect);
|
255
255
|
if (this._mustRebind(scene, effect, subMesh)) {
|
256
256
|
// Textures
|
257
257
|
if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
|
@@ -270,20 +270,20 @@ export class FurMaterial extends PushMaterial {
|
|
270
270
|
}
|
271
271
|
// Log. depth
|
272
272
|
if (this._useLogarithmicDepth) {
|
273
|
-
|
273
|
+
BindLogDepth(defines, effect, scene);
|
274
274
|
}
|
275
275
|
scene.bindEyePosition(effect);
|
276
276
|
}
|
277
277
|
this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
|
278
278
|
if (scene.lightsEnabled && !this.disableLighting) {
|
279
|
-
|
279
|
+
BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
|
280
280
|
}
|
281
281
|
// View
|
282
282
|
if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
|
283
283
|
this._activeEffect.setMatrix("view", scene.getViewMatrix());
|
284
284
|
}
|
285
285
|
// Fog
|
286
|
-
|
286
|
+
BindFogParameters(scene, mesh, this._activeEffect);
|
287
287
|
this._activeEffect.setFloat("furLength", this.furLength);
|
288
288
|
this._activeEffect.setFloat("furAngle", this.furAngle);
|
289
289
|
this._activeEffect.setColor4("furColor", this.furColor, 1.0);
|