@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 { serializeAsVector2, serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
3
3
  import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
4
4
  import { Matrix, TmpVectors, Vector2, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
@@ -70,691 +70,791 @@ class WaterMaterialDefines extends MaterialDefines {
70
70
  this.rebuild();
71
71
  }
72
72
  }
73
- export class WaterMaterial extends PushMaterial {
74
- /**
75
- * Gets a boolean indicating that current material needs to register RTT
76
- */
77
- get hasRenderTargetTextures() {
78
- return true;
79
- }
80
- /**
81
- * Constructor
82
- * @param name
83
- * @param scene
84
- * @param renderTargetSize
85
- * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
86
- */
87
- constructor(name, scene, renderTargetSize = new Vector2(512, 512), forceGLSL = false) {
88
- super(name, scene, undefined, forceGLSL);
89
- this.renderTargetSize = renderTargetSize;
90
- this.diffuseColor = new Color3(1, 1, 1);
91
- this.specularColor = new Color3(0, 0, 0);
92
- this.specularPower = 64;
93
- this._disableLighting = false;
94
- this._maxSimultaneousLights = 4;
95
- /**
96
- * Defines the wind force.
97
- */
98
- this.windForce = 6;
99
- /**
100
- * Defines the direction of the wind in the plane (X, Z).
101
- */
102
- this.windDirection = new Vector2(0, 1);
103
- /**
104
- * Defines the height of the waves.
105
- */
106
- this.waveHeight = 0.4;
107
- /**
108
- * Defines the bump height related to the bump map.
109
- */
110
- this.bumpHeight = 0.4;
111
- /**
112
- * Defines wether or not: to add a smaller moving bump to less steady waves.
113
- */
114
- this._bumpSuperimpose = false;
115
- /**
116
- * Defines wether or not color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
117
- */
118
- this._fresnelSeparate = false;
119
- /**
120
- * Defines wether or not bump Wwves modify the reflection.
121
- */
122
- this._bumpAffectsReflection = false;
123
- /**
124
- * Defines the water color blended with the refraction (near).
125
- */
126
- this.waterColor = new Color3(0.1, 0.1, 0.6);
127
- /**
128
- * Defines the blend factor related to the water color.
129
- */
130
- this.colorBlendFactor = 0.2;
131
- /**
132
- * Defines the water color blended with the reflection (far).
133
- */
134
- this.waterColor2 = new Color3(0.1, 0.1, 0.6);
135
- /**
136
- * Defines the blend factor related to the water color (reflection, far).
137
- */
138
- this.colorBlendFactor2 = 0.2;
139
- /**
140
- * Defines the maximum length of a wave.
141
- */
142
- this.waveLength = 0.1;
143
- /**
144
- * Defines the waves speed.
145
- */
146
- this.waveSpeed = 1.0;
147
- /**
148
- * Defines the number of times waves are repeated. This is typically used to adjust waves count according to the ground's size where the material is applied on.
149
- */
150
- this.waveCount = 20;
151
- /**
152
- * Sets or gets whether or not automatic clipping should be enabled or not. Setting to true will save performances and
153
- * will avoid calculating useless pixels in the pixel shader of the water material.
154
- */
155
- this.disableClipPlane = false;
156
- /**
157
- * Defines whether or not to use world coordinates for wave deformations.
158
- * The default value is false, meaning that the deformation is applied in object (local) space.
159
- * You will probably need to set it to true if you are using instances or thin instances for your water objects.
160
- */
161
- this._useWorldCoordinatesForWaveDeformation = false;
162
- this._renderTargets = new SmartArray(16);
163
- /*
164
- * Private members
165
- */
166
- this._mesh = null;
167
- this._reflectionTransform = Matrix.Zero();
168
- this._offsetMirror = Matrix.Zero();
169
- this._tempPlane = new Plane(0, 0, 0, 0);
170
- this._lastTime = 0;
171
- this._shadersLoaded = false;
172
- this._lastDeltaTime = 0;
173
- this._createRenderTargets(this.getScene(), renderTargetSize);
174
- // Create render targets
175
- this.getRenderTargetTextures = () => {
176
- this._renderTargets.reset();
177
- this._renderTargets.push(this._reflectionRTT);
178
- this._renderTargets.push(this._refractionRTT);
179
- return this._renderTargets;
180
- };
181
- this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;
182
- if (this._imageProcessingConfiguration) {
183
- this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {
184
- this._markAllSubMeshesAsImageProcessingDirty();
185
- });
186
- }
187
- }
188
- // Get / Set
189
- get refractionTexture() {
190
- return this._refractionRTT;
191
- }
192
- get reflectionTexture() {
193
- return this._reflectionRTT;
194
- }
195
- // Methods
196
- addToRenderList(node) {
197
- if (this._refractionRTT && this._refractionRTT.renderList) {
198
- this._refractionRTT.renderList.push(node);
199
- }
200
- if (this._reflectionRTT && this._reflectionRTT.renderList) {
201
- this._reflectionRTT.renderList.push(node);
202
- }
203
- }
204
- removeFromRenderList(node) {
205
- if (this._refractionRTT && this._refractionRTT.renderList) {
206
- const idx = this._refractionRTT.renderList.indexOf(node);
207
- if (idx !== -1) {
208
- this._refractionRTT.renderList.splice(idx, 1);
209
- }
210
- }
211
- if (this._reflectionRTT && this._reflectionRTT.renderList) {
212
- const idx = this._reflectionRTT.renderList.indexOf(node);
213
- if (idx !== -1) {
214
- this._reflectionRTT.renderList.splice(idx, 1);
215
- }
216
- }
217
- }
218
- enableRenderTargets(enable) {
219
- const refreshRate = enable ? 1 : 0;
220
- if (this._refractionRTT) {
221
- this._refractionRTT.refreshRate = refreshRate;
222
- }
223
- if (this._reflectionRTT) {
224
- this._reflectionRTT.refreshRate = refreshRate;
225
- }
226
- }
227
- getRenderList() {
228
- return this._refractionRTT ? this._refractionRTT.renderList : [];
229
- }
230
- get renderTargetsEnabled() {
231
- return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);
232
- }
233
- needAlphaBlending() {
234
- return this.alpha < 1.0;
235
- }
236
- needAlphaTesting() {
237
- return false;
238
- }
239
- getAlphaTestTexture() {
240
- return null;
241
- }
242
- isReadyForSubMesh(mesh, subMesh, useInstances) {
243
- const drawWrapper = subMesh._drawWrapper;
244
- if (this.isFrozen) {
245
- if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {
73
+ let WaterMaterial = (() => {
74
+ var _a, _WaterMaterial_bumpTexture_accessor_storage, _WaterMaterial_disableLighting_accessor_storage, _WaterMaterial_maxSimultaneousLights_accessor_storage, _WaterMaterial_bumpSuperimpose_accessor_storage, _WaterMaterial_fresnelSeparate_accessor_storage, _WaterMaterial_bumpAffectsReflection_accessor_storage, _WaterMaterial_useWorldCoordinatesForWaveDeformation_accessor_storage;
75
+ let _classSuper = PushMaterial;
76
+ let __bumpTexture_decorators;
77
+ let __bumpTexture_initializers = [];
78
+ let __bumpTexture_extraInitializers = [];
79
+ let _bumpTexture_decorators;
80
+ let _bumpTexture_initializers = [];
81
+ let _bumpTexture_extraInitializers = [];
82
+ let _diffuseColor_decorators;
83
+ let _diffuseColor_initializers = [];
84
+ let _diffuseColor_extraInitializers = [];
85
+ let _specularColor_decorators;
86
+ let _specularColor_initializers = [];
87
+ let _specularColor_extraInitializers = [];
88
+ let _specularPower_decorators;
89
+ let _specularPower_initializers = [];
90
+ let _specularPower_extraInitializers = [];
91
+ let __disableLighting_decorators;
92
+ let __disableLighting_initializers = [];
93
+ let __disableLighting_extraInitializers = [];
94
+ let _disableLighting_decorators;
95
+ let _disableLighting_initializers = [];
96
+ let _disableLighting_extraInitializers = [];
97
+ let __maxSimultaneousLights_decorators;
98
+ let __maxSimultaneousLights_initializers = [];
99
+ let __maxSimultaneousLights_extraInitializers = [];
100
+ let _maxSimultaneousLights_decorators;
101
+ let _maxSimultaneousLights_initializers = [];
102
+ let _maxSimultaneousLights_extraInitializers = [];
103
+ let _windForce_decorators;
104
+ let _windForce_initializers = [];
105
+ let _windForce_extraInitializers = [];
106
+ let _windDirection_decorators;
107
+ let _windDirection_initializers = [];
108
+ let _windDirection_extraInitializers = [];
109
+ let _waveHeight_decorators;
110
+ let _waveHeight_initializers = [];
111
+ let _waveHeight_extraInitializers = [];
112
+ let _bumpHeight_decorators;
113
+ let _bumpHeight_initializers = [];
114
+ let _bumpHeight_extraInitializers = [];
115
+ let __bumpSuperimpose_decorators;
116
+ let __bumpSuperimpose_initializers = [];
117
+ let __bumpSuperimpose_extraInitializers = [];
118
+ let _bumpSuperimpose_decorators;
119
+ let _bumpSuperimpose_initializers = [];
120
+ let _bumpSuperimpose_extraInitializers = [];
121
+ let __fresnelSeparate_decorators;
122
+ let __fresnelSeparate_initializers = [];
123
+ let __fresnelSeparate_extraInitializers = [];
124
+ let _fresnelSeparate_decorators;
125
+ let _fresnelSeparate_initializers = [];
126
+ let _fresnelSeparate_extraInitializers = [];
127
+ let __bumpAffectsReflection_decorators;
128
+ let __bumpAffectsReflection_initializers = [];
129
+ let __bumpAffectsReflection_extraInitializers = [];
130
+ let _bumpAffectsReflection_decorators;
131
+ let _bumpAffectsReflection_initializers = [];
132
+ let _bumpAffectsReflection_extraInitializers = [];
133
+ let _waterColor_decorators;
134
+ let _waterColor_initializers = [];
135
+ let _waterColor_extraInitializers = [];
136
+ let _colorBlendFactor_decorators;
137
+ let _colorBlendFactor_initializers = [];
138
+ let _colorBlendFactor_extraInitializers = [];
139
+ let _waterColor2_decorators;
140
+ let _waterColor2_initializers = [];
141
+ let _waterColor2_extraInitializers = [];
142
+ let _colorBlendFactor2_decorators;
143
+ let _colorBlendFactor2_initializers = [];
144
+ let _colorBlendFactor2_extraInitializers = [];
145
+ let _waveLength_decorators;
146
+ let _waveLength_initializers = [];
147
+ let _waveLength_extraInitializers = [];
148
+ let _waveSpeed_decorators;
149
+ let _waveSpeed_initializers = [];
150
+ let _waveSpeed_extraInitializers = [];
151
+ let _waveCount_decorators;
152
+ let _waveCount_initializers = [];
153
+ let _waveCount_extraInitializers = [];
154
+ let _disableClipPlane_decorators;
155
+ let _disableClipPlane_initializers = [];
156
+ let _disableClipPlane_extraInitializers = [];
157
+ let __useWorldCoordinatesForWaveDeformation_decorators;
158
+ let __useWorldCoordinatesForWaveDeformation_initializers = [];
159
+ let __useWorldCoordinatesForWaveDeformation_extraInitializers = [];
160
+ let _useWorldCoordinatesForWaveDeformation_decorators;
161
+ let _useWorldCoordinatesForWaveDeformation_initializers = [];
162
+ let _useWorldCoordinatesForWaveDeformation_extraInitializers = [];
163
+ return _a = class WaterMaterial extends _classSuper {
164
+ get bumpTexture() { return __classPrivateFieldGet(this, _WaterMaterial_bumpTexture_accessor_storage, "f"); }
165
+ set bumpTexture(value) { __classPrivateFieldSet(this, _WaterMaterial_bumpTexture_accessor_storage, value, "f"); }
166
+ get disableLighting() { return __classPrivateFieldGet(this, _WaterMaterial_disableLighting_accessor_storage, "f"); }
167
+ set disableLighting(value) { __classPrivateFieldSet(this, _WaterMaterial_disableLighting_accessor_storage, value, "f"); }
168
+ get maxSimultaneousLights() { return __classPrivateFieldGet(this, _WaterMaterial_maxSimultaneousLights_accessor_storage, "f"); }
169
+ set maxSimultaneousLights(value) { __classPrivateFieldSet(this, _WaterMaterial_maxSimultaneousLights_accessor_storage, value, "f"); }
170
+ get bumpSuperimpose() { return __classPrivateFieldGet(this, _WaterMaterial_bumpSuperimpose_accessor_storage, "f"); }
171
+ set bumpSuperimpose(value) { __classPrivateFieldSet(this, _WaterMaterial_bumpSuperimpose_accessor_storage, value, "f"); }
172
+ get fresnelSeparate() { return __classPrivateFieldGet(this, _WaterMaterial_fresnelSeparate_accessor_storage, "f"); }
173
+ set fresnelSeparate(value) { __classPrivateFieldSet(this, _WaterMaterial_fresnelSeparate_accessor_storage, value, "f"); }
174
+ get bumpAffectsReflection() { return __classPrivateFieldGet(this, _WaterMaterial_bumpAffectsReflection_accessor_storage, "f"); }
175
+ set bumpAffectsReflection(value) { __classPrivateFieldSet(this, _WaterMaterial_bumpAffectsReflection_accessor_storage, value, "f"); }
176
+ get useWorldCoordinatesForWaveDeformation() { return __classPrivateFieldGet(this, _WaterMaterial_useWorldCoordinatesForWaveDeformation_accessor_storage, "f"); }
177
+ set useWorldCoordinatesForWaveDeformation(value) { __classPrivateFieldSet(this, _WaterMaterial_useWorldCoordinatesForWaveDeformation_accessor_storage, value, "f"); }
178
+ /**
179
+ * Gets a boolean indicating that current material needs to register RTT
180
+ */
181
+ get hasRenderTargetTextures() {
246
182
  return true;
247
183
  }
248
- }
249
- if (!subMesh.materialDefines) {
250
- subMesh.materialDefines = new WaterMaterialDefines();
251
- }
252
- const defines = subMesh.materialDefines;
253
- const scene = this.getScene();
254
- if (this._isReadyForSubMesh(subMesh)) {
255
- return true;
256
- }
257
- const engine = scene.getEngine();
258
- // Textures
259
- if (defines._areTexturesDirty) {
260
- defines._needUVs = false;
261
- if (scene.texturesEnabled) {
262
- if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {
263
- if (!this.bumpTexture.isReady()) {
264
- return false;
265
- }
266
- else {
267
- defines._needUVs = true;
268
- defines.BUMP = true;
269
- }
270
- }
271
- if (MaterialFlags.ReflectionTextureEnabled) {
272
- defines.REFLECTION = true;
184
+ /**
185
+ * Constructor
186
+ * @param name
187
+ * @param scene
188
+ * @param renderTargetSize
189
+ * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
190
+ */
191
+ constructor(name, scene, renderTargetSize = new Vector2(512, 512), forceGLSL = false) {
192
+ super(name, scene, undefined, forceGLSL);
193
+ this.renderTargetSize = renderTargetSize;
194
+ /*
195
+ * Public members
196
+ */
197
+ this._bumpTexture = __runInitializers(this, __bumpTexture_initializers, void 0);
198
+ _WaterMaterial_bumpTexture_accessor_storage.set(this, (__runInitializers(this, __bumpTexture_extraInitializers), __runInitializers(this, _bumpTexture_initializers, void 0)));
199
+ this.diffuseColor = (__runInitializers(this, _bumpTexture_extraInitializers), __runInitializers(this, _diffuseColor_initializers, new Color3(1, 1, 1)));
200
+ this.specularColor = (__runInitializers(this, _diffuseColor_extraInitializers), __runInitializers(this, _specularColor_initializers, new Color3(0, 0, 0)));
201
+ this.specularPower = (__runInitializers(this, _specularColor_extraInitializers), __runInitializers(this, _specularPower_initializers, 64));
202
+ this._disableLighting = (__runInitializers(this, _specularPower_extraInitializers), __runInitializers(this, __disableLighting_initializers, false));
203
+ _WaterMaterial_disableLighting_accessor_storage.set(this, (__runInitializers(this, __disableLighting_extraInitializers), __runInitializers(this, _disableLighting_initializers, void 0)));
204
+ this._maxSimultaneousLights = (__runInitializers(this, _disableLighting_extraInitializers), __runInitializers(this, __maxSimultaneousLights_initializers, 4));
205
+ _WaterMaterial_maxSimultaneousLights_accessor_storage.set(this, (__runInitializers(this, __maxSimultaneousLights_extraInitializers), __runInitializers(this, _maxSimultaneousLights_initializers, void 0)));
206
+ /**
207
+ * Defines the wind force.
208
+ */
209
+ this.windForce = (__runInitializers(this, _maxSimultaneousLights_extraInitializers), __runInitializers(this, _windForce_initializers, 6));
210
+ /**
211
+ * Defines the direction of the wind in the plane (X, Z).
212
+ */
213
+ this.windDirection = (__runInitializers(this, _windForce_extraInitializers), __runInitializers(this, _windDirection_initializers, new Vector2(0, 1)));
214
+ /**
215
+ * Defines the height of the waves.
216
+ */
217
+ this.waveHeight = (__runInitializers(this, _windDirection_extraInitializers), __runInitializers(this, _waveHeight_initializers, 0.4));
218
+ /**
219
+ * Defines the bump height related to the bump map.
220
+ */
221
+ this.bumpHeight = (__runInitializers(this, _waveHeight_extraInitializers), __runInitializers(this, _bumpHeight_initializers, 0.4));
222
+ /**
223
+ * Defines wether or not: to add a smaller moving bump to less steady waves.
224
+ */
225
+ this._bumpSuperimpose = (__runInitializers(this, _bumpHeight_extraInitializers), __runInitializers(this, __bumpSuperimpose_initializers, false));
226
+ _WaterMaterial_bumpSuperimpose_accessor_storage.set(this, (__runInitializers(this, __bumpSuperimpose_extraInitializers), __runInitializers(this, _bumpSuperimpose_initializers, void 0)));
227
+ /**
228
+ * Defines wether or not color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
229
+ */
230
+ this._fresnelSeparate = (__runInitializers(this, _bumpSuperimpose_extraInitializers), __runInitializers(this, __fresnelSeparate_initializers, false));
231
+ _WaterMaterial_fresnelSeparate_accessor_storage.set(this, (__runInitializers(this, __fresnelSeparate_extraInitializers), __runInitializers(this, _fresnelSeparate_initializers, void 0)));
232
+ /**
233
+ * Defines wether or not bump Wwves modify the reflection.
234
+ */
235
+ this._bumpAffectsReflection = (__runInitializers(this, _fresnelSeparate_extraInitializers), __runInitializers(this, __bumpAffectsReflection_initializers, false));
236
+ _WaterMaterial_bumpAffectsReflection_accessor_storage.set(this, (__runInitializers(this, __bumpAffectsReflection_extraInitializers), __runInitializers(this, _bumpAffectsReflection_initializers, void 0)));
237
+ /**
238
+ * Defines the water color blended with the refraction (near).
239
+ */
240
+ this.waterColor = (__runInitializers(this, _bumpAffectsReflection_extraInitializers), __runInitializers(this, _waterColor_initializers, new Color3(0.1, 0.1, 0.6)));
241
+ /**
242
+ * Defines the blend factor related to the water color.
243
+ */
244
+ this.colorBlendFactor = (__runInitializers(this, _waterColor_extraInitializers), __runInitializers(this, _colorBlendFactor_initializers, 0.2));
245
+ /**
246
+ * Defines the water color blended with the reflection (far).
247
+ */
248
+ this.waterColor2 = (__runInitializers(this, _colorBlendFactor_extraInitializers), __runInitializers(this, _waterColor2_initializers, new Color3(0.1, 0.1, 0.6)));
249
+ /**
250
+ * Defines the blend factor related to the water color (reflection, far).
251
+ */
252
+ this.colorBlendFactor2 = (__runInitializers(this, _waterColor2_extraInitializers), __runInitializers(this, _colorBlendFactor2_initializers, 0.2));
253
+ /**
254
+ * Defines the maximum length of a wave.
255
+ */
256
+ this.waveLength = (__runInitializers(this, _colorBlendFactor2_extraInitializers), __runInitializers(this, _waveLength_initializers, 0.1));
257
+ /**
258
+ * Defines the waves speed.
259
+ */
260
+ this.waveSpeed = (__runInitializers(this, _waveLength_extraInitializers), __runInitializers(this, _waveSpeed_initializers, 1.0));
261
+ /**
262
+ * Defines the number of times waves are repeated. This is typically used to adjust waves count according to the ground's size where the material is applied on.
263
+ */
264
+ this.waveCount = (__runInitializers(this, _waveSpeed_extraInitializers), __runInitializers(this, _waveCount_initializers, 20));
265
+ /**
266
+ * Sets or gets whether or not automatic clipping should be enabled or not. Setting to true will save performances and
267
+ * will avoid calculating useless pixels in the pixel shader of the water material.
268
+ */
269
+ this.disableClipPlane = (__runInitializers(this, _waveCount_extraInitializers), __runInitializers(this, _disableClipPlane_initializers, false));
270
+ /**
271
+ * Defines whether or not to use world coordinates for wave deformations.
272
+ * The default value is false, meaning that the deformation is applied in object (local) space.
273
+ * You will probably need to set it to true if you are using instances or thin instances for your water objects.
274
+ */
275
+ this._useWorldCoordinatesForWaveDeformation = (__runInitializers(this, _disableClipPlane_extraInitializers), __runInitializers(this, __useWorldCoordinatesForWaveDeformation_initializers, false));
276
+ _WaterMaterial_useWorldCoordinatesForWaveDeformation_accessor_storage.set(this, (__runInitializers(this, __useWorldCoordinatesForWaveDeformation_extraInitializers), __runInitializers(this, _useWorldCoordinatesForWaveDeformation_initializers, void 0)));
277
+ this._renderTargets = (__runInitializers(this, _useWorldCoordinatesForWaveDeformation_extraInitializers), new SmartArray(16));
278
+ /*
279
+ * Private members
280
+ */
281
+ this._mesh = null;
282
+ this._reflectionTransform = Matrix.Zero();
283
+ this._offsetMirror = Matrix.Zero();
284
+ this._tempPlane = new Plane(0, 0, 0, 0);
285
+ this._lastTime = 0;
286
+ this._shadersLoaded = false;
287
+ this._lastDeltaTime = 0;
288
+ this._createRenderTargets(this.getScene(), renderTargetSize);
289
+ // Create render targets
290
+ this.getRenderTargetTextures = () => {
291
+ this._renderTargets.reset();
292
+ this._renderTargets.push(this._reflectionRTT);
293
+ this._renderTargets.push(this._refractionRTT);
294
+ return this._renderTargets;
295
+ };
296
+ this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;
297
+ if (this._imageProcessingConfiguration) {
298
+ this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {
299
+ this._markAllSubMeshesAsImageProcessingDirty();
300
+ });
273
301
  }
274
302
  }
275
- }
276
- PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
277
- PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(mesh), defines, undefined, undefined, undefined, this._isVertexOutputInvariant);
278
- if (defines._areMiscDirty) {
279
- defines.FRESNELSEPARATE = this._fresnelSeparate;
280
- defines.BUMPSUPERIMPOSE = this._bumpSuperimpose;
281
- defines.BUMPAFFECTSREFLECTION = this._bumpAffectsReflection;
282
- defines.USE_WORLD_COORDINATES = this._useWorldCoordinatesForWaveDeformation;
283
- }
284
- // Lights
285
- defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);
286
- // Image processing
287
- if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {
288
- if (!this._imageProcessingConfiguration.isReady()) {
289
- return false;
303
+ // Get / Set
304
+ get refractionTexture() {
305
+ return this._refractionRTT;
290
306
  }
291
- this._imageProcessingConfiguration.prepareDefines(defines);
292
- defines.IS_REFLECTION_LINEAR = this.reflectionTexture != null && !this.reflectionTexture.gammaSpace;
293
- defines.IS_REFRACTION_LINEAR = this.refractionTexture != null && !this.refractionTexture.gammaSpace;
294
- }
295
- // Attribs
296
- PrepareDefinesForAttributes(mesh, defines, true, true);
297
- // Configure this
298
- this._mesh = mesh;
299
- if (this._waitingRenderList) {
300
- for (let i = 0; i < this._waitingRenderList.length; i++) {
301
- this.addToRenderList(scene.getNodeById(this._waitingRenderList[i]));
307
+ get reflectionTexture() {
308
+ return this._reflectionRTT;
302
309
  }
303
- this._waitingRenderList = null;
304
- }
305
- // Get correct effect
306
- if (defines.isDirty) {
307
- defines.markAsProcessed();
308
- scene.resetCachedMaterial();
309
- // Fallbacks
310
- const fallbacks = new EffectFallbacks();
311
- if (defines.FOG) {
312
- fallbacks.addFallback(1, "FOG");
310
+ // Methods
311
+ addToRenderList(node) {
312
+ if (this._refractionRTT && this._refractionRTT.renderList) {
313
+ this._refractionRTT.renderList.push(node);
314
+ }
315
+ if (this._reflectionRTT && this._reflectionRTT.renderList) {
316
+ this._reflectionRTT.renderList.push(node);
317
+ }
313
318
  }
314
- if (defines.LOGARITHMICDEPTH) {
315
- fallbacks.addFallback(0, "LOGARITHMICDEPTH");
319
+ removeFromRenderList(node) {
320
+ if (this._refractionRTT && this._refractionRTT.renderList) {
321
+ const idx = this._refractionRTT.renderList.indexOf(node);
322
+ if (idx !== -1) {
323
+ this._refractionRTT.renderList.splice(idx, 1);
324
+ }
325
+ }
326
+ if (this._reflectionRTT && this._reflectionRTT.renderList) {
327
+ const idx = this._reflectionRTT.renderList.indexOf(node);
328
+ if (idx !== -1) {
329
+ this._reflectionRTT.renderList.splice(idx, 1);
330
+ }
331
+ }
316
332
  }
317
- HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
318
- if (defines.NUM_BONE_INFLUENCERS > 0) {
319
- fallbacks.addCPUSkinningFallback(0, mesh);
333
+ enableRenderTargets(enable) {
334
+ const refreshRate = enable ? 1 : 0;
335
+ if (this._refractionRTT) {
336
+ this._refractionRTT.refreshRate = refreshRate;
337
+ }
338
+ if (this._reflectionRTT) {
339
+ this._reflectionRTT.refreshRate = refreshRate;
340
+ }
320
341
  }
321
- //Attributes
322
- const attribs = [VertexBuffer.PositionKind];
323
- if (defines.NORMAL) {
324
- attribs.push(VertexBuffer.NormalKind);
342
+ getRenderList() {
343
+ return this._refractionRTT ? this._refractionRTT.renderList : [];
325
344
  }
326
- if (defines.UV1) {
327
- attribs.push(VertexBuffer.UVKind);
345
+ get renderTargetsEnabled() {
346
+ return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);
328
347
  }
329
- if (defines.UV2) {
330
- attribs.push(VertexBuffer.UV2Kind);
348
+ needAlphaBlending() {
349
+ return this.alpha < 1.0;
331
350
  }
332
- if (defines.VERTEXCOLOR) {
333
- attribs.push(VertexBuffer.ColorKind);
351
+ needAlphaTesting() {
352
+ return false;
334
353
  }
335
- PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
336
- PrepareAttributesForInstances(attribs, defines);
337
- // Legacy browser patch
338
- const shaderName = "water";
339
- const join = defines.toString();
340
- const uniforms = [
341
- "world",
342
- "view",
343
- "viewProjection",
344
- "vEyePosition",
345
- "vLightsType",
346
- "vDiffuseColor",
347
- "vSpecularColor",
348
- "vFogInfos",
349
- "vFogColor",
350
- "pointSize",
351
- "vNormalInfos",
352
- "mBones",
353
- "normalMatrix",
354
- "logarithmicDepthConstant",
355
- // Water
356
- "reflectionViewProjection",
357
- "windDirection",
358
- "waveLength",
359
- "time",
360
- "windForce",
361
- "cameraPosition",
362
- "bumpHeight",
363
- "waveHeight",
364
- "waterColor",
365
- "waterColor2",
366
- "colorBlendFactor",
367
- "colorBlendFactor2",
368
- "waveSpeed",
369
- "waveCount",
370
- ];
371
- const samplers = [
372
- "normalSampler",
373
- // Water
374
- "refractionSampler",
375
- "reflectionSampler",
376
- ];
377
- const uniformBuffers = [];
378
- if (ImageProcessingConfiguration) {
379
- ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);
380
- ImageProcessingConfiguration.PrepareSamplers(samplers, defines);
354
+ getAlphaTestTexture() {
355
+ return null;
381
356
  }
382
- AddClipPlaneUniforms(uniforms);
383
- PrepareUniformsAndSamplersList({
384
- uniformsNames: uniforms,
385
- uniformBuffersNames: uniformBuffers,
386
- samplers: samplers,
387
- defines: defines,
388
- maxSimultaneousLights: this.maxSimultaneousLights,
389
- shaderLanguage: this._shaderLanguage,
390
- });
391
- subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
392
- attributes: attribs,
393
- uniformsNames: uniforms,
394
- uniformBuffersNames: uniformBuffers,
395
- samplers: samplers,
396
- defines: join,
397
- fallbacks: fallbacks,
398
- onCompiled: this.onCompiled,
399
- onError: this.onError,
400
- indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights },
401
- shaderLanguage: this._shaderLanguage,
402
- extraInitializationsAsync: this._shadersLoaded
403
- ? undefined
404
- : async () => {
405
- if (this.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
406
- await Promise.all([import("./wgsl/water.vertex.js"), import("./wgsl/water.fragment.js")]);
357
+ isReadyForSubMesh(mesh, subMesh, useInstances) {
358
+ const drawWrapper = subMesh._drawWrapper;
359
+ if (this.isFrozen) {
360
+ if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {
361
+ return true;
362
+ }
363
+ }
364
+ if (!subMesh.materialDefines) {
365
+ subMesh.materialDefines = new WaterMaterialDefines();
366
+ }
367
+ const defines = subMesh.materialDefines;
368
+ const scene = this.getScene();
369
+ if (this._isReadyForSubMesh(subMesh)) {
370
+ return true;
371
+ }
372
+ const engine = scene.getEngine();
373
+ // Textures
374
+ if (defines._areTexturesDirty) {
375
+ defines._needUVs = false;
376
+ if (scene.texturesEnabled) {
377
+ if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {
378
+ if (!this.bumpTexture.isReady()) {
379
+ return false;
380
+ }
381
+ else {
382
+ defines._needUVs = true;
383
+ defines.BUMP = true;
384
+ }
407
385
  }
408
- else {
409
- await Promise.all([import("./water.vertex.js"), import("./water.fragment.js")]);
386
+ if (MaterialFlags.ReflectionTextureEnabled) {
387
+ defines.REFLECTION = true;
410
388
  }
411
- this._shadersLoaded = true;
412
- },
413
- }, engine), defines, this._materialContext);
414
- }
415
- if (!subMesh.effect || !subMesh.effect.isReady()) {
416
- return false;
417
- }
418
- defines._renderId = scene.getRenderId();
419
- drawWrapper._wasPreviouslyReady = true;
420
- drawWrapper._wasPreviouslyUsingInstances = !!useInstances;
421
- return true;
422
- }
423
- bindForSubMesh(world, mesh, subMesh) {
424
- const scene = this.getScene();
425
- const defines = subMesh.materialDefines;
426
- if (!defines) {
427
- return;
428
- }
429
- const effect = subMesh.effect;
430
- if (!effect || !this._mesh) {
431
- return;
432
- }
433
- this._activeEffect = effect;
434
- // Matrices
435
- this.bindOnlyWorldMatrix(world);
436
- this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
437
- // Bones
438
- BindBonesParameters(mesh, this._activeEffect);
439
- if (this._mustRebind(scene, effect, subMesh)) {
440
- // Textures
441
- if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {
442
- this._activeEffect.setTexture("normalSampler", this.bumpTexture);
443
- this._activeEffect.setFloat2("vNormalInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
444
- this._activeEffect.setMatrix("normalMatrix", this.bumpTexture.getTextureMatrix());
389
+ }
390
+ }
391
+ PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
392
+ PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(mesh), defines, undefined, undefined, undefined, this._isVertexOutputInvariant);
393
+ if (defines._areMiscDirty) {
394
+ defines.FRESNELSEPARATE = this._fresnelSeparate;
395
+ defines.BUMPSUPERIMPOSE = this._bumpSuperimpose;
396
+ defines.BUMPAFFECTSREFLECTION = this._bumpAffectsReflection;
397
+ defines.USE_WORLD_COORDINATES = this._useWorldCoordinatesForWaveDeformation;
398
+ }
399
+ // Lights
400
+ defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);
401
+ // Image processing
402
+ if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {
403
+ if (!this._imageProcessingConfiguration.isReady()) {
404
+ return false;
405
+ }
406
+ this._imageProcessingConfiguration.prepareDefines(defines);
407
+ defines.IS_REFLECTION_LINEAR = this.reflectionTexture != null && !this.reflectionTexture.gammaSpace;
408
+ defines.IS_REFRACTION_LINEAR = this.refractionTexture != null && !this.refractionTexture.gammaSpace;
409
+ }
410
+ // Attribs
411
+ PrepareDefinesForAttributes(mesh, defines, true, true);
412
+ // Configure this
413
+ this._mesh = mesh;
414
+ if (this._waitingRenderList) {
415
+ for (let i = 0; i < this._waitingRenderList.length; i++) {
416
+ this.addToRenderList(scene.getNodeById(this._waitingRenderList[i]));
417
+ }
418
+ this._waitingRenderList = null;
419
+ }
420
+ // Get correct effect
421
+ if (defines.isDirty) {
422
+ defines.markAsProcessed();
423
+ scene.resetCachedMaterial();
424
+ // Fallbacks
425
+ const fallbacks = new EffectFallbacks();
426
+ if (defines.FOG) {
427
+ fallbacks.addFallback(1, "FOG");
428
+ }
429
+ if (defines.LOGARITHMICDEPTH) {
430
+ fallbacks.addFallback(0, "LOGARITHMICDEPTH");
431
+ }
432
+ HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
433
+ if (defines.NUM_BONE_INFLUENCERS > 0) {
434
+ fallbacks.addCPUSkinningFallback(0, mesh);
435
+ }
436
+ //Attributes
437
+ const attribs = [VertexBuffer.PositionKind];
438
+ if (defines.NORMAL) {
439
+ attribs.push(VertexBuffer.NormalKind);
440
+ }
441
+ if (defines.UV1) {
442
+ attribs.push(VertexBuffer.UVKind);
443
+ }
444
+ if (defines.UV2) {
445
+ attribs.push(VertexBuffer.UV2Kind);
446
+ }
447
+ if (defines.VERTEXCOLOR) {
448
+ attribs.push(VertexBuffer.ColorKind);
449
+ }
450
+ PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
451
+ PrepareAttributesForInstances(attribs, defines);
452
+ // Legacy browser patch
453
+ const shaderName = "water";
454
+ const join = defines.toString();
455
+ const uniforms = [
456
+ "world",
457
+ "view",
458
+ "viewProjection",
459
+ "vEyePosition",
460
+ "vLightsType",
461
+ "vDiffuseColor",
462
+ "vSpecularColor",
463
+ "vFogInfos",
464
+ "vFogColor",
465
+ "pointSize",
466
+ "vNormalInfos",
467
+ "mBones",
468
+ "normalMatrix",
469
+ "logarithmicDepthConstant",
470
+ // Water
471
+ "reflectionViewProjection",
472
+ "windDirection",
473
+ "waveLength",
474
+ "time",
475
+ "windForce",
476
+ "cameraPosition",
477
+ "bumpHeight",
478
+ "waveHeight",
479
+ "waterColor",
480
+ "waterColor2",
481
+ "colorBlendFactor",
482
+ "colorBlendFactor2",
483
+ "waveSpeed",
484
+ "waveCount",
485
+ ];
486
+ const samplers = [
487
+ "normalSampler",
488
+ // Water
489
+ "refractionSampler",
490
+ "reflectionSampler",
491
+ ];
492
+ const uniformBuffers = [];
493
+ if (ImageProcessingConfiguration) {
494
+ ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);
495
+ ImageProcessingConfiguration.PrepareSamplers(samplers, defines);
496
+ }
497
+ AddClipPlaneUniforms(uniforms);
498
+ PrepareUniformsAndSamplersList({
499
+ uniformsNames: uniforms,
500
+ uniformBuffersNames: uniformBuffers,
501
+ samplers: samplers,
502
+ defines: defines,
503
+ maxSimultaneousLights: this.maxSimultaneousLights,
504
+ shaderLanguage: this._shaderLanguage,
505
+ });
506
+ subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
507
+ attributes: attribs,
508
+ uniformsNames: uniforms,
509
+ uniformBuffersNames: uniformBuffers,
510
+ samplers: samplers,
511
+ defines: join,
512
+ fallbacks: fallbacks,
513
+ onCompiled: this.onCompiled,
514
+ onError: this.onError,
515
+ indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights },
516
+ shaderLanguage: this._shaderLanguage,
517
+ extraInitializationsAsync: this._shadersLoaded
518
+ ? undefined
519
+ : async () => {
520
+ if (this.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
521
+ await Promise.all([import("./wgsl/water.vertex.js"), import("./wgsl/water.fragment.js")]);
522
+ }
523
+ else {
524
+ await Promise.all([import("./water.vertex.js"), import("./water.fragment.js")]);
525
+ }
526
+ this._shadersLoaded = true;
527
+ },
528
+ }, engine), defines, this._materialContext);
529
+ }
530
+ if (!subMesh.effect || !subMesh.effect.isReady()) {
531
+ return false;
532
+ }
533
+ defines._renderId = scene.getRenderId();
534
+ drawWrapper._wasPreviouslyReady = true;
535
+ drawWrapper._wasPreviouslyUsingInstances = !!useInstances;
536
+ return true;
445
537
  }
446
- // Clip plane
447
- BindClipPlane(effect, this, scene);
448
- // Point size
449
- if (this.pointsCloud) {
450
- this._activeEffect.setFloat("pointSize", this.pointSize);
538
+ bindForSubMesh(world, mesh, subMesh) {
539
+ const scene = this.getScene();
540
+ const defines = subMesh.materialDefines;
541
+ if (!defines) {
542
+ return;
543
+ }
544
+ const effect = subMesh.effect;
545
+ if (!effect || !this._mesh) {
546
+ return;
547
+ }
548
+ this._activeEffect = effect;
549
+ // Matrices
550
+ this.bindOnlyWorldMatrix(world);
551
+ this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
552
+ // Bones
553
+ BindBonesParameters(mesh, this._activeEffect);
554
+ if (this._mustRebind(scene, effect, subMesh)) {
555
+ // Textures
556
+ if (this.bumpTexture && MaterialFlags.BumpTextureEnabled) {
557
+ this._activeEffect.setTexture("normalSampler", this.bumpTexture);
558
+ this._activeEffect.setFloat2("vNormalInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
559
+ this._activeEffect.setMatrix("normalMatrix", this.bumpTexture.getTextureMatrix());
560
+ }
561
+ // Clip plane
562
+ BindClipPlane(effect, this, scene);
563
+ // Point size
564
+ if (this.pointsCloud) {
565
+ this._activeEffect.setFloat("pointSize", this.pointSize);
566
+ }
567
+ // Log. depth
568
+ if (this._useLogarithmicDepth) {
569
+ BindLogDepth(defines, effect, scene);
570
+ }
571
+ scene.bindEyePosition(effect);
572
+ }
573
+ this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
574
+ if (defines.SPECULARTERM) {
575
+ this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
576
+ }
577
+ if (scene.lightsEnabled && !this.disableLighting) {
578
+ BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
579
+ }
580
+ // View
581
+ if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
582
+ this._activeEffect.setMatrix("view", scene.getViewMatrix());
583
+ }
584
+ // Fog
585
+ BindFogParameters(scene, mesh, this._activeEffect);
586
+ // Log. depth
587
+ BindLogDepth(defines, this._activeEffect, scene);
588
+ // Water
589
+ if (MaterialFlags.ReflectionTextureEnabled) {
590
+ this._activeEffect.setTexture("refractionSampler", this._refractionRTT);
591
+ this._activeEffect.setTexture("reflectionSampler", this._reflectionRTT);
592
+ }
593
+ const wrvp = TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);
594
+ // Handle floating origin for reflection
595
+ if (scene.floatingOriginMode) {
596
+ // Recalculate reflection transform using offset mirror matrix
597
+ const offsetView = OffsetViewToRef(scene.floatingOriginOffset, scene.getViewMatrix(), TmpVectors.Matrix[1]);
598
+ MultiplyMatricesToRef(this._offsetMirror, offsetView, wrvp);
599
+ }
600
+ wrvp.multiplyToRef(scene.getProjectionMatrix(), wrvp);
601
+ // Add delta time. Prevent adding delta time if it hasn't changed.
602
+ const deltaTime = scene.getEngine().getDeltaTime();
603
+ if (deltaTime !== this._lastDeltaTime) {
604
+ this._lastDeltaTime = deltaTime;
605
+ this._lastTime += this._lastDeltaTime;
606
+ }
607
+ this._activeEffect.setMatrix("reflectionViewProjection", wrvp);
608
+ this._activeEffect.setVector2("windDirection", this.windDirection);
609
+ this._activeEffect.setFloat("waveLength", this.waveLength);
610
+ this._activeEffect.setFloat("time", this._lastTime / 100000);
611
+ this._activeEffect.setFloat("windForce", this.windForce);
612
+ this._activeEffect.setFloat("waveHeight", this.waveHeight);
613
+ this._activeEffect.setFloat("bumpHeight", this.bumpHeight);
614
+ this._activeEffect.setColor4("waterColor", this.waterColor, 1.0);
615
+ this._activeEffect.setFloat("colorBlendFactor", this.colorBlendFactor);
616
+ this._activeEffect.setColor4("waterColor2", this.waterColor2, 1.0);
617
+ this._activeEffect.setFloat("colorBlendFactor2", this.colorBlendFactor2);
618
+ this._activeEffect.setFloat("waveSpeed", this.waveSpeed);
619
+ this._activeEffect.setFloat("waveCount", this.waveCount);
620
+ // image processing
621
+ if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {
622
+ this._imageProcessingConfiguration.bind(this._activeEffect);
623
+ }
624
+ this._afterBind(mesh, this._activeEffect, subMesh);
451
625
  }
452
- // Log. depth
453
- if (this._useLogarithmicDepth) {
454
- BindLogDepth(defines, effect, scene);
626
+ _createRenderTargets(scene, renderTargetSize) {
627
+ // Render targets
628
+ this._refractionRTT = new RenderTargetTexture(name + "_refraction", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
629
+ this._refractionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;
630
+ this._refractionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;
631
+ this._refractionRTT.ignoreCameraViewport = true;
632
+ let boundingBoxRendererEnabled = false;
633
+ this._refractionRTT.onBeforeRenderObservable.add(() => {
634
+ boundingBoxRendererEnabled = scene.getBoundingBoxRenderer().enabled;
635
+ scene.getBoundingBoxRenderer().enabled = false;
636
+ });
637
+ this._refractionRTT.onAfterRenderObservable.add(() => {
638
+ scene.getBoundingBoxRenderer().enabled = boundingBoxRendererEnabled;
639
+ });
640
+ this._reflectionRTT = new RenderTargetTexture(name + "_reflection", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
641
+ this._reflectionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;
642
+ this._reflectionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;
643
+ this._reflectionRTT.ignoreCameraViewport = true;
644
+ let isVisible;
645
+ let clipPlane = null;
646
+ let savedViewMatrix;
647
+ const mirrorMatrix = Matrix.Zero();
648
+ this._refractionRTT.onBeforeRender = () => {
649
+ if (this._mesh) {
650
+ isVisible = this._mesh.isVisible;
651
+ this._mesh.isVisible = false;
652
+ }
653
+ // Clip plane
654
+ if (!this.disableClipPlane) {
655
+ clipPlane = scene.clipPlane;
656
+ const positiony = this._mesh ? this._mesh.absolutePosition.y : 0.0;
657
+ scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony + 0.05, 0), new Vector3(0, 1, 0));
658
+ }
659
+ };
660
+ this._refractionRTT.onAfterRender = () => {
661
+ if (this._mesh) {
662
+ this._mesh.isVisible = isVisible;
663
+ }
664
+ // Clip plane
665
+ if (!this.disableClipPlane) {
666
+ scene.clipPlane = clipPlane;
667
+ }
668
+ };
669
+ this._reflectionRTT.onBeforeRender = () => {
670
+ if (this._mesh) {
671
+ isVisible = this._mesh.isVisible;
672
+ this._mesh.isVisible = false;
673
+ }
674
+ // Clip plane
675
+ if (!this.disableClipPlane) {
676
+ clipPlane = scene.clipPlane;
677
+ const positiony = this._mesh ? this._mesh.absolutePosition.y : 0.0;
678
+ scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony - 0.05, 0), new Vector3(0, -1, 0));
679
+ Matrix.ReflectionToRef(scene.clipPlane, mirrorMatrix);
680
+ this._offsetMirror.copyFrom(mirrorMatrix);
681
+ if (scene.floatingOriginMode) {
682
+ OffsetClipPlaneToRef(scene.floatingOriginOffset, scene.clipPlane, this._tempPlane);
683
+ Matrix.ReflectionToRef(this._tempPlane, this._offsetMirror);
684
+ }
685
+ }
686
+ // Transform
687
+ savedViewMatrix = scene.getViewMatrix();
688
+ mirrorMatrix.multiplyToRef(savedViewMatrix, this._reflectionTransform);
689
+ scene.setTransformMatrix(this._reflectionTransform, scene.getProjectionMatrix());
690
+ const cameraPos = Vector3.TransformCoordinates(scene.activeCamera.position, mirrorMatrix);
691
+ scene._mirroredCameraPosition = cameraPos;
692
+ scene._forcedViewPosition = cameraPos; // More performant to set 2 properties here than to check both mirroredCameraPos and forcedViewPos within eye binding (which happens on critical rendering path)
693
+ };
694
+ this._reflectionRTT.onAfterRender = () => {
695
+ if (this._mesh) {
696
+ this._mesh.isVisible = isVisible;
697
+ }
698
+ // Clip plane
699
+ scene.clipPlane = clipPlane;
700
+ // Transform
701
+ scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());
702
+ scene._mirroredCameraPosition = null;
703
+ scene._forcedViewPosition = null;
704
+ };
455
705
  }
456
- scene.bindEyePosition(effect);
457
- }
458
- this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
459
- if (defines.SPECULARTERM) {
460
- this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
461
- }
462
- if (scene.lightsEnabled && !this.disableLighting) {
463
- BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
464
- }
465
- // View
466
- if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
467
- this._activeEffect.setMatrix("view", scene.getViewMatrix());
468
- }
469
- // Fog
470
- BindFogParameters(scene, mesh, this._activeEffect);
471
- // Log. depth
472
- BindLogDepth(defines, this._activeEffect, scene);
473
- // Water
474
- if (MaterialFlags.ReflectionTextureEnabled) {
475
- this._activeEffect.setTexture("refractionSampler", this._refractionRTT);
476
- this._activeEffect.setTexture("reflectionSampler", this._reflectionRTT);
477
- }
478
- const wrvp = TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);
479
- // Handle floating origin for reflection
480
- if (scene.floatingOriginMode) {
481
- // Recalculate reflection transform using offset mirror matrix
482
- const offsetView = OffsetViewToRef(scene.floatingOriginOffset, scene.getViewMatrix(), TmpVectors.Matrix[1]);
483
- MultiplyMatricesToRef(this._offsetMirror, offsetView, wrvp);
484
- }
485
- wrvp.multiplyToRef(scene.getProjectionMatrix(), wrvp);
486
- // Add delta time. Prevent adding delta time if it hasn't changed.
487
- const deltaTime = scene.getEngine().getDeltaTime();
488
- if (deltaTime !== this._lastDeltaTime) {
489
- this._lastDeltaTime = deltaTime;
490
- this._lastTime += this._lastDeltaTime;
491
- }
492
- this._activeEffect.setMatrix("reflectionViewProjection", wrvp);
493
- this._activeEffect.setVector2("windDirection", this.windDirection);
494
- this._activeEffect.setFloat("waveLength", this.waveLength);
495
- this._activeEffect.setFloat("time", this._lastTime / 100000);
496
- this._activeEffect.setFloat("windForce", this.windForce);
497
- this._activeEffect.setFloat("waveHeight", this.waveHeight);
498
- this._activeEffect.setFloat("bumpHeight", this.bumpHeight);
499
- this._activeEffect.setColor4("waterColor", this.waterColor, 1.0);
500
- this._activeEffect.setFloat("colorBlendFactor", this.colorBlendFactor);
501
- this._activeEffect.setColor4("waterColor2", this.waterColor2, 1.0);
502
- this._activeEffect.setFloat("colorBlendFactor2", this.colorBlendFactor2);
503
- this._activeEffect.setFloat("waveSpeed", this.waveSpeed);
504
- this._activeEffect.setFloat("waveCount", this.waveCount);
505
- // image processing
506
- if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {
507
- this._imageProcessingConfiguration.bind(this._activeEffect);
508
- }
509
- this._afterBind(mesh, this._activeEffect, subMesh);
510
- }
511
- _createRenderTargets(scene, renderTargetSize) {
512
- // Render targets
513
- this._refractionRTT = new RenderTargetTexture(name + "_refraction", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
514
- this._refractionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;
515
- this._refractionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;
516
- this._refractionRTT.ignoreCameraViewport = true;
517
- let boundingBoxRendererEnabled = false;
518
- this._refractionRTT.onBeforeRenderObservable.add(() => {
519
- boundingBoxRendererEnabled = scene.getBoundingBoxRenderer().enabled;
520
- scene.getBoundingBoxRenderer().enabled = false;
521
- });
522
- this._refractionRTT.onAfterRenderObservable.add(() => {
523
- scene.getBoundingBoxRenderer().enabled = boundingBoxRendererEnabled;
524
- });
525
- this._reflectionRTT = new RenderTargetTexture(name + "_reflection", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
526
- this._reflectionRTT.wrapU = Constants.TEXTURE_MIRROR_ADDRESSMODE;
527
- this._reflectionRTT.wrapV = Constants.TEXTURE_MIRROR_ADDRESSMODE;
528
- this._reflectionRTT.ignoreCameraViewport = true;
529
- let isVisible;
530
- let clipPlane = null;
531
- let savedViewMatrix;
532
- const mirrorMatrix = Matrix.Zero();
533
- this._refractionRTT.onBeforeRender = () => {
534
- if (this._mesh) {
535
- isVisible = this._mesh.isVisible;
536
- this._mesh.isVisible = false;
706
+ getAnimatables() {
707
+ const results = [];
708
+ if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
709
+ results.push(this.bumpTexture);
710
+ }
711
+ if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {
712
+ results.push(this._reflectionRTT);
713
+ }
714
+ if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {
715
+ results.push(this._refractionRTT);
716
+ }
717
+ return results;
537
718
  }
538
- // Clip plane
539
- if (!this.disableClipPlane) {
540
- clipPlane = scene.clipPlane;
541
- const positiony = this._mesh ? this._mesh.absolutePosition.y : 0.0;
542
- scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony + 0.05, 0), new Vector3(0, 1, 0));
719
+ getActiveTextures() {
720
+ const activeTextures = super.getActiveTextures();
721
+ if (this._bumpTexture) {
722
+ activeTextures.push(this._bumpTexture);
723
+ }
724
+ return activeTextures;
543
725
  }
544
- };
545
- this._refractionRTT.onAfterRender = () => {
546
- if (this._mesh) {
547
- this._mesh.isVisible = isVisible;
726
+ hasTexture(texture) {
727
+ if (super.hasTexture(texture)) {
728
+ return true;
729
+ }
730
+ if (this._bumpTexture === texture) {
731
+ return true;
732
+ }
733
+ return false;
548
734
  }
549
- // Clip plane
550
- if (!this.disableClipPlane) {
551
- scene.clipPlane = clipPlane;
735
+ dispose(forceDisposeEffect) {
736
+ if (this.bumpTexture) {
737
+ this.bumpTexture.dispose();
738
+ }
739
+ let index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);
740
+ if (index != -1) {
741
+ this.getScene().customRenderTargets.splice(index, 1);
742
+ }
743
+ index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);
744
+ if (index != -1) {
745
+ this.getScene().customRenderTargets.splice(index, 1);
746
+ }
747
+ if (this._reflectionRTT) {
748
+ this._reflectionRTT.dispose();
749
+ }
750
+ if (this._refractionRTT) {
751
+ this._refractionRTT.dispose();
752
+ }
753
+ // Remove image-processing observer
754
+ if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
755
+ this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
756
+ }
757
+ super.dispose(forceDisposeEffect);
552
758
  }
553
- };
554
- this._reflectionRTT.onBeforeRender = () => {
555
- if (this._mesh) {
556
- isVisible = this._mesh.isVisible;
557
- this._mesh.isVisible = false;
759
+ clone(name) {
760
+ return SerializationHelper.Clone(() => new _a(name, this.getScene()), this);
558
761
  }
559
- // Clip plane
560
- if (!this.disableClipPlane) {
561
- clipPlane = scene.clipPlane;
562
- const positiony = this._mesh ? this._mesh.absolutePosition.y : 0.0;
563
- scene.clipPlane = Plane.FromPositionAndNormal(new Vector3(0, positiony - 0.05, 0), new Vector3(0, -1, 0));
564
- Matrix.ReflectionToRef(scene.clipPlane, mirrorMatrix);
565
- this._offsetMirror.copyFrom(mirrorMatrix);
566
- if (scene.floatingOriginMode) {
567
- OffsetClipPlaneToRef(scene.floatingOriginOffset, scene.clipPlane, this._tempPlane);
568
- Matrix.ReflectionToRef(this._tempPlane, this._offsetMirror);
762
+ serialize() {
763
+ const serializationObject = super.serialize();
764
+ serializationObject.customType = "BABYLON.WaterMaterial";
765
+ serializationObject.renderList = [];
766
+ if (this._refractionRTT && this._refractionRTT.renderList) {
767
+ for (let i = 0; i < this._refractionRTT.renderList.length; i++) {
768
+ serializationObject.renderList.push(this._refractionRTT.renderList[i].id);
769
+ }
569
770
  }
771
+ return serializationObject;
570
772
  }
571
- // Transform
572
- savedViewMatrix = scene.getViewMatrix();
573
- mirrorMatrix.multiplyToRef(savedViewMatrix, this._reflectionTransform);
574
- scene.setTransformMatrix(this._reflectionTransform, scene.getProjectionMatrix());
575
- const cameraPos = Vector3.TransformCoordinates(scene.activeCamera.position, mirrorMatrix);
576
- scene._mirroredCameraPosition = cameraPos;
577
- scene._forcedViewPosition = cameraPos; // More performant to set 2 properties here than to check both mirroredCameraPos and forcedViewPos within eye binding (which happens on critical rendering path)
578
- };
579
- this._reflectionRTT.onAfterRender = () => {
580
- if (this._mesh) {
581
- this._mesh.isVisible = isVisible;
773
+ getClassName() {
774
+ return "WaterMaterial";
582
775
  }
583
- // Clip plane
584
- scene.clipPlane = clipPlane;
585
- // Transform
586
- scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());
587
- scene._mirroredCameraPosition = null;
588
- scene._forcedViewPosition = null;
589
- };
590
- }
591
- getAnimatables() {
592
- const results = [];
593
- if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
594
- results.push(this.bumpTexture);
595
- }
596
- if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {
597
- results.push(this._reflectionRTT);
598
- }
599
- if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {
600
- results.push(this._refractionRTT);
601
- }
602
- return results;
603
- }
604
- getActiveTextures() {
605
- const activeTextures = super.getActiveTextures();
606
- if (this._bumpTexture) {
607
- activeTextures.push(this._bumpTexture);
608
- }
609
- return activeTextures;
610
- }
611
- hasTexture(texture) {
612
- if (super.hasTexture(texture)) {
613
- return true;
614
- }
615
- if (this._bumpTexture === texture) {
616
- return true;
617
- }
618
- return false;
619
- }
620
- dispose(forceDisposeEffect) {
621
- if (this.bumpTexture) {
622
- this.bumpTexture.dispose();
623
- }
624
- let index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);
625
- if (index != -1) {
626
- this.getScene().customRenderTargets.splice(index, 1);
627
- }
628
- index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);
629
- if (index != -1) {
630
- this.getScene().customRenderTargets.splice(index, 1);
631
- }
632
- if (this._reflectionRTT) {
633
- this._reflectionRTT.dispose();
634
- }
635
- if (this._refractionRTT) {
636
- this._refractionRTT.dispose();
637
- }
638
- // Remove image-processing observer
639
- if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
640
- this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
641
- }
642
- super.dispose(forceDisposeEffect);
643
- }
644
- clone(name) {
645
- return SerializationHelper.Clone(() => new WaterMaterial(name, this.getScene()), this);
646
- }
647
- serialize() {
648
- const serializationObject = super.serialize();
649
- serializationObject.customType = "BABYLON.WaterMaterial";
650
- serializationObject.renderList = [];
651
- if (this._refractionRTT && this._refractionRTT.renderList) {
652
- for (let i = 0; i < this._refractionRTT.renderList.length; i++) {
653
- serializationObject.renderList.push(this._refractionRTT.renderList[i].id);
776
+ // Statics
777
+ static Parse(source, scene, rootUrl) {
778
+ const mat = SerializationHelper.Parse(() => new _a(source.name, scene), source, scene, rootUrl);
779
+ mat._waitingRenderList = source.renderList;
780
+ return mat;
654
781
  }
655
- }
656
- return serializationObject;
657
- }
658
- getClassName() {
659
- return "WaterMaterial";
660
- }
661
- // Statics
662
- static Parse(source, scene, rootUrl) {
663
- const mat = SerializationHelper.Parse(() => new WaterMaterial(source.name, scene), source, scene, rootUrl);
664
- mat._waitingRenderList = source.renderList;
665
- return mat;
666
- }
667
- static CreateDefaultMesh(name, scene) {
668
- const mesh = CreateGround(name, { width: 512, height: 512, subdivisions: 32, updatable: false }, scene);
669
- return mesh;
670
- }
671
- }
672
- __decorate([
673
- serializeAsTexture("bumpTexture")
674
- ], WaterMaterial.prototype, "_bumpTexture", void 0);
675
- __decorate([
676
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
677
- ], WaterMaterial.prototype, "bumpTexture", void 0);
678
- __decorate([
679
- serializeAsColor3()
680
- ], WaterMaterial.prototype, "diffuseColor", void 0);
681
- __decorate([
682
- serializeAsColor3()
683
- ], WaterMaterial.prototype, "specularColor", void 0);
684
- __decorate([
685
- serialize()
686
- ], WaterMaterial.prototype, "specularPower", void 0);
687
- __decorate([
688
- serialize("disableLighting")
689
- ], WaterMaterial.prototype, "_disableLighting", void 0);
690
- __decorate([
691
- expandToProperty("_markAllSubMeshesAsLightsDirty")
692
- ], WaterMaterial.prototype, "disableLighting", void 0);
693
- __decorate([
694
- serialize("maxSimultaneousLights")
695
- ], WaterMaterial.prototype, "_maxSimultaneousLights", void 0);
696
- __decorate([
697
- expandToProperty("_markAllSubMeshesAsLightsDirty")
698
- ], WaterMaterial.prototype, "maxSimultaneousLights", void 0);
699
- __decorate([
700
- serialize()
701
- ], WaterMaterial.prototype, "windForce", void 0);
702
- __decorate([
703
- serializeAsVector2()
704
- ], WaterMaterial.prototype, "windDirection", void 0);
705
- __decorate([
706
- serialize()
707
- ], WaterMaterial.prototype, "waveHeight", void 0);
708
- __decorate([
709
- serialize()
710
- ], WaterMaterial.prototype, "bumpHeight", void 0);
711
- __decorate([
712
- serialize("bumpSuperimpose")
713
- ], WaterMaterial.prototype, "_bumpSuperimpose", void 0);
714
- __decorate([
715
- expandToProperty("_markAllSubMeshesAsMiscDirty")
716
- ], WaterMaterial.prototype, "bumpSuperimpose", void 0);
717
- __decorate([
718
- serialize("fresnelSeparate")
719
- ], WaterMaterial.prototype, "_fresnelSeparate", void 0);
720
- __decorate([
721
- expandToProperty("_markAllSubMeshesAsMiscDirty")
722
- ], WaterMaterial.prototype, "fresnelSeparate", void 0);
723
- __decorate([
724
- serialize("bumpAffectsReflection")
725
- ], WaterMaterial.prototype, "_bumpAffectsReflection", void 0);
726
- __decorate([
727
- expandToProperty("_markAllSubMeshesAsMiscDirty")
728
- ], WaterMaterial.prototype, "bumpAffectsReflection", void 0);
729
- __decorate([
730
- serializeAsColor3()
731
- ], WaterMaterial.prototype, "waterColor", void 0);
732
- __decorate([
733
- serialize()
734
- ], WaterMaterial.prototype, "colorBlendFactor", void 0);
735
- __decorate([
736
- serializeAsColor3()
737
- ], WaterMaterial.prototype, "waterColor2", void 0);
738
- __decorate([
739
- serialize()
740
- ], WaterMaterial.prototype, "colorBlendFactor2", void 0);
741
- __decorate([
742
- serialize()
743
- ], WaterMaterial.prototype, "waveLength", void 0);
744
- __decorate([
745
- serialize()
746
- ], WaterMaterial.prototype, "waveSpeed", void 0);
747
- __decorate([
748
- serialize()
749
- ], WaterMaterial.prototype, "waveCount", void 0);
750
- __decorate([
751
- serialize()
752
- ], WaterMaterial.prototype, "disableClipPlane", void 0);
753
- __decorate([
754
- serialize("useWorldCoordinatesForWaveDeformation")
755
- ], WaterMaterial.prototype, "_useWorldCoordinatesForWaveDeformation", void 0);
756
- __decorate([
757
- expandToProperty("_markAllSubMeshesAsMiscDirty")
758
- ], WaterMaterial.prototype, "useWorldCoordinatesForWaveDeformation", void 0);
782
+ static CreateDefaultMesh(name, scene) {
783
+ const mesh = CreateGround(name, { width: 512, height: 512, subdivisions: 32, updatable: false }, scene);
784
+ return mesh;
785
+ }
786
+ },
787
+ _WaterMaterial_bumpTexture_accessor_storage = new WeakMap(),
788
+ _WaterMaterial_disableLighting_accessor_storage = new WeakMap(),
789
+ _WaterMaterial_maxSimultaneousLights_accessor_storage = new WeakMap(),
790
+ _WaterMaterial_bumpSuperimpose_accessor_storage = new WeakMap(),
791
+ _WaterMaterial_fresnelSeparate_accessor_storage = new WeakMap(),
792
+ _WaterMaterial_bumpAffectsReflection_accessor_storage = new WeakMap(),
793
+ _WaterMaterial_useWorldCoordinatesForWaveDeformation_accessor_storage = new WeakMap(),
794
+ (() => {
795
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
796
+ __bumpTexture_decorators = [serializeAsTexture("bumpTexture")];
797
+ _bumpTexture_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
798
+ _diffuseColor_decorators = [serializeAsColor3()];
799
+ _specularColor_decorators = [serializeAsColor3()];
800
+ _specularPower_decorators = [serialize()];
801
+ __disableLighting_decorators = [serialize("disableLighting")];
802
+ _disableLighting_decorators = [expandToProperty("_markAllSubMeshesAsLightsDirty")];
803
+ __maxSimultaneousLights_decorators = [serialize("maxSimultaneousLights")];
804
+ _maxSimultaneousLights_decorators = [expandToProperty("_markAllSubMeshesAsLightsDirty")];
805
+ _windForce_decorators = [serialize()];
806
+ _windDirection_decorators = [serializeAsVector2()];
807
+ _waveHeight_decorators = [serialize()];
808
+ _bumpHeight_decorators = [serialize()];
809
+ __bumpSuperimpose_decorators = [serialize("bumpSuperimpose")];
810
+ _bumpSuperimpose_decorators = [expandToProperty("_markAllSubMeshesAsMiscDirty")];
811
+ __fresnelSeparate_decorators = [serialize("fresnelSeparate")];
812
+ _fresnelSeparate_decorators = [expandToProperty("_markAllSubMeshesAsMiscDirty")];
813
+ __bumpAffectsReflection_decorators = [serialize("bumpAffectsReflection")];
814
+ _bumpAffectsReflection_decorators = [expandToProperty("_markAllSubMeshesAsMiscDirty")];
815
+ _waterColor_decorators = [serializeAsColor3()];
816
+ _colorBlendFactor_decorators = [serialize()];
817
+ _waterColor2_decorators = [serializeAsColor3()];
818
+ _colorBlendFactor2_decorators = [serialize()];
819
+ _waveLength_decorators = [serialize()];
820
+ _waveSpeed_decorators = [serialize()];
821
+ _waveCount_decorators = [serialize()];
822
+ _disableClipPlane_decorators = [serialize()];
823
+ __useWorldCoordinatesForWaveDeformation_decorators = [serialize("useWorldCoordinatesForWaveDeformation")];
824
+ _useWorldCoordinatesForWaveDeformation_decorators = [expandToProperty("_markAllSubMeshesAsMiscDirty")];
825
+ __esDecorate(_a, null, _bumpTexture_decorators, { kind: "accessor", name: "bumpTexture", static: false, private: false, access: { has: obj => "bumpTexture" in obj, get: obj => obj.bumpTexture, set: (obj, value) => { obj.bumpTexture = value; } }, metadata: _metadata }, _bumpTexture_initializers, _bumpTexture_extraInitializers);
826
+ __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);
827
+ __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);
828
+ __esDecorate(_a, null, _bumpSuperimpose_decorators, { kind: "accessor", name: "bumpSuperimpose", static: false, private: false, access: { has: obj => "bumpSuperimpose" in obj, get: obj => obj.bumpSuperimpose, set: (obj, value) => { obj.bumpSuperimpose = value; } }, metadata: _metadata }, _bumpSuperimpose_initializers, _bumpSuperimpose_extraInitializers);
829
+ __esDecorate(_a, null, _fresnelSeparate_decorators, { kind: "accessor", name: "fresnelSeparate", static: false, private: false, access: { has: obj => "fresnelSeparate" in obj, get: obj => obj.fresnelSeparate, set: (obj, value) => { obj.fresnelSeparate = value; } }, metadata: _metadata }, _fresnelSeparate_initializers, _fresnelSeparate_extraInitializers);
830
+ __esDecorate(_a, null, _bumpAffectsReflection_decorators, { kind: "accessor", name: "bumpAffectsReflection", static: false, private: false, access: { has: obj => "bumpAffectsReflection" in obj, get: obj => obj.bumpAffectsReflection, set: (obj, value) => { obj.bumpAffectsReflection = value; } }, metadata: _metadata }, _bumpAffectsReflection_initializers, _bumpAffectsReflection_extraInitializers);
831
+ __esDecorate(_a, null, _useWorldCoordinatesForWaveDeformation_decorators, { kind: "accessor", name: "useWorldCoordinatesForWaveDeformation", static: false, private: false, access: { has: obj => "useWorldCoordinatesForWaveDeformation" in obj, get: obj => obj.useWorldCoordinatesForWaveDeformation, set: (obj, value) => { obj.useWorldCoordinatesForWaveDeformation = value; } }, metadata: _metadata }, _useWorldCoordinatesForWaveDeformation_initializers, _useWorldCoordinatesForWaveDeformation_extraInitializers);
832
+ __esDecorate(null, null, __bumpTexture_decorators, { kind: "field", name: "_bumpTexture", static: false, private: false, access: { has: obj => "_bumpTexture" in obj, get: obj => obj._bumpTexture, set: (obj, value) => { obj._bumpTexture = value; } }, metadata: _metadata }, __bumpTexture_initializers, __bumpTexture_extraInitializers);
833
+ __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);
834
+ __esDecorate(null, null, _specularColor_decorators, { kind: "field", name: "specularColor", static: false, private: false, access: { has: obj => "specularColor" in obj, get: obj => obj.specularColor, set: (obj, value) => { obj.specularColor = value; } }, metadata: _metadata }, _specularColor_initializers, _specularColor_extraInitializers);
835
+ __esDecorate(null, null, _specularPower_decorators, { kind: "field", name: "specularPower", static: false, private: false, access: { has: obj => "specularPower" in obj, get: obj => obj.specularPower, set: (obj, value) => { obj.specularPower = value; } }, metadata: _metadata }, _specularPower_initializers, _specularPower_extraInitializers);
836
+ __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);
837
+ __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);
838
+ __esDecorate(null, null, _windForce_decorators, { kind: "field", name: "windForce", static: false, private: false, access: { has: obj => "windForce" in obj, get: obj => obj.windForce, set: (obj, value) => { obj.windForce = value; } }, metadata: _metadata }, _windForce_initializers, _windForce_extraInitializers);
839
+ __esDecorate(null, null, _windDirection_decorators, { kind: "field", name: "windDirection", static: false, private: false, access: { has: obj => "windDirection" in obj, get: obj => obj.windDirection, set: (obj, value) => { obj.windDirection = value; } }, metadata: _metadata }, _windDirection_initializers, _windDirection_extraInitializers);
840
+ __esDecorate(null, null, _waveHeight_decorators, { kind: "field", name: "waveHeight", static: false, private: false, access: { has: obj => "waveHeight" in obj, get: obj => obj.waveHeight, set: (obj, value) => { obj.waveHeight = value; } }, metadata: _metadata }, _waveHeight_initializers, _waveHeight_extraInitializers);
841
+ __esDecorate(null, null, _bumpHeight_decorators, { kind: "field", name: "bumpHeight", static: false, private: false, access: { has: obj => "bumpHeight" in obj, get: obj => obj.bumpHeight, set: (obj, value) => { obj.bumpHeight = value; } }, metadata: _metadata }, _bumpHeight_initializers, _bumpHeight_extraInitializers);
842
+ __esDecorate(null, null, __bumpSuperimpose_decorators, { kind: "field", name: "_bumpSuperimpose", static: false, private: false, access: { has: obj => "_bumpSuperimpose" in obj, get: obj => obj._bumpSuperimpose, set: (obj, value) => { obj._bumpSuperimpose = value; } }, metadata: _metadata }, __bumpSuperimpose_initializers, __bumpSuperimpose_extraInitializers);
843
+ __esDecorate(null, null, __fresnelSeparate_decorators, { kind: "field", name: "_fresnelSeparate", static: false, private: false, access: { has: obj => "_fresnelSeparate" in obj, get: obj => obj._fresnelSeparate, set: (obj, value) => { obj._fresnelSeparate = value; } }, metadata: _metadata }, __fresnelSeparate_initializers, __fresnelSeparate_extraInitializers);
844
+ __esDecorate(null, null, __bumpAffectsReflection_decorators, { kind: "field", name: "_bumpAffectsReflection", static: false, private: false, access: { has: obj => "_bumpAffectsReflection" in obj, get: obj => obj._bumpAffectsReflection, set: (obj, value) => { obj._bumpAffectsReflection = value; } }, metadata: _metadata }, __bumpAffectsReflection_initializers, __bumpAffectsReflection_extraInitializers);
845
+ __esDecorate(null, null, _waterColor_decorators, { kind: "field", name: "waterColor", static: false, private: false, access: { has: obj => "waterColor" in obj, get: obj => obj.waterColor, set: (obj, value) => { obj.waterColor = value; } }, metadata: _metadata }, _waterColor_initializers, _waterColor_extraInitializers);
846
+ __esDecorate(null, null, _colorBlendFactor_decorators, { kind: "field", name: "colorBlendFactor", static: false, private: false, access: { has: obj => "colorBlendFactor" in obj, get: obj => obj.colorBlendFactor, set: (obj, value) => { obj.colorBlendFactor = value; } }, metadata: _metadata }, _colorBlendFactor_initializers, _colorBlendFactor_extraInitializers);
847
+ __esDecorate(null, null, _waterColor2_decorators, { kind: "field", name: "waterColor2", static: false, private: false, access: { has: obj => "waterColor2" in obj, get: obj => obj.waterColor2, set: (obj, value) => { obj.waterColor2 = value; } }, metadata: _metadata }, _waterColor2_initializers, _waterColor2_extraInitializers);
848
+ __esDecorate(null, null, _colorBlendFactor2_decorators, { kind: "field", name: "colorBlendFactor2", static: false, private: false, access: { has: obj => "colorBlendFactor2" in obj, get: obj => obj.colorBlendFactor2, set: (obj, value) => { obj.colorBlendFactor2 = value; } }, metadata: _metadata }, _colorBlendFactor2_initializers, _colorBlendFactor2_extraInitializers);
849
+ __esDecorate(null, null, _waveLength_decorators, { kind: "field", name: "waveLength", static: false, private: false, access: { has: obj => "waveLength" in obj, get: obj => obj.waveLength, set: (obj, value) => { obj.waveLength = value; } }, metadata: _metadata }, _waveLength_initializers, _waveLength_extraInitializers);
850
+ __esDecorate(null, null, _waveSpeed_decorators, { kind: "field", name: "waveSpeed", static: false, private: false, access: { has: obj => "waveSpeed" in obj, get: obj => obj.waveSpeed, set: (obj, value) => { obj.waveSpeed = value; } }, metadata: _metadata }, _waveSpeed_initializers, _waveSpeed_extraInitializers);
851
+ __esDecorate(null, null, _waveCount_decorators, { kind: "field", name: "waveCount", static: false, private: false, access: { has: obj => "waveCount" in obj, get: obj => obj.waveCount, set: (obj, value) => { obj.waveCount = value; } }, metadata: _metadata }, _waveCount_initializers, _waveCount_extraInitializers);
852
+ __esDecorate(null, null, _disableClipPlane_decorators, { kind: "field", name: "disableClipPlane", static: false, private: false, access: { has: obj => "disableClipPlane" in obj, get: obj => obj.disableClipPlane, set: (obj, value) => { obj.disableClipPlane = value; } }, metadata: _metadata }, _disableClipPlane_initializers, _disableClipPlane_extraInitializers);
853
+ __esDecorate(null, null, __useWorldCoordinatesForWaveDeformation_decorators, { kind: "field", name: "_useWorldCoordinatesForWaveDeformation", static: false, private: false, access: { has: obj => "_useWorldCoordinatesForWaveDeformation" in obj, get: obj => obj._useWorldCoordinatesForWaveDeformation, set: (obj, value) => { obj._useWorldCoordinatesForWaveDeformation = value; } }, metadata: _metadata }, __useWorldCoordinatesForWaveDeformation_initializers, __useWorldCoordinatesForWaveDeformation_extraInitializers);
854
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
855
+ })(),
856
+ _a;
857
+ })();
858
+ export { WaterMaterial };
759
859
  RegisterClass("BABYLON.WaterMaterial", WaterMaterial);
760
860
  //# sourceMappingURL=waterMaterial.js.map