babylonjs-materials 7.15.2 → 7.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 (51) hide show
  1. package/babylon.cellMaterial.js +1 -5
  2. package/babylon.cellMaterial.min.js +1 -1
  3. package/babylon.cellMaterial.min.js.map +1 -1
  4. package/babylon.customMaterial.js +1 -5
  5. package/babylon.customMaterial.min.js +1 -1
  6. package/babylon.customMaterial.min.js.map +1 -1
  7. package/babylon.fireMaterial.js +1 -5
  8. package/babylon.fireMaterial.min.js +1 -1
  9. package/babylon.fireMaterial.min.js.map +1 -1
  10. package/babylon.furMaterial.js +1 -5
  11. package/babylon.furMaterial.min.js +1 -1
  12. package/babylon.furMaterial.min.js.map +1 -1
  13. package/babylon.gradientMaterial.js +1 -5
  14. package/babylon.gradientMaterial.min.js +1 -1
  15. package/babylon.gradientMaterial.min.js.map +1 -1
  16. package/babylon.gridMaterial.js +1 -5
  17. package/babylon.gridMaterial.min.js +1 -1
  18. package/babylon.gridMaterial.min.js.map +1 -1
  19. package/babylon.lavaMaterial.js +1 -5
  20. package/babylon.lavaMaterial.min.js +1 -1
  21. package/babylon.lavaMaterial.min.js.map +1 -1
  22. package/babylon.mixMaterial.js +1 -5
  23. package/babylon.mixMaterial.min.js +1 -1
  24. package/babylon.mixMaterial.min.js.map +1 -1
  25. package/babylon.normalMaterial.js +1 -5
  26. package/babylon.normalMaterial.min.js +1 -1
  27. package/babylon.normalMaterial.min.js.map +1 -1
  28. package/babylon.shadowOnlyMaterial.js +1 -5
  29. package/babylon.shadowOnlyMaterial.min.js +1 -1
  30. package/babylon.shadowOnlyMaterial.min.js.map +1 -1
  31. package/babylon.simpleMaterial.js +1 -5
  32. package/babylon.simpleMaterial.min.js +1 -1
  33. package/babylon.simpleMaterial.min.js.map +1 -1
  34. package/babylon.skyMaterial.js +1 -5
  35. package/babylon.skyMaterial.min.js +1 -1
  36. package/babylon.skyMaterial.min.js.map +1 -1
  37. package/babylon.terrainMaterial.js +1 -5
  38. package/babylon.terrainMaterial.min.js +1 -1
  39. package/babylon.terrainMaterial.min.js.map +1 -1
  40. package/babylon.triPlanarMaterial.js +1 -5
  41. package/babylon.triPlanarMaterial.min.js +1 -1
  42. package/babylon.triPlanarMaterial.min.js.map +1 -1
  43. package/babylon.waterMaterial.js +1 -5
  44. package/babylon.waterMaterial.min.js +1 -1
  45. package/babylon.waterMaterial.min.js.map +1 -1
  46. package/babylonjs.materials.d.ts +1068 -1068
  47. package/babylonjs.materials.js +1 -5
  48. package/babylonjs.materials.min.js +1 -1
  49. package/babylonjs.materials.min.js.map +1 -1
  50. package/babylonjs.materials.module.d.ts +2641 -2641
  51. package/package.json +2 -2
@@ -1,637 +1,625 @@
1
1
 
2
2
  declare module BABYLON {
3
- /** @internal */
4
- export var cellPixelShader: {
5
- name: string;
6
- shader: string;
7
- };
8
-
9
-
10
- /** @internal */
11
- export var cellVertexShader: {
12
- name: string;
13
- shader: string;
14
- };
15
3
 
16
4
 
17
- export class CellMaterial extends PushMaterial {
18
- private _diffuseTexture;
19
- diffuseTexture: BaseTexture;
5
+ export class WaterMaterial extends PushMaterial {
6
+ renderTargetSize: Vector2;
7
+ private _bumpTexture;
8
+ bumpTexture: BaseTexture;
20
9
  diffuseColor: Color3;
21
- _computeHighLevel: boolean;
22
- computeHighLevel: boolean;
10
+ specularColor: Color3;
11
+ specularPower: number;
23
12
  private _disableLighting;
24
13
  disableLighting: boolean;
25
14
  private _maxSimultaneousLights;
26
15
  maxSimultaneousLights: number;
27
- constructor(name: string, scene?: Scene);
28
- needAlphaBlending(): boolean;
29
- needAlphaTesting(): boolean;
30
- getAlphaTestTexture(): Nullable<BaseTexture>;
31
- isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
32
- bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
33
- getAnimatables(): IAnimatable[];
34
- getActiveTextures(): BaseTexture[];
35
- hasTexture(texture: BaseTexture): boolean;
36
- dispose(forceDisposeEffect?: boolean): void;
37
- getClassName(): string;
38
- clone(name: string): CellMaterial;
39
- serialize(): any;
40
- static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial;
41
- }
42
-
43
-
44
-
45
-
46
- /**
47
- * Structure of a custom shader
48
- */
49
- export class CustomShaderStructure {
50
16
  /**
51
- * Fragment store
17
+ * Defines the wind force.
52
18
  */
53
- FragmentStore: string;
19
+ windForce: number;
54
20
  /**
55
- * Vertex store
21
+ * Defines the direction of the wind in the plane (X, Z).
56
22
  */
57
- VertexStore: string;
58
- constructor();
59
- }
60
- /**
61
- * Parts of a shader
62
- */
63
- export class ShaderSpecialParts {
64
- constructor();
23
+ windDirection: Vector2;
65
24
  /**
66
- * Beginning of the fragment shader
25
+ * Defines the height of the waves.
67
26
  */
68
- Fragment_Begin: string;
27
+ waveHeight: number;
69
28
  /**
70
- * Variable definitions of the fragment shader
29
+ * Defines the bump height related to the bump map.
71
30
  */
72
- Fragment_Definitions: string;
31
+ bumpHeight: number;
73
32
  /**
74
- * Beginning of the fragment main function
33
+ * Defines wether or not: to add a smaller moving bump to less steady waves.
75
34
  */
76
- Fragment_MainBegin: string;
35
+ private _bumpSuperimpose;
36
+ bumpSuperimpose: boolean;
77
37
  /**
78
- * End of the fragment main function
38
+ * Defines wether or not color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
79
39
  */
80
- Fragment_MainEnd: string;
40
+ private _fresnelSeparate;
41
+ fresnelSeparate: boolean;
81
42
  /**
82
- * Diffuse color calculation
43
+ * Defines wether or not bump Wwves modify the reflection.
83
44
  */
84
- Fragment_Custom_Diffuse: string;
45
+ private _bumpAffectsReflection;
46
+ bumpAffectsReflection: boolean;
85
47
  /**
86
- * Before lightning computations
48
+ * Defines the water color blended with the refraction (near).
87
49
  */
88
- Fragment_Before_Lights: string;
50
+ waterColor: Color3;
89
51
  /**
90
- * Before fog computations
52
+ * Defines the blend factor related to the water color.
91
53
  */
92
- Fragment_Before_Fog: string;
54
+ colorBlendFactor: number;
93
55
  /**
94
- * Alpha calculations
56
+ * Defines the water color blended with the reflection (far).
95
57
  */
96
- Fragment_Custom_Alpha: string;
58
+ waterColor2: Color3;
97
59
  /**
98
- * Before frag color is assigned
60
+ * Defines the blend factor related to the water color (reflection, far).
99
61
  */
100
- Fragment_Before_FragColor: string;
62
+ colorBlendFactor2: number;
101
63
  /**
102
- * Beginning of the vertex shader
64
+ * Defines the maximum length of a wave.
103
65
  */
104
- Vertex_Begin: string;
66
+ waveLength: number;
105
67
  /**
106
- * Variable definitions of the vertex shader
68
+ * Defines the waves speed.
107
69
  */
108
- Vertex_Definitions: string;
70
+ waveSpeed: number;
109
71
  /**
110
- * Start of the main function of the vertex shader
72
+ * 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.
111
73
  */
112
- Vertex_MainBegin: string;
74
+ waveCount: number;
113
75
  /**
114
- * Before the world position computation
76
+ * Sets or gets whether or not automatic clipping should be enabled or not. Setting to true will save performances and
77
+ * will avoid calculating useless pixels in the pixel shader of the water material.
115
78
  */
116
- Vertex_Before_PositionUpdated: string;
79
+ disableClipPlane: boolean;
117
80
  /**
118
- * Before the normal computation
81
+ * Defines whether or not to use world coordinates for wave deformations.
82
+ * The default value is false, meaning that the deformation is applied in object (local) space.
83
+ * You will probably need to set it to true if you are using instances or thin instances for your water objects.
119
84
  */
120
- Vertex_Before_NormalUpdated: string;
85
+ private _useWorldCoordinatesForWaveDeformation;
86
+ useWorldCoordinatesForWaveDeformation: boolean;
87
+ protected _renderTargets: SmartArray<RenderTargetTexture>;
88
+ private _mesh;
89
+ private _refractionRTT;
90
+ private _reflectionRTT;
91
+ private _reflectionTransform;
92
+ private _lastTime;
93
+ private _lastDeltaTime;
94
+ private _waitingRenderList;
95
+ private _imageProcessingConfiguration;
96
+ private _imageProcessingObserver;
121
97
  /**
122
- * After the world position has been computed
98
+ * Gets a boolean indicating that current material needs to register RTT
123
99
  */
124
- Vertex_After_WorldPosComputed: string;
100
+ get hasRenderTargetTextures(): boolean;
125
101
  /**
126
- * Main end of the vertex shader
102
+ * Constructor
103
+ * @param name
104
+ * @param scene
105
+ * @param renderTargetSize
127
106
  */
128
- Vertex_MainEnd: string;
107
+ constructor(name: string, scene?: Scene, renderTargetSize?: Vector2);
108
+ get refractionTexture(): Nullable<RenderTargetTexture>;
109
+ get reflectionTexture(): Nullable<RenderTargetTexture>;
110
+ addToRenderList(node: any): void;
111
+ removeFromRenderList(node: any): void;
112
+ enableRenderTargets(enable: boolean): void;
113
+ getRenderList(): Nullable<AbstractMesh[]>;
114
+ get renderTargetsEnabled(): boolean;
115
+ needAlphaBlending(): boolean;
116
+ needAlphaTesting(): boolean;
117
+ getAlphaTestTexture(): Nullable<BaseTexture>;
118
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
119
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
120
+ private _createRenderTargets;
121
+ getAnimatables(): IAnimatable[];
122
+ getActiveTextures(): BaseTexture[];
123
+ hasTexture(texture: BaseTexture): boolean;
124
+ dispose(forceDisposeEffect?: boolean): void;
125
+ clone(name: string): WaterMaterial;
126
+ serialize(): any;
127
+ getClassName(): string;
128
+ static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial;
129
+ static CreateDefaultMesh(name: string, scene: Scene): Mesh;
129
130
  }
130
- /**
131
- * Customized material
132
- */
133
- export class CustomMaterial extends StandardMaterial {
134
- /**
135
- * Index for each created shader
136
- */
137
- static ShaderIndexer: number;
138
- /**
139
- * Custom shader structure
140
- */
141
- CustomParts: ShaderSpecialParts;
142
- /**
143
- * Name of the shader
144
- */
145
- _createdShaderName: string;
146
- /**
147
- * List of custom uniforms
148
- */
149
- _customUniform: string[];
150
- /**
151
- * Names of the new uniforms
152
- */
153
- _newUniforms: string[];
154
- /**
155
- * Instances of the new uniform objects
156
- */
157
- _newUniformInstances: {
158
- [name: string]: any;
159
- };
160
- /**
161
- * Instances of the new sampler objects
162
- */
163
- _newSamplerInstances: {
164
- [name: string]: Texture;
165
- };
166
- /**
167
- * List of the custom attributes
168
- */
169
- _customAttributes: string[];
170
- /**
171
- * Fragment shader string
172
- */
173
- FragmentShader: string;
174
- /**
175
- * Vertex shader string
176
- */
177
- VertexShader: string;
178
- /**
179
- * Runs after the material is bound to a mesh
180
- * @param mesh mesh bound
181
- * @param effect bound effect used to render
182
- */
183
- AttachAfterBind(mesh: Mesh | undefined, effect: Effect): void;
184
- /**
185
- * @internal
186
- */
187
- ReviewUniform(name: string, arr: string[]): string[];
188
- /**
189
- * Builds the material
190
- * @param shaderName name of the shader
191
- * @param uniforms list of uniforms
192
- * @param uniformBuffers list of uniform buffers
193
- * @param samplers list of samplers
194
- * @param defines list of defines
195
- * @param attributes list of attributes
196
- * @returns the shader name
197
- */
198
- Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[]): string;
199
- protected _injectCustomCode(code: string, shaderType: string): string;
200
- protected _getCustomCode(shaderType: string): {
201
- [pointName: string]: string;
202
- };
203
- constructor(name: string, scene?: Scene);
204
- protected _afterBind(mesh?: Mesh, effect?: Nullable<Effect>, subMesh?: SubMesh): void;
205
- /**
206
- * Adds a new uniform to the shader
207
- * @param name the name of the uniform to add
208
- * @param kind the type of the uniform to add
209
- * @param param the value of the uniform to add
210
- * @returns the current material
211
- */
212
- AddUniform(name: string, kind: string, param: any): CustomMaterial;
213
- /**
214
- * Adds a custom attribute
215
- * @param name the name of the attribute
216
- * @returns the current material
217
- */
218
- AddAttribute(name: string): CustomMaterial;
131
+
132
+
133
+ /** @internal */
134
+ export var waterVertexShader: {
135
+ name: string;
136
+ shader: string;
137
+ };
138
+
139
+
140
+ /** @internal */
141
+ export var waterPixelShader: {
142
+ name: string;
143
+ shader: string;
144
+ };
145
+
146
+
147
+
148
+
149
+ /** @internal */
150
+ export var triplanarVertexShader: {
151
+ name: string;
152
+ shader: string;
153
+ };
154
+
155
+
156
+ /** @internal */
157
+ export var triplanarPixelShader: {
158
+ name: string;
159
+ shader: string;
160
+ };
161
+
162
+
163
+ export class TriPlanarMaterial extends PushMaterial {
164
+ mixTexture: BaseTexture;
165
+ private _diffuseTextureX;
166
+ diffuseTextureX: BaseTexture;
167
+ private _diffuseTextureY;
168
+ diffuseTextureY: BaseTexture;
169
+ private _diffuseTextureZ;
170
+ diffuseTextureZ: BaseTexture;
171
+ private _normalTextureX;
172
+ normalTextureX: BaseTexture;
173
+ private _normalTextureY;
174
+ normalTextureY: BaseTexture;
175
+ private _normalTextureZ;
176
+ normalTextureZ: BaseTexture;
177
+ tileSize: number;
178
+ diffuseColor: Color3;
179
+ specularColor: Color3;
180
+ specularPower: number;
181
+ private _disableLighting;
182
+ disableLighting: boolean;
183
+ private _maxSimultaneousLights;
184
+ maxSimultaneousLights: number;
185
+ constructor(name: string, scene?: Scene);
186
+ needAlphaBlending(): boolean;
187
+ needAlphaTesting(): boolean;
188
+ getAlphaTestTexture(): Nullable<BaseTexture>;
189
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
190
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
191
+ getAnimatables(): IAnimatable[];
192
+ getActiveTextures(): BaseTexture[];
193
+ hasTexture(texture: BaseTexture): boolean;
194
+ dispose(forceDisposeEffect?: boolean): void;
195
+ clone(name: string): TriPlanarMaterial;
196
+ serialize(): any;
197
+ getClassName(): string;
198
+ static Parse(source: any, scene: Scene, rootUrl: string): TriPlanarMaterial;
199
+ }
200
+
201
+
202
+
203
+
204
+ export class TerrainMaterial extends PushMaterial {
205
+ private _mixTexture;
206
+ mixTexture: BaseTexture;
207
+ private _diffuseTexture1;
208
+ diffuseTexture1: Texture;
209
+ private _diffuseTexture2;
210
+ diffuseTexture2: Texture;
211
+ private _diffuseTexture3;
212
+ diffuseTexture3: Texture;
213
+ private _bumpTexture1;
214
+ bumpTexture1: Texture;
215
+ private _bumpTexture2;
216
+ bumpTexture2: Texture;
217
+ private _bumpTexture3;
218
+ bumpTexture3: Texture;
219
+ diffuseColor: Color3;
220
+ specularColor: Color3;
221
+ specularPower: number;
222
+ private _disableLighting;
223
+ disableLighting: boolean;
224
+ private _maxSimultaneousLights;
225
+ maxSimultaneousLights: number;
226
+ constructor(name: string, scene?: Scene);
227
+ needAlphaBlending(): boolean;
228
+ needAlphaTesting(): boolean;
229
+ getAlphaTestTexture(): Nullable<BaseTexture>;
230
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
231
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
232
+ getAnimatables(): IAnimatable[];
233
+ getActiveTextures(): BaseTexture[];
234
+ hasTexture(texture: BaseTexture): boolean;
235
+ dispose(forceDisposeEffect?: boolean): void;
236
+ clone(name: string): TerrainMaterial;
237
+ serialize(): any;
238
+ getClassName(): string;
239
+ static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial;
240
+ }
241
+
242
+
243
+ /** @internal */
244
+ export var terrainVertexShader: {
245
+ name: string;
246
+ shader: string;
247
+ };
248
+
249
+
250
+ /** @internal */
251
+ export var terrainPixelShader: {
252
+ name: string;
253
+ shader: string;
254
+ };
255
+
256
+
257
+
258
+
259
+ /**
260
+ * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
261
+ * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat
262
+ */
263
+ export class SkyMaterial extends PushMaterial {
219
264
  /**
220
- * Sets the code on Fragment_Begin portion
221
- * @param shaderPart the code string
222
- * @returns the current material
265
+ * Defines the overall luminance of sky in interval ]0, 1[.
223
266
  */
224
- Fragment_Begin(shaderPart: string): CustomMaterial;
267
+ luminance: number;
225
268
  /**
226
- * Sets the code on Fragment_Definitions portion
227
- * @param shaderPart the code string
228
- * @returns the current material
269
+ * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.
229
270
  */
230
- Fragment_Definitions(shaderPart: string): CustomMaterial;
271
+ turbidity: number;
231
272
  /**
232
- * Sets the code on Fragment_MainBegin portion
233
- * @param shaderPart the code string
234
- * @returns the current material
273
+ * Defines the sky appearance (light intensity).
235
274
  */
236
- Fragment_MainBegin(shaderPart: string): CustomMaterial;
275
+ rayleigh: number;
237
276
  /**
238
- * Sets the code on Fragment_MainEnd portion
239
- * @param shaderPart the code string
240
- * @returns the current material
277
+ * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.
241
278
  */
242
- Fragment_MainEnd(shaderPart: string): CustomMaterial;
279
+ mieCoefficient: number;
243
280
  /**
244
- * Sets the code on Fragment_Custom_Diffuse portion
245
- * @param shaderPart the code string
246
- * @returns the current material
281
+ * Defines the amount of haze particles following the Mie scattering theory.
247
282
  */
248
- Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
283
+ mieDirectionalG: number;
249
284
  /**
250
- * Sets the code on Fragment_Custom_Alpha portion
251
- * @param shaderPart the code string
252
- * @returns the current material
285
+ * Defines the distance of the sun according to the active scene camera.
253
286
  */
254
- Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
287
+ distance: number;
255
288
  /**
256
- * Sets the code on Fragment_Before_Lights portion
257
- * @param shaderPart the code string
258
- * @returns the current material
289
+ * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said
290
+ * "inclined".
259
291
  */
260
- Fragment_Before_Lights(shaderPart: string): CustomMaterial;
292
+ inclination: number;
261
293
  /**
262
- * Sets the code on Fragment_Before_Fog portion
263
- * @param shaderPart the code string
264
- * @returns the current material
294
+ * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between
295
+ * an object direction and a reference direction.
265
296
  */
266
- Fragment_Before_Fog(shaderPart: string): CustomMaterial;
297
+ azimuth: number;
267
298
  /**
268
- * Sets the code on Fragment_Before_FragColor portion
269
- * @param shaderPart the code string
270
- * @returns the current material
299
+ * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then
300
+ * the property is overridden by the inclination and the azimuth and can be read at any moment.
271
301
  */
272
- Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
302
+ sunPosition: Vector3;
273
303
  /**
274
- * Sets the code on Vertex_Begin portion
275
- * @param shaderPart the code string
276
- * @returns the current material
304
+ * Defines if the sun position should be computed (inclination and azimuth) according to the given
305
+ * .sunPosition property.
277
306
  */
278
- Vertex_Begin(shaderPart: string): CustomMaterial;
307
+ useSunPosition: boolean;
279
308
  /**
280
- * Sets the code on Vertex_Definitions portion
281
- * @param shaderPart the code string
282
- * @returns the current material
309
+ * Defines an offset vector used to get a horizon offset.
310
+ * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis
283
311
  */
284
- Vertex_Definitions(shaderPart: string): CustomMaterial;
312
+ cameraOffset: Vector3;
285
313
  /**
286
- * Sets the code on Vertex_MainBegin portion
287
- * @param shaderPart the code string
288
- * @returns the current material
314
+ * Defines the vector the skyMaterial should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())
289
315
  */
290
- Vertex_MainBegin(shaderPart: string): CustomMaterial;
316
+ up: Vector3;
291
317
  /**
292
- * Sets the code on Vertex_Before_PositionUpdated portion
293
- * @param shaderPart the code string
294
- * @returns the current material
318
+ * Defines if sky should be dithered.
295
319
  */
296
- Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
320
+ dithering: boolean;
321
+ private _cameraPosition;
322
+ private _skyOrientation;
297
323
  /**
298
- * Sets the code on Vertex_Before_NormalUpdated portion
299
- * @param shaderPart the code string
300
- * @returns the current material
324
+ * Instantiates a new sky material.
325
+ * This material allows to create dynamic and texture free
326
+ * effects for skyboxes by taking care of the atmosphere state.
327
+ * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat
328
+ * @param name Define the name of the material in the scene
329
+ * @param scene Define the scene the material belong to
301
330
  */
302
- Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
331
+ constructor(name: string, scene?: Scene);
303
332
  /**
304
- * Sets the code on Vertex_After_WorldPosComputed portion
305
- * @param shaderPart the code string
306
- * @returns the current material
333
+ * Specifies if the material will require alpha blending
334
+ * @returns a boolean specifying if alpha blending is needed
307
335
  */
308
- Vertex_After_WorldPosComputed(shaderPart: string): CustomMaterial;
336
+ needAlphaBlending(): boolean;
309
337
  /**
310
- * Sets the code on Vertex_MainEnd portion
311
- * @param shaderPart the code string
312
- * @returns the current material
338
+ * Specifies if this material should be rendered in alpha test mode
339
+ * @returns false as the sky material doesn't need alpha testing.
313
340
  */
314
- Vertex_MainEnd(shaderPart: string): CustomMaterial;
315
- }
316
-
317
-
318
-
319
-
320
- /**
321
- * Albedo parts of the shader
322
- */
323
- export class ShaderAlbedoParts {
324
- constructor();
341
+ needAlphaTesting(): boolean;
325
342
  /**
326
- * Beginning of the fragment shader
343
+ * Get the texture used for alpha test purpose.
344
+ * @returns null as the sky material has no texture.
327
345
  */
328
- Fragment_Begin: string;
329
- /**
330
- * Fragment definitions
331
- */
332
- Fragment_Definitions: string;
333
- /**
334
- * Beginning of the main function
335
- */
336
- Fragment_MainBegin: string;
337
- /**
338
- * End of main function
339
- */
340
- Fragment_MainEnd: string;
341
- /**
342
- * Albedo color
343
- */
344
- Fragment_Custom_Albedo: string;
345
- /**
346
- * Lights
347
- */
348
- Fragment_Before_Lights: string;
349
- /**
350
- * Metallic and roughness
351
- */
352
- Fragment_Custom_MetallicRoughness: string;
353
- /**
354
- * Microsurface
355
- */
356
- Fragment_Custom_MicroSurface: string;
346
+ getAlphaTestTexture(): Nullable<BaseTexture>;
357
347
  /**
358
- * Fog computations
348
+ * Get if the submesh is ready to be used and all its information available.
349
+ * Child classes can use it to update shaders
350
+ * @param mesh defines the mesh to check
351
+ * @param subMesh defines which submesh to check
352
+ * @returns a boolean indicating that the submesh is ready or not
359
353
  */
360
- Fragment_Before_Fog: string;
354
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean;
361
355
  /**
362
- * Alpha
356
+ * Binds the submesh to this material by preparing the effect and shader to draw
357
+ * @param world defines the world transformation matrix
358
+ * @param mesh defines the mesh containing the submesh
359
+ * @param subMesh defines the submesh to bind the material to
363
360
  */
364
- Fragment_Custom_Alpha: string;
361
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
365
362
  /**
366
- * Color composition
363
+ * Get the list of animatables in the material.
364
+ * @returns the list of animatables object used in the material
367
365
  */
368
- Fragment_Before_FinalColorComposition: string;
366
+ getAnimatables(): IAnimatable[];
369
367
  /**
370
- * Fragment color
368
+ * Disposes the material
369
+ * @param forceDisposeEffect specifies if effects should be forcefully disposed
371
370
  */
372
- Fragment_Before_FragColor: string;
371
+ dispose(forceDisposeEffect?: boolean): void;
373
372
  /**
374
- * Beginning of vertex shader
373
+ * Makes a duplicate of the material, and gives it a new name
374
+ * @param name defines the new name for the duplicated material
375
+ * @returns the cloned material
375
376
  */
376
- Vertex_Begin: string;
377
+ clone(name: string): SkyMaterial;
377
378
  /**
378
- * Vertex definitions
379
+ * Serializes this material in a JSON representation
380
+ * @returns the serialized material object
379
381
  */
380
- Vertex_Definitions: string;
382
+ serialize(): any;
381
383
  /**
382
- * Vertex main begin
384
+ * Gets the current class name of the material e.g. "SkyMaterial"
385
+ * Mainly use in serialization.
386
+ * @returns the class name
383
387
  */
384
- Vertex_MainBegin: string;
388
+ getClassName(): string;
385
389
  /**
386
- * Vertex before position updated
390
+ * Creates a sky material from parsed material data
391
+ * @param source defines the JSON representation of the material
392
+ * @param scene defines the hosting scene
393
+ * @param rootUrl defines the root URL to use to load textures and relative dependencies
394
+ * @returns a new sky material
387
395
  */
388
- Vertex_Before_PositionUpdated: string;
396
+ static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial;
397
+ }
398
+
399
+
400
+ /** @internal */
401
+ export var skyVertexShader: {
402
+ name: string;
403
+ shader: string;
404
+ };
405
+
406
+
407
+ /** @internal */
408
+ export var skyPixelShader: {
409
+ name: string;
410
+ shader: string;
411
+ };
412
+
413
+
414
+
415
+
416
+ export class SimpleMaterial extends PushMaterial {
417
+ private _diffuseTexture;
418
+ diffuseTexture: BaseTexture;
419
+ diffuseColor: Color3;
420
+ private _disableLighting;
421
+ disableLighting: boolean;
422
+ private _maxSimultaneousLights;
423
+ maxSimultaneousLights: number;
424
+ constructor(name: string, scene?: Scene);
425
+ needAlphaBlending(): boolean;
426
+ needAlphaTesting(): boolean;
427
+ getAlphaTestTexture(): Nullable<BaseTexture>;
428
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
429
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
430
+ getAnimatables(): IAnimatable[];
431
+ getActiveTextures(): BaseTexture[];
432
+ hasTexture(texture: BaseTexture): boolean;
433
+ dispose(forceDisposeEffect?: boolean): void;
434
+ clone(name: string): SimpleMaterial;
435
+ serialize(): any;
436
+ getClassName(): string;
437
+ static Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial;
438
+ }
439
+
440
+
441
+ /** @internal */
442
+ export var simpleVertexShader: {
443
+ name: string;
444
+ shader: string;
445
+ };
446
+
447
+
448
+ /** @internal */
449
+ export var simplePixelShader: {
450
+ name: string;
451
+ shader: string;
452
+ };
453
+
454
+
455
+
456
+
457
+ export class ShadowOnlyMaterial extends PushMaterial {
458
+ private _activeLight;
459
+ private _needAlphaBlending;
460
+ constructor(name: string, scene?: Scene);
461
+ shadowColor: Color3;
462
+ needAlphaBlending(): boolean;
463
+ needAlphaTesting(): boolean;
464
+ getAlphaTestTexture(): Nullable<BaseTexture>;
465
+ get activeLight(): IShadowLight;
466
+ set activeLight(light: IShadowLight);
467
+ private _getFirstShadowLightForMesh;
468
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
469
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
470
+ clone(name: string): ShadowOnlyMaterial;
471
+ serialize(): any;
472
+ getClassName(): string;
473
+ static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial;
474
+ }
475
+
476
+
477
+ /** @internal */
478
+ export var shadowOnlyVertexShader: {
479
+ name: string;
480
+ shader: string;
481
+ };
482
+
483
+
484
+ /** @internal */
485
+ export var shadowOnlyPixelShader: {
486
+ name: string;
487
+ shader: string;
488
+ };
489
+
490
+
491
+
492
+
493
+ export class NormalMaterial extends PushMaterial {
494
+ private _diffuseTexture;
495
+ diffuseTexture: BaseTexture;
496
+ diffuseColor: Color3;
497
+ private _disableLighting;
498
+ disableLighting: boolean;
499
+ private _maxSimultaneousLights;
500
+ maxSimultaneousLights: number;
501
+ constructor(name: string, scene?: Scene);
502
+ needAlphaBlending(): boolean;
503
+ needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
504
+ needAlphaTesting(): boolean;
505
+ getAlphaTestTexture(): Nullable<BaseTexture>;
506
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
507
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
508
+ getAnimatables(): IAnimatable[];
509
+ getActiveTextures(): BaseTexture[];
510
+ hasTexture(texture: BaseTexture): boolean;
511
+ dispose(forceDisposeEffect?: boolean): void;
512
+ clone(name: string): NormalMaterial;
513
+ serialize(): any;
514
+ getClassName(): string;
515
+ static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial;
516
+ }
517
+
518
+
519
+ /** @internal */
520
+ export var normalVertexShader: {
521
+ name: string;
522
+ shader: string;
523
+ };
524
+
525
+
526
+ /** @internal */
527
+ export var normalPixelShader: {
528
+ name: string;
529
+ shader: string;
530
+ };
531
+
532
+
533
+
534
+
535
+ export class MixMaterial extends PushMaterial {
389
536
  /**
390
- * Vertex before normal updated
537
+ * Mix textures
391
538
  */
392
- Vertex_Before_NormalUpdated: string;
539
+ private _mixTexture1;
540
+ mixTexture1: BaseTexture;
541
+ private _mixTexture2;
542
+ mixTexture2: BaseTexture;
393
543
  /**
394
- * Vertex after world pos computed
544
+ * Diffuse textures
395
545
  */
396
- Vertex_After_WorldPosComputed: string;
546
+ private _diffuseTexture1;
547
+ diffuseTexture1: Texture;
548
+ private _diffuseTexture2;
549
+ diffuseTexture2: Texture;
550
+ private _diffuseTexture3;
551
+ diffuseTexture3: Texture;
552
+ private _diffuseTexture4;
553
+ diffuseTexture4: Texture;
554
+ private _diffuseTexture5;
555
+ diffuseTexture5: Texture;
556
+ private _diffuseTexture6;
557
+ diffuseTexture6: Texture;
558
+ private _diffuseTexture7;
559
+ diffuseTexture7: Texture;
560
+ private _diffuseTexture8;
561
+ diffuseTexture8: Texture;
397
562
  /**
398
- * Vertex main end
563
+ * Uniforms
399
564
  */
400
- Vertex_MainEnd: string;
401
- }
402
- /**
403
- * @deprecated use ShaderAlbedoParts instead.
404
- */
405
- export var ShaderAlebdoParts: typeof ShaderAlbedoParts;
406
- export class PBRCustomMaterial extends PBRMaterial {
407
- /**
408
- * Index for each created shader
409
- */
410
- static ShaderIndexer: number;
411
- /**
412
- * Custom shader structure
413
- */
414
- CustomParts: ShaderAlbedoParts;
415
- /**
416
- * Name of the shader
417
- */
418
- _createdShaderName: string;
419
- /**
420
- * List of custom uniforms
421
- */
422
- _customUniform: string[];
423
- /**
424
- * Names of the new uniforms
425
- */
426
- _newUniforms: string[];
427
- /**
428
- * Instances of the new uniform objects
429
- */
430
- _newUniformInstances: {
431
- [name: string]: any;
432
- };
433
- /**
434
- * Instances of the new sampler objects
435
- */
436
- _newSamplerInstances: {
437
- [name: string]: Texture;
438
- };
439
- /**
440
- * List of the custom attributes
441
- */
442
- _customAttributes: string[];
443
- /**
444
- * Fragment shader string
445
- */
446
- FragmentShader: string;
447
- /**
448
- * Vertex shader string
449
- */
450
- VertexShader: string;
451
- /**
452
- * Runs after the material is bound to a mesh
453
- * @param mesh mesh bound
454
- * @param effect bound effect used to render
455
- */
456
- AttachAfterBind(mesh: Mesh | undefined, effect: Effect): void;
457
- /**
458
- * @internal
459
- */
460
- ReviewUniform(name: string, arr: string[]): string[];
461
- /**
462
- * Builds the material
463
- * @param shaderName name of the shader
464
- * @param uniforms list of uniforms
465
- * @param uniformBuffers list of uniform buffers
466
- * @param samplers list of samplers
467
- * @param defines list of defines
468
- * @param attributes list of attributes
469
- * @param options options to compile the shader
470
- * @returns the shader name
471
- */
472
- Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[], options?: ICustomShaderNameResolveOptions): string;
473
- protected _injectCustomCode(code: string, shaderType: string): string;
474
- protected _getCustomCode(shaderType: string): {
475
- [pointName: string]: string;
476
- };
565
+ diffuseColor: Color3;
566
+ specularColor: Color3;
567
+ specularPower: number;
568
+ private _disableLighting;
569
+ disableLighting: boolean;
570
+ private _maxSimultaneousLights;
571
+ maxSimultaneousLights: number;
477
572
  constructor(name: string, scene?: Scene);
478
- protected _afterBind(mesh?: Mesh, effect?: Nullable<Effect>, subMesh?: SubMesh): void;
479
- /**
480
- * Adds a new uniform to the shader
481
- * @param name the name of the uniform to add
482
- * @param kind the type of the uniform to add
483
- * @param param the value of the uniform to add
484
- * @returns the current material
485
- */
486
- AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
487
- /**
488
- * Adds a custom attribute
489
- * @param name the name of the attribute
490
- * @returns the current material
491
- */
492
- AddAttribute(name: string): PBRCustomMaterial;
493
- /**
494
- * Sets the code on Fragment_Begin portion
495
- * @param shaderPart the code string
496
- * @returns the current material
497
- */
498
- Fragment_Begin(shaderPart: string): PBRCustomMaterial;
499
- /**
500
- * Sets the code on Fragment_Definitions portion
501
- * @param shaderPart the code string
502
- * @returns the current material
503
- */
504
- Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
505
- /**
506
- * Sets the code on Fragment_MainBegin portion
507
- * @param shaderPart the code string
508
- * @returns the current material
509
- */
510
- Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
511
- /**
512
- * Sets the code on Fragment_Custom_Albedo portion
513
- * @param shaderPart the code string
514
- * @returns the current material
515
- */
516
- Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
517
- /**
518
- * Sets the code on Fragment_Custom_Alpha portion
519
- * @param shaderPart the code string
520
- * @returns the current material
521
- */
522
- Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
523
- /**
524
- * Sets the code on Fragment_Before_Lights portion
525
- * @param shaderPart the code string
526
- * @returns the current material
527
- */
528
- Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
529
- /**
530
- * Sets the code on Fragment_Custom_MetallicRoughness portion
531
- * @param shaderPart the code string
532
- * @returns the current material
533
- */
534
- Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial;
535
- /**
536
- * Sets the code on Fragment_Custom_MicroSurface portion
537
- * @param shaderPart the code string
538
- * @returns the current material
539
- */
540
- Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial;
541
- /**
542
- * Sets the code on Fragment_Before_Fog portion
543
- * @param shaderPart the code string
544
- * @returns the current material
545
- */
546
- Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
547
- /**
548
- * Sets the code on Fragment_Before_FinalColorComposition portion
549
- * @param shaderPart the code string
550
- * @returns the current material
551
- */
552
- Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial;
553
- /**
554
- * Sets the code on Fragment_Before_FragColor portion
555
- * @param shaderPart the code string
556
- * @returns the current material
557
- */
558
- Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
559
- /**
560
- * Sets the code on Fragment_MainEnd portion
561
- * @param shaderPart the code string
562
- * @returns the current material
563
- */
564
- Fragment_MainEnd(shaderPart: string): PBRCustomMaterial;
565
- /**
566
- * Sets the code on Vertex_Begin portion
567
- * @param shaderPart the code string
568
- * @returns the current material
569
- */
570
- Vertex_Begin(shaderPart: string): PBRCustomMaterial;
571
- /**
572
- * Sets the code on Vertex_Definitions portion
573
- * @param shaderPart the code string
574
- * @returns the current material
575
- */
576
- Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
577
- /**
578
- * Sets the code on Vertex_MainBegin portion
579
- * @param shaderPart the code string
580
- * @returns the current material
581
- */
582
- Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
583
- /**
584
- * Sets the code on Vertex_Before_PositionUpdated portion
585
- * @param shaderPart the code string
586
- * @returns the current material
587
- */
588
- Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
589
- /**
590
- * Sets the code on Vertex_Before_NormalUpdated portion
591
- * @param shaderPart the code string
592
- * @returns the current material
593
- */
594
- Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
595
- /**
596
- * Sets the code on Vertex_After_WorldPosComputed portion
597
- * @param shaderPart the code string
598
- * @returns the current material
599
- */
600
- Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial;
601
- /**
602
- * Sets the code on Vertex_MainEnd portion
603
- * @param shaderPart the code string
604
- * @returns the current material
605
- */
606
- Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
573
+ needAlphaBlending(): boolean;
574
+ needAlphaTesting(): boolean;
575
+ getAlphaTestTexture(): Nullable<BaseTexture>;
576
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
577
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
578
+ getAnimatables(): IAnimatable[];
579
+ getActiveTextures(): BaseTexture[];
580
+ hasTexture(texture: BaseTexture): boolean;
581
+ dispose(forceDisposeEffect?: boolean): void;
582
+ clone(name: string): MixMaterial;
583
+ serialize(): any;
584
+ getClassName(): string;
585
+ static Parse(source: any, scene: Scene, rootUrl: string): MixMaterial;
607
586
  }
608
587
 
609
588
 
610
589
  /** @internal */
611
- export var firePixelShader: {
590
+ export var mixVertexShader: {
612
591
  name: string;
613
592
  shader: string;
614
593
  };
615
594
 
616
595
 
617
596
  /** @internal */
618
- export var fireVertexShader: {
597
+ export var mixPixelShader: {
619
598
  name: string;
620
599
  shader: string;
621
600
  };
622
601
 
623
602
 
624
- export class FireMaterial extends PushMaterial {
603
+
604
+
605
+ export class LavaMaterial extends PushMaterial {
625
606
  private _diffuseTexture;
626
- diffuseTexture: Nullable<BaseTexture>;
627
- private _distortionTexture;
628
- distortionTexture: Nullable<BaseTexture>;
629
- private _opacityTexture;
630
- opacityTexture: Nullable<BaseTexture>;
631
- diffuseColor: Color3;
607
+ diffuseTexture: BaseTexture;
608
+ noiseTexture: BaseTexture;
609
+ fogColor: Color3;
632
610
  speed: number;
633
- private _scaledDiffuse;
611
+ movingSpeed: number;
612
+ lowFrequencySpeed: number;
613
+ fogDensity: number;
634
614
  private _lastTime;
615
+ diffuseColor: Color3;
616
+ private _disableLighting;
617
+ disableLighting: boolean;
618
+ private _unlit;
619
+ unlit: boolean;
620
+ private _maxSimultaneousLights;
621
+ maxSimultaneousLights: number;
622
+ private _scaledDiffuse;
635
623
  constructor(name: string, scene?: Scene);
636
624
  needAlphaBlending(): boolean;
637
625
  needAlphaTesting(): boolean;
@@ -641,132 +629,30 @@ declare module BABYLON {
641
629
  getAnimatables(): IAnimatable[];
642
630
  getActiveTextures(): BaseTexture[];
643
631
  hasTexture(texture: BaseTexture): boolean;
644
- getClassName(): string;
645
632
  dispose(forceDisposeEffect?: boolean): void;
646
- clone(name: string): FireMaterial;
633
+ clone(name: string): LavaMaterial;
647
634
  serialize(): any;
648
- static Parse(source: any, scene: Scene, rootUrl: string): FireMaterial;
635
+ getClassName(): string;
636
+ static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial;
649
637
  }
650
638
 
651
639
 
652
-
653
-
654
640
  /** @internal */
655
- export var furPixelShader: {
641
+ export var lavaVertexShader: {
656
642
  name: string;
657
643
  shader: string;
658
644
  };
659
645
 
660
646
 
661
647
  /** @internal */
662
- export var furVertexShader: {
663
- name: string;
664
- shader: string;
665
- };
666
-
667
-
668
- export class FurMaterial extends PushMaterial {
669
- private _diffuseTexture;
670
- diffuseTexture: BaseTexture;
671
- private _heightTexture;
672
- heightTexture: BaseTexture;
673
- diffuseColor: Color3;
674
- furLength: number;
675
- furAngle: number;
676
- furColor: Color3;
677
- furOffset: number;
678
- furSpacing: number;
679
- furGravity: Vector3;
680
- furSpeed: number;
681
- furDensity: number;
682
- furOcclusion: number;
683
- furTexture: DynamicTexture;
684
- private _disableLighting;
685
- disableLighting: boolean;
686
- private _maxSimultaneousLights;
687
- maxSimultaneousLights: number;
688
- highLevelFur: boolean;
689
- _meshes: AbstractMesh[];
690
- private _furTime;
691
- constructor(name: string, scene?: Scene);
692
- get furTime(): number;
693
- set furTime(furTime: number);
694
- needAlphaBlending(): boolean;
695
- needAlphaTesting(): boolean;
696
- getAlphaTestTexture(): Nullable<BaseTexture>;
697
- updateFur(): void;
698
- isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
699
- bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
700
- getAnimatables(): IAnimatable[];
701
- getActiveTextures(): BaseTexture[];
702
- hasTexture(texture: BaseTexture): boolean;
703
- dispose(forceDisposeEffect?: boolean): void;
704
- clone(name: string): FurMaterial;
705
- serialize(): any;
706
- getClassName(): string;
707
- static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial;
708
- static GenerateTexture(name: string, scene: Scene): DynamicTexture;
709
- static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[];
710
- }
711
-
712
-
713
-
714
-
715
- /** @internal */
716
- export var gradientPixelShader: {
717
- name: string;
718
- shader: string;
719
- };
720
-
721
-
722
- /** @internal */
723
- export var gradientVertexShader: {
648
+ export var lavaPixelShader: {
724
649
  name: string;
725
650
  shader: string;
726
651
  };
727
652
 
728
653
 
729
- export class GradientMaterial extends PushMaterial {
730
- private _maxSimultaneousLights;
731
- maxSimultaneousLights: number;
732
- topColor: Color3;
733
- topColorAlpha: number;
734
- bottomColor: Color3;
735
- bottomColorAlpha: number;
736
- offset: number;
737
- scale: number;
738
- smoothness: number;
739
- private _disableLighting;
740
- disableLighting: boolean;
741
- constructor(name: string, scene?: Scene);
742
- needAlphaBlending(): boolean;
743
- needAlphaTesting(): boolean;
744
- getAlphaTestTexture(): Nullable<BaseTexture>;
745
- isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
746
- bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
747
- getAnimatables(): IAnimatable[];
748
- dispose(forceDisposeEffect?: boolean): void;
749
- clone(name: string): GradientMaterial;
750
- serialize(): any;
751
- getClassName(): string;
752
- static Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial;
753
- }
754
-
755
-
756
-
757
-
758
- /** @internal */
759
- export var gridPixelShader: {
760
- name: string;
761
- shader: string;
762
- };
763
654
 
764
655
 
765
- /** @internal */
766
- export var gridVertexShader: {
767
- name: string;
768
- shader: string;
769
- };
770
656
 
771
657
 
772
658
  /**
@@ -845,44 +731,34 @@ declare module BABYLON {
845
731
  }
846
732
 
847
733
 
848
-
849
-
850
-
851
-
852
-
853
-
854
734
  /** @internal */
855
- export var lavaPixelShader: {
735
+ export var gridVertexShader: {
856
736
  name: string;
857
737
  shader: string;
858
738
  };
859
739
 
860
740
 
861
741
  /** @internal */
862
- export var lavaVertexShader: {
742
+ export var gridPixelShader: {
863
743
  name: string;
864
744
  shader: string;
865
745
  };
866
746
 
867
747
 
868
- export class LavaMaterial extends PushMaterial {
869
- private _diffuseTexture;
870
- diffuseTexture: BaseTexture;
871
- noiseTexture: BaseTexture;
872
- fogColor: Color3;
873
- speed: number;
874
- movingSpeed: number;
875
- lowFrequencySpeed: number;
876
- fogDensity: number;
877
- private _lastTime;
878
- diffuseColor: Color3;
879
- private _disableLighting;
880
- disableLighting: boolean;
881
- private _unlit;
882
- unlit: boolean;
748
+
749
+
750
+ export class GradientMaterial extends PushMaterial {
883
751
  private _maxSimultaneousLights;
884
752
  maxSimultaneousLights: number;
885
- private _scaledDiffuse;
753
+ topColor: Color3;
754
+ topColorAlpha: number;
755
+ bottomColor: Color3;
756
+ bottomColorAlpha: number;
757
+ offset: number;
758
+ scale: number;
759
+ smoothness: number;
760
+ private _disableLighting;
761
+ disableLighting: boolean;
886
762
  constructor(name: string, scene?: Scene);
887
763
  needAlphaBlending(): boolean;
888
764
  needAlphaTesting(): boolean;
@@ -890,113 +766,104 @@ declare module BABYLON {
890
766
  isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
891
767
  bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
892
768
  getAnimatables(): IAnimatable[];
893
- getActiveTextures(): BaseTexture[];
894
- hasTexture(texture: BaseTexture): boolean;
895
769
  dispose(forceDisposeEffect?: boolean): void;
896
- clone(name: string): LavaMaterial;
770
+ clone(name: string): GradientMaterial;
897
771
  serialize(): any;
898
772
  getClassName(): string;
899
- static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial;
773
+ static Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial;
900
774
  }
901
775
 
902
776
 
903
-
904
-
905
777
  /** @internal */
906
- export var mixPixelShader: {
778
+ export var gradientVertexShader: {
907
779
  name: string;
908
780
  shader: string;
909
781
  };
910
782
 
911
783
 
912
784
  /** @internal */
913
- export var mixVertexShader: {
785
+ export var gradientPixelShader: {
914
786
  name: string;
915
787
  shader: string;
916
788
  };
917
789
 
918
790
 
919
- export class MixMaterial extends PushMaterial {
920
- /**
921
- * Mix textures
922
- */
923
- private _mixTexture1;
924
- mixTexture1: BaseTexture;
925
- private _mixTexture2;
926
- mixTexture2: BaseTexture;
927
- /**
928
- * Diffuse textures
929
- */
930
- private _diffuseTexture1;
931
- diffuseTexture1: Texture;
932
- private _diffuseTexture2;
933
- diffuseTexture2: Texture;
934
- private _diffuseTexture3;
935
- diffuseTexture3: Texture;
936
- private _diffuseTexture4;
937
- diffuseTexture4: Texture;
938
- private _diffuseTexture5;
939
- diffuseTexture5: Texture;
940
- private _diffuseTexture6;
941
- diffuseTexture6: Texture;
942
- private _diffuseTexture7;
943
- diffuseTexture7: Texture;
944
- private _diffuseTexture8;
945
- diffuseTexture8: Texture;
946
- /**
947
- * Uniforms
948
- */
791
+
792
+
793
+ export class FurMaterial extends PushMaterial {
794
+ private _diffuseTexture;
795
+ diffuseTexture: BaseTexture;
796
+ private _heightTexture;
797
+ heightTexture: BaseTexture;
949
798
  diffuseColor: Color3;
950
- specularColor: Color3;
951
- specularPower: number;
799
+ furLength: number;
800
+ furAngle: number;
801
+ furColor: Color3;
802
+ furOffset: number;
803
+ furSpacing: number;
804
+ furGravity: Vector3;
805
+ furSpeed: number;
806
+ furDensity: number;
807
+ furOcclusion: number;
808
+ furTexture: DynamicTexture;
952
809
  private _disableLighting;
953
810
  disableLighting: boolean;
954
811
  private _maxSimultaneousLights;
955
812
  maxSimultaneousLights: number;
813
+ highLevelFur: boolean;
814
+ _meshes: AbstractMesh[];
815
+ private _furTime;
956
816
  constructor(name: string, scene?: Scene);
817
+ get furTime(): number;
818
+ set furTime(furTime: number);
957
819
  needAlphaBlending(): boolean;
958
820
  needAlphaTesting(): boolean;
959
821
  getAlphaTestTexture(): Nullable<BaseTexture>;
822
+ updateFur(): void;
960
823
  isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
961
824
  bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
962
825
  getAnimatables(): IAnimatable[];
963
826
  getActiveTextures(): BaseTexture[];
964
827
  hasTexture(texture: BaseTexture): boolean;
965
828
  dispose(forceDisposeEffect?: boolean): void;
966
- clone(name: string): MixMaterial;
829
+ clone(name: string): FurMaterial;
967
830
  serialize(): any;
968
831
  getClassName(): string;
969
- static Parse(source: any, scene: Scene, rootUrl: string): MixMaterial;
832
+ static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial;
833
+ static GenerateTexture(name: string, scene: Scene): DynamicTexture;
834
+ static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[];
970
835
  }
971
836
 
972
837
 
973
-
974
-
975
838
  /** @internal */
976
- export var normalPixelShader: {
839
+ export var furVertexShader: {
977
840
  name: string;
978
841
  shader: string;
979
842
  };
980
843
 
981
844
 
982
845
  /** @internal */
983
- export var normalVertexShader: {
846
+ export var furPixelShader: {
984
847
  name: string;
985
848
  shader: string;
986
849
  };
987
850
 
988
851
 
989
- export class NormalMaterial extends PushMaterial {
852
+
853
+
854
+ export class FireMaterial extends PushMaterial {
990
855
  private _diffuseTexture;
991
- diffuseTexture: BaseTexture;
856
+ diffuseTexture: Nullable<BaseTexture>;
857
+ private _distortionTexture;
858
+ distortionTexture: Nullable<BaseTexture>;
859
+ private _opacityTexture;
860
+ opacityTexture: Nullable<BaseTexture>;
992
861
  diffuseColor: Color3;
993
- private _disableLighting;
994
- disableLighting: boolean;
995
- private _maxSimultaneousLights;
996
- maxSimultaneousLights: number;
862
+ speed: number;
863
+ private _scaledDiffuse;
864
+ private _lastTime;
997
865
  constructor(name: string, scene?: Scene);
998
866
  needAlphaBlending(): boolean;
999
- needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
1000
867
  needAlphaTesting(): boolean;
1001
868
  getAlphaTestTexture(): Nullable<BaseTexture>;
1002
869
  isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
@@ -1004,502 +871,635 @@ declare module BABYLON {
1004
871
  getAnimatables(): IAnimatable[];
1005
872
  getActiveTextures(): BaseTexture[];
1006
873
  hasTexture(texture: BaseTexture): boolean;
874
+ getClassName(): string;
1007
875
  dispose(forceDisposeEffect?: boolean): void;
1008
- clone(name: string): NormalMaterial;
876
+ clone(name: string): FireMaterial;
1009
877
  serialize(): any;
1010
- getClassName(): string;
1011
- static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial;
878
+ static Parse(source: any, scene: Scene, rootUrl: string): FireMaterial;
1012
879
  }
1013
880
 
1014
881
 
1015
-
1016
-
1017
882
  /** @internal */
1018
- export var shadowOnlyPixelShader: {
883
+ export var fireVertexShader: {
1019
884
  name: string;
1020
885
  shader: string;
1021
886
  };
1022
887
 
1023
888
 
1024
889
  /** @internal */
1025
- export var shadowOnlyVertexShader: {
890
+ export var firePixelShader: {
1026
891
  name: string;
1027
892
  shader: string;
1028
893
  };
1029
894
 
1030
895
 
1031
- export class ShadowOnlyMaterial extends PushMaterial {
1032
- private _activeLight;
1033
- private _needAlphaBlending;
1034
- constructor(name: string, scene?: Scene);
1035
- shadowColor: Color3;
1036
- needAlphaBlending(): boolean;
1037
- needAlphaTesting(): boolean;
1038
- getAlphaTestTexture(): Nullable<BaseTexture>;
1039
- get activeLight(): IShadowLight;
1040
- set activeLight(light: IShadowLight);
1041
- private _getFirstShadowLightForMesh;
1042
- isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
1043
- bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
1044
- clone(name: string): ShadowOnlyMaterial;
1045
- serialize(): any;
1046
- getClassName(): string;
1047
- static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial;
896
+ /**
897
+ * Albedo parts of the shader
898
+ */
899
+ export class ShaderAlbedoParts {
900
+ constructor();
901
+ /**
902
+ * Beginning of the fragment shader
903
+ */
904
+ Fragment_Begin: string;
905
+ /**
906
+ * Fragment definitions
907
+ */
908
+ Fragment_Definitions: string;
909
+ /**
910
+ * Beginning of the main function
911
+ */
912
+ Fragment_MainBegin: string;
913
+ /**
914
+ * End of main function
915
+ */
916
+ Fragment_MainEnd: string;
917
+ /**
918
+ * Albedo color
919
+ */
920
+ Fragment_Custom_Albedo: string;
921
+ /**
922
+ * Lights
923
+ */
924
+ Fragment_Before_Lights: string;
925
+ /**
926
+ * Metallic and roughness
927
+ */
928
+ Fragment_Custom_MetallicRoughness: string;
929
+ /**
930
+ * Microsurface
931
+ */
932
+ Fragment_Custom_MicroSurface: string;
933
+ /**
934
+ * Fog computations
935
+ */
936
+ Fragment_Before_Fog: string;
937
+ /**
938
+ * Alpha
939
+ */
940
+ Fragment_Custom_Alpha: string;
941
+ /**
942
+ * Color composition
943
+ */
944
+ Fragment_Before_FinalColorComposition: string;
945
+ /**
946
+ * Fragment color
947
+ */
948
+ Fragment_Before_FragColor: string;
949
+ /**
950
+ * Beginning of vertex shader
951
+ */
952
+ Vertex_Begin: string;
953
+ /**
954
+ * Vertex definitions
955
+ */
956
+ Vertex_Definitions: string;
957
+ /**
958
+ * Vertex main begin
959
+ */
960
+ Vertex_MainBegin: string;
961
+ /**
962
+ * Vertex before position updated
963
+ */
964
+ Vertex_Before_PositionUpdated: string;
965
+ /**
966
+ * Vertex before normal updated
967
+ */
968
+ Vertex_Before_NormalUpdated: string;
969
+ /**
970
+ * Vertex after world pos computed
971
+ */
972
+ Vertex_After_WorldPosComputed: string;
973
+ /**
974
+ * Vertex main end
975
+ */
976
+ Vertex_MainEnd: string;
1048
977
  }
1049
-
1050
-
1051
-
1052
-
1053
- /** @internal */
1054
- export var simplePixelShader: {
1055
- name: string;
1056
- shader: string;
1057
- };
1058
-
1059
-
1060
- /** @internal */
1061
- export var simpleVertexShader: {
1062
- name: string;
1063
- shader: string;
1064
- };
1065
-
1066
-
1067
- export class SimpleMaterial extends PushMaterial {
1068
- private _diffuseTexture;
1069
- diffuseTexture: BaseTexture;
1070
- diffuseColor: Color3;
1071
- private _disableLighting;
1072
- disableLighting: boolean;
1073
- private _maxSimultaneousLights;
1074
- maxSimultaneousLights: number;
978
+ /**
979
+ * @deprecated use ShaderAlbedoParts instead.
980
+ */
981
+ export var ShaderAlebdoParts: typeof ShaderAlbedoParts;
982
+ export class PBRCustomMaterial extends PBRMaterial {
983
+ /**
984
+ * Index for each created shader
985
+ */
986
+ static ShaderIndexer: number;
987
+ /**
988
+ * Custom shader structure
989
+ */
990
+ CustomParts: ShaderAlbedoParts;
991
+ /**
992
+ * Name of the shader
993
+ */
994
+ _createdShaderName: string;
995
+ /**
996
+ * List of custom uniforms
997
+ */
998
+ _customUniform: string[];
999
+ /**
1000
+ * Names of the new uniforms
1001
+ */
1002
+ _newUniforms: string[];
1003
+ /**
1004
+ * Instances of the new uniform objects
1005
+ */
1006
+ _newUniformInstances: {
1007
+ [name: string]: any;
1008
+ };
1009
+ /**
1010
+ * Instances of the new sampler objects
1011
+ */
1012
+ _newSamplerInstances: {
1013
+ [name: string]: Texture;
1014
+ };
1015
+ /**
1016
+ * List of the custom attributes
1017
+ */
1018
+ _customAttributes: string[];
1019
+ /**
1020
+ * Fragment shader string
1021
+ */
1022
+ FragmentShader: string;
1023
+ /**
1024
+ * Vertex shader string
1025
+ */
1026
+ VertexShader: string;
1027
+ /**
1028
+ * Runs after the material is bound to a mesh
1029
+ * @param mesh mesh bound
1030
+ * @param effect bound effect used to render
1031
+ */
1032
+ AttachAfterBind(mesh: Mesh | undefined, effect: Effect): void;
1033
+ /**
1034
+ * @internal
1035
+ */
1036
+ ReviewUniform(name: string, arr: string[]): string[];
1037
+ /**
1038
+ * Builds the material
1039
+ * @param shaderName name of the shader
1040
+ * @param uniforms list of uniforms
1041
+ * @param uniformBuffers list of uniform buffers
1042
+ * @param samplers list of samplers
1043
+ * @param defines list of defines
1044
+ * @param attributes list of attributes
1045
+ * @param options options to compile the shader
1046
+ * @returns the shader name
1047
+ */
1048
+ Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[], options?: ICustomShaderNameResolveOptions): string;
1049
+ protected _injectCustomCode(code: string, shaderType: string): string;
1050
+ protected _getCustomCode(shaderType: string): {
1051
+ [pointName: string]: string;
1052
+ };
1075
1053
  constructor(name: string, scene?: Scene);
1076
- needAlphaBlending(): boolean;
1077
- needAlphaTesting(): boolean;
1078
- getAlphaTestTexture(): Nullable<BaseTexture>;
1079
- isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
1080
- bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
1081
- getAnimatables(): IAnimatable[];
1082
- getActiveTextures(): BaseTexture[];
1083
- hasTexture(texture: BaseTexture): boolean;
1084
- dispose(forceDisposeEffect?: boolean): void;
1085
- clone(name: string): SimpleMaterial;
1086
- serialize(): any;
1087
- getClassName(): string;
1088
- static Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial;
1089
- }
1090
-
1091
-
1092
-
1093
-
1094
- /** @internal */
1095
- export var skyPixelShader: {
1096
- name: string;
1097
- shader: string;
1098
- };
1054
+ protected _afterBind(mesh?: Mesh, effect?: Nullable<Effect>, subMesh?: SubMesh): void;
1055
+ /**
1056
+ * Adds a new uniform to the shader
1057
+ * @param name the name of the uniform to add
1058
+ * @param kind the type of the uniform to add
1059
+ * @param param the value of the uniform to add
1060
+ * @returns the current material
1061
+ */
1062
+ AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
1063
+ /**
1064
+ * Adds a custom attribute
1065
+ * @param name the name of the attribute
1066
+ * @returns the current material
1067
+ */
1068
+ AddAttribute(name: string): PBRCustomMaterial;
1069
+ /**
1070
+ * Sets the code on Fragment_Begin portion
1071
+ * @param shaderPart the code string
1072
+ * @returns the current material
1073
+ */
1074
+ Fragment_Begin(shaderPart: string): PBRCustomMaterial;
1075
+ /**
1076
+ * Sets the code on Fragment_Definitions portion
1077
+ * @param shaderPart the code string
1078
+ * @returns the current material
1079
+ */
1080
+ Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
1081
+ /**
1082
+ * Sets the code on Fragment_MainBegin portion
1083
+ * @param shaderPart the code string
1084
+ * @returns the current material
1085
+ */
1086
+ Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
1087
+ /**
1088
+ * Sets the code on Fragment_Custom_Albedo portion
1089
+ * @param shaderPart the code string
1090
+ * @returns the current material
1091
+ */
1092
+ Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
1093
+ /**
1094
+ * Sets the code on Fragment_Custom_Alpha portion
1095
+ * @param shaderPart the code string
1096
+ * @returns the current material
1097
+ */
1098
+ Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
1099
+ /**
1100
+ * Sets the code on Fragment_Before_Lights portion
1101
+ * @param shaderPart the code string
1102
+ * @returns the current material
1103
+ */
1104
+ Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
1105
+ /**
1106
+ * Sets the code on Fragment_Custom_MetallicRoughness portion
1107
+ * @param shaderPart the code string
1108
+ * @returns the current material
1109
+ */
1110
+ Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial;
1111
+ /**
1112
+ * Sets the code on Fragment_Custom_MicroSurface portion
1113
+ * @param shaderPart the code string
1114
+ * @returns the current material
1115
+ */
1116
+ Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial;
1117
+ /**
1118
+ * Sets the code on Fragment_Before_Fog portion
1119
+ * @param shaderPart the code string
1120
+ * @returns the current material
1121
+ */
1122
+ Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
1123
+ /**
1124
+ * Sets the code on Fragment_Before_FinalColorComposition portion
1125
+ * @param shaderPart the code string
1126
+ * @returns the current material
1127
+ */
1128
+ Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial;
1129
+ /**
1130
+ * Sets the code on Fragment_Before_FragColor portion
1131
+ * @param shaderPart the code string
1132
+ * @returns the current material
1133
+ */
1134
+ Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
1135
+ /**
1136
+ * Sets the code on Fragment_MainEnd portion
1137
+ * @param shaderPart the code string
1138
+ * @returns the current material
1139
+ */
1140
+ Fragment_MainEnd(shaderPart: string): PBRCustomMaterial;
1141
+ /**
1142
+ * Sets the code on Vertex_Begin portion
1143
+ * @param shaderPart the code string
1144
+ * @returns the current material
1145
+ */
1146
+ Vertex_Begin(shaderPart: string): PBRCustomMaterial;
1147
+ /**
1148
+ * Sets the code on Vertex_Definitions portion
1149
+ * @param shaderPart the code string
1150
+ * @returns the current material
1151
+ */
1152
+ Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
1153
+ /**
1154
+ * Sets the code on Vertex_MainBegin portion
1155
+ * @param shaderPart the code string
1156
+ * @returns the current material
1157
+ */
1158
+ Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
1159
+ /**
1160
+ * Sets the code on Vertex_Before_PositionUpdated portion
1161
+ * @param shaderPart the code string
1162
+ * @returns the current material
1163
+ */
1164
+ Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
1165
+ /**
1166
+ * Sets the code on Vertex_Before_NormalUpdated portion
1167
+ * @param shaderPart the code string
1168
+ * @returns the current material
1169
+ */
1170
+ Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
1171
+ /**
1172
+ * Sets the code on Vertex_After_WorldPosComputed portion
1173
+ * @param shaderPart the code string
1174
+ * @returns the current material
1175
+ */
1176
+ Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial;
1177
+ /**
1178
+ * Sets the code on Vertex_MainEnd portion
1179
+ * @param shaderPart the code string
1180
+ * @returns the current material
1181
+ */
1182
+ Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
1183
+ }
1099
1184
 
1100
1185
 
1101
- /** @internal */
1102
- export var skyVertexShader: {
1103
- name: string;
1104
- shader: string;
1105
- };
1106
1186
 
1107
1187
 
1108
1188
  /**
1109
- * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
1110
- * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat
1189
+ * Structure of a custom shader
1111
1190
  */
1112
- export class SkyMaterial extends PushMaterial {
1191
+ export class CustomShaderStructure {
1113
1192
  /**
1114
- * Defines the overall luminance of sky in interval ]0, 1[.
1193
+ * Fragment store
1115
1194
  */
1116
- luminance: number;
1195
+ FragmentStore: string;
1117
1196
  /**
1118
- * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.
1197
+ * Vertex store
1119
1198
  */
1120
- turbidity: number;
1199
+ VertexStore: string;
1200
+ constructor();
1201
+ }
1202
+ /**
1203
+ * Parts of a shader
1204
+ */
1205
+ export class ShaderSpecialParts {
1206
+ constructor();
1121
1207
  /**
1122
- * Defines the sky appearance (light intensity).
1208
+ * Beginning of the fragment shader
1123
1209
  */
1124
- rayleigh: number;
1210
+ Fragment_Begin: string;
1125
1211
  /**
1126
- * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.
1212
+ * Variable definitions of the fragment shader
1127
1213
  */
1128
- mieCoefficient: number;
1214
+ Fragment_Definitions: string;
1129
1215
  /**
1130
- * Defines the amount of haze particles following the Mie scattering theory.
1216
+ * Beginning of the fragment main function
1131
1217
  */
1132
- mieDirectionalG: number;
1218
+ Fragment_MainBegin: string;
1133
1219
  /**
1134
- * Defines the distance of the sun according to the active scene camera.
1220
+ * End of the fragment main function
1135
1221
  */
1136
- distance: number;
1222
+ Fragment_MainEnd: string;
1137
1223
  /**
1138
- * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said
1139
- * "inclined".
1224
+ * Diffuse color calculation
1140
1225
  */
1141
- inclination: number;
1226
+ Fragment_Custom_Diffuse: string;
1142
1227
  /**
1143
- * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between
1144
- * an object direction and a reference direction.
1228
+ * Before lightning computations
1145
1229
  */
1146
- azimuth: number;
1230
+ Fragment_Before_Lights: string;
1147
1231
  /**
1148
- * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then
1149
- * the property is overridden by the inclination and the azimuth and can be read at any moment.
1232
+ * Before fog computations
1150
1233
  */
1151
- sunPosition: Vector3;
1234
+ Fragment_Before_Fog: string;
1152
1235
  /**
1153
- * Defines if the sun position should be computed (inclination and azimuth) according to the given
1154
- * .sunPosition property.
1236
+ * Alpha calculations
1155
1237
  */
1156
- useSunPosition: boolean;
1238
+ Fragment_Custom_Alpha: string;
1157
1239
  /**
1158
- * Defines an offset vector used to get a horizon offset.
1159
- * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis
1240
+ * Before frag color is assigned
1160
1241
  */
1161
- cameraOffset: Vector3;
1242
+ Fragment_Before_FragColor: string;
1162
1243
  /**
1163
- * Defines the vector the skyMaterial should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())
1244
+ * Beginning of the vertex shader
1164
1245
  */
1165
- up: Vector3;
1246
+ Vertex_Begin: string;
1166
1247
  /**
1167
- * Defines if sky should be dithered.
1248
+ * Variable definitions of the vertex shader
1168
1249
  */
1169
- dithering: boolean;
1170
- private _cameraPosition;
1171
- private _skyOrientation;
1250
+ Vertex_Definitions: string;
1172
1251
  /**
1173
- * Instantiates a new sky material.
1174
- * This material allows to create dynamic and texture free
1175
- * effects for skyboxes by taking care of the atmosphere state.
1176
- * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat
1177
- * @param name Define the name of the material in the scene
1178
- * @param scene Define the scene the material belong to
1252
+ * Start of the main function of the vertex shader
1179
1253
  */
1180
- constructor(name: string, scene?: Scene);
1254
+ Vertex_MainBegin: string;
1181
1255
  /**
1182
- * Specifies if the material will require alpha blending
1183
- * @returns a boolean specifying if alpha blending is needed
1256
+ * Before the world position computation
1184
1257
  */
1185
- needAlphaBlending(): boolean;
1258
+ Vertex_Before_PositionUpdated: string;
1186
1259
  /**
1187
- * Specifies if this material should be rendered in alpha test mode
1188
- * @returns false as the sky material doesn't need alpha testing.
1260
+ * Before the normal computation
1189
1261
  */
1190
- needAlphaTesting(): boolean;
1262
+ Vertex_Before_NormalUpdated: string;
1191
1263
  /**
1192
- * Get the texture used for alpha test purpose.
1193
- * @returns null as the sky material has no texture.
1264
+ * After the world position has been computed
1194
1265
  */
1195
- getAlphaTestTexture(): Nullable<BaseTexture>;
1266
+ Vertex_After_WorldPosComputed: string;
1196
1267
  /**
1197
- * Get if the submesh is ready to be used and all its information available.
1198
- * Child classes can use it to update shaders
1199
- * @param mesh defines the mesh to check
1200
- * @param subMesh defines which submesh to check
1201
- * @returns a boolean indicating that the submesh is ready or not
1268
+ * Main end of the vertex shader
1202
1269
  */
1203
- isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean;
1270
+ Vertex_MainEnd: string;
1271
+ }
1272
+ /**
1273
+ * Customized material
1274
+ */
1275
+ export class CustomMaterial extends StandardMaterial {
1204
1276
  /**
1205
- * Binds the submesh to this material by preparing the effect and shader to draw
1206
- * @param world defines the world transformation matrix
1207
- * @param mesh defines the mesh containing the submesh
1208
- * @param subMesh defines the submesh to bind the material to
1277
+ * Index for each created shader
1209
1278
  */
1210
- bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
1279
+ static ShaderIndexer: number;
1211
1280
  /**
1212
- * Get the list of animatables in the material.
1213
- * @returns the list of animatables object used in the material
1281
+ * Custom shader structure
1214
1282
  */
1215
- getAnimatables(): IAnimatable[];
1283
+ CustomParts: ShaderSpecialParts;
1216
1284
  /**
1217
- * Disposes the material
1218
- * @param forceDisposeEffect specifies if effects should be forcefully disposed
1285
+ * Name of the shader
1219
1286
  */
1220
- dispose(forceDisposeEffect?: boolean): void;
1287
+ _createdShaderName: string;
1221
1288
  /**
1222
- * Makes a duplicate of the material, and gives it a new name
1223
- * @param name defines the new name for the duplicated material
1224
- * @returns the cloned material
1289
+ * List of custom uniforms
1225
1290
  */
1226
- clone(name: string): SkyMaterial;
1291
+ _customUniform: string[];
1227
1292
  /**
1228
- * Serializes this material in a JSON representation
1229
- * @returns the serialized material object
1293
+ * Names of the new uniforms
1230
1294
  */
1231
- serialize(): any;
1295
+ _newUniforms: string[];
1232
1296
  /**
1233
- * Gets the current class name of the material e.g. "SkyMaterial"
1234
- * Mainly use in serialization.
1235
- * @returns the class name
1297
+ * Instances of the new uniform objects
1236
1298
  */
1237
- getClassName(): string;
1299
+ _newUniformInstances: {
1300
+ [name: string]: any;
1301
+ };
1238
1302
  /**
1239
- * Creates a sky material from parsed material data
1240
- * @param source defines the JSON representation of the material
1241
- * @param scene defines the hosting scene
1242
- * @param rootUrl defines the root URL to use to load textures and relative dependencies
1243
- * @returns a new sky material
1303
+ * Instances of the new sampler objects
1244
1304
  */
1245
- static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial;
1246
- }
1247
-
1248
-
1249
-
1250
-
1251
- /** @internal */
1252
- export var terrainPixelShader: {
1253
- name: string;
1254
- shader: string;
1255
- };
1256
-
1257
-
1258
- /** @internal */
1259
- export var terrainVertexShader: {
1260
- name: string;
1261
- shader: string;
1262
- };
1263
-
1264
-
1265
- export class TerrainMaterial extends PushMaterial {
1266
- private _mixTexture;
1267
- mixTexture: BaseTexture;
1268
- private _diffuseTexture1;
1269
- diffuseTexture1: Texture;
1270
- private _diffuseTexture2;
1271
- diffuseTexture2: Texture;
1272
- private _diffuseTexture3;
1273
- diffuseTexture3: Texture;
1274
- private _bumpTexture1;
1275
- bumpTexture1: Texture;
1276
- private _bumpTexture2;
1277
- bumpTexture2: Texture;
1278
- private _bumpTexture3;
1279
- bumpTexture3: Texture;
1280
- diffuseColor: Color3;
1281
- specularColor: Color3;
1282
- specularPower: number;
1283
- private _disableLighting;
1284
- disableLighting: boolean;
1285
- private _maxSimultaneousLights;
1286
- maxSimultaneousLights: number;
1287
- constructor(name: string, scene?: Scene);
1288
- needAlphaBlending(): boolean;
1289
- needAlphaTesting(): boolean;
1290
- getAlphaTestTexture(): Nullable<BaseTexture>;
1291
- isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
1292
- bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
1293
- getAnimatables(): IAnimatable[];
1294
- getActiveTextures(): BaseTexture[];
1295
- hasTexture(texture: BaseTexture): boolean;
1296
- dispose(forceDisposeEffect?: boolean): void;
1297
- clone(name: string): TerrainMaterial;
1298
- serialize(): any;
1299
- getClassName(): string;
1300
- static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial;
1301
- }
1302
-
1303
-
1304
-
1305
-
1306
- /** @internal */
1307
- export var triplanarPixelShader: {
1308
- name: string;
1309
- shader: string;
1310
- };
1311
-
1312
-
1313
- /** @internal */
1314
- export var triplanarVertexShader: {
1315
- name: string;
1316
- shader: string;
1317
- };
1318
-
1319
-
1320
- export class TriPlanarMaterial extends PushMaterial {
1321
- mixTexture: BaseTexture;
1322
- private _diffuseTextureX;
1323
- diffuseTextureX: BaseTexture;
1324
- private _diffuseTextureY;
1325
- diffuseTextureY: BaseTexture;
1326
- private _diffuseTextureZ;
1327
- diffuseTextureZ: BaseTexture;
1328
- private _normalTextureX;
1329
- normalTextureX: BaseTexture;
1330
- private _normalTextureY;
1331
- normalTextureY: BaseTexture;
1332
- private _normalTextureZ;
1333
- normalTextureZ: BaseTexture;
1334
- tileSize: number;
1335
- diffuseColor: Color3;
1336
- specularColor: Color3;
1337
- specularPower: number;
1338
- private _disableLighting;
1339
- disableLighting: boolean;
1340
- private _maxSimultaneousLights;
1341
- maxSimultaneousLights: number;
1305
+ _newSamplerInstances: {
1306
+ [name: string]: Texture;
1307
+ };
1308
+ /**
1309
+ * List of the custom attributes
1310
+ */
1311
+ _customAttributes: string[];
1312
+ /**
1313
+ * Fragment shader string
1314
+ */
1315
+ FragmentShader: string;
1316
+ /**
1317
+ * Vertex shader string
1318
+ */
1319
+ VertexShader: string;
1320
+ /**
1321
+ * Runs after the material is bound to a mesh
1322
+ * @param mesh mesh bound
1323
+ * @param effect bound effect used to render
1324
+ */
1325
+ AttachAfterBind(mesh: Mesh | undefined, effect: Effect): void;
1326
+ /**
1327
+ * @internal
1328
+ */
1329
+ ReviewUniform(name: string, arr: string[]): string[];
1330
+ /**
1331
+ * Builds the material
1332
+ * @param shaderName name of the shader
1333
+ * @param uniforms list of uniforms
1334
+ * @param uniformBuffers list of uniform buffers
1335
+ * @param samplers list of samplers
1336
+ * @param defines list of defines
1337
+ * @param attributes list of attributes
1338
+ * @returns the shader name
1339
+ */
1340
+ Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[]): string;
1341
+ protected _injectCustomCode(code: string, shaderType: string): string;
1342
+ protected _getCustomCode(shaderType: string): {
1343
+ [pointName: string]: string;
1344
+ };
1342
1345
  constructor(name: string, scene?: Scene);
1343
- needAlphaBlending(): boolean;
1344
- needAlphaTesting(): boolean;
1345
- getAlphaTestTexture(): Nullable<BaseTexture>;
1346
- isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
1347
- bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
1348
- getAnimatables(): IAnimatable[];
1349
- getActiveTextures(): BaseTexture[];
1350
- hasTexture(texture: BaseTexture): boolean;
1351
- dispose(forceDisposeEffect?: boolean): void;
1352
- clone(name: string): TriPlanarMaterial;
1353
- serialize(): any;
1354
- getClassName(): string;
1355
- static Parse(source: any, scene: Scene, rootUrl: string): TriPlanarMaterial;
1356
- }
1357
-
1358
-
1359
-
1360
-
1361
- /** @internal */
1362
- export var waterPixelShader: {
1363
- name: string;
1364
- shader: string;
1365
- };
1366
-
1367
-
1368
- /** @internal */
1369
- export var waterVertexShader: {
1370
- name: string;
1371
- shader: string;
1372
- };
1373
-
1374
-
1375
- export class WaterMaterial extends PushMaterial {
1376
- renderTargetSize: Vector2;
1377
- private _bumpTexture;
1378
- bumpTexture: BaseTexture;
1379
- diffuseColor: Color3;
1380
- specularColor: Color3;
1381
- specularPower: number;
1382
- private _disableLighting;
1383
- disableLighting: boolean;
1384
- private _maxSimultaneousLights;
1385
- maxSimultaneousLights: number;
1346
+ protected _afterBind(mesh?: Mesh, effect?: Nullable<Effect>, subMesh?: SubMesh): void;
1386
1347
  /**
1387
- * Defines the wind force.
1348
+ * Adds a new uniform to the shader
1349
+ * @param name the name of the uniform to add
1350
+ * @param kind the type of the uniform to add
1351
+ * @param param the value of the uniform to add
1352
+ * @returns the current material
1388
1353
  */
1389
- windForce: number;
1354
+ AddUniform(name: string, kind: string, param: any): CustomMaterial;
1390
1355
  /**
1391
- * Defines the direction of the wind in the plane (X, Z).
1356
+ * Adds a custom attribute
1357
+ * @param name the name of the attribute
1358
+ * @returns the current material
1392
1359
  */
1393
- windDirection: Vector2;
1360
+ AddAttribute(name: string): CustomMaterial;
1394
1361
  /**
1395
- * Defines the height of the waves.
1362
+ * Sets the code on Fragment_Begin portion
1363
+ * @param shaderPart the code string
1364
+ * @returns the current material
1396
1365
  */
1397
- waveHeight: number;
1366
+ Fragment_Begin(shaderPart: string): CustomMaterial;
1398
1367
  /**
1399
- * Defines the bump height related to the bump map.
1368
+ * Sets the code on Fragment_Definitions portion
1369
+ * @param shaderPart the code string
1370
+ * @returns the current material
1400
1371
  */
1401
- bumpHeight: number;
1372
+ Fragment_Definitions(shaderPart: string): CustomMaterial;
1402
1373
  /**
1403
- * Defines wether or not: to add a smaller moving bump to less steady waves.
1374
+ * Sets the code on Fragment_MainBegin portion
1375
+ * @param shaderPart the code string
1376
+ * @returns the current material
1404
1377
  */
1405
- private _bumpSuperimpose;
1406
- bumpSuperimpose: boolean;
1378
+ Fragment_MainBegin(shaderPart: string): CustomMaterial;
1407
1379
  /**
1408
- * Defines wether or not color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
1380
+ * Sets the code on Fragment_MainEnd portion
1381
+ * @param shaderPart the code string
1382
+ * @returns the current material
1409
1383
  */
1410
- private _fresnelSeparate;
1411
- fresnelSeparate: boolean;
1384
+ Fragment_MainEnd(shaderPart: string): CustomMaterial;
1412
1385
  /**
1413
- * Defines wether or not bump Wwves modify the reflection.
1386
+ * Sets the code on Fragment_Custom_Diffuse portion
1387
+ * @param shaderPart the code string
1388
+ * @returns the current material
1414
1389
  */
1415
- private _bumpAffectsReflection;
1416
- bumpAffectsReflection: boolean;
1390
+ Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
1417
1391
  /**
1418
- * Defines the water color blended with the refraction (near).
1392
+ * Sets the code on Fragment_Custom_Alpha portion
1393
+ * @param shaderPart the code string
1394
+ * @returns the current material
1419
1395
  */
1420
- waterColor: Color3;
1396
+ Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
1421
1397
  /**
1422
- * Defines the blend factor related to the water color.
1398
+ * Sets the code on Fragment_Before_Lights portion
1399
+ * @param shaderPart the code string
1400
+ * @returns the current material
1423
1401
  */
1424
- colorBlendFactor: number;
1402
+ Fragment_Before_Lights(shaderPart: string): CustomMaterial;
1425
1403
  /**
1426
- * Defines the water color blended with the reflection (far).
1404
+ * Sets the code on Fragment_Before_Fog portion
1405
+ * @param shaderPart the code string
1406
+ * @returns the current material
1427
1407
  */
1428
- waterColor2: Color3;
1408
+ Fragment_Before_Fog(shaderPart: string): CustomMaterial;
1429
1409
  /**
1430
- * Defines the blend factor related to the water color (reflection, far).
1410
+ * Sets the code on Fragment_Before_FragColor portion
1411
+ * @param shaderPart the code string
1412
+ * @returns the current material
1431
1413
  */
1432
- colorBlendFactor2: number;
1414
+ Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
1433
1415
  /**
1434
- * Defines the maximum length of a wave.
1416
+ * Sets the code on Vertex_Begin portion
1417
+ * @param shaderPart the code string
1418
+ * @returns the current material
1435
1419
  */
1436
- waveLength: number;
1420
+ Vertex_Begin(shaderPart: string): CustomMaterial;
1437
1421
  /**
1438
- * Defines the waves speed.
1422
+ * Sets the code on Vertex_Definitions portion
1423
+ * @param shaderPart the code string
1424
+ * @returns the current material
1439
1425
  */
1440
- waveSpeed: number;
1426
+ Vertex_Definitions(shaderPart: string): CustomMaterial;
1441
1427
  /**
1442
- * 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.
1428
+ * Sets the code on Vertex_MainBegin portion
1429
+ * @param shaderPart the code string
1430
+ * @returns the current material
1443
1431
  */
1444
- waveCount: number;
1432
+ Vertex_MainBegin(shaderPart: string): CustomMaterial;
1445
1433
  /**
1446
- * Sets or gets whether or not automatic clipping should be enabled or not. Setting to true will save performances and
1447
- * will avoid calculating useless pixels in the pixel shader of the water material.
1434
+ * Sets the code on Vertex_Before_PositionUpdated portion
1435
+ * @param shaderPart the code string
1436
+ * @returns the current material
1448
1437
  */
1449
- disableClipPlane: boolean;
1438
+ Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
1450
1439
  /**
1451
- * Defines whether or not to use world coordinates for wave deformations.
1452
- * The default value is false, meaning that the deformation is applied in object (local) space.
1453
- * You will probably need to set it to true if you are using instances or thin instances for your water objects.
1440
+ * Sets the code on Vertex_Before_NormalUpdated portion
1441
+ * @param shaderPart the code string
1442
+ * @returns the current material
1454
1443
  */
1455
- private _useWorldCoordinatesForWaveDeformation;
1456
- useWorldCoordinatesForWaveDeformation: boolean;
1457
- protected _renderTargets: SmartArray<RenderTargetTexture>;
1458
- private _mesh;
1459
- private _refractionRTT;
1460
- private _reflectionRTT;
1461
- private _reflectionTransform;
1462
- private _lastTime;
1463
- private _lastDeltaTime;
1464
- private _waitingRenderList;
1465
- private _imageProcessingConfiguration;
1466
- private _imageProcessingObserver;
1444
+ Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
1467
1445
  /**
1468
- * Gets a boolean indicating that current material needs to register RTT
1446
+ * Sets the code on Vertex_After_WorldPosComputed portion
1447
+ * @param shaderPart the code string
1448
+ * @returns the current material
1469
1449
  */
1470
- get hasRenderTargetTextures(): boolean;
1450
+ Vertex_After_WorldPosComputed(shaderPart: string): CustomMaterial;
1471
1451
  /**
1472
- * Constructor
1473
- * @param name
1474
- * @param scene
1475
- * @param renderTargetSize
1452
+ * Sets the code on Vertex_MainEnd portion
1453
+ * @param shaderPart the code string
1454
+ * @returns the current material
1476
1455
  */
1477
- constructor(name: string, scene?: Scene, renderTargetSize?: Vector2);
1478
- get refractionTexture(): Nullable<RenderTargetTexture>;
1479
- get reflectionTexture(): Nullable<RenderTargetTexture>;
1480
- addToRenderList(node: any): void;
1481
- removeFromRenderList(node: any): void;
1482
- enableRenderTargets(enable: boolean): void;
1483
- getRenderList(): Nullable<AbstractMesh[]>;
1484
- get renderTargetsEnabled(): boolean;
1456
+ Vertex_MainEnd(shaderPart: string): CustomMaterial;
1457
+ }
1458
+
1459
+
1460
+
1461
+
1462
+ export class CellMaterial extends PushMaterial {
1463
+ private _diffuseTexture;
1464
+ diffuseTexture: BaseTexture;
1465
+ diffuseColor: Color3;
1466
+ _computeHighLevel: boolean;
1467
+ computeHighLevel: boolean;
1468
+ private _disableLighting;
1469
+ disableLighting: boolean;
1470
+ private _maxSimultaneousLights;
1471
+ maxSimultaneousLights: number;
1472
+ constructor(name: string, scene?: Scene);
1485
1473
  needAlphaBlending(): boolean;
1486
1474
  needAlphaTesting(): boolean;
1487
1475
  getAlphaTestTexture(): Nullable<BaseTexture>;
1488
1476
  isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
1489
1477
  bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
1490
- private _createRenderTargets;
1491
1478
  getAnimatables(): IAnimatable[];
1492
1479
  getActiveTextures(): BaseTexture[];
1493
1480
  hasTexture(texture: BaseTexture): boolean;
1494
1481
  dispose(forceDisposeEffect?: boolean): void;
1495
- clone(name: string): WaterMaterial;
1496
- serialize(): any;
1497
1482
  getClassName(): string;
1498
- static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial;
1499
- static CreateDefaultMesh(name: string, scene: Scene): Mesh;
1483
+ clone(name: string): CellMaterial;
1484
+ serialize(): any;
1485
+ static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial;
1500
1486
  }
1501
1487
 
1502
1488
 
1489
+ /** @internal */
1490
+ export var cellVertexShader: {
1491
+ name: string;
1492
+ shader: string;
1493
+ };
1494
+
1495
+
1496
+ /** @internal */
1497
+ export var cellPixelShader: {
1498
+ name: string;
1499
+ shader: string;
1500
+ };
1501
+
1502
+
1503
1503
 
1504
1504
 
1505
1505