@onerjs/materials 8.23.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.
- package/cell/cell.fragment.d.ts +19 -0
- package/cell/cell.fragment.js +100 -0
- package/cell/cell.fragment.js.map +1 -0
- package/cell/cell.vertex.d.ts +21 -0
- package/cell/cell.vertex.js +96 -0
- package/cell/cell.vertex.js.map +1 -0
- package/cell/cellMaterial.d.ts +37 -0
- package/cell/cellMaterial.js +312 -0
- package/cell/cellMaterial.js.map +1 -0
- package/cell/index.d.ts +1 -0
- package/cell/index.js +2 -0
- package/cell/index.js.map +1 -0
- package/custom/customMaterial.d.ts +280 -0
- package/custom/customMaterial.js +355 -0
- package/custom/customMaterial.js.map +1 -0
- package/custom/index.d.ts +2 -0
- package/custom/index.js +3 -0
- package/custom/index.js.map +1 -0
- package/custom/pbrCustomMaterial.d.ts +299 -0
- package/custom/pbrCustomMaterial.js +397 -0
- package/custom/pbrCustomMaterial.js.map +1 -0
- package/fire/fire.fragment.d.ts +13 -0
- package/fire/fire.fragment.js +65 -0
- package/fire/fire.fragment.js.map +1 -0
- package/fire/fire.vertex.d.ts +18 -0
- package/fire/fire.vertex.js +80 -0
- package/fire/fire.vertex.js.map +1 -0
- package/fire/fireMaterial.d.ts +38 -0
- package/fire/fireMaterial.js +342 -0
- package/fire/fireMaterial.js.map +1 -0
- package/fire/index.d.ts +1 -0
- package/fire/index.js +2 -0
- package/fire/index.js.map +1 -0
- package/fur/fur.fragment.d.ts +19 -0
- package/fur/fur.fragment.js +94 -0
- package/fur/fur.fragment.js.map +1 -0
- package/fur/fur.vertex.d.ts +21 -0
- package/fur/fur.vertex.js +126 -0
- package/fur/fur.vertex.js.map +1 -0
- package/fur/furMaterial.d.ts +57 -0
- package/fur/furMaterial.js +505 -0
- package/fur/furMaterial.js.map +1 -0
- package/fur/index.d.ts +1 -0
- package/fur/index.js +2 -0
- package/fur/index.js.map +1 -0
- package/gradient/gradient.fragment.d.ts +19 -0
- package/gradient/gradient.fragment.js +80 -0
- package/gradient/gradient.fragment.js.map +1 -0
- package/gradient/gradient.vertex.d.ts +21 -0
- package/gradient/gradient.vertex.js +87 -0
- package/gradient/gradient.vertex.js.map +1 -0
- package/gradient/gradientMaterial.d.ts +37 -0
- package/gradient/gradientMaterial.js +283 -0
- package/gradient/gradientMaterial.js.map +1 -0
- package/gradient/index.d.ts +1 -0
- package/gradient/index.js +2 -0
- package/gradient/index.js.map +1 -0
- package/grid/grid.fragment.d.ts +12 -0
- package/grid/grid.fragment.js +79 -0
- package/grid/grid.fragment.js.map +1 -0
- package/grid/grid.vertex.d.ts +15 -0
- package/grid/grid.vertex.js +60 -0
- package/grid/grid.vertex.js.map +1 -0
- package/grid/gridMaterial.d.ts +85 -0
- package/grid/gridMaterial.js +308 -0
- package/grid/gridMaterial.js.map +1 -0
- package/grid/index.d.ts +1 -0
- package/grid/index.js +2 -0
- package/grid/index.js.map +1 -0
- package/index.d.ts +15 -0
- package/index.js +17 -0
- package/index.js.map +1 -0
- package/lava/index.d.ts +1 -0
- package/lava/index.js +2 -0
- package/lava/index.js.map +1 -0
- package/lava/lava.fragment.d.ts +19 -0
- package/lava/lava.fragment.js +89 -0
- package/lava/lava.fragment.js.map +1 -0
- package/lava/lava.vertex.d.ts +21 -0
- package/lava/lava.vertex.js +113 -0
- package/lava/lava.vertex.js.map +1 -0
- package/lava/lavaMaterial.d.ts +45 -0
- package/lava/lavaMaterial.js +402 -0
- package/lava/lavaMaterial.js.map +1 -0
- package/legacy/legacy-cell.d.ts +1 -0
- package/legacy/legacy-cell.js +14 -0
- package/legacy/legacy-cell.js.map +1 -0
- package/legacy/legacy-custom.d.ts +1 -0
- package/legacy/legacy-custom.js +14 -0
- package/legacy/legacy-custom.js.map +1 -0
- package/legacy/legacy-fire.d.ts +1 -0
- package/legacy/legacy-fire.js +14 -0
- package/legacy/legacy-fire.js.map +1 -0
- package/legacy/legacy-fur.d.ts +1 -0
- package/legacy/legacy-fur.js +14 -0
- package/legacy/legacy-fur.js.map +1 -0
- package/legacy/legacy-gradient.d.ts +1 -0
- package/legacy/legacy-gradient.js +14 -0
- package/legacy/legacy-gradient.js.map +1 -0
- package/legacy/legacy-grid.d.ts +1 -0
- package/legacy/legacy-grid.js +14 -0
- package/legacy/legacy-grid.js.map +1 -0
- package/legacy/legacy-lava.d.ts +1 -0
- package/legacy/legacy-lava.js +14 -0
- package/legacy/legacy-lava.js.map +1 -0
- package/legacy/legacy-mix.d.ts +1 -0
- package/legacy/legacy-mix.js +14 -0
- package/legacy/legacy-mix.js.map +1 -0
- package/legacy/legacy-normal.d.ts +1 -0
- package/legacy/legacy-normal.js +14 -0
- package/legacy/legacy-normal.js.map +1 -0
- package/legacy/legacy-shadowOnly.d.ts +1 -0
- package/legacy/legacy-shadowOnly.js +14 -0
- package/legacy/legacy-shadowOnly.js.map +1 -0
- package/legacy/legacy-simple.d.ts +1 -0
- package/legacy/legacy-simple.js +14 -0
- package/legacy/legacy-simple.js.map +1 -0
- package/legacy/legacy-sky.d.ts +1 -0
- package/legacy/legacy-sky.js +14 -0
- package/legacy/legacy-sky.js.map +1 -0
- package/legacy/legacy-terrain.d.ts +1 -0
- package/legacy/legacy-terrain.js +14 -0
- package/legacy/legacy-terrain.js.map +1 -0
- package/legacy/legacy-triPlanar.d.ts +1 -0
- package/legacy/legacy-triPlanar.js +14 -0
- package/legacy/legacy-triPlanar.js.map +1 -0
- package/legacy/legacy-water.d.ts +1 -0
- package/legacy/legacy-water.js +14 -0
- package/legacy/legacy-water.js.map +1 -0
- package/legacy/legacy.d.ts +1 -0
- package/legacy/legacy.js +17 -0
- package/legacy/legacy.js.map +1 -0
- package/license.md +71 -0
- package/mix/index.d.ts +1 -0
- package/mix/index.js +2 -0
- package/mix/index.js.map +1 -0
- package/mix/mix.fragment.d.ts +19 -0
- package/mix/mix.fragment.js +106 -0
- package/mix/mix.fragment.js.map +1 -0
- package/mix/mix.vertex.d.ts +21 -0
- package/mix/mix.vertex.js +96 -0
- package/mix/mix.vertex.js.map +1 -0
- package/mix/mixMaterial.d.ts +65 -0
- package/mix/mixMaterial.js +508 -0
- package/mix/mixMaterial.js.map +1 -0
- package/normal/index.d.ts +1 -0
- package/normal/index.js +2 -0
- package/normal/index.js.map +1 -0
- package/normal/normal.fragment.d.ts +19 -0
- package/normal/normal.fragment.js +85 -0
- package/normal/normal.fragment.js.map +1 -0
- package/normal/normal.vertex.d.ts +20 -0
- package/normal/normal.vertex.js +88 -0
- package/normal/normal.vertex.js.map +1 -0
- package/normal/normalMaterial.d.ts +36 -0
- package/normal/normalMaterial.js +345 -0
- package/normal/normalMaterial.js.map +1 -0
- package/package.json +47 -0
- package/readme.md +30 -0
- package/shadowOnly/index.d.ts +1 -0
- package/shadowOnly/index.js +2 -0
- package/shadowOnly/index.js.map +1 -0
- package/shadowOnly/shadowOnly.fragment.d.ts +20 -0
- package/shadowOnly/shadowOnly.fragment.js +60 -0
- package/shadowOnly/shadowOnly.fragment.js.map +1 -0
- package/shadowOnly/shadowOnly.vertex.d.ts +22 -0
- package/shadowOnly/shadowOnly.vertex.js +69 -0
- package/shadowOnly/shadowOnly.vertex.js.map +1 -0
- package/shadowOnly/shadowOnlyMaterial.d.ts +30 -0
- package/shadowOnly/shadowOnlyMaterial.js +243 -0
- package/shadowOnly/shadowOnlyMaterial.js.map +1 -0
- package/simple/index.d.ts +1 -0
- package/simple/index.js +2 -0
- package/simple/index.js.map +1 -0
- package/simple/simple.fragment.d.ts +19 -0
- package/simple/simple.fragment.js +81 -0
- package/simple/simple.fragment.js.map +1 -0
- package/simple/simple.vertex.d.ts +21 -0
- package/simple/simple.vertex.js +96 -0
- package/simple/simple.vertex.js.map +1 -0
- package/simple/simpleMaterial.d.ts +35 -0
- package/simple/simpleMaterial.js +303 -0
- package/simple/simpleMaterial.js.map +1 -0
- package/sky/index.d.ts +1 -0
- package/sky/index.js +2 -0
- package/sky/index.js.map +1 -0
- package/sky/sky.fragment.d.ts +13 -0
- package/sky/sky.fragment.js +81 -0
- package/sky/sky.fragment.js.map +1 -0
- package/sky/sky.vertex.d.ts +11 -0
- package/sky/sky.vertex.js +47 -0
- package/sky/sky.vertex.js.map +1 -0
- package/sky/skyMaterial.d.ts +151 -0
- package/sky/skyMaterial.js +367 -0
- package/sky/skyMaterial.js.map +1 -0
- package/terrain/index.d.ts +1 -0
- package/terrain/index.js +2 -0
- package/terrain/index.js.map +1 -0
- package/terrain/terrain.fragment.d.ts +19 -0
- package/terrain/terrain.fragment.js +110 -0
- package/terrain/terrain.fragment.js.map +1 -0
- package/terrain/terrain.vertex.d.ts +21 -0
- package/terrain/terrain.vertex.js +96 -0
- package/terrain/terrain.vertex.js.map +1 -0
- package/terrain/terrainMaterial.d.ts +50 -0
- package/terrain/terrainMaterial.js +445 -0
- package/terrain/terrainMaterial.js.map +1 -0
- package/triPlanar/index.d.ts +1 -0
- package/triPlanar/index.js +2 -0
- package/triPlanar/index.js.map +1 -0
- package/triPlanar/triPlanarMaterial.d.ts +49 -0
- package/triPlanar/triPlanarMaterial.js +421 -0
- package/triPlanar/triPlanarMaterial.js.map +1 -0
- package/triPlanar/triplanar.fragment.d.ts +19 -0
- package/triPlanar/triplanar.fragment.js +126 -0
- package/triPlanar/triplanar.fragment.js.map +1 -0
- package/triPlanar/triplanar.vertex.d.ts +22 -0
- package/triPlanar/triplanar.vertex.js +101 -0
- package/triPlanar/triplanar.vertex.js.map +1 -0
- package/water/index.d.ts +1 -0
- package/water/index.js +2 -0
- package/water/index.js.map +1 -0
- package/water/water.fragment.d.ts +19 -0
- package/water/water.fragment.js +160 -0
- package/water/water.fragment.js.map +1 -0
- package/water/water.vertex.d.ts +21 -0
- package/water/water.vertex.js +125 -0
- package/water/water.vertex.js.map +1 -0
- package/water/waterMaterial.d.ts +141 -0
- package/water/waterMaterial.js +729 -0
- package/water/waterMaterial.js.map +1 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
3
|
+
import "@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js";
|
|
4
|
+
import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js";
|
|
5
|
+
import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
|
|
6
|
+
import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
|
|
7
|
+
import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
|
|
8
|
+
import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
|
|
9
|
+
import "@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js";
|
|
10
|
+
import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
|
|
11
|
+
import "@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js";
|
|
12
|
+
import "@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js";
|
|
13
|
+
import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js";
|
|
14
|
+
import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
|
|
15
|
+
import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
|
|
16
|
+
import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
|
|
17
|
+
import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
|
|
18
|
+
import "@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js";
|
|
19
|
+
const name = "terrainVertexShader";
|
|
20
|
+
const shader = `precision highp float;attribute vec3 position;
|
|
21
|
+
#ifdef NORMAL
|
|
22
|
+
attribute vec3 normal;
|
|
23
|
+
#endif
|
|
24
|
+
#ifdef UV1
|
|
25
|
+
attribute vec2 uv;
|
|
26
|
+
#endif
|
|
27
|
+
#ifdef UV2
|
|
28
|
+
attribute vec2 uv2;
|
|
29
|
+
#endif
|
|
30
|
+
#ifdef VERTEXCOLOR
|
|
31
|
+
attribute vec4 color;
|
|
32
|
+
#endif
|
|
33
|
+
#include<bonesDeclaration>
|
|
34
|
+
#include<bakedVertexAnimationDeclaration>
|
|
35
|
+
#include<instancesDeclaration>
|
|
36
|
+
uniform mat4 view;uniform mat4 viewProjection;
|
|
37
|
+
#ifdef DIFFUSE
|
|
38
|
+
varying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;
|
|
39
|
+
#endif
|
|
40
|
+
#ifdef POINTSIZE
|
|
41
|
+
uniform float pointSize;
|
|
42
|
+
#endif
|
|
43
|
+
varying vec3 vPositionW;
|
|
44
|
+
#ifdef NORMAL
|
|
45
|
+
varying vec3 vNormalW;
|
|
46
|
+
#endif
|
|
47
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
48
|
+
varying vec4 vColor;
|
|
49
|
+
#endif
|
|
50
|
+
#include<logDepthDeclaration>
|
|
51
|
+
#include<clipPlaneVertexDeclaration>
|
|
52
|
+
#include<fogVertexDeclaration>
|
|
53
|
+
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
|
54
|
+
#define CUSTOM_VERTEX_DEFINITIONS
|
|
55
|
+
void main(void) {
|
|
56
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
|
57
|
+
#ifdef VERTEXCOLOR
|
|
58
|
+
vec4 colorUpdated=color;
|
|
59
|
+
#endif
|
|
60
|
+
#include<instancesVertex>
|
|
61
|
+
#include<bonesVertex>
|
|
62
|
+
#include<bakedVertexAnimation>
|
|
63
|
+
vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);
|
|
64
|
+
#ifdef NORMAL
|
|
65
|
+
vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
|
|
66
|
+
#endif
|
|
67
|
+
#ifndef UV1
|
|
68
|
+
vec2 uv=vec2(0.,0.);
|
|
69
|
+
#endif
|
|
70
|
+
#ifndef UV2
|
|
71
|
+
vec2 uv2=vec2(0.,0.);
|
|
72
|
+
#endif
|
|
73
|
+
#ifdef DIFFUSE
|
|
74
|
+
if (vTextureInfos.x==0.)
|
|
75
|
+
{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}
|
|
76
|
+
else
|
|
77
|
+
{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}
|
|
78
|
+
#endif
|
|
79
|
+
#include<clipPlaneVertex>
|
|
80
|
+
#include<logDepthVertex>
|
|
81
|
+
#include<fogVertex>
|
|
82
|
+
#include<shadowsVertex>[0..maxSimultaneousLights]
|
|
83
|
+
#include<vertexColorMixing>
|
|
84
|
+
#if defined(POINTSIZE) && !defined(WEBGPU)
|
|
85
|
+
gl_PointSize=pointSize;
|
|
86
|
+
#endif
|
|
87
|
+
#define CUSTOM_VERTEX_MAIN_END
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
// Sideeffect
|
|
91
|
+
if (!ShaderStore.ShadersStore[name]) {
|
|
92
|
+
ShaderStore.ShadersStore[name] = shader;
|
|
93
|
+
}
|
|
94
|
+
/** @internal */
|
|
95
|
+
export const terrainVertexShader = { name, shader };
|
|
96
|
+
//# sourceMappingURL=terrain.vertex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terrain.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/terrain/terrain.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,uEAAyD;AACzD,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,kEAAoD;AACpD,6DAA+C;AAC/C,iEAAmD;AACnD,qEAAuD;AAEvD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesVertex\";\nimport \"core/Shaders/ShadersInclude/bonesVertex\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"core/Shaders/ShadersInclude/logDepthVertex\";\nimport \"core/Shaders/ShadersInclude/fogVertex\";\nimport \"core/Shaders/ShadersInclude/shadowsVertex\";\nimport \"core/Shaders/ShadersInclude/vertexColorMixing\";\n\nconst name = \"terrainVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<logDepthDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef VERTEXCOLOR\nvec4 colorUpdated=color;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const terrainVertexShader = { name, shader };\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
2
|
+
import type { Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
|
+
import type { IAnimatable } from "@babylonjs/core/Animations/animatable.interface.js";
|
|
5
|
+
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
|
6
|
+
import type { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
7
|
+
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
|
8
|
+
import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
|
9
|
+
import type { SubMesh } from "@babylonjs/core/Meshes/subMesh.js";
|
|
10
|
+
import type { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
|
11
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
12
|
+
import "./terrain.fragment.js";
|
|
13
|
+
import "./terrain.vertex.js";
|
|
14
|
+
export declare class TerrainMaterial extends PushMaterial {
|
|
15
|
+
private _mixTexture;
|
|
16
|
+
mixTexture: BaseTexture;
|
|
17
|
+
private _diffuseTexture1;
|
|
18
|
+
diffuseTexture1: Texture;
|
|
19
|
+
private _diffuseTexture2;
|
|
20
|
+
diffuseTexture2: Texture;
|
|
21
|
+
private _diffuseTexture3;
|
|
22
|
+
diffuseTexture3: Texture;
|
|
23
|
+
private _bumpTexture1;
|
|
24
|
+
bumpTexture1: Texture;
|
|
25
|
+
private _bumpTexture2;
|
|
26
|
+
bumpTexture2: Texture;
|
|
27
|
+
private _bumpTexture3;
|
|
28
|
+
bumpTexture3: Texture;
|
|
29
|
+
diffuseColor: Color3;
|
|
30
|
+
specularColor: Color3;
|
|
31
|
+
specularPower: number;
|
|
32
|
+
private _disableLighting;
|
|
33
|
+
disableLighting: boolean;
|
|
34
|
+
private _maxSimultaneousLights;
|
|
35
|
+
maxSimultaneousLights: number;
|
|
36
|
+
constructor(name: string, scene?: Scene);
|
|
37
|
+
needAlphaBlending(): boolean;
|
|
38
|
+
needAlphaTesting(): boolean;
|
|
39
|
+
getAlphaTestTexture(): Nullable<BaseTexture>;
|
|
40
|
+
isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
|
|
41
|
+
bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
|
|
42
|
+
getAnimatables(): IAnimatable[];
|
|
43
|
+
getActiveTextures(): BaseTexture[];
|
|
44
|
+
hasTexture(texture: BaseTexture): boolean;
|
|
45
|
+
dispose(forceDisposeEffect?: boolean): void;
|
|
46
|
+
clone(name: string): TerrainMaterial;
|
|
47
|
+
serialize(): any;
|
|
48
|
+
getClassName(): string;
|
|
49
|
+
static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial;
|
|
50
|
+
}
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
+
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
4
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
5
|
+
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
|
6
|
+
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
|
7
|
+
import { MaterialFlags } from "@babylonjs/core/Materials/materialFlags.js";
|
|
8
|
+
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
|
9
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
10
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
11
|
+
import "./terrain.fragment.js";
|
|
12
|
+
import "./terrain.vertex.js";
|
|
13
|
+
import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
|
|
14
|
+
import { AddClipPlaneUniforms, BindClipPlane } from "@babylonjs/core/Materials/clipPlaneMaterialHelper.js";
|
|
15
|
+
import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, HandleFallbacksForShadows, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForMisc, PrepareUniformsAndSamplersList, } from "@babylonjs/core/Materials/materialHelper.functions.js";
|
|
16
|
+
class TerrainMaterialDefines extends MaterialDefines {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.DIFFUSE = false;
|
|
20
|
+
this.BUMP = false;
|
|
21
|
+
this.CLIPPLANE = false;
|
|
22
|
+
this.CLIPPLANE2 = false;
|
|
23
|
+
this.CLIPPLANE3 = false;
|
|
24
|
+
this.CLIPPLANE4 = false;
|
|
25
|
+
this.CLIPPLANE5 = false;
|
|
26
|
+
this.CLIPPLANE6 = false;
|
|
27
|
+
this.ALPHATEST = false;
|
|
28
|
+
this.DEPTHPREPASS = false;
|
|
29
|
+
this.POINTSIZE = false;
|
|
30
|
+
this.FOG = false;
|
|
31
|
+
this.SPECULARTERM = false;
|
|
32
|
+
this.NORMAL = false;
|
|
33
|
+
this.UV1 = false;
|
|
34
|
+
this.UV2 = false;
|
|
35
|
+
this.VERTEXCOLOR = false;
|
|
36
|
+
this.VERTEXALPHA = false;
|
|
37
|
+
this.NUM_BONE_INFLUENCERS = 0;
|
|
38
|
+
this.BonesPerMesh = 0;
|
|
39
|
+
this.INSTANCES = false;
|
|
40
|
+
this.INSTANCESCOLOR = false;
|
|
41
|
+
this.IMAGEPROCESSINGPOSTPROCESS = false;
|
|
42
|
+
this.SKIPFINALCOLORCLAMP = false;
|
|
43
|
+
this.LOGARITHMICDEPTH = false;
|
|
44
|
+
this.AREALIGHTSUPPORTED = true;
|
|
45
|
+
this.AREALIGHTNOROUGHTNESS = true;
|
|
46
|
+
this.rebuild();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export class TerrainMaterial extends PushMaterial {
|
|
50
|
+
constructor(name, scene) {
|
|
51
|
+
super(name, scene);
|
|
52
|
+
this.diffuseColor = new Color3(1, 1, 1);
|
|
53
|
+
this.specularColor = new Color3(0, 0, 0);
|
|
54
|
+
this.specularPower = 64;
|
|
55
|
+
this._disableLighting = false;
|
|
56
|
+
this._maxSimultaneousLights = 4;
|
|
57
|
+
}
|
|
58
|
+
needAlphaBlending() {
|
|
59
|
+
return this.alpha < 1.0;
|
|
60
|
+
}
|
|
61
|
+
needAlphaTesting() {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
getAlphaTestTexture() {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
// Methods
|
|
68
|
+
isReadyForSubMesh(mesh, subMesh, useInstances) {
|
|
69
|
+
const drawWrapper = subMesh._drawWrapper;
|
|
70
|
+
if (this.isFrozen) {
|
|
71
|
+
if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!subMesh.materialDefines) {
|
|
76
|
+
subMesh.materialDefines = new TerrainMaterialDefines();
|
|
77
|
+
}
|
|
78
|
+
const defines = subMesh.materialDefines;
|
|
79
|
+
const scene = this.getScene();
|
|
80
|
+
if (this._isReadyForSubMesh(subMesh)) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
const engine = scene.getEngine();
|
|
84
|
+
// Textures
|
|
85
|
+
if (scene.texturesEnabled) {
|
|
86
|
+
if (!this.mixTexture || !this.mixTexture.isReady()) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
defines._needUVs = true;
|
|
90
|
+
if (MaterialFlags.DiffuseTextureEnabled) {
|
|
91
|
+
if (!this.diffuseTexture1 || !this.diffuseTexture1.isReady()) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (!this.diffuseTexture2 || !this.diffuseTexture2.isReady()) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (!this.diffuseTexture3 || !this.diffuseTexture3.isReady()) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
defines.DIFFUSE = true;
|
|
101
|
+
}
|
|
102
|
+
if (this.bumpTexture1 && this.bumpTexture2 && this.bumpTexture3 && MaterialFlags.BumpTextureEnabled) {
|
|
103
|
+
if (!this.bumpTexture1.isReady()) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (!this.bumpTexture2.isReady()) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (!this.bumpTexture3.isReady()) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
defines._needNormals = true;
|
|
113
|
+
defines.BUMP = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Misc.
|
|
117
|
+
PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(mesh), defines);
|
|
118
|
+
// Lights
|
|
119
|
+
defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
|
|
120
|
+
// Values that need to be evaluated on every frame
|
|
121
|
+
PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
|
|
122
|
+
// Attribs
|
|
123
|
+
PrepareDefinesForAttributes(mesh, defines, true, true);
|
|
124
|
+
// Get correct effect
|
|
125
|
+
if (defines.isDirty) {
|
|
126
|
+
defines.markAsProcessed();
|
|
127
|
+
scene.resetCachedMaterial();
|
|
128
|
+
// Fallbacks
|
|
129
|
+
const fallbacks = new EffectFallbacks();
|
|
130
|
+
if (defines.FOG) {
|
|
131
|
+
fallbacks.addFallback(1, "FOG");
|
|
132
|
+
}
|
|
133
|
+
HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
|
|
134
|
+
if (defines.NUM_BONE_INFLUENCERS > 0) {
|
|
135
|
+
fallbacks.addCPUSkinningFallback(0, mesh);
|
|
136
|
+
}
|
|
137
|
+
defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
|
|
138
|
+
//Attributes
|
|
139
|
+
const attribs = [VertexBuffer.PositionKind];
|
|
140
|
+
if (defines.NORMAL) {
|
|
141
|
+
attribs.push(VertexBuffer.NormalKind);
|
|
142
|
+
}
|
|
143
|
+
if (defines.UV1) {
|
|
144
|
+
attribs.push(VertexBuffer.UVKind);
|
|
145
|
+
}
|
|
146
|
+
if (defines.UV2) {
|
|
147
|
+
attribs.push(VertexBuffer.UV2Kind);
|
|
148
|
+
}
|
|
149
|
+
if (defines.VERTEXCOLOR) {
|
|
150
|
+
attribs.push(VertexBuffer.ColorKind);
|
|
151
|
+
}
|
|
152
|
+
PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
|
|
153
|
+
PrepareAttributesForInstances(attribs, defines);
|
|
154
|
+
// Legacy browser patch
|
|
155
|
+
const shaderName = "terrain";
|
|
156
|
+
const join = defines.toString();
|
|
157
|
+
const uniforms = [
|
|
158
|
+
"world",
|
|
159
|
+
"view",
|
|
160
|
+
"viewProjection",
|
|
161
|
+
"vEyePosition",
|
|
162
|
+
"vLightsType",
|
|
163
|
+
"vDiffuseColor",
|
|
164
|
+
"vSpecularColor",
|
|
165
|
+
"vFogInfos",
|
|
166
|
+
"vFogColor",
|
|
167
|
+
"pointSize",
|
|
168
|
+
"vTextureInfos",
|
|
169
|
+
"mBones",
|
|
170
|
+
"textureMatrix",
|
|
171
|
+
"diffuse1Infos",
|
|
172
|
+
"diffuse2Infos",
|
|
173
|
+
"diffuse3Infos",
|
|
174
|
+
];
|
|
175
|
+
const samplers = [
|
|
176
|
+
"textureSampler",
|
|
177
|
+
"diffuse1Sampler",
|
|
178
|
+
"diffuse2Sampler",
|
|
179
|
+
"diffuse3Sampler",
|
|
180
|
+
"bump1Sampler",
|
|
181
|
+
"bump2Sampler",
|
|
182
|
+
"bump3Sampler",
|
|
183
|
+
"logarithmicDepthConstant",
|
|
184
|
+
"areaLightsLTC1Sampler",
|
|
185
|
+
"areaLightsLTC2Sampler",
|
|
186
|
+
];
|
|
187
|
+
const uniformBuffers = [];
|
|
188
|
+
AddClipPlaneUniforms(uniforms);
|
|
189
|
+
PrepareUniformsAndSamplersList({
|
|
190
|
+
uniformsNames: uniforms,
|
|
191
|
+
uniformBuffersNames: uniformBuffers,
|
|
192
|
+
samplers: samplers,
|
|
193
|
+
defines: defines,
|
|
194
|
+
maxSimultaneousLights: this.maxSimultaneousLights,
|
|
195
|
+
});
|
|
196
|
+
subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
|
|
197
|
+
attributes: attribs,
|
|
198
|
+
uniformsNames: uniforms,
|
|
199
|
+
uniformBuffersNames: uniformBuffers,
|
|
200
|
+
samplers: samplers,
|
|
201
|
+
defines: join,
|
|
202
|
+
fallbacks: fallbacks,
|
|
203
|
+
onCompiled: this.onCompiled,
|
|
204
|
+
onError: this.onError,
|
|
205
|
+
indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights },
|
|
206
|
+
}, engine), defines, this._materialContext);
|
|
207
|
+
}
|
|
208
|
+
// Check if Area Lights have LTC texture.
|
|
209
|
+
if (defines["AREALIGHTUSED"]) {
|
|
210
|
+
for (let index = 0; index < mesh.lightSources.length; index++) {
|
|
211
|
+
if (!mesh.lightSources[index]._isReady()) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (!subMesh.effect || !subMesh.effect.isReady()) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
defines._renderId = scene.getRenderId();
|
|
220
|
+
drawWrapper._wasPreviouslyReady = true;
|
|
221
|
+
drawWrapper._wasPreviouslyUsingInstances = !!useInstances;
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
bindForSubMesh(world, mesh, subMesh) {
|
|
225
|
+
const scene = this.getScene();
|
|
226
|
+
const defines = subMesh.materialDefines;
|
|
227
|
+
if (!defines) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const effect = subMesh.effect;
|
|
231
|
+
if (!effect) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
this._activeEffect = effect;
|
|
235
|
+
// Matrices
|
|
236
|
+
this.bindOnlyWorldMatrix(world);
|
|
237
|
+
this._activeEffect.setMatrix("view", scene.getViewMatrix());
|
|
238
|
+
this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
|
|
239
|
+
// Bones
|
|
240
|
+
BindBonesParameters(mesh, this._activeEffect);
|
|
241
|
+
if (this._mustRebind(scene, effect, subMesh)) {
|
|
242
|
+
// Textures
|
|
243
|
+
if (this.mixTexture) {
|
|
244
|
+
this._activeEffect.setTexture("textureSampler", this._mixTexture);
|
|
245
|
+
this._activeEffect.setFloat2("vTextureInfos", this._mixTexture.coordinatesIndex, this._mixTexture.level);
|
|
246
|
+
this._activeEffect.setMatrix("textureMatrix", this._mixTexture.getTextureMatrix());
|
|
247
|
+
if (MaterialFlags.DiffuseTextureEnabled) {
|
|
248
|
+
if (this._diffuseTexture1) {
|
|
249
|
+
this._activeEffect.setTexture("diffuse1Sampler", this._diffuseTexture1);
|
|
250
|
+
this._activeEffect.setFloat2("diffuse1Infos", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);
|
|
251
|
+
}
|
|
252
|
+
if (this._diffuseTexture2) {
|
|
253
|
+
this._activeEffect.setTexture("diffuse2Sampler", this._diffuseTexture2);
|
|
254
|
+
this._activeEffect.setFloat2("diffuse2Infos", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);
|
|
255
|
+
}
|
|
256
|
+
if (this._diffuseTexture3) {
|
|
257
|
+
this._activeEffect.setTexture("diffuse3Sampler", this._diffuseTexture3);
|
|
258
|
+
this._activeEffect.setFloat2("diffuse3Infos", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (MaterialFlags.BumpTextureEnabled && scene.getEngine().getCaps().standardDerivatives) {
|
|
262
|
+
if (this._bumpTexture1) {
|
|
263
|
+
this._activeEffect.setTexture("bump1Sampler", this._bumpTexture1);
|
|
264
|
+
}
|
|
265
|
+
if (this._bumpTexture2) {
|
|
266
|
+
this._activeEffect.setTexture("bump2Sampler", this._bumpTexture2);
|
|
267
|
+
}
|
|
268
|
+
if (this._bumpTexture3) {
|
|
269
|
+
this._activeEffect.setTexture("bump3Sampler", this._bumpTexture3);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// Clip plane
|
|
274
|
+
BindClipPlane(effect, this, scene);
|
|
275
|
+
// Point size
|
|
276
|
+
if (this.pointsCloud) {
|
|
277
|
+
this._activeEffect.setFloat("pointSize", this.pointSize);
|
|
278
|
+
}
|
|
279
|
+
// Log. depth
|
|
280
|
+
if (this._useLogarithmicDepth) {
|
|
281
|
+
BindLogDepth(defines, effect, scene);
|
|
282
|
+
}
|
|
283
|
+
scene.bindEyePosition(effect);
|
|
284
|
+
}
|
|
285
|
+
this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
|
|
286
|
+
if (defines.SPECULARTERM) {
|
|
287
|
+
this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
|
|
288
|
+
}
|
|
289
|
+
if (scene.lightsEnabled && !this.disableLighting) {
|
|
290
|
+
BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
|
|
291
|
+
}
|
|
292
|
+
// View
|
|
293
|
+
if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
|
|
294
|
+
this._activeEffect.setMatrix("view", scene.getViewMatrix());
|
|
295
|
+
}
|
|
296
|
+
// Fog
|
|
297
|
+
BindFogParameters(scene, mesh, this._activeEffect);
|
|
298
|
+
this._afterBind(mesh, this._activeEffect, subMesh);
|
|
299
|
+
}
|
|
300
|
+
getAnimatables() {
|
|
301
|
+
const results = [];
|
|
302
|
+
if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {
|
|
303
|
+
results.push(this.mixTexture);
|
|
304
|
+
}
|
|
305
|
+
return results;
|
|
306
|
+
}
|
|
307
|
+
getActiveTextures() {
|
|
308
|
+
const activeTextures = super.getActiveTextures();
|
|
309
|
+
if (this._mixTexture) {
|
|
310
|
+
activeTextures.push(this._mixTexture);
|
|
311
|
+
}
|
|
312
|
+
if (this._diffuseTexture1) {
|
|
313
|
+
activeTextures.push(this._diffuseTexture1);
|
|
314
|
+
}
|
|
315
|
+
if (this._diffuseTexture2) {
|
|
316
|
+
activeTextures.push(this._diffuseTexture2);
|
|
317
|
+
}
|
|
318
|
+
if (this._diffuseTexture3) {
|
|
319
|
+
activeTextures.push(this._diffuseTexture3);
|
|
320
|
+
}
|
|
321
|
+
if (this._bumpTexture1) {
|
|
322
|
+
activeTextures.push(this._bumpTexture1);
|
|
323
|
+
}
|
|
324
|
+
if (this._bumpTexture2) {
|
|
325
|
+
activeTextures.push(this._bumpTexture2);
|
|
326
|
+
}
|
|
327
|
+
if (this._bumpTexture3) {
|
|
328
|
+
activeTextures.push(this._bumpTexture3);
|
|
329
|
+
}
|
|
330
|
+
return activeTextures;
|
|
331
|
+
}
|
|
332
|
+
hasTexture(texture) {
|
|
333
|
+
if (super.hasTexture(texture)) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
if (this._mixTexture === texture) {
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
if (this._diffuseTexture1 === texture) {
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
if (this._diffuseTexture2 === texture) {
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
if (this._diffuseTexture3 === texture) {
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
if (this._bumpTexture1 === texture) {
|
|
349
|
+
return true;
|
|
350
|
+
}
|
|
351
|
+
if (this._bumpTexture2 === texture) {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
if (this._bumpTexture3 === texture) {
|
|
355
|
+
return true;
|
|
356
|
+
}
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
dispose(forceDisposeEffect) {
|
|
360
|
+
if (this.mixTexture) {
|
|
361
|
+
this.mixTexture.dispose();
|
|
362
|
+
}
|
|
363
|
+
super.dispose(forceDisposeEffect);
|
|
364
|
+
}
|
|
365
|
+
clone(name) {
|
|
366
|
+
return SerializationHelper.Clone(() => new TerrainMaterial(name, this.getScene()), this);
|
|
367
|
+
}
|
|
368
|
+
serialize() {
|
|
369
|
+
const serializationObject = super.serialize();
|
|
370
|
+
serializationObject.customType = "BABYLON.TerrainMaterial";
|
|
371
|
+
return serializationObject;
|
|
372
|
+
}
|
|
373
|
+
getClassName() {
|
|
374
|
+
return "TerrainMaterial";
|
|
375
|
+
}
|
|
376
|
+
// Statics
|
|
377
|
+
static Parse(source, scene, rootUrl) {
|
|
378
|
+
return SerializationHelper.Parse(() => new TerrainMaterial(source.name, scene), source, scene, rootUrl);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
__decorate([
|
|
382
|
+
serializeAsTexture("mixTexture")
|
|
383
|
+
], TerrainMaterial.prototype, "_mixTexture", void 0);
|
|
384
|
+
__decorate([
|
|
385
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
386
|
+
], TerrainMaterial.prototype, "mixTexture", void 0);
|
|
387
|
+
__decorate([
|
|
388
|
+
serializeAsTexture("diffuseTexture1")
|
|
389
|
+
], TerrainMaterial.prototype, "_diffuseTexture1", void 0);
|
|
390
|
+
__decorate([
|
|
391
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
392
|
+
], TerrainMaterial.prototype, "diffuseTexture1", void 0);
|
|
393
|
+
__decorate([
|
|
394
|
+
serializeAsTexture("diffuseTexture2")
|
|
395
|
+
], TerrainMaterial.prototype, "_diffuseTexture2", void 0);
|
|
396
|
+
__decorate([
|
|
397
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
398
|
+
], TerrainMaterial.prototype, "diffuseTexture2", void 0);
|
|
399
|
+
__decorate([
|
|
400
|
+
serializeAsTexture("diffuseTexture3")
|
|
401
|
+
], TerrainMaterial.prototype, "_diffuseTexture3", void 0);
|
|
402
|
+
__decorate([
|
|
403
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
404
|
+
], TerrainMaterial.prototype, "diffuseTexture3", void 0);
|
|
405
|
+
__decorate([
|
|
406
|
+
serializeAsTexture("bumpTexture1")
|
|
407
|
+
], TerrainMaterial.prototype, "_bumpTexture1", void 0);
|
|
408
|
+
__decorate([
|
|
409
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
410
|
+
], TerrainMaterial.prototype, "bumpTexture1", void 0);
|
|
411
|
+
__decorate([
|
|
412
|
+
serializeAsTexture("bumpTexture2")
|
|
413
|
+
], TerrainMaterial.prototype, "_bumpTexture2", void 0);
|
|
414
|
+
__decorate([
|
|
415
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
416
|
+
], TerrainMaterial.prototype, "bumpTexture2", void 0);
|
|
417
|
+
__decorate([
|
|
418
|
+
serializeAsTexture("bumpTexture3")
|
|
419
|
+
], TerrainMaterial.prototype, "_bumpTexture3", void 0);
|
|
420
|
+
__decorate([
|
|
421
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
422
|
+
], TerrainMaterial.prototype, "bumpTexture3", void 0);
|
|
423
|
+
__decorate([
|
|
424
|
+
serializeAsColor3()
|
|
425
|
+
], TerrainMaterial.prototype, "diffuseColor", void 0);
|
|
426
|
+
__decorate([
|
|
427
|
+
serializeAsColor3()
|
|
428
|
+
], TerrainMaterial.prototype, "specularColor", void 0);
|
|
429
|
+
__decorate([
|
|
430
|
+
serialize()
|
|
431
|
+
], TerrainMaterial.prototype, "specularPower", void 0);
|
|
432
|
+
__decorate([
|
|
433
|
+
serialize("disableLighting")
|
|
434
|
+
], TerrainMaterial.prototype, "_disableLighting", void 0);
|
|
435
|
+
__decorate([
|
|
436
|
+
expandToProperty("_markAllSubMeshesAsLightsDirty")
|
|
437
|
+
], TerrainMaterial.prototype, "disableLighting", void 0);
|
|
438
|
+
__decorate([
|
|
439
|
+
serialize("maxSimultaneousLights")
|
|
440
|
+
], TerrainMaterial.prototype, "_maxSimultaneousLights", void 0);
|
|
441
|
+
__decorate([
|
|
442
|
+
expandToProperty("_markAllSubMeshesAsLightsDirty")
|
|
443
|
+
], TerrainMaterial.prototype, "maxSimultaneousLights", void 0);
|
|
444
|
+
RegisterClass("BABYLON.TerrainMaterial", TerrainMaterial);
|
|
445
|
+
//# sourceMappingURL=terrainMaterial.js.map
|