@babylonjs/materials 5.0.0-rc.5 → 5.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/cell/cell.fragment.d.ts +17 -17
  2. package/cell/cell.fragment.js +20 -20
  3. package/cell/cell.vertex.d.ts +18 -18
  4. package/cell/cell.vertex.js +21 -21
  5. package/cell/cellMaterial.d.ts +37 -37
  6. package/cell/cellMaterial.js +304 -304
  7. package/cell/index.d.ts +1 -1
  8. package/cell/index.js +1 -1
  9. package/custom/customMaterial.d.ts +69 -69
  10. package/custom/customMaterial.js +216 -216
  11. package/custom/index.d.ts +2 -2
  12. package/custom/index.js +2 -2
  13. package/custom/pbrCustomMaterial.d.ts +71 -71
  14. package/custom/pbrCustomMaterial.js +241 -241
  15. package/fire/fire.fragment.d.ts +11 -11
  16. package/fire/fire.fragment.js +14 -14
  17. package/fire/fire.vertex.d.ts +15 -15
  18. package/fire/fire.vertex.js +18 -18
  19. package/fire/fireMaterial.d.ts +38 -38
  20. package/fire/fireMaterial.js +342 -342
  21. package/fire/index.d.ts +1 -1
  22. package/fire/index.js +1 -1
  23. package/fur/fur.fragment.d.ts +17 -17
  24. package/fur/fur.fragment.js +20 -20
  25. package/fur/fur.vertex.d.ts +18 -18
  26. package/fur/fur.vertex.js +21 -21
  27. package/fur/furMaterial.d.ts +56 -56
  28. package/fur/furMaterial.js +500 -500
  29. package/fur/index.d.ts +1 -1
  30. package/fur/index.js +1 -1
  31. package/gradient/gradient.fragment.d.ts +17 -17
  32. package/gradient/gradient.fragment.js +20 -20
  33. package/gradient/gradient.vertex.d.ts +18 -18
  34. package/gradient/gradient.vertex.js +21 -21
  35. package/gradient/gradientMaterial.d.ts +37 -37
  36. package/gradient/gradientMaterial.js +275 -275
  37. package/gradient/index.d.ts +1 -1
  38. package/gradient/index.js +1 -1
  39. package/grid/grid.fragment.d.ts +8 -8
  40. package/grid/grid.fragment.js +11 -11
  41. package/grid/grid.vertex.d.ts +9 -9
  42. package/grid/grid.vertex.js +12 -12
  43. package/grid/gridMaterial.d.ts +77 -77
  44. package/grid/gridMaterial.js +276 -276
  45. package/grid/index.d.ts +1 -1
  46. package/grid/index.js +1 -1
  47. package/index.d.ts +15 -15
  48. package/index.js +15 -15
  49. package/lava/index.d.ts +1 -1
  50. package/lava/index.js +1 -1
  51. package/lava/lava.fragment.d.ts +17 -17
  52. package/lava/lava.fragment.js +20 -20
  53. package/lava/lava.vertex.d.ts +18 -18
  54. package/lava/lava.vertex.js +21 -21
  55. package/lava/lavaMaterial.d.ts +45 -45
  56. package/lava/lavaMaterial.js +394 -394
  57. package/legacy/legacy-cell.d.ts +1 -1
  58. package/legacy/legacy-cell.js +12 -12
  59. package/legacy/legacy-custom.d.ts +1 -1
  60. package/legacy/legacy-custom.js +12 -12
  61. package/legacy/legacy-fire.d.ts +1 -1
  62. package/legacy/legacy-fire.js +12 -12
  63. package/legacy/legacy-fur.d.ts +1 -1
  64. package/legacy/legacy-fur.js +12 -12
  65. package/legacy/legacy-gradient.d.ts +1 -1
  66. package/legacy/legacy-gradient.js +12 -12
  67. package/legacy/legacy-grid.d.ts +1 -1
  68. package/legacy/legacy-grid.js +12 -12
  69. package/legacy/legacy-lava.d.ts +1 -1
  70. package/legacy/legacy-lava.js +12 -12
  71. package/legacy/legacy-mix.d.ts +1 -1
  72. package/legacy/legacy-mix.js +12 -12
  73. package/legacy/legacy-normal.d.ts +1 -1
  74. package/legacy/legacy-normal.js +12 -12
  75. package/legacy/legacy-shadowOnly.d.ts +1 -1
  76. package/legacy/legacy-shadowOnly.js +12 -12
  77. package/legacy/legacy-simple.d.ts +1 -1
  78. package/legacy/legacy-simple.js +12 -12
  79. package/legacy/legacy-sky.d.ts +1 -1
  80. package/legacy/legacy-sky.js +12 -12
  81. package/legacy/legacy-terrain.d.ts +1 -1
  82. package/legacy/legacy-terrain.js +12 -12
  83. package/legacy/legacy-triPlanar.d.ts +1 -1
  84. package/legacy/legacy-triPlanar.js +12 -12
  85. package/legacy/legacy-water.d.ts +1 -1
  86. package/legacy/legacy-water.js +12 -12
  87. package/legacy/legacy.d.ts +1 -1
  88. package/legacy/legacy.js +15 -15
  89. package/mix/index.d.ts +1 -1
  90. package/mix/index.js +1 -1
  91. package/mix/mix.fragment.d.ts +17 -17
  92. package/mix/mix.fragment.js +20 -20
  93. package/mix/mix.vertex.d.ts +18 -18
  94. package/mix/mix.vertex.js +21 -21
  95. package/mix/mixMaterial.d.ts +65 -65
  96. package/mix/mixMaterial.js +510 -510
  97. package/normal/index.d.ts +1 -1
  98. package/normal/index.js +1 -1
  99. package/normal/normal.fragment.d.ts +17 -17
  100. package/normal/normal.fragment.js +20 -20
  101. package/normal/normal.vertex.d.ts +18 -18
  102. package/normal/normal.vertex.js +21 -21
  103. package/normal/normalMaterial.d.ts +36 -36
  104. package/normal/normalMaterial.js +336 -336
  105. package/package.json +2 -2
  106. package/shadowOnly/index.d.ts +1 -1
  107. package/shadowOnly/index.js +1 -1
  108. package/shadowOnly/shadowOnly.fragment.d.ts +16 -16
  109. package/shadowOnly/shadowOnly.fragment.js +19 -19
  110. package/shadowOnly/shadowOnly.vertex.d.ts +18 -18
  111. package/shadowOnly/shadowOnly.vertex.js +21 -21
  112. package/shadowOnly/shadowOnlyMaterial.d.ts +30 -30
  113. package/shadowOnly/shadowOnlyMaterial.js +254 -254
  114. package/simple/index.d.ts +1 -1
  115. package/simple/index.js +1 -1
  116. package/simple/simple.fragment.d.ts +17 -17
  117. package/simple/simple.fragment.js +20 -20
  118. package/simple/simple.vertex.d.ts +18 -18
  119. package/simple/simple.vertex.js +21 -21
  120. package/simple/simpleMaterial.d.ts +35 -35
  121. package/simple/simpleMaterial.js +295 -295
  122. package/sky/index.d.ts +1 -1
  123. package/sky/index.js +1 -1
  124. package/sky/sky.fragment.d.ts +10 -10
  125. package/sky/sky.fragment.js +13 -13
  126. package/sky/sky.vertex.d.ts +9 -9
  127. package/sky/sky.vertex.js +12 -12
  128. package/sky/skyMaterial.d.ts +146 -146
  129. package/sky/skyMaterial.js +359 -359
  130. package/terrain/index.d.ts +1 -1
  131. package/terrain/index.js +1 -1
  132. package/terrain/terrain.fragment.d.ts +17 -17
  133. package/terrain/terrain.fragment.js +20 -20
  134. package/terrain/terrain.vertex.d.ts +18 -18
  135. package/terrain/terrain.vertex.js +21 -21
  136. package/terrain/terrainMaterial.d.ts +50 -50
  137. package/terrain/terrainMaterial.js +426 -426
  138. package/triPlanar/index.d.ts +1 -1
  139. package/triPlanar/index.js +1 -1
  140. package/triPlanar/triPlanarMaterial.d.ts +49 -49
  141. package/triPlanar/triPlanarMaterial.js +403 -403
  142. package/triPlanar/triplanar.fragment.d.ts +17 -17
  143. package/triPlanar/triplanar.fragment.js +20 -20
  144. package/triPlanar/triplanar.vertex.d.ts +18 -18
  145. package/triPlanar/triplanar.vertex.js +21 -21
  146. package/water/index.d.ts +1 -1
  147. package/water/index.js +1 -1
  148. package/water/water.fragment.d.ts +19 -19
  149. package/water/water.fragment.js +22 -22
  150. package/water/water.vertex.d.ts +20 -20
  151. package/water/water.vertex.js +23 -23
  152. package/water/waterMaterial.d.ts +135 -135
  153. package/water/waterMaterial.js +736 -736
@@ -1,511 +1,511 @@
1
- import { __decorate, __extends } from "tslib";
2
- import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
3
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
4
- import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
5
- import { MaterialHelper } from "@babylonjs/core/Materials/materialHelper.js";
6
- import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
7
- import { MaterialFlags } from "@babylonjs/core/Materials/materialFlags.js";
8
- import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
9
- import { Scene } from "@babylonjs/core/scene.js";
10
- import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
11
- import "./mix.fragment.js";
12
- import "./mix.vertex.js";
13
- import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
14
- var MixMaterialDefines = /** @class */ (function (_super) {
15
- __extends(MixMaterialDefines, _super);
16
- function MixMaterialDefines() {
17
- var _this = _super.call(this) || this;
18
- _this.DIFFUSE = false;
19
- _this.CLIPPLANE = false;
20
- _this.CLIPPLANE2 = false;
21
- _this.CLIPPLANE3 = false;
22
- _this.CLIPPLANE4 = false;
23
- _this.CLIPPLANE5 = false;
24
- _this.CLIPPLANE6 = false;
25
- _this.ALPHATEST = false;
26
- _this.DEPTHPREPASS = false;
27
- _this.POINTSIZE = false;
28
- _this.FOG = false;
29
- _this.SPECULARTERM = false;
30
- _this.NORMAL = false;
31
- _this.UV1 = false;
32
- _this.UV2 = false;
33
- _this.VERTEXCOLOR = false;
34
- _this.VERTEXALPHA = false;
35
- _this.NUM_BONE_INFLUENCERS = 0;
36
- _this.BonesPerMesh = 0;
37
- _this.INSTANCES = false;
38
- _this.INSTANCESCOLOR = false;
39
- _this.MIXMAP2 = false;
40
- _this.IMAGEPROCESSINGPOSTPROCESS = false;
41
- _this.SKIPFINALCOLORCLAMP = false;
42
- _this.rebuild();
43
- return _this;
44
- }
45
- return MixMaterialDefines;
46
- }(MaterialDefines));
47
- var MixMaterial = /** @class */ (function (_super) {
48
- __extends(MixMaterial, _super);
49
- function MixMaterial(name, scene) {
50
- var _this = _super.call(this, name, scene) || this;
51
- /**
52
- * Uniforms
53
- */
54
- _this.diffuseColor = new Color3(1, 1, 1);
55
- _this.specularColor = new Color3(0, 0, 0);
56
- _this.specularPower = 64;
57
- _this._disableLighting = false;
58
- _this._maxSimultaneousLights = 4;
59
- return _this;
60
- }
61
- MixMaterial.prototype.needAlphaBlending = function () {
62
- return this.alpha < 1.0;
63
- };
64
- MixMaterial.prototype.needAlphaTesting = function () {
65
- return false;
66
- };
67
- MixMaterial.prototype.getAlphaTestTexture = function () {
68
- return null;
69
- };
70
- // Methods
71
- MixMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
72
- if (this.isFrozen) {
73
- if (subMesh.effect && subMesh.effect._wasPreviouslyReady) {
74
- return true;
75
- }
76
- }
77
- if (!subMesh.materialDefines) {
78
- subMesh.materialDefines = new MixMaterialDefines();
79
- }
80
- var defines = subMesh.materialDefines;
81
- var scene = this.getScene();
82
- if (this._isReadyForSubMesh(subMesh)) {
83
- return true;
84
- }
85
- var engine = scene.getEngine();
86
- // Textures
87
- if (scene.texturesEnabled) {
88
- if (!this._mixTexture1 || !this._mixTexture1.isReady()) {
89
- return false;
90
- }
91
- defines._needUVs = true;
92
- if (MaterialFlags.DiffuseTextureEnabled) {
93
- if (!this._diffuseTexture1 || !this._diffuseTexture1.isReady()) {
94
- return false;
95
- }
96
- defines.DIFFUSE = true;
97
- if (!this._diffuseTexture2 || !this._diffuseTexture2.isReady()) {
98
- return false;
99
- }
100
- if (!this._diffuseTexture3 || !this._diffuseTexture3.isReady()) {
101
- return false;
102
- }
103
- if (!this._diffuseTexture4 || !this._diffuseTexture4.isReady()) {
104
- return false;
105
- }
106
- if (this._mixTexture2) {
107
- if (!this._mixTexture2.isReady()) {
108
- return false;
109
- }
110
- defines.MIXMAP2 = true;
111
- if (!this._diffuseTexture5 || !this._diffuseTexture5.isReady()) {
112
- return false;
113
- }
114
- if (!this._diffuseTexture6 || !this._diffuseTexture6.isReady()) {
115
- return false;
116
- }
117
- if (!this._diffuseTexture7 || !this._diffuseTexture7.isReady()) {
118
- return false;
119
- }
120
- if (!this._diffuseTexture8 || !this._diffuseTexture8.isReady()) {
121
- return false;
122
- }
123
- }
124
- }
125
- }
126
- // Misc.
127
- MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
128
- // Lights
129
- defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
130
- // Values that need to be evaluated on every frame
131
- MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
132
- // Attribs
133
- MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);
134
- // Get correct effect
135
- if (defines.isDirty) {
136
- defines.markAsProcessed();
137
- scene.resetCachedMaterial();
138
- // Fallbacks
139
- var fallbacks = new EffectFallbacks();
140
- if (defines.FOG) {
141
- fallbacks.addFallback(1, "FOG");
142
- }
143
- MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
144
- if (defines.NUM_BONE_INFLUENCERS > 0) {
145
- fallbacks.addCPUSkinningFallback(0, mesh);
146
- }
147
- defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
148
- //Attributes
149
- var attribs = [VertexBuffer.PositionKind];
150
- if (defines.NORMAL) {
151
- attribs.push(VertexBuffer.NormalKind);
152
- }
153
- if (defines.UV1) {
154
- attribs.push(VertexBuffer.UVKind);
155
- }
156
- if (defines.UV2) {
157
- attribs.push(VertexBuffer.UV2Kind);
158
- }
159
- if (defines.VERTEXCOLOR) {
160
- attribs.push(VertexBuffer.ColorKind);
161
- }
162
- MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
163
- MaterialHelper.PrepareAttributesForInstances(attribs, defines);
164
- // Legacy browser patch
165
- var shaderName = "mix";
166
- var join = defines.toString();
167
- var uniforms = [
168
- "world",
169
- "view",
170
- "viewProjection",
171
- "vEyePosition",
172
- "vLightsType",
173
- "vDiffuseColor",
174
- "vSpecularColor",
175
- "vFogInfos",
176
- "vFogColor",
177
- "pointSize",
178
- "vTextureInfos",
179
- "mBones",
180
- "vClipPlane",
181
- "vClipPlane2",
182
- "vClipPlane3",
183
- "vClipPlane4",
184
- "vClipPlane5",
185
- "vClipPlane6",
186
- "textureMatrix",
187
- "diffuse1Infos",
188
- "diffuse2Infos",
189
- "diffuse3Infos",
190
- "diffuse4Infos",
191
- "diffuse5Infos",
192
- "diffuse6Infos",
193
- "diffuse7Infos",
194
- "diffuse8Infos",
195
- ];
196
- var samplers = [
197
- "mixMap1Sampler",
198
- "mixMap2Sampler",
199
- "diffuse1Sampler",
200
- "diffuse2Sampler",
201
- "diffuse3Sampler",
202
- "diffuse4Sampler",
203
- "diffuse5Sampler",
204
- "diffuse6Sampler",
205
- "diffuse7Sampler",
206
- "diffuse8Sampler",
207
- ];
208
- var uniformBuffers = new Array();
209
- MaterialHelper.PrepareUniformsAndSamplersList({
210
- uniformsNames: uniforms,
211
- uniformBuffersNames: uniformBuffers,
212
- samplers: samplers,
213
- defines: defines,
214
- maxSimultaneousLights: this.maxSimultaneousLights,
215
- });
216
- subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
217
- attributes: attribs,
218
- uniformsNames: uniforms,
219
- uniformBuffersNames: uniformBuffers,
220
- samplers: samplers,
221
- defines: join,
222
- fallbacks: fallbacks,
223
- onCompiled: this.onCompiled,
224
- onError: this.onError,
225
- indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights },
226
- }, engine), defines, this._materialContext);
227
- }
228
- if (!subMesh.effect || !subMesh.effect.isReady()) {
229
- return false;
230
- }
231
- defines._renderId = scene.getRenderId();
232
- subMesh.effect._wasPreviouslyReady = true;
233
- return true;
234
- };
235
- MixMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
236
- var scene = this.getScene();
237
- var defines = subMesh.materialDefines;
238
- if (!defines) {
239
- return;
240
- }
241
- var effect = subMesh.effect;
242
- if (!effect) {
243
- return;
244
- }
245
- this._activeEffect = effect;
246
- // Matrices
247
- this.bindOnlyWorldMatrix(world);
248
- this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
249
- // Bones
250
- MaterialHelper.BindBonesParameters(mesh, this._activeEffect);
251
- if (this._mustRebind(scene, effect)) {
252
- // Textures
253
- if (this._mixTexture1) {
254
- this._activeEffect.setTexture("mixMap1Sampler", this._mixTexture1);
255
- this._activeEffect.setFloat2("vTextureInfos", this._mixTexture1.coordinatesIndex, this._mixTexture1.level);
256
- this._activeEffect.setMatrix("textureMatrix", this._mixTexture1.getTextureMatrix());
257
- if (MaterialFlags.DiffuseTextureEnabled) {
258
- if (this._diffuseTexture1) {
259
- this._activeEffect.setTexture("diffuse1Sampler", this._diffuseTexture1);
260
- this._activeEffect.setFloat2("diffuse1Infos", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);
261
- }
262
- if (this._diffuseTexture2) {
263
- this._activeEffect.setTexture("diffuse2Sampler", this._diffuseTexture2);
264
- this._activeEffect.setFloat2("diffuse2Infos", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);
265
- }
266
- if (this._diffuseTexture3) {
267
- this._activeEffect.setTexture("diffuse3Sampler", this._diffuseTexture3);
268
- this._activeEffect.setFloat2("diffuse3Infos", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);
269
- }
270
- if (this._diffuseTexture4) {
271
- this._activeEffect.setTexture("diffuse4Sampler", this._diffuseTexture4);
272
- this._activeEffect.setFloat2("diffuse4Infos", this._diffuseTexture4.uScale, this._diffuseTexture4.vScale);
273
- }
274
- }
275
- }
276
- if (this._mixTexture2) {
277
- this._activeEffect.setTexture("mixMap2Sampler", this._mixTexture2);
278
- if (MaterialFlags.DiffuseTextureEnabled) {
279
- if (this._diffuseTexture5) {
280
- this._activeEffect.setTexture("diffuse5Sampler", this._diffuseTexture5);
281
- this._activeEffect.setFloat2("diffuse5Infos", this._diffuseTexture5.uScale, this._diffuseTexture5.vScale);
282
- }
283
- if (this._diffuseTexture6) {
284
- this._activeEffect.setTexture("diffuse6Sampler", this._diffuseTexture6);
285
- this._activeEffect.setFloat2("diffuse6Infos", this._diffuseTexture6.uScale, this._diffuseTexture6.vScale);
286
- }
287
- if (this._diffuseTexture7) {
288
- this._activeEffect.setTexture("diffuse7Sampler", this._diffuseTexture7);
289
- this._activeEffect.setFloat2("diffuse7Infos", this._diffuseTexture7.uScale, this._diffuseTexture7.vScale);
290
- }
291
- if (this._diffuseTexture8) {
292
- this._activeEffect.setTexture("diffuse8Sampler", this._diffuseTexture8);
293
- this._activeEffect.setFloat2("diffuse8Infos", this._diffuseTexture8.uScale, this._diffuseTexture8.vScale);
294
- }
295
- }
296
- }
297
- // Clip plane
298
- MaterialHelper.BindClipPlane(this._activeEffect, scene);
299
- // Point size
300
- if (this.pointsCloud) {
301
- this._activeEffect.setFloat("pointSize", this.pointSize);
302
- }
303
- scene.bindEyePosition(effect);
304
- }
305
- this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
306
- if (defines.SPECULARTERM) {
307
- this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
308
- }
309
- if (scene.lightsEnabled && !this.disableLighting) {
310
- MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
311
- }
312
- // View
313
- if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
314
- this._activeEffect.setMatrix("view", scene.getViewMatrix());
315
- }
316
- // Fog
317
- MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);
318
- this._afterBind(mesh, this._activeEffect);
319
- };
320
- MixMaterial.prototype.getAnimatables = function () {
321
- var results = [];
322
- if (this._mixTexture1 && this._mixTexture1.animations && this._mixTexture1.animations.length > 0) {
323
- results.push(this._mixTexture1);
324
- }
325
- if (this._mixTexture2 && this._mixTexture2.animations && this._mixTexture2.animations.length > 0) {
326
- results.push(this._mixTexture2);
327
- }
328
- return results;
329
- };
330
- MixMaterial.prototype.getActiveTextures = function () {
331
- var activeTextures = _super.prototype.getActiveTextures.call(this);
332
- // Mix map 1
333
- if (this._mixTexture1) {
334
- activeTextures.push(this._mixTexture1);
335
- }
336
- if (this._diffuseTexture1) {
337
- activeTextures.push(this._diffuseTexture1);
338
- }
339
- if (this._diffuseTexture2) {
340
- activeTextures.push(this._diffuseTexture2);
341
- }
342
- if (this._diffuseTexture3) {
343
- activeTextures.push(this._diffuseTexture3);
344
- }
345
- if (this._diffuseTexture4) {
346
- activeTextures.push(this._diffuseTexture4);
347
- }
348
- // Mix map 2
349
- if (this._mixTexture2) {
350
- activeTextures.push(this._mixTexture2);
351
- }
352
- if (this._diffuseTexture5) {
353
- activeTextures.push(this._diffuseTexture5);
354
- }
355
- if (this._diffuseTexture6) {
356
- activeTextures.push(this._diffuseTexture6);
357
- }
358
- if (this._diffuseTexture7) {
359
- activeTextures.push(this._diffuseTexture7);
360
- }
361
- if (this._diffuseTexture8) {
362
- activeTextures.push(this._diffuseTexture8);
363
- }
364
- return activeTextures;
365
- };
366
- MixMaterial.prototype.hasTexture = function (texture) {
367
- if (_super.prototype.hasTexture.call(this, texture)) {
368
- return true;
369
- }
370
- // Mix map 1
371
- if (this._mixTexture1 === texture) {
372
- return true;
373
- }
374
- if (this._diffuseTexture1 === texture) {
375
- return true;
376
- }
377
- if (this._diffuseTexture2 === texture) {
378
- return true;
379
- }
380
- if (this._diffuseTexture3 === texture) {
381
- return true;
382
- }
383
- if (this._diffuseTexture4 === texture) {
384
- return true;
385
- }
386
- // Mix map 2
387
- if (this._mixTexture2 === texture) {
388
- return true;
389
- }
390
- if (this._diffuseTexture5 === texture) {
391
- return true;
392
- }
393
- if (this._diffuseTexture6 === texture) {
394
- return true;
395
- }
396
- if (this._diffuseTexture7 === texture) {
397
- return true;
398
- }
399
- if (this._diffuseTexture8 === texture) {
400
- return true;
401
- }
402
- return false;
403
- };
404
- MixMaterial.prototype.dispose = function (forceDisposeEffect) {
405
- if (this._mixTexture1) {
406
- this._mixTexture1.dispose();
407
- }
408
- _super.prototype.dispose.call(this, forceDisposeEffect);
409
- };
410
- MixMaterial.prototype.clone = function (name) {
411
- var _this = this;
412
- return SerializationHelper.Clone(function () { return new MixMaterial(name, _this.getScene()); }, this);
413
- };
414
- MixMaterial.prototype.serialize = function () {
415
- var serializationObject = _super.prototype.serialize.call(this);
416
- serializationObject.customType = "BABYLON.MixMaterial";
417
- return serializationObject;
418
- };
419
- MixMaterial.prototype.getClassName = function () {
420
- return "MixMaterial";
421
- };
422
- // Statics
423
- MixMaterial.Parse = function (source, scene, rootUrl) {
424
- return SerializationHelper.Parse(function () { return new MixMaterial(source.name, scene); }, source, scene, rootUrl);
425
- };
426
- __decorate([
427
- serializeAsTexture("mixTexture1")
428
- ], MixMaterial.prototype, "_mixTexture1", void 0);
429
- __decorate([
430
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
431
- ], MixMaterial.prototype, "mixTexture1", void 0);
432
- __decorate([
433
- serializeAsTexture("mixTexture2")
434
- ], MixMaterial.prototype, "_mixTexture2", void 0);
435
- __decorate([
436
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
437
- ], MixMaterial.prototype, "mixTexture2", void 0);
438
- __decorate([
439
- serializeAsTexture("diffuseTexture1")
440
- ], MixMaterial.prototype, "_diffuseTexture1", void 0);
441
- __decorate([
442
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
443
- ], MixMaterial.prototype, "diffuseTexture1", void 0);
444
- __decorate([
445
- serializeAsTexture("diffuseTexture2")
446
- ], MixMaterial.prototype, "_diffuseTexture2", void 0);
447
- __decorate([
448
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
449
- ], MixMaterial.prototype, "diffuseTexture2", void 0);
450
- __decorate([
451
- serializeAsTexture("diffuseTexture3")
452
- ], MixMaterial.prototype, "_diffuseTexture3", void 0);
453
- __decorate([
454
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
455
- ], MixMaterial.prototype, "diffuseTexture3", void 0);
456
- __decorate([
457
- serializeAsTexture("diffuseTexture4")
458
- ], MixMaterial.prototype, "_diffuseTexture4", void 0);
459
- __decorate([
460
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
461
- ], MixMaterial.prototype, "diffuseTexture4", void 0);
462
- __decorate([
463
- serializeAsTexture("diffuseTexture1")
464
- ], MixMaterial.prototype, "_diffuseTexture5", void 0);
465
- __decorate([
466
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
467
- ], MixMaterial.prototype, "diffuseTexture5", void 0);
468
- __decorate([
469
- serializeAsTexture("diffuseTexture2")
470
- ], MixMaterial.prototype, "_diffuseTexture6", void 0);
471
- __decorate([
472
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
473
- ], MixMaterial.prototype, "diffuseTexture6", void 0);
474
- __decorate([
475
- serializeAsTexture("diffuseTexture3")
476
- ], MixMaterial.prototype, "_diffuseTexture7", void 0);
477
- __decorate([
478
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
479
- ], MixMaterial.prototype, "diffuseTexture7", void 0);
480
- __decorate([
481
- serializeAsTexture("diffuseTexture4")
482
- ], MixMaterial.prototype, "_diffuseTexture8", void 0);
483
- __decorate([
484
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
485
- ], MixMaterial.prototype, "diffuseTexture8", void 0);
486
- __decorate([
487
- serializeAsColor3()
488
- ], MixMaterial.prototype, "diffuseColor", void 0);
489
- __decorate([
490
- serializeAsColor3()
491
- ], MixMaterial.prototype, "specularColor", void 0);
492
- __decorate([
493
- serialize()
494
- ], MixMaterial.prototype, "specularPower", void 0);
495
- __decorate([
496
- serialize("disableLighting")
497
- ], MixMaterial.prototype, "_disableLighting", void 0);
498
- __decorate([
499
- expandToProperty("_markAllSubMeshesAsLightsDirty")
500
- ], MixMaterial.prototype, "disableLighting", void 0);
501
- __decorate([
502
- serialize("maxSimultaneousLights")
503
- ], MixMaterial.prototype, "_maxSimultaneousLights", void 0);
504
- __decorate([
505
- expandToProperty("_markAllSubMeshesAsLightsDirty")
506
- ], MixMaterial.prototype, "maxSimultaneousLights", void 0);
507
- return MixMaterial;
508
- }(PushMaterial));
509
- export { MixMaterial };
510
- RegisterClass("BABYLON.MixMaterial", MixMaterial);
1
+ import { __decorate, __extends } from "tslib";
2
+ import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
3
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
4
+ import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
5
+ import { MaterialHelper } from "@babylonjs/core/Materials/materialHelper.js";
6
+ import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
7
+ import { MaterialFlags } from "@babylonjs/core/Materials/materialFlags.js";
8
+ import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
9
+ import { Scene } from "@babylonjs/core/scene.js";
10
+ import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
11
+ import "./mix.fragment";
12
+ import "./mix.vertex";
13
+ import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
14
+ var MixMaterialDefines = /** @class */ (function (_super) {
15
+ __extends(MixMaterialDefines, _super);
16
+ function MixMaterialDefines() {
17
+ var _this = _super.call(this) || this;
18
+ _this.DIFFUSE = false;
19
+ _this.CLIPPLANE = false;
20
+ _this.CLIPPLANE2 = false;
21
+ _this.CLIPPLANE3 = false;
22
+ _this.CLIPPLANE4 = false;
23
+ _this.CLIPPLANE5 = false;
24
+ _this.CLIPPLANE6 = false;
25
+ _this.ALPHATEST = false;
26
+ _this.DEPTHPREPASS = false;
27
+ _this.POINTSIZE = false;
28
+ _this.FOG = false;
29
+ _this.SPECULARTERM = false;
30
+ _this.NORMAL = false;
31
+ _this.UV1 = false;
32
+ _this.UV2 = false;
33
+ _this.VERTEXCOLOR = false;
34
+ _this.VERTEXALPHA = false;
35
+ _this.NUM_BONE_INFLUENCERS = 0;
36
+ _this.BonesPerMesh = 0;
37
+ _this.INSTANCES = false;
38
+ _this.INSTANCESCOLOR = false;
39
+ _this.MIXMAP2 = false;
40
+ _this.IMAGEPROCESSINGPOSTPROCESS = false;
41
+ _this.SKIPFINALCOLORCLAMP = false;
42
+ _this.rebuild();
43
+ return _this;
44
+ }
45
+ return MixMaterialDefines;
46
+ }(MaterialDefines));
47
+ var MixMaterial = /** @class */ (function (_super) {
48
+ __extends(MixMaterial, _super);
49
+ function MixMaterial(name, scene) {
50
+ var _this = _super.call(this, name, scene) || this;
51
+ /**
52
+ * Uniforms
53
+ */
54
+ _this.diffuseColor = new Color3(1, 1, 1);
55
+ _this.specularColor = new Color3(0, 0, 0);
56
+ _this.specularPower = 64;
57
+ _this._disableLighting = false;
58
+ _this._maxSimultaneousLights = 4;
59
+ return _this;
60
+ }
61
+ MixMaterial.prototype.needAlphaBlending = function () {
62
+ return this.alpha < 1.0;
63
+ };
64
+ MixMaterial.prototype.needAlphaTesting = function () {
65
+ return false;
66
+ };
67
+ MixMaterial.prototype.getAlphaTestTexture = function () {
68
+ return null;
69
+ };
70
+ // Methods
71
+ MixMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
72
+ if (this.isFrozen) {
73
+ if (subMesh.effect && subMesh.effect._wasPreviouslyReady) {
74
+ return true;
75
+ }
76
+ }
77
+ if (!subMesh.materialDefines) {
78
+ subMesh.materialDefines = new MixMaterialDefines();
79
+ }
80
+ var defines = subMesh.materialDefines;
81
+ var scene = this.getScene();
82
+ if (this._isReadyForSubMesh(subMesh)) {
83
+ return true;
84
+ }
85
+ var engine = scene.getEngine();
86
+ // Textures
87
+ if (scene.texturesEnabled) {
88
+ if (!this._mixTexture1 || !this._mixTexture1.isReady()) {
89
+ return false;
90
+ }
91
+ defines._needUVs = true;
92
+ if (MaterialFlags.DiffuseTextureEnabled) {
93
+ if (!this._diffuseTexture1 || !this._diffuseTexture1.isReady()) {
94
+ return false;
95
+ }
96
+ defines.DIFFUSE = true;
97
+ if (!this._diffuseTexture2 || !this._diffuseTexture2.isReady()) {
98
+ return false;
99
+ }
100
+ if (!this._diffuseTexture3 || !this._diffuseTexture3.isReady()) {
101
+ return false;
102
+ }
103
+ if (!this._diffuseTexture4 || !this._diffuseTexture4.isReady()) {
104
+ return false;
105
+ }
106
+ if (this._mixTexture2) {
107
+ if (!this._mixTexture2.isReady()) {
108
+ return false;
109
+ }
110
+ defines.MIXMAP2 = true;
111
+ if (!this._diffuseTexture5 || !this._diffuseTexture5.isReady()) {
112
+ return false;
113
+ }
114
+ if (!this._diffuseTexture6 || !this._diffuseTexture6.isReady()) {
115
+ return false;
116
+ }
117
+ if (!this._diffuseTexture7 || !this._diffuseTexture7.isReady()) {
118
+ return false;
119
+ }
120
+ if (!this._diffuseTexture8 || !this._diffuseTexture8.isReady()) {
121
+ return false;
122
+ }
123
+ }
124
+ }
125
+ }
126
+ // Misc.
127
+ MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
128
+ // Lights
129
+ defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
130
+ // Values that need to be evaluated on every frame
131
+ MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
132
+ // Attribs
133
+ MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);
134
+ // Get correct effect
135
+ if (defines.isDirty) {
136
+ defines.markAsProcessed();
137
+ scene.resetCachedMaterial();
138
+ // Fallbacks
139
+ var fallbacks = new EffectFallbacks();
140
+ if (defines.FOG) {
141
+ fallbacks.addFallback(1, "FOG");
142
+ }
143
+ MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
144
+ if (defines.NUM_BONE_INFLUENCERS > 0) {
145
+ fallbacks.addCPUSkinningFallback(0, mesh);
146
+ }
147
+ defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
148
+ //Attributes
149
+ var attribs = [VertexBuffer.PositionKind];
150
+ if (defines.NORMAL) {
151
+ attribs.push(VertexBuffer.NormalKind);
152
+ }
153
+ if (defines.UV1) {
154
+ attribs.push(VertexBuffer.UVKind);
155
+ }
156
+ if (defines.UV2) {
157
+ attribs.push(VertexBuffer.UV2Kind);
158
+ }
159
+ if (defines.VERTEXCOLOR) {
160
+ attribs.push(VertexBuffer.ColorKind);
161
+ }
162
+ MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
163
+ MaterialHelper.PrepareAttributesForInstances(attribs, defines);
164
+ // Legacy browser patch
165
+ var shaderName = "mix";
166
+ var join = defines.toString();
167
+ var uniforms = [
168
+ "world",
169
+ "view",
170
+ "viewProjection",
171
+ "vEyePosition",
172
+ "vLightsType",
173
+ "vDiffuseColor",
174
+ "vSpecularColor",
175
+ "vFogInfos",
176
+ "vFogColor",
177
+ "pointSize",
178
+ "vTextureInfos",
179
+ "mBones",
180
+ "vClipPlane",
181
+ "vClipPlane2",
182
+ "vClipPlane3",
183
+ "vClipPlane4",
184
+ "vClipPlane5",
185
+ "vClipPlane6",
186
+ "textureMatrix",
187
+ "diffuse1Infos",
188
+ "diffuse2Infos",
189
+ "diffuse3Infos",
190
+ "diffuse4Infos",
191
+ "diffuse5Infos",
192
+ "diffuse6Infos",
193
+ "diffuse7Infos",
194
+ "diffuse8Infos",
195
+ ];
196
+ var samplers = [
197
+ "mixMap1Sampler",
198
+ "mixMap2Sampler",
199
+ "diffuse1Sampler",
200
+ "diffuse2Sampler",
201
+ "diffuse3Sampler",
202
+ "diffuse4Sampler",
203
+ "diffuse5Sampler",
204
+ "diffuse6Sampler",
205
+ "diffuse7Sampler",
206
+ "diffuse8Sampler",
207
+ ];
208
+ var uniformBuffers = new Array();
209
+ MaterialHelper.PrepareUniformsAndSamplersList({
210
+ uniformsNames: uniforms,
211
+ uniformBuffersNames: uniformBuffers,
212
+ samplers: samplers,
213
+ defines: defines,
214
+ maxSimultaneousLights: this.maxSimultaneousLights,
215
+ });
216
+ subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
217
+ attributes: attribs,
218
+ uniformsNames: uniforms,
219
+ uniformBuffersNames: uniformBuffers,
220
+ samplers: samplers,
221
+ defines: join,
222
+ fallbacks: fallbacks,
223
+ onCompiled: this.onCompiled,
224
+ onError: this.onError,
225
+ indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights },
226
+ }, engine), defines, this._materialContext);
227
+ }
228
+ if (!subMesh.effect || !subMesh.effect.isReady()) {
229
+ return false;
230
+ }
231
+ defines._renderId = scene.getRenderId();
232
+ subMesh.effect._wasPreviouslyReady = true;
233
+ return true;
234
+ };
235
+ MixMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
236
+ var scene = this.getScene();
237
+ var defines = subMesh.materialDefines;
238
+ if (!defines) {
239
+ return;
240
+ }
241
+ var effect = subMesh.effect;
242
+ if (!effect) {
243
+ return;
244
+ }
245
+ this._activeEffect = effect;
246
+ // Matrices
247
+ this.bindOnlyWorldMatrix(world);
248
+ this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
249
+ // Bones
250
+ MaterialHelper.BindBonesParameters(mesh, this._activeEffect);
251
+ if (this._mustRebind(scene, effect)) {
252
+ // Textures
253
+ if (this._mixTexture1) {
254
+ this._activeEffect.setTexture("mixMap1Sampler", this._mixTexture1);
255
+ this._activeEffect.setFloat2("vTextureInfos", this._mixTexture1.coordinatesIndex, this._mixTexture1.level);
256
+ this._activeEffect.setMatrix("textureMatrix", this._mixTexture1.getTextureMatrix());
257
+ if (MaterialFlags.DiffuseTextureEnabled) {
258
+ if (this._diffuseTexture1) {
259
+ this._activeEffect.setTexture("diffuse1Sampler", this._diffuseTexture1);
260
+ this._activeEffect.setFloat2("diffuse1Infos", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);
261
+ }
262
+ if (this._diffuseTexture2) {
263
+ this._activeEffect.setTexture("diffuse2Sampler", this._diffuseTexture2);
264
+ this._activeEffect.setFloat2("diffuse2Infos", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);
265
+ }
266
+ if (this._diffuseTexture3) {
267
+ this._activeEffect.setTexture("diffuse3Sampler", this._diffuseTexture3);
268
+ this._activeEffect.setFloat2("diffuse3Infos", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);
269
+ }
270
+ if (this._diffuseTexture4) {
271
+ this._activeEffect.setTexture("diffuse4Sampler", this._diffuseTexture4);
272
+ this._activeEffect.setFloat2("diffuse4Infos", this._diffuseTexture4.uScale, this._diffuseTexture4.vScale);
273
+ }
274
+ }
275
+ }
276
+ if (this._mixTexture2) {
277
+ this._activeEffect.setTexture("mixMap2Sampler", this._mixTexture2);
278
+ if (MaterialFlags.DiffuseTextureEnabled) {
279
+ if (this._diffuseTexture5) {
280
+ this._activeEffect.setTexture("diffuse5Sampler", this._diffuseTexture5);
281
+ this._activeEffect.setFloat2("diffuse5Infos", this._diffuseTexture5.uScale, this._diffuseTexture5.vScale);
282
+ }
283
+ if (this._diffuseTexture6) {
284
+ this._activeEffect.setTexture("diffuse6Sampler", this._diffuseTexture6);
285
+ this._activeEffect.setFloat2("diffuse6Infos", this._diffuseTexture6.uScale, this._diffuseTexture6.vScale);
286
+ }
287
+ if (this._diffuseTexture7) {
288
+ this._activeEffect.setTexture("diffuse7Sampler", this._diffuseTexture7);
289
+ this._activeEffect.setFloat2("diffuse7Infos", this._diffuseTexture7.uScale, this._diffuseTexture7.vScale);
290
+ }
291
+ if (this._diffuseTexture8) {
292
+ this._activeEffect.setTexture("diffuse8Sampler", this._diffuseTexture8);
293
+ this._activeEffect.setFloat2("diffuse8Infos", this._diffuseTexture8.uScale, this._diffuseTexture8.vScale);
294
+ }
295
+ }
296
+ }
297
+ // Clip plane
298
+ MaterialHelper.BindClipPlane(this._activeEffect, scene);
299
+ // Point size
300
+ if (this.pointsCloud) {
301
+ this._activeEffect.setFloat("pointSize", this.pointSize);
302
+ }
303
+ scene.bindEyePosition(effect);
304
+ }
305
+ this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
306
+ if (defines.SPECULARTERM) {
307
+ this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
308
+ }
309
+ if (scene.lightsEnabled && !this.disableLighting) {
310
+ MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
311
+ }
312
+ // View
313
+ if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
314
+ this._activeEffect.setMatrix("view", scene.getViewMatrix());
315
+ }
316
+ // Fog
317
+ MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);
318
+ this._afterBind(mesh, this._activeEffect);
319
+ };
320
+ MixMaterial.prototype.getAnimatables = function () {
321
+ var results = [];
322
+ if (this._mixTexture1 && this._mixTexture1.animations && this._mixTexture1.animations.length > 0) {
323
+ results.push(this._mixTexture1);
324
+ }
325
+ if (this._mixTexture2 && this._mixTexture2.animations && this._mixTexture2.animations.length > 0) {
326
+ results.push(this._mixTexture2);
327
+ }
328
+ return results;
329
+ };
330
+ MixMaterial.prototype.getActiveTextures = function () {
331
+ var activeTextures = _super.prototype.getActiveTextures.call(this);
332
+ // Mix map 1
333
+ if (this._mixTexture1) {
334
+ activeTextures.push(this._mixTexture1);
335
+ }
336
+ if (this._diffuseTexture1) {
337
+ activeTextures.push(this._diffuseTexture1);
338
+ }
339
+ if (this._diffuseTexture2) {
340
+ activeTextures.push(this._diffuseTexture2);
341
+ }
342
+ if (this._diffuseTexture3) {
343
+ activeTextures.push(this._diffuseTexture3);
344
+ }
345
+ if (this._diffuseTexture4) {
346
+ activeTextures.push(this._diffuseTexture4);
347
+ }
348
+ // Mix map 2
349
+ if (this._mixTexture2) {
350
+ activeTextures.push(this._mixTexture2);
351
+ }
352
+ if (this._diffuseTexture5) {
353
+ activeTextures.push(this._diffuseTexture5);
354
+ }
355
+ if (this._diffuseTexture6) {
356
+ activeTextures.push(this._diffuseTexture6);
357
+ }
358
+ if (this._diffuseTexture7) {
359
+ activeTextures.push(this._diffuseTexture7);
360
+ }
361
+ if (this._diffuseTexture8) {
362
+ activeTextures.push(this._diffuseTexture8);
363
+ }
364
+ return activeTextures;
365
+ };
366
+ MixMaterial.prototype.hasTexture = function (texture) {
367
+ if (_super.prototype.hasTexture.call(this, texture)) {
368
+ return true;
369
+ }
370
+ // Mix map 1
371
+ if (this._mixTexture1 === texture) {
372
+ return true;
373
+ }
374
+ if (this._diffuseTexture1 === texture) {
375
+ return true;
376
+ }
377
+ if (this._diffuseTexture2 === texture) {
378
+ return true;
379
+ }
380
+ if (this._diffuseTexture3 === texture) {
381
+ return true;
382
+ }
383
+ if (this._diffuseTexture4 === texture) {
384
+ return true;
385
+ }
386
+ // Mix map 2
387
+ if (this._mixTexture2 === texture) {
388
+ return true;
389
+ }
390
+ if (this._diffuseTexture5 === texture) {
391
+ return true;
392
+ }
393
+ if (this._diffuseTexture6 === texture) {
394
+ return true;
395
+ }
396
+ if (this._diffuseTexture7 === texture) {
397
+ return true;
398
+ }
399
+ if (this._diffuseTexture8 === texture) {
400
+ return true;
401
+ }
402
+ return false;
403
+ };
404
+ MixMaterial.prototype.dispose = function (forceDisposeEffect) {
405
+ if (this._mixTexture1) {
406
+ this._mixTexture1.dispose();
407
+ }
408
+ _super.prototype.dispose.call(this, forceDisposeEffect);
409
+ };
410
+ MixMaterial.prototype.clone = function (name) {
411
+ var _this = this;
412
+ return SerializationHelper.Clone(function () { return new MixMaterial(name, _this.getScene()); }, this);
413
+ };
414
+ MixMaterial.prototype.serialize = function () {
415
+ var serializationObject = _super.prototype.serialize.call(this);
416
+ serializationObject.customType = "BABYLON.MixMaterial";
417
+ return serializationObject;
418
+ };
419
+ MixMaterial.prototype.getClassName = function () {
420
+ return "MixMaterial";
421
+ };
422
+ // Statics
423
+ MixMaterial.Parse = function (source, scene, rootUrl) {
424
+ return SerializationHelper.Parse(function () { return new MixMaterial(source.name, scene); }, source, scene, rootUrl);
425
+ };
426
+ __decorate([
427
+ serializeAsTexture("mixTexture1")
428
+ ], MixMaterial.prototype, "_mixTexture1", void 0);
429
+ __decorate([
430
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
431
+ ], MixMaterial.prototype, "mixTexture1", void 0);
432
+ __decorate([
433
+ serializeAsTexture("mixTexture2")
434
+ ], MixMaterial.prototype, "_mixTexture2", void 0);
435
+ __decorate([
436
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
437
+ ], MixMaterial.prototype, "mixTexture2", void 0);
438
+ __decorate([
439
+ serializeAsTexture("diffuseTexture1")
440
+ ], MixMaterial.prototype, "_diffuseTexture1", void 0);
441
+ __decorate([
442
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
443
+ ], MixMaterial.prototype, "diffuseTexture1", void 0);
444
+ __decorate([
445
+ serializeAsTexture("diffuseTexture2")
446
+ ], MixMaterial.prototype, "_diffuseTexture2", void 0);
447
+ __decorate([
448
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
449
+ ], MixMaterial.prototype, "diffuseTexture2", void 0);
450
+ __decorate([
451
+ serializeAsTexture("diffuseTexture3")
452
+ ], MixMaterial.prototype, "_diffuseTexture3", void 0);
453
+ __decorate([
454
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
455
+ ], MixMaterial.prototype, "diffuseTexture3", void 0);
456
+ __decorate([
457
+ serializeAsTexture("diffuseTexture4")
458
+ ], MixMaterial.prototype, "_diffuseTexture4", void 0);
459
+ __decorate([
460
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
461
+ ], MixMaterial.prototype, "diffuseTexture4", void 0);
462
+ __decorate([
463
+ serializeAsTexture("diffuseTexture1")
464
+ ], MixMaterial.prototype, "_diffuseTexture5", void 0);
465
+ __decorate([
466
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
467
+ ], MixMaterial.prototype, "diffuseTexture5", void 0);
468
+ __decorate([
469
+ serializeAsTexture("diffuseTexture2")
470
+ ], MixMaterial.prototype, "_diffuseTexture6", void 0);
471
+ __decorate([
472
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
473
+ ], MixMaterial.prototype, "diffuseTexture6", void 0);
474
+ __decorate([
475
+ serializeAsTexture("diffuseTexture3")
476
+ ], MixMaterial.prototype, "_diffuseTexture7", void 0);
477
+ __decorate([
478
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
479
+ ], MixMaterial.prototype, "diffuseTexture7", void 0);
480
+ __decorate([
481
+ serializeAsTexture("diffuseTexture4")
482
+ ], MixMaterial.prototype, "_diffuseTexture8", void 0);
483
+ __decorate([
484
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
485
+ ], MixMaterial.prototype, "diffuseTexture8", void 0);
486
+ __decorate([
487
+ serializeAsColor3()
488
+ ], MixMaterial.prototype, "diffuseColor", void 0);
489
+ __decorate([
490
+ serializeAsColor3()
491
+ ], MixMaterial.prototype, "specularColor", void 0);
492
+ __decorate([
493
+ serialize()
494
+ ], MixMaterial.prototype, "specularPower", void 0);
495
+ __decorate([
496
+ serialize("disableLighting")
497
+ ], MixMaterial.prototype, "_disableLighting", void 0);
498
+ __decorate([
499
+ expandToProperty("_markAllSubMeshesAsLightsDirty")
500
+ ], MixMaterial.prototype, "disableLighting", void 0);
501
+ __decorate([
502
+ serialize("maxSimultaneousLights")
503
+ ], MixMaterial.prototype, "_maxSimultaneousLights", void 0);
504
+ __decorate([
505
+ expandToProperty("_markAllSubMeshesAsLightsDirty")
506
+ ], MixMaterial.prototype, "maxSimultaneousLights", void 0);
507
+ return MixMaterial;
508
+ }(PushMaterial));
509
+ export { MixMaterial };
510
+ RegisterClass("BABYLON.MixMaterial", MixMaterial);
511
511
  //# sourceMappingURL=mixMaterial.js.map