@babylonjs/materials 9.15.0 → 9.16.1

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 (39) hide show
  1. package/cell/cellMaterial.d.ts +4 -4
  2. package/cell/cellMaterial.js +313 -268
  3. package/cell/cellMaterial.js.map +1 -1
  4. package/fire/fireMaterial.d.ts +3 -3
  5. package/fire/fireMaterial.js +344 -303
  6. package/fire/fireMaterial.js.map +1 -1
  7. package/fur/furMaterial.d.ts +4 -4
  8. package/fur/furMaterial.js +519 -450
  9. package/fur/furMaterial.js.map +1 -1
  10. package/gradient/gradientMaterial.d.ts +2 -2
  11. package/gradient/gradientMaterial.js +286 -246
  12. package/gradient/gradientMaterial.js.map +1 -1
  13. package/grid/gridMaterial.d.ts +1 -1
  14. package/grid/gridMaterial.js +453 -398
  15. package/grid/gridMaterial.js.map +1 -1
  16. package/lava/lavaMaterial.d.ts +4 -4
  17. package/lava/lavaMaterial.js +377 -318
  18. package/lava/lavaMaterial.js.map +1 -1
  19. package/mix/mixMaterial.d.ts +12 -12
  20. package/mix/mixMaterial.js +584 -456
  21. package/mix/mixMaterial.js.map +1 -1
  22. package/normal/normalMaterial.d.ts +3 -3
  23. package/normal/normalMaterial.js +301 -264
  24. package/normal/normalMaterial.js.map +1 -1
  25. package/package.json +2 -2
  26. package/simple/simpleMaterial.d.ts +3 -3
  27. package/simple/simpleMaterial.js +299 -262
  28. package/simple/simpleMaterial.js.map +1 -1
  29. package/sky/skyMaterial.js +380 -344
  30. package/sky/skyMaterial.js.map +1 -1
  31. package/terrain/terrainMaterial.d.ts +9 -9
  32. package/terrain/terrainMaterial.js +490 -395
  33. package/terrain/terrainMaterial.js.map +1 -1
  34. package/triPlanar/triPlanarMaterial.d.ts +8 -8
  35. package/triPlanar/triPlanarMaterial.js +460 -369
  36. package/triPlanar/triPlanarMaterial.js.map +1 -1
  37. package/water/waterMaterial.d.ts +7 -7
  38. package/water/waterMaterial.js +759 -659
  39. package/water/waterMaterial.js.map +1 -1
@@ -1,4 +1,4 @@
1
- import { __decorate } from "@babylonjs/core/tslib.es6.js";
1
+ import { __classPrivateFieldGet, __classPrivateFieldSet, __esDecorate, __runInitializers } from "@babylonjs/core/tslib.es6.js";
2
2
  import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
3
3
  import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
4
4
  import { Color3 } from "@babylonjs/core/Maths/math.color.js";
@@ -82,282 +82,319 @@ class NormalMaterialDefines extends MaterialDefines {
82
82
  this.rebuild();
83
83
  }
84
84
  }
85
- export class NormalMaterial extends PushMaterial {
86
- /**
87
- * Instantiates a Normal Material in the given scene
88
- * @param name The friendly name of the material
89
- * @param scene The scene to add the material to
90
- * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
91
- */
92
- constructor(name, scene, forceGLSL = false) {
93
- super(name, scene, undefined, forceGLSL);
94
- this.diffuseColor = new Color3(1, 1, 1);
95
- this._disableLighting = false;
96
- this._maxSimultaneousLights = 4;
97
- this._shadersLoaded = false;
98
- }
99
- needAlphaBlending() {
100
- return this.alpha < 1.0;
101
- }
102
- needAlphaBlendingForMesh(mesh) {
103
- return this.needAlphaBlending() || mesh.visibility < 1.0;
104
- }
105
- needAlphaTesting() {
106
- return false;
107
- }
108
- getAlphaTestTexture() {
109
- return null;
110
- }
111
- // Methods
112
- isReadyForSubMesh(mesh, subMesh, useInstances) {
113
- const drawWrapper = subMesh._drawWrapper;
114
- if (this.isFrozen) {
115
- if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {
116
- return true;
85
+ let NormalMaterial = (() => {
86
+ var _a, _NormalMaterial_diffuseTexture_accessor_storage, _NormalMaterial_disableLighting_accessor_storage, _NormalMaterial_maxSimultaneousLights_accessor_storage;
87
+ let _classSuper = PushMaterial;
88
+ let __diffuseTexture_decorators;
89
+ let __diffuseTexture_initializers = [];
90
+ let __diffuseTexture_extraInitializers = [];
91
+ let _diffuseTexture_decorators;
92
+ let _diffuseTexture_initializers = [];
93
+ let _diffuseTexture_extraInitializers = [];
94
+ let _diffuseColor_decorators;
95
+ let _diffuseColor_initializers = [];
96
+ let _diffuseColor_extraInitializers = [];
97
+ let __disableLighting_decorators;
98
+ let __disableLighting_initializers = [];
99
+ let __disableLighting_extraInitializers = [];
100
+ let _disableLighting_decorators;
101
+ let _disableLighting_initializers = [];
102
+ let _disableLighting_extraInitializers = [];
103
+ let __maxSimultaneousLights_decorators;
104
+ let __maxSimultaneousLights_initializers = [];
105
+ let __maxSimultaneousLights_extraInitializers = [];
106
+ let _maxSimultaneousLights_decorators;
107
+ let _maxSimultaneousLights_initializers = [];
108
+ let _maxSimultaneousLights_extraInitializers = [];
109
+ return _a = class NormalMaterial extends _classSuper {
110
+ get diffuseTexture() { return __classPrivateFieldGet(this, _NormalMaterial_diffuseTexture_accessor_storage, "f"); }
111
+ set diffuseTexture(value) { __classPrivateFieldSet(this, _NormalMaterial_diffuseTexture_accessor_storage, value, "f"); }
112
+ get disableLighting() { return __classPrivateFieldGet(this, _NormalMaterial_disableLighting_accessor_storage, "f"); }
113
+ set disableLighting(value) { __classPrivateFieldSet(this, _NormalMaterial_disableLighting_accessor_storage, value, "f"); }
114
+ get maxSimultaneousLights() { return __classPrivateFieldGet(this, _NormalMaterial_maxSimultaneousLights_accessor_storage, "f"); }
115
+ set maxSimultaneousLights(value) { __classPrivateFieldSet(this, _NormalMaterial_maxSimultaneousLights_accessor_storage, value, "f"); }
116
+ /**
117
+ * Instantiates a Normal Material in the given scene
118
+ * @param name The friendly name of the material
119
+ * @param scene The scene to add the material to
120
+ * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
121
+ */
122
+ constructor(name, scene, forceGLSL = false) {
123
+ super(name, scene, undefined, forceGLSL);
124
+ this._diffuseTexture = __runInitializers(this, __diffuseTexture_initializers, void 0);
125
+ _NormalMaterial_diffuseTexture_accessor_storage.set(this, (__runInitializers(this, __diffuseTexture_extraInitializers), __runInitializers(this, _diffuseTexture_initializers, void 0)));
126
+ this.diffuseColor = (__runInitializers(this, _diffuseTexture_extraInitializers), __runInitializers(this, _diffuseColor_initializers, new Color3(1, 1, 1)));
127
+ this._disableLighting = (__runInitializers(this, _diffuseColor_extraInitializers), __runInitializers(this, __disableLighting_initializers, false));
128
+ _NormalMaterial_disableLighting_accessor_storage.set(this, (__runInitializers(this, __disableLighting_extraInitializers), __runInitializers(this, _disableLighting_initializers, void 0)));
129
+ this._maxSimultaneousLights = (__runInitializers(this, _disableLighting_extraInitializers), __runInitializers(this, __maxSimultaneousLights_initializers, 4));
130
+ _NormalMaterial_maxSimultaneousLights_accessor_storage.set(this, (__runInitializers(this, __maxSimultaneousLights_extraInitializers), __runInitializers(this, _maxSimultaneousLights_initializers, void 0)));
131
+ this._shadersLoaded = (__runInitializers(this, _maxSimultaneousLights_extraInitializers), false);
132
+ }
133
+ needAlphaBlending() {
134
+ return this.alpha < 1.0;
117
135
  }
118
- }
119
- if (!subMesh.materialDefines) {
120
- subMesh.materialDefines = new NormalMaterialDefines();
121
- }
122
- const defines = subMesh.materialDefines;
123
- const scene = this.getScene();
124
- if (this._isReadyForSubMesh(subMesh)) {
125
- return true;
126
- }
127
- const engine = scene.getEngine();
128
- // Textures
129
- if (defines._areTexturesDirty) {
130
- defines._needUVs = false;
131
- if (scene.texturesEnabled) {
132
- if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
133
- if (!this._diffuseTexture.isReady()) {
134
- return false;
136
+ needAlphaBlendingForMesh(mesh) {
137
+ return this.needAlphaBlending() || mesh.visibility < 1.0;
138
+ }
139
+ needAlphaTesting() {
140
+ return false;
141
+ }
142
+ getAlphaTestTexture() {
143
+ return null;
144
+ }
145
+ // Methods
146
+ isReadyForSubMesh(mesh, subMesh, useInstances) {
147
+ const drawWrapper = subMesh._drawWrapper;
148
+ if (this.isFrozen) {
149
+ if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {
150
+ return true;
135
151
  }
136
- else {
137
- defines._needUVs = true;
138
- defines.DIFFUSE = true;
152
+ }
153
+ if (!subMesh.materialDefines) {
154
+ subMesh.materialDefines = new NormalMaterialDefines();
155
+ }
156
+ const defines = subMesh.materialDefines;
157
+ const scene = this.getScene();
158
+ if (this._isReadyForSubMesh(subMesh)) {
159
+ return true;
160
+ }
161
+ const engine = scene.getEngine();
162
+ // Textures
163
+ if (defines._areTexturesDirty) {
164
+ defines._needUVs = false;
165
+ if (scene.texturesEnabled) {
166
+ if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
167
+ if (!this._diffuseTexture.isReady()) {
168
+ return false;
169
+ }
170
+ else {
171
+ defines._needUVs = true;
172
+ defines.DIFFUSE = true;
173
+ }
174
+ }
139
175
  }
140
176
  }
177
+ // Misc.
178
+ PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(mesh), defines, undefined, undefined, undefined, this._isVertexOutputInvariant);
179
+ // Lights
180
+ defines._needNormals = true;
181
+ PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
182
+ // Values that need to be evaluated on every frame
183
+ PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false, null, subMesh.getRenderingMesh().hasThinInstances);
184
+ defines.LIGHTING = !this._disableLighting;
185
+ // Attribs
186
+ PrepareDefinesForAttributes(mesh, defines, true, true);
187
+ // Get correct effect
188
+ if (defines.isDirty) {
189
+ defines.markAsProcessed();
190
+ scene.resetCachedMaterial();
191
+ // Fallbacks
192
+ const fallbacks = new EffectFallbacks();
193
+ if (defines.FOG) {
194
+ fallbacks.addFallback(1, "FOG");
195
+ }
196
+ HandleFallbacksForShadows(defines, fallbacks);
197
+ if (defines.NUM_BONE_INFLUENCERS > 0) {
198
+ fallbacks.addCPUSkinningFallback(0, mesh);
199
+ }
200
+ defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
201
+ //Attributes
202
+ const attribs = [VertexBuffer.PositionKind];
203
+ if (defines.NORMAL) {
204
+ attribs.push(VertexBuffer.NormalKind);
205
+ }
206
+ if (defines.UV1) {
207
+ attribs.push(VertexBuffer.UVKind);
208
+ }
209
+ if (defines.UV2) {
210
+ attribs.push(VertexBuffer.UV2Kind);
211
+ }
212
+ PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
213
+ PrepareAttributesForInstances(attribs, defines);
214
+ const shaderName = "normal";
215
+ const join = defines.toString();
216
+ const uniforms = [
217
+ "world",
218
+ "view",
219
+ "viewProjection",
220
+ "vEyePosition",
221
+ "vLightsType",
222
+ "vDiffuseColor",
223
+ "vFogInfos",
224
+ "vFogColor",
225
+ "pointSize",
226
+ "vDiffuseInfos",
227
+ "mBones",
228
+ "diffuseMatrix",
229
+ "logarithmicDepthConstant",
230
+ ];
231
+ const samplers = ["diffuseSampler", "areaLightsLTC1Sampler", "areaLightsLTC2Sampler"];
232
+ const uniformBuffers = [];
233
+ AddClipPlaneUniforms(uniforms);
234
+ PrepareUniformsAndSamplersList({
235
+ uniformsNames: uniforms,
236
+ uniformBuffersNames: uniformBuffers,
237
+ samplers: samplers,
238
+ defines: defines,
239
+ maxSimultaneousLights: 4,
240
+ shaderLanguage: this._shaderLanguage,
241
+ });
242
+ subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
243
+ attributes: attribs,
244
+ uniformsNames: uniforms,
245
+ uniformBuffersNames: uniformBuffers,
246
+ samplers: samplers,
247
+ defines: join,
248
+ fallbacks: fallbacks,
249
+ onCompiled: this.onCompiled,
250
+ onError: this.onError,
251
+ indexParameters: { maxSimultaneousLights: 4 },
252
+ shaderLanguage: this._shaderLanguage,
253
+ extraInitializationsAsync: this._shadersLoaded
254
+ ? undefined
255
+ : async () => {
256
+ if (this.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
257
+ await Promise.all([import("./wgsl/normal.vertex.js"), import("./wgsl/normal.fragment.js")]);
258
+ }
259
+ else {
260
+ await Promise.all([import("./normal.vertex.js"), import("./normal.fragment.js")]);
261
+ }
262
+ this._shadersLoaded = true;
263
+ },
264
+ }, engine), defines, this._materialContext);
265
+ }
266
+ // Check if Area Lights have LTC texture.
267
+ if (defines["AREALIGHTUSED"]) {
268
+ for (let index = 0; index < mesh.lightSources.length; index++) {
269
+ if (!mesh.lightSources[index]._isReady()) {
270
+ return false;
271
+ }
272
+ }
273
+ }
274
+ if (!subMesh.effect || !subMesh.effect.isReady()) {
275
+ return false;
276
+ }
277
+ defines._renderId = scene.getRenderId();
278
+ drawWrapper._wasPreviouslyReady = true;
279
+ drawWrapper._wasPreviouslyUsingInstances = !!useInstances;
280
+ return true;
141
281
  }
142
- }
143
- // Misc.
144
- PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(mesh), defines, undefined, undefined, undefined, this._isVertexOutputInvariant);
145
- // Lights
146
- defines._needNormals = true;
147
- PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
148
- // Values that need to be evaluated on every frame
149
- PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false, null, subMesh.getRenderingMesh().hasThinInstances);
150
- defines.LIGHTING = !this._disableLighting;
151
- // Attribs
152
- PrepareDefinesForAttributes(mesh, defines, true, true);
153
- // Get correct effect
154
- if (defines.isDirty) {
155
- defines.markAsProcessed();
156
- scene.resetCachedMaterial();
157
- // Fallbacks
158
- const fallbacks = new EffectFallbacks();
159
- if (defines.FOG) {
160
- fallbacks.addFallback(1, "FOG");
161
- }
162
- HandleFallbacksForShadows(defines, fallbacks);
163
- if (defines.NUM_BONE_INFLUENCERS > 0) {
164
- fallbacks.addCPUSkinningFallback(0, mesh);
282
+ bindForSubMesh(world, mesh, subMesh) {
283
+ const scene = this.getScene();
284
+ const defines = subMesh.materialDefines;
285
+ if (!defines) {
286
+ return;
287
+ }
288
+ const effect = subMesh.effect;
289
+ if (!effect) {
290
+ return;
291
+ }
292
+ this._activeEffect = effect;
293
+ // Matrices
294
+ this.bindOnlyWorldMatrix(world);
295
+ this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
296
+ // Bones
297
+ BindBonesParameters(mesh, this._activeEffect);
298
+ if (this._mustRebind(scene, effect, subMesh)) {
299
+ // Textures
300
+ if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
301
+ this._activeEffect.setTexture("diffuseSampler", this.diffuseTexture);
302
+ this._activeEffect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
303
+ this._activeEffect.setMatrix("diffuseMatrix", this.diffuseTexture.getTextureMatrix());
304
+ }
305
+ // Clip plane
306
+ BindClipPlane(effect, this, scene);
307
+ // Point size
308
+ if (this.pointsCloud) {
309
+ this._activeEffect.setFloat("pointSize", this.pointSize);
310
+ }
311
+ // Log. depth
312
+ if (this._useLogarithmicDepth) {
313
+ BindLogDepth(defines, effect, scene);
314
+ }
315
+ scene.bindEyePosition(effect);
316
+ }
317
+ this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
318
+ // Lights
319
+ if (scene.lightsEnabled && !this.disableLighting) {
320
+ BindLights(scene, mesh, this._activeEffect, defines);
321
+ }
322
+ // View
323
+ if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
324
+ this._activeEffect.setMatrix("view", scene.getViewMatrix());
325
+ }
326
+ // Fog
327
+ BindFogParameters(scene, mesh, this._activeEffect);
328
+ this._afterBind(mesh, this._activeEffect, subMesh);
165
329
  }
166
- defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
167
- //Attributes
168
- const attribs = [VertexBuffer.PositionKind];
169
- if (defines.NORMAL) {
170
- attribs.push(VertexBuffer.NormalKind);
330
+ getAnimatables() {
331
+ const results = [];
332
+ if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
333
+ results.push(this.diffuseTexture);
334
+ }
335
+ return results;
171
336
  }
172
- if (defines.UV1) {
173
- attribs.push(VertexBuffer.UVKind);
337
+ getActiveTextures() {
338
+ const activeTextures = super.getActiveTextures();
339
+ if (this._diffuseTexture) {
340
+ activeTextures.push(this._diffuseTexture);
341
+ }
342
+ return activeTextures;
174
343
  }
175
- if (defines.UV2) {
176
- attribs.push(VertexBuffer.UV2Kind);
344
+ hasTexture(texture) {
345
+ if (super.hasTexture(texture)) {
346
+ return true;
347
+ }
348
+ if (this.diffuseTexture === texture) {
349
+ return true;
350
+ }
351
+ return false;
177
352
  }
178
- PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
179
- PrepareAttributesForInstances(attribs, defines);
180
- const shaderName = "normal";
181
- const join = defines.toString();
182
- const uniforms = [
183
- "world",
184
- "view",
185
- "viewProjection",
186
- "vEyePosition",
187
- "vLightsType",
188
- "vDiffuseColor",
189
- "vFogInfos",
190
- "vFogColor",
191
- "pointSize",
192
- "vDiffuseInfos",
193
- "mBones",
194
- "diffuseMatrix",
195
- "logarithmicDepthConstant",
196
- ];
197
- const samplers = ["diffuseSampler", "areaLightsLTC1Sampler", "areaLightsLTC2Sampler"];
198
- const uniformBuffers = [];
199
- AddClipPlaneUniforms(uniforms);
200
- PrepareUniformsAndSamplersList({
201
- uniformsNames: uniforms,
202
- uniformBuffersNames: uniformBuffers,
203
- samplers: samplers,
204
- defines: defines,
205
- maxSimultaneousLights: 4,
206
- shaderLanguage: this._shaderLanguage,
207
- });
208
- subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
209
- attributes: attribs,
210
- uniformsNames: uniforms,
211
- uniformBuffersNames: uniformBuffers,
212
- samplers: samplers,
213
- defines: join,
214
- fallbacks: fallbacks,
215
- onCompiled: this.onCompiled,
216
- onError: this.onError,
217
- indexParameters: { maxSimultaneousLights: 4 },
218
- shaderLanguage: this._shaderLanguage,
219
- extraInitializationsAsync: this._shadersLoaded
220
- ? undefined
221
- : async () => {
222
- if (this.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
223
- await Promise.all([import("./wgsl/normal.vertex.js"), import("./wgsl/normal.fragment.js")]);
224
- }
225
- else {
226
- await Promise.all([import("./normal.vertex.js"), import("./normal.fragment.js")]);
227
- }
228
- this._shadersLoaded = true;
229
- },
230
- }, engine), defines, this._materialContext);
231
- }
232
- // Check if Area Lights have LTC texture.
233
- if (defines["AREALIGHTUSED"]) {
234
- for (let index = 0; index < mesh.lightSources.length; index++) {
235
- if (!mesh.lightSources[index]._isReady()) {
236
- return false;
353
+ dispose(forceDisposeEffect) {
354
+ if (this.diffuseTexture) {
355
+ this.diffuseTexture.dispose();
237
356
  }
357
+ super.dispose(forceDisposeEffect);
238
358
  }
239
- }
240
- if (!subMesh.effect || !subMesh.effect.isReady()) {
241
- return false;
242
- }
243
- defines._renderId = scene.getRenderId();
244
- drawWrapper._wasPreviouslyReady = true;
245
- drawWrapper._wasPreviouslyUsingInstances = !!useInstances;
246
- return true;
247
- }
248
- bindForSubMesh(world, mesh, subMesh) {
249
- const scene = this.getScene();
250
- const defines = subMesh.materialDefines;
251
- if (!defines) {
252
- return;
253
- }
254
- const effect = subMesh.effect;
255
- if (!effect) {
256
- return;
257
- }
258
- this._activeEffect = effect;
259
- // Matrices
260
- this.bindOnlyWorldMatrix(world);
261
- this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
262
- // Bones
263
- BindBonesParameters(mesh, this._activeEffect);
264
- if (this._mustRebind(scene, effect, subMesh)) {
265
- // Textures
266
- if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
267
- this._activeEffect.setTexture("diffuseSampler", this.diffuseTexture);
268
- this._activeEffect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
269
- this._activeEffect.setMatrix("diffuseMatrix", this.diffuseTexture.getTextureMatrix());
359
+ clone(name) {
360
+ return SerializationHelper.Clone(() => new _a(name, this.getScene()), this);
270
361
  }
271
- // Clip plane
272
- BindClipPlane(effect, this, scene);
273
- // Point size
274
- if (this.pointsCloud) {
275
- this._activeEffect.setFloat("pointSize", this.pointSize);
362
+ serialize() {
363
+ const serializationObject = super.serialize();
364
+ serializationObject.customType = "BABYLON.NormalMaterial";
365
+ return serializationObject;
276
366
  }
277
- // Log. depth
278
- if (this._useLogarithmicDepth) {
279
- BindLogDepth(defines, effect, scene);
367
+ getClassName() {
368
+ return "NormalMaterial";
280
369
  }
281
- scene.bindEyePosition(effect);
282
- }
283
- this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
284
- // Lights
285
- if (scene.lightsEnabled && !this.disableLighting) {
286
- BindLights(scene, mesh, this._activeEffect, defines);
287
- }
288
- // View
289
- if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
290
- this._activeEffect.setMatrix("view", scene.getViewMatrix());
291
- }
292
- // Fog
293
- BindFogParameters(scene, mesh, this._activeEffect);
294
- this._afterBind(mesh, this._activeEffect, subMesh);
295
- }
296
- getAnimatables() {
297
- const results = [];
298
- if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
299
- results.push(this.diffuseTexture);
300
- }
301
- return results;
302
- }
303
- getActiveTextures() {
304
- const activeTextures = super.getActiveTextures();
305
- if (this._diffuseTexture) {
306
- activeTextures.push(this._diffuseTexture);
307
- }
308
- return activeTextures;
309
- }
310
- hasTexture(texture) {
311
- if (super.hasTexture(texture)) {
312
- return true;
313
- }
314
- if (this.diffuseTexture === texture) {
315
- return true;
316
- }
317
- return false;
318
- }
319
- dispose(forceDisposeEffect) {
320
- if (this.diffuseTexture) {
321
- this.diffuseTexture.dispose();
322
- }
323
- super.dispose(forceDisposeEffect);
324
- }
325
- clone(name) {
326
- return SerializationHelper.Clone(() => new NormalMaterial(name, this.getScene()), this);
327
- }
328
- serialize() {
329
- const serializationObject = super.serialize();
330
- serializationObject.customType = "BABYLON.NormalMaterial";
331
- return serializationObject;
332
- }
333
- getClassName() {
334
- return "NormalMaterial";
335
- }
336
- // Statics
337
- static Parse(source, scene, rootUrl) {
338
- return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);
339
- }
340
- }
341
- __decorate([
342
- serializeAsTexture("diffuseTexture")
343
- ], NormalMaterial.prototype, "_diffuseTexture", void 0);
344
- __decorate([
345
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
346
- ], NormalMaterial.prototype, "diffuseTexture", void 0);
347
- __decorate([
348
- serializeAsColor3()
349
- ], NormalMaterial.prototype, "diffuseColor", void 0);
350
- __decorate([
351
- serialize("disableLighting")
352
- ], NormalMaterial.prototype, "_disableLighting", void 0);
353
- __decorate([
354
- expandToProperty("_markAllSubMeshesAsLightsDirty")
355
- ], NormalMaterial.prototype, "disableLighting", void 0);
356
- __decorate([
357
- serialize("maxSimultaneousLights")
358
- ], NormalMaterial.prototype, "_maxSimultaneousLights", void 0);
359
- __decorate([
360
- expandToProperty("_markAllSubMeshesAsLightsDirty")
361
- ], NormalMaterial.prototype, "maxSimultaneousLights", void 0);
370
+ // Statics
371
+ static Parse(source, scene, rootUrl) {
372
+ return SerializationHelper.Parse(() => new _a(source.name, scene), source, scene, rootUrl);
373
+ }
374
+ },
375
+ _NormalMaterial_diffuseTexture_accessor_storage = new WeakMap(),
376
+ _NormalMaterial_disableLighting_accessor_storage = new WeakMap(),
377
+ _NormalMaterial_maxSimultaneousLights_accessor_storage = new WeakMap(),
378
+ (() => {
379
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
380
+ __diffuseTexture_decorators = [serializeAsTexture("diffuseTexture")];
381
+ _diffuseTexture_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
382
+ _diffuseColor_decorators = [serializeAsColor3()];
383
+ __disableLighting_decorators = [serialize("disableLighting")];
384
+ _disableLighting_decorators = [expandToProperty("_markAllSubMeshesAsLightsDirty")];
385
+ __maxSimultaneousLights_decorators = [serialize("maxSimultaneousLights")];
386
+ _maxSimultaneousLights_decorators = [expandToProperty("_markAllSubMeshesAsLightsDirty")];
387
+ __esDecorate(_a, null, _diffuseTexture_decorators, { kind: "accessor", name: "diffuseTexture", static: false, private: false, access: { has: obj => "diffuseTexture" in obj, get: obj => obj.diffuseTexture, set: (obj, value) => { obj.diffuseTexture = value; } }, metadata: _metadata }, _diffuseTexture_initializers, _diffuseTexture_extraInitializers);
388
+ __esDecorate(_a, null, _disableLighting_decorators, { kind: "accessor", name: "disableLighting", static: false, private: false, access: { has: obj => "disableLighting" in obj, get: obj => obj.disableLighting, set: (obj, value) => { obj.disableLighting = value; } }, metadata: _metadata }, _disableLighting_initializers, _disableLighting_extraInitializers);
389
+ __esDecorate(_a, null, _maxSimultaneousLights_decorators, { kind: "accessor", name: "maxSimultaneousLights", static: false, private: false, access: { has: obj => "maxSimultaneousLights" in obj, get: obj => obj.maxSimultaneousLights, set: (obj, value) => { obj.maxSimultaneousLights = value; } }, metadata: _metadata }, _maxSimultaneousLights_initializers, _maxSimultaneousLights_extraInitializers);
390
+ __esDecorate(null, null, __diffuseTexture_decorators, { kind: "field", name: "_diffuseTexture", static: false, private: false, access: { has: obj => "_diffuseTexture" in obj, get: obj => obj._diffuseTexture, set: (obj, value) => { obj._diffuseTexture = value; } }, metadata: _metadata }, __diffuseTexture_initializers, __diffuseTexture_extraInitializers);
391
+ __esDecorate(null, null, _diffuseColor_decorators, { kind: "field", name: "diffuseColor", static: false, private: false, access: { has: obj => "diffuseColor" in obj, get: obj => obj.diffuseColor, set: (obj, value) => { obj.diffuseColor = value; } }, metadata: _metadata }, _diffuseColor_initializers, _diffuseColor_extraInitializers);
392
+ __esDecorate(null, null, __disableLighting_decorators, { kind: "field", name: "_disableLighting", static: false, private: false, access: { has: obj => "_disableLighting" in obj, get: obj => obj._disableLighting, set: (obj, value) => { obj._disableLighting = value; } }, metadata: _metadata }, __disableLighting_initializers, __disableLighting_extraInitializers);
393
+ __esDecorate(null, null, __maxSimultaneousLights_decorators, { kind: "field", name: "_maxSimultaneousLights", static: false, private: false, access: { has: obj => "_maxSimultaneousLights" in obj, get: obj => obj._maxSimultaneousLights, set: (obj, value) => { obj._maxSimultaneousLights = value; } }, metadata: _metadata }, __maxSimultaneousLights_initializers, __maxSimultaneousLights_extraInitializers);
394
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
395
+ })(),
396
+ _a;
397
+ })();
398
+ export { NormalMaterial };
362
399
  RegisterClass("BABYLON.NormalMaterial", NormalMaterial);
363
400
  //# sourceMappingURL=normalMaterial.js.map