@babylonjs/materials 9.15.0 → 9.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cell/cellMaterial.d.ts +4 -4
- package/cell/cellMaterial.js +313 -268
- package/cell/cellMaterial.js.map +1 -1
- package/fire/fireMaterial.d.ts +3 -3
- package/fire/fireMaterial.js +344 -303
- package/fire/fireMaterial.js.map +1 -1
- package/fur/furMaterial.d.ts +4 -4
- package/fur/furMaterial.js +519 -450
- package/fur/furMaterial.js.map +1 -1
- package/gradient/gradientMaterial.d.ts +2 -2
- package/gradient/gradientMaterial.js +286 -246
- package/gradient/gradientMaterial.js.map +1 -1
- package/grid/gridMaterial.d.ts +1 -1
- package/grid/gridMaterial.js +453 -398
- package/grid/gridMaterial.js.map +1 -1
- package/lava/lavaMaterial.d.ts +4 -4
- package/lava/lavaMaterial.js +377 -318
- package/lava/lavaMaterial.js.map +1 -1
- package/mix/mixMaterial.d.ts +12 -12
- package/mix/mixMaterial.js +584 -456
- package/mix/mixMaterial.js.map +1 -1
- package/normal/normalMaterial.d.ts +3 -3
- package/normal/normalMaterial.js +301 -264
- package/normal/normalMaterial.js.map +1 -1
- package/package.json +2 -2
- package/simple/simpleMaterial.d.ts +3 -3
- package/simple/simpleMaterial.js +299 -262
- package/simple/simpleMaterial.js.map +1 -1
- package/sky/skyMaterial.js +380 -344
- package/sky/skyMaterial.js.map +1 -1
- package/terrain/terrainMaterial.d.ts +9 -9
- package/terrain/terrainMaterial.js +490 -395
- package/terrain/terrainMaterial.js.map +1 -1
- package/triPlanar/triPlanarMaterial.d.ts +8 -8
- package/triPlanar/triPlanarMaterial.js +460 -369
- package/triPlanar/triPlanarMaterial.js.map +1 -1
- package/water/waterMaterial.d.ts +7 -7
- package/water/waterMaterial.js +759 -659
- package/water/waterMaterial.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet, __esDecorate, __runInitializers } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
4
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
@@ -44,420 +44,515 @@ class TerrainMaterialDefines extends MaterialDefines {
|
|
|
44
44
|
this.rebuild();
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
47
|
+
let TerrainMaterial = (() => {
|
|
48
|
+
var _a, _TerrainMaterial_mixTexture_accessor_storage, _TerrainMaterial_diffuseTexture1_accessor_storage, _TerrainMaterial_diffuseTexture2_accessor_storage, _TerrainMaterial_diffuseTexture3_accessor_storage, _TerrainMaterial_bumpTexture1_accessor_storage, _TerrainMaterial_bumpTexture2_accessor_storage, _TerrainMaterial_bumpTexture3_accessor_storage, _TerrainMaterial_disableLighting_accessor_storage, _TerrainMaterial_maxSimultaneousLights_accessor_storage;
|
|
49
|
+
let _classSuper = PushMaterial;
|
|
50
|
+
let __mixTexture_decorators;
|
|
51
|
+
let __mixTexture_initializers = [];
|
|
52
|
+
let __mixTexture_extraInitializers = [];
|
|
53
|
+
let _mixTexture_decorators;
|
|
54
|
+
let _mixTexture_initializers = [];
|
|
55
|
+
let _mixTexture_extraInitializers = [];
|
|
56
|
+
let __diffuseTexture1_decorators;
|
|
57
|
+
let __diffuseTexture1_initializers = [];
|
|
58
|
+
let __diffuseTexture1_extraInitializers = [];
|
|
59
|
+
let _diffuseTexture1_decorators;
|
|
60
|
+
let _diffuseTexture1_initializers = [];
|
|
61
|
+
let _diffuseTexture1_extraInitializers = [];
|
|
62
|
+
let __diffuseTexture2_decorators;
|
|
63
|
+
let __diffuseTexture2_initializers = [];
|
|
64
|
+
let __diffuseTexture2_extraInitializers = [];
|
|
65
|
+
let _diffuseTexture2_decorators;
|
|
66
|
+
let _diffuseTexture2_initializers = [];
|
|
67
|
+
let _diffuseTexture2_extraInitializers = [];
|
|
68
|
+
let __diffuseTexture3_decorators;
|
|
69
|
+
let __diffuseTexture3_initializers = [];
|
|
70
|
+
let __diffuseTexture3_extraInitializers = [];
|
|
71
|
+
let _diffuseTexture3_decorators;
|
|
72
|
+
let _diffuseTexture3_initializers = [];
|
|
73
|
+
let _diffuseTexture3_extraInitializers = [];
|
|
74
|
+
let __bumpTexture1_decorators;
|
|
75
|
+
let __bumpTexture1_initializers = [];
|
|
76
|
+
let __bumpTexture1_extraInitializers = [];
|
|
77
|
+
let _bumpTexture1_decorators;
|
|
78
|
+
let _bumpTexture1_initializers = [];
|
|
79
|
+
let _bumpTexture1_extraInitializers = [];
|
|
80
|
+
let __bumpTexture2_decorators;
|
|
81
|
+
let __bumpTexture2_initializers = [];
|
|
82
|
+
let __bumpTexture2_extraInitializers = [];
|
|
83
|
+
let _bumpTexture2_decorators;
|
|
84
|
+
let _bumpTexture2_initializers = [];
|
|
85
|
+
let _bumpTexture2_extraInitializers = [];
|
|
86
|
+
let __bumpTexture3_decorators;
|
|
87
|
+
let __bumpTexture3_initializers = [];
|
|
88
|
+
let __bumpTexture3_extraInitializers = [];
|
|
89
|
+
let _bumpTexture3_decorators;
|
|
90
|
+
let _bumpTexture3_initializers = [];
|
|
91
|
+
let _bumpTexture3_extraInitializers = [];
|
|
92
|
+
let _diffuseColor_decorators;
|
|
93
|
+
let _diffuseColor_initializers = [];
|
|
94
|
+
let _diffuseColor_extraInitializers = [];
|
|
95
|
+
let _specularColor_decorators;
|
|
96
|
+
let _specularColor_initializers = [];
|
|
97
|
+
let _specularColor_extraInitializers = [];
|
|
98
|
+
let _specularPower_decorators;
|
|
99
|
+
let _specularPower_initializers = [];
|
|
100
|
+
let _specularPower_extraInitializers = [];
|
|
101
|
+
let __disableLighting_decorators;
|
|
102
|
+
let __disableLighting_initializers = [];
|
|
103
|
+
let __disableLighting_extraInitializers = [];
|
|
104
|
+
let _disableLighting_decorators;
|
|
105
|
+
let _disableLighting_initializers = [];
|
|
106
|
+
let _disableLighting_extraInitializers = [];
|
|
107
|
+
let __maxSimultaneousLights_decorators;
|
|
108
|
+
let __maxSimultaneousLights_initializers = [];
|
|
109
|
+
let __maxSimultaneousLights_extraInitializers = [];
|
|
110
|
+
let _maxSimultaneousLights_decorators;
|
|
111
|
+
let _maxSimultaneousLights_initializers = [];
|
|
112
|
+
let _maxSimultaneousLights_extraInitializers = [];
|
|
113
|
+
return _a = class TerrainMaterial extends _classSuper {
|
|
114
|
+
get mixTexture() { return __classPrivateFieldGet(this, _TerrainMaterial_mixTexture_accessor_storage, "f"); }
|
|
115
|
+
set mixTexture(value) { __classPrivateFieldSet(this, _TerrainMaterial_mixTexture_accessor_storage, value, "f"); }
|
|
116
|
+
get diffuseTexture1() { return __classPrivateFieldGet(this, _TerrainMaterial_diffuseTexture1_accessor_storage, "f"); }
|
|
117
|
+
set diffuseTexture1(value) { __classPrivateFieldSet(this, _TerrainMaterial_diffuseTexture1_accessor_storage, value, "f"); }
|
|
118
|
+
get diffuseTexture2() { return __classPrivateFieldGet(this, _TerrainMaterial_diffuseTexture2_accessor_storage, "f"); }
|
|
119
|
+
set diffuseTexture2(value) { __classPrivateFieldSet(this, _TerrainMaterial_diffuseTexture2_accessor_storage, value, "f"); }
|
|
120
|
+
get diffuseTexture3() { return __classPrivateFieldGet(this, _TerrainMaterial_diffuseTexture3_accessor_storage, "f"); }
|
|
121
|
+
set diffuseTexture3(value) { __classPrivateFieldSet(this, _TerrainMaterial_diffuseTexture3_accessor_storage, value, "f"); }
|
|
122
|
+
get bumpTexture1() { return __classPrivateFieldGet(this, _TerrainMaterial_bumpTexture1_accessor_storage, "f"); }
|
|
123
|
+
set bumpTexture1(value) { __classPrivateFieldSet(this, _TerrainMaterial_bumpTexture1_accessor_storage, value, "f"); }
|
|
124
|
+
get bumpTexture2() { return __classPrivateFieldGet(this, _TerrainMaterial_bumpTexture2_accessor_storage, "f"); }
|
|
125
|
+
set bumpTexture2(value) { __classPrivateFieldSet(this, _TerrainMaterial_bumpTexture2_accessor_storage, value, "f"); }
|
|
126
|
+
get bumpTexture3() { return __classPrivateFieldGet(this, _TerrainMaterial_bumpTexture3_accessor_storage, "f"); }
|
|
127
|
+
set bumpTexture3(value) { __classPrivateFieldSet(this, _TerrainMaterial_bumpTexture3_accessor_storage, value, "f"); }
|
|
128
|
+
get disableLighting() { return __classPrivateFieldGet(this, _TerrainMaterial_disableLighting_accessor_storage, "f"); }
|
|
129
|
+
set disableLighting(value) { __classPrivateFieldSet(this, _TerrainMaterial_disableLighting_accessor_storage, value, "f"); }
|
|
130
|
+
get maxSimultaneousLights() { return __classPrivateFieldGet(this, _TerrainMaterial_maxSimultaneousLights_accessor_storage, "f"); }
|
|
131
|
+
set maxSimultaneousLights(value) { __classPrivateFieldSet(this, _TerrainMaterial_maxSimultaneousLights_accessor_storage, value, "f"); }
|
|
132
|
+
/**
|
|
133
|
+
* Instantiates a Terrain Material in the given scene
|
|
134
|
+
* @param name The friendly name of the material
|
|
135
|
+
* @param scene The scene to add the material to
|
|
136
|
+
* @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
|
|
137
|
+
*/
|
|
138
|
+
constructor(name, scene, forceGLSL = false) {
|
|
139
|
+
super(name, scene, undefined, forceGLSL);
|
|
140
|
+
this._mixTexture = __runInitializers(this, __mixTexture_initializers, void 0);
|
|
141
|
+
_TerrainMaterial_mixTexture_accessor_storage.set(this, (__runInitializers(this, __mixTexture_extraInitializers), __runInitializers(this, _mixTexture_initializers, void 0)));
|
|
142
|
+
this._diffuseTexture1 = (__runInitializers(this, _mixTexture_extraInitializers), __runInitializers(this, __diffuseTexture1_initializers, void 0));
|
|
143
|
+
_TerrainMaterial_diffuseTexture1_accessor_storage.set(this, (__runInitializers(this, __diffuseTexture1_extraInitializers), __runInitializers(this, _diffuseTexture1_initializers, void 0)));
|
|
144
|
+
this._diffuseTexture2 = (__runInitializers(this, _diffuseTexture1_extraInitializers), __runInitializers(this, __diffuseTexture2_initializers, void 0));
|
|
145
|
+
_TerrainMaterial_diffuseTexture2_accessor_storage.set(this, (__runInitializers(this, __diffuseTexture2_extraInitializers), __runInitializers(this, _diffuseTexture2_initializers, void 0)));
|
|
146
|
+
this._diffuseTexture3 = (__runInitializers(this, _diffuseTexture2_extraInitializers), __runInitializers(this, __diffuseTexture3_initializers, void 0));
|
|
147
|
+
_TerrainMaterial_diffuseTexture3_accessor_storage.set(this, (__runInitializers(this, __diffuseTexture3_extraInitializers), __runInitializers(this, _diffuseTexture3_initializers, void 0)));
|
|
148
|
+
this._bumpTexture1 = (__runInitializers(this, _diffuseTexture3_extraInitializers), __runInitializers(this, __bumpTexture1_initializers, void 0));
|
|
149
|
+
_TerrainMaterial_bumpTexture1_accessor_storage.set(this, (__runInitializers(this, __bumpTexture1_extraInitializers), __runInitializers(this, _bumpTexture1_initializers, void 0)));
|
|
150
|
+
this._bumpTexture2 = (__runInitializers(this, _bumpTexture1_extraInitializers), __runInitializers(this, __bumpTexture2_initializers, void 0));
|
|
151
|
+
_TerrainMaterial_bumpTexture2_accessor_storage.set(this, (__runInitializers(this, __bumpTexture2_extraInitializers), __runInitializers(this, _bumpTexture2_initializers, void 0)));
|
|
152
|
+
this._bumpTexture3 = (__runInitializers(this, _bumpTexture2_extraInitializers), __runInitializers(this, __bumpTexture3_initializers, void 0));
|
|
153
|
+
_TerrainMaterial_bumpTexture3_accessor_storage.set(this, (__runInitializers(this, __bumpTexture3_extraInitializers), __runInitializers(this, _bumpTexture3_initializers, void 0)));
|
|
154
|
+
this.diffuseColor = (__runInitializers(this, _bumpTexture3_extraInitializers), __runInitializers(this, _diffuseColor_initializers, new Color3(1, 1, 1)));
|
|
155
|
+
this.specularColor = (__runInitializers(this, _diffuseColor_extraInitializers), __runInitializers(this, _specularColor_initializers, new Color3(0, 0, 0)));
|
|
156
|
+
this.specularPower = (__runInitializers(this, _specularColor_extraInitializers), __runInitializers(this, _specularPower_initializers, 64));
|
|
157
|
+
this._disableLighting = (__runInitializers(this, _specularPower_extraInitializers), __runInitializers(this, __disableLighting_initializers, false));
|
|
158
|
+
_TerrainMaterial_disableLighting_accessor_storage.set(this, (__runInitializers(this, __disableLighting_extraInitializers), __runInitializers(this, _disableLighting_initializers, void 0)));
|
|
159
|
+
this._maxSimultaneousLights = (__runInitializers(this, _disableLighting_extraInitializers), __runInitializers(this, __maxSimultaneousLights_initializers, 4));
|
|
160
|
+
_TerrainMaterial_maxSimultaneousLights_accessor_storage.set(this, (__runInitializers(this, __maxSimultaneousLights_extraInitializers), __runInitializers(this, _maxSimultaneousLights_initializers, void 0)));
|
|
161
|
+
this._shadersLoaded = (__runInitializers(this, _maxSimultaneousLights_extraInitializers), false);
|
|
162
|
+
}
|
|
163
|
+
needAlphaBlending() {
|
|
164
|
+
return this.alpha < 1.0;
|
|
78
165
|
}
|
|
79
|
-
|
|
80
|
-
if (!subMesh.materialDefines) {
|
|
81
|
-
subMesh.materialDefines = new TerrainMaterialDefines();
|
|
82
|
-
}
|
|
83
|
-
const defines = subMesh.materialDefines;
|
|
84
|
-
const scene = this.getScene();
|
|
85
|
-
if (this._isReadyForSubMesh(subMesh)) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
const engine = scene.getEngine();
|
|
89
|
-
// Textures
|
|
90
|
-
if (scene.texturesEnabled) {
|
|
91
|
-
if (!this.mixTexture || !this.mixTexture.isReady()) {
|
|
166
|
+
needAlphaTesting() {
|
|
92
167
|
return false;
|
|
93
168
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (!this.diffuseTexture1 || !this.diffuseTexture1.isReady()) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
if (!this.diffuseTexture2 || !this.diffuseTexture2.isReady()) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
if (!this.diffuseTexture3 || !this.diffuseTexture3.isReady()) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
defines.DIFFUSE = true;
|
|
169
|
+
getAlphaTestTexture() {
|
|
170
|
+
return null;
|
|
106
171
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
172
|
+
// Methods
|
|
173
|
+
isReadyForSubMesh(mesh, subMesh, useInstances) {
|
|
174
|
+
const drawWrapper = subMesh._drawWrapper;
|
|
175
|
+
if (this.isFrozen) {
|
|
176
|
+
if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
110
179
|
}
|
|
111
|
-
if (!
|
|
112
|
-
|
|
180
|
+
if (!subMesh.materialDefines) {
|
|
181
|
+
subMesh.materialDefines = new TerrainMaterialDefines();
|
|
113
182
|
}
|
|
114
|
-
|
|
115
|
-
|
|
183
|
+
const defines = subMesh.materialDefines;
|
|
184
|
+
const scene = this.getScene();
|
|
185
|
+
if (this._isReadyForSubMesh(subMesh)) {
|
|
186
|
+
return true;
|
|
116
187
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// Attribs
|
|
128
|
-
PrepareDefinesForAttributes(mesh, defines, true, true);
|
|
129
|
-
// Get correct effect
|
|
130
|
-
if (defines.isDirty) {
|
|
131
|
-
defines.markAsProcessed();
|
|
132
|
-
scene.resetCachedMaterial();
|
|
133
|
-
// Fallbacks
|
|
134
|
-
const fallbacks = new EffectFallbacks();
|
|
135
|
-
if (defines.FOG) {
|
|
136
|
-
fallbacks.addFallback(1, "FOG");
|
|
137
|
-
}
|
|
138
|
-
HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
|
|
139
|
-
if (defines.NUM_BONE_INFLUENCERS > 0) {
|
|
140
|
-
fallbacks.addCPUSkinningFallback(0, mesh);
|
|
141
|
-
}
|
|
142
|
-
defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
|
|
143
|
-
//Attributes
|
|
144
|
-
const attribs = [VertexBuffer.PositionKind];
|
|
145
|
-
if (defines.NORMAL) {
|
|
146
|
-
attribs.push(VertexBuffer.NormalKind);
|
|
147
|
-
}
|
|
148
|
-
if (defines.UV1) {
|
|
149
|
-
attribs.push(VertexBuffer.UVKind);
|
|
150
|
-
}
|
|
151
|
-
if (defines.UV2) {
|
|
152
|
-
attribs.push(VertexBuffer.UV2Kind);
|
|
153
|
-
}
|
|
154
|
-
if (defines.VERTEXCOLOR) {
|
|
155
|
-
attribs.push(VertexBuffer.ColorKind);
|
|
156
|
-
}
|
|
157
|
-
PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
|
|
158
|
-
PrepareAttributesForInstances(attribs, defines);
|
|
159
|
-
// Legacy browser patch
|
|
160
|
-
const shaderName = "terrain";
|
|
161
|
-
const join = defines.toString();
|
|
162
|
-
const uniforms = [
|
|
163
|
-
"world",
|
|
164
|
-
"view",
|
|
165
|
-
"viewProjection",
|
|
166
|
-
"vEyePosition",
|
|
167
|
-
"vLightsType",
|
|
168
|
-
"vDiffuseColor",
|
|
169
|
-
"vSpecularColor",
|
|
170
|
-
"vFogInfos",
|
|
171
|
-
"vFogColor",
|
|
172
|
-
"pointSize",
|
|
173
|
-
"vTextureInfos",
|
|
174
|
-
"mBones",
|
|
175
|
-
"textureMatrix",
|
|
176
|
-
"diffuse1Infos",
|
|
177
|
-
"diffuse2Infos",
|
|
178
|
-
"diffuse3Infos",
|
|
179
|
-
];
|
|
180
|
-
const samplers = [
|
|
181
|
-
"textureSampler",
|
|
182
|
-
"diffuse1Sampler",
|
|
183
|
-
"diffuse2Sampler",
|
|
184
|
-
"diffuse3Sampler",
|
|
185
|
-
"bump1Sampler",
|
|
186
|
-
"bump2Sampler",
|
|
187
|
-
"bump3Sampler",
|
|
188
|
-
"logarithmicDepthConstant",
|
|
189
|
-
"areaLightsLTC1Sampler",
|
|
190
|
-
"areaLightsLTC2Sampler",
|
|
191
|
-
];
|
|
192
|
-
const uniformBuffers = [];
|
|
193
|
-
AddClipPlaneUniforms(uniforms);
|
|
194
|
-
PrepareUniformsAndSamplersList({
|
|
195
|
-
uniformsNames: uniforms,
|
|
196
|
-
uniformBuffersNames: uniformBuffers,
|
|
197
|
-
samplers: samplers,
|
|
198
|
-
defines: defines,
|
|
199
|
-
maxSimultaneousLights: this.maxSimultaneousLights,
|
|
200
|
-
shaderLanguage: this._shaderLanguage,
|
|
201
|
-
});
|
|
202
|
-
subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
|
|
203
|
-
attributes: attribs,
|
|
204
|
-
uniformsNames: uniforms,
|
|
205
|
-
uniformBuffersNames: uniformBuffers,
|
|
206
|
-
samplers: samplers,
|
|
207
|
-
defines: join,
|
|
208
|
-
fallbacks: fallbacks,
|
|
209
|
-
onCompiled: this.onCompiled,
|
|
210
|
-
onError: this.onError,
|
|
211
|
-
indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights },
|
|
212
|
-
shaderLanguage: this._shaderLanguage,
|
|
213
|
-
extraInitializationsAsync: this._shadersLoaded
|
|
214
|
-
? undefined
|
|
215
|
-
: async () => {
|
|
216
|
-
if (this.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
217
|
-
await Promise.all([import("./wgsl/terrain.vertex.js"), import("./wgsl/terrain.fragment.js")]);
|
|
188
|
+
const engine = scene.getEngine();
|
|
189
|
+
// Textures
|
|
190
|
+
if (scene.texturesEnabled) {
|
|
191
|
+
if (!this.mixTexture || !this.mixTexture.isReady()) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
defines._needUVs = true;
|
|
195
|
+
if (MaterialFlags.DiffuseTextureEnabled) {
|
|
196
|
+
if (!this.diffuseTexture1 || !this.diffuseTexture1.isReady()) {
|
|
197
|
+
return false;
|
|
218
198
|
}
|
|
219
|
-
|
|
220
|
-
|
|
199
|
+
if (!this.diffuseTexture2 || !this.diffuseTexture2.isReady()) {
|
|
200
|
+
return false;
|
|
221
201
|
}
|
|
222
|
-
this.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
202
|
+
if (!this.diffuseTexture3 || !this.diffuseTexture3.isReady()) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
defines.DIFFUSE = true;
|
|
206
|
+
}
|
|
207
|
+
if (this.bumpTexture1 && this.bumpTexture2 && this.bumpTexture3 && MaterialFlags.BumpTextureEnabled) {
|
|
208
|
+
if (!this.bumpTexture1.isReady()) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
if (!this.bumpTexture2.isReady()) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
if (!this.bumpTexture3.isReady()) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
defines._needNormals = true;
|
|
218
|
+
defines.BUMP = true;
|
|
219
|
+
}
|
|
231
220
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
this._activeEffect.setMatrix("textureMatrix", this._mixTexture.getTextureMatrix());
|
|
265
|
-
if (MaterialFlags.DiffuseTextureEnabled) {
|
|
266
|
-
if (this._diffuseTexture1) {
|
|
267
|
-
this._activeEffect.setTexture("diffuse1Sampler", this._diffuseTexture1);
|
|
268
|
-
this._activeEffect.setFloat2("diffuse1Infos", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);
|
|
221
|
+
// Misc.
|
|
222
|
+
PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(mesh), defines, undefined, undefined, undefined, this._isVertexOutputInvariant);
|
|
223
|
+
// Lights
|
|
224
|
+
defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
|
|
225
|
+
// Values that need to be evaluated on every frame
|
|
226
|
+
PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
|
|
227
|
+
// Attribs
|
|
228
|
+
PrepareDefinesForAttributes(mesh, defines, true, true);
|
|
229
|
+
// Get correct effect
|
|
230
|
+
if (defines.isDirty) {
|
|
231
|
+
defines.markAsProcessed();
|
|
232
|
+
scene.resetCachedMaterial();
|
|
233
|
+
// Fallbacks
|
|
234
|
+
const fallbacks = new EffectFallbacks();
|
|
235
|
+
if (defines.FOG) {
|
|
236
|
+
fallbacks.addFallback(1, "FOG");
|
|
237
|
+
}
|
|
238
|
+
HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
|
|
239
|
+
if (defines.NUM_BONE_INFLUENCERS > 0) {
|
|
240
|
+
fallbacks.addCPUSkinningFallback(0, mesh);
|
|
241
|
+
}
|
|
242
|
+
defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
|
|
243
|
+
//Attributes
|
|
244
|
+
const attribs = [VertexBuffer.PositionKind];
|
|
245
|
+
if (defines.NORMAL) {
|
|
246
|
+
attribs.push(VertexBuffer.NormalKind);
|
|
247
|
+
}
|
|
248
|
+
if (defines.UV1) {
|
|
249
|
+
attribs.push(VertexBuffer.UVKind);
|
|
250
|
+
}
|
|
251
|
+
if (defines.UV2) {
|
|
252
|
+
attribs.push(VertexBuffer.UV2Kind);
|
|
269
253
|
}
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
this._activeEffect.setFloat2("diffuse2Infos", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);
|
|
254
|
+
if (defines.VERTEXCOLOR) {
|
|
255
|
+
attribs.push(VertexBuffer.ColorKind);
|
|
273
256
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
257
|
+
PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
|
|
258
|
+
PrepareAttributesForInstances(attribs, defines);
|
|
259
|
+
// Legacy browser patch
|
|
260
|
+
const shaderName = "terrain";
|
|
261
|
+
const join = defines.toString();
|
|
262
|
+
const uniforms = [
|
|
263
|
+
"world",
|
|
264
|
+
"view",
|
|
265
|
+
"viewProjection",
|
|
266
|
+
"vEyePosition",
|
|
267
|
+
"vLightsType",
|
|
268
|
+
"vDiffuseColor",
|
|
269
|
+
"vSpecularColor",
|
|
270
|
+
"vFogInfos",
|
|
271
|
+
"vFogColor",
|
|
272
|
+
"pointSize",
|
|
273
|
+
"vTextureInfos",
|
|
274
|
+
"mBones",
|
|
275
|
+
"textureMatrix",
|
|
276
|
+
"diffuse1Infos",
|
|
277
|
+
"diffuse2Infos",
|
|
278
|
+
"diffuse3Infos",
|
|
279
|
+
];
|
|
280
|
+
const samplers = [
|
|
281
|
+
"textureSampler",
|
|
282
|
+
"diffuse1Sampler",
|
|
283
|
+
"diffuse2Sampler",
|
|
284
|
+
"diffuse3Sampler",
|
|
285
|
+
"bump1Sampler",
|
|
286
|
+
"bump2Sampler",
|
|
287
|
+
"bump3Sampler",
|
|
288
|
+
"logarithmicDepthConstant",
|
|
289
|
+
"areaLightsLTC1Sampler",
|
|
290
|
+
"areaLightsLTC2Sampler",
|
|
291
|
+
];
|
|
292
|
+
const uniformBuffers = [];
|
|
293
|
+
AddClipPlaneUniforms(uniforms);
|
|
294
|
+
PrepareUniformsAndSamplersList({
|
|
295
|
+
uniformsNames: uniforms,
|
|
296
|
+
uniformBuffersNames: uniformBuffers,
|
|
297
|
+
samplers: samplers,
|
|
298
|
+
defines: defines,
|
|
299
|
+
maxSimultaneousLights: this.maxSimultaneousLights,
|
|
300
|
+
shaderLanguage: this._shaderLanguage,
|
|
301
|
+
});
|
|
302
|
+
subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
|
|
303
|
+
attributes: attribs,
|
|
304
|
+
uniformsNames: uniforms,
|
|
305
|
+
uniformBuffersNames: uniformBuffers,
|
|
306
|
+
samplers: samplers,
|
|
307
|
+
defines: join,
|
|
308
|
+
fallbacks: fallbacks,
|
|
309
|
+
onCompiled: this.onCompiled,
|
|
310
|
+
onError: this.onError,
|
|
311
|
+
indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights },
|
|
312
|
+
shaderLanguage: this._shaderLanguage,
|
|
313
|
+
extraInitializationsAsync: this._shadersLoaded
|
|
314
|
+
? undefined
|
|
315
|
+
: async () => {
|
|
316
|
+
if (this.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
317
|
+
await Promise.all([import("./wgsl/terrain.vertex.js"), import("./wgsl/terrain.fragment.js")]);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
await Promise.all([import("./terrain.vertex.js"), import("./terrain.fragment.js")]);
|
|
321
|
+
}
|
|
322
|
+
this._shadersLoaded = true;
|
|
323
|
+
},
|
|
324
|
+
}, engine), defines, this._materialContext);
|
|
325
|
+
}
|
|
326
|
+
// Check if Area Lights have LTC texture.
|
|
327
|
+
if (defines["AREALIGHTUSED"]) {
|
|
328
|
+
for (let index = 0; index < mesh.lightSources.length; index++) {
|
|
329
|
+
if (!mesh.lightSources[index]._isReady()) {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
277
332
|
}
|
|
278
333
|
}
|
|
279
|
-
if (
|
|
280
|
-
|
|
281
|
-
|
|
334
|
+
if (!subMesh.effect || !subMesh.effect.isReady()) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
defines._renderId = scene.getRenderId();
|
|
338
|
+
drawWrapper._wasPreviouslyReady = true;
|
|
339
|
+
drawWrapper._wasPreviouslyUsingInstances = !!useInstances;
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
bindForSubMesh(world, mesh, subMesh) {
|
|
343
|
+
const scene = this.getScene();
|
|
344
|
+
const defines = subMesh.materialDefines;
|
|
345
|
+
if (!defines) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const effect = subMesh.effect;
|
|
349
|
+
if (!effect) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
this._activeEffect = effect;
|
|
353
|
+
// Matrices
|
|
354
|
+
this.bindOnlyWorldMatrix(world);
|
|
355
|
+
this._activeEffect.setMatrix("view", scene.getViewMatrix());
|
|
356
|
+
this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
|
|
357
|
+
// Bones
|
|
358
|
+
BindBonesParameters(mesh, this._activeEffect);
|
|
359
|
+
if (this._mustRebind(scene, effect, subMesh)) {
|
|
360
|
+
// Textures
|
|
361
|
+
if (this.mixTexture) {
|
|
362
|
+
this._activeEffect.setTexture("textureSampler", this._mixTexture);
|
|
363
|
+
this._activeEffect.setFloat2("vTextureInfos", this._mixTexture.coordinatesIndex, this._mixTexture.level);
|
|
364
|
+
this._activeEffect.setMatrix("textureMatrix", this._mixTexture.getTextureMatrix());
|
|
365
|
+
if (MaterialFlags.DiffuseTextureEnabled) {
|
|
366
|
+
if (this._diffuseTexture1) {
|
|
367
|
+
this._activeEffect.setTexture("diffuse1Sampler", this._diffuseTexture1);
|
|
368
|
+
this._activeEffect.setFloat2("diffuse1Infos", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);
|
|
369
|
+
}
|
|
370
|
+
if (this._diffuseTexture2) {
|
|
371
|
+
this._activeEffect.setTexture("diffuse2Sampler", this._diffuseTexture2);
|
|
372
|
+
this._activeEffect.setFloat2("diffuse2Infos", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);
|
|
373
|
+
}
|
|
374
|
+
if (this._diffuseTexture3) {
|
|
375
|
+
this._activeEffect.setTexture("diffuse3Sampler", this._diffuseTexture3);
|
|
376
|
+
this._activeEffect.setFloat2("diffuse3Infos", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (MaterialFlags.BumpTextureEnabled && scene.getEngine().getCaps().standardDerivatives) {
|
|
380
|
+
if (this._bumpTexture1) {
|
|
381
|
+
this._activeEffect.setTexture("bump1Sampler", this._bumpTexture1);
|
|
382
|
+
}
|
|
383
|
+
if (this._bumpTexture2) {
|
|
384
|
+
this._activeEffect.setTexture("bump2Sampler", this._bumpTexture2);
|
|
385
|
+
}
|
|
386
|
+
if (this._bumpTexture3) {
|
|
387
|
+
this._activeEffect.setTexture("bump3Sampler", this._bumpTexture3);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
282
390
|
}
|
|
283
|
-
|
|
284
|
-
|
|
391
|
+
// Clip plane
|
|
392
|
+
BindClipPlane(effect, this, scene);
|
|
393
|
+
// Point size
|
|
394
|
+
if (this.pointsCloud) {
|
|
395
|
+
this._activeEffect.setFloat("pointSize", this.pointSize);
|
|
285
396
|
}
|
|
286
|
-
|
|
287
|
-
|
|
397
|
+
// Log. depth
|
|
398
|
+
if (this._useLogarithmicDepth) {
|
|
399
|
+
BindLogDepth(defines, effect, scene);
|
|
288
400
|
}
|
|
401
|
+
scene.bindEyePosition(effect);
|
|
402
|
+
}
|
|
403
|
+
this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
|
|
404
|
+
if (defines.SPECULARTERM) {
|
|
405
|
+
this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
|
|
289
406
|
}
|
|
407
|
+
if (scene.lightsEnabled && !this.disableLighting) {
|
|
408
|
+
BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
|
|
409
|
+
}
|
|
410
|
+
// View
|
|
411
|
+
if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
|
|
412
|
+
this._activeEffect.setMatrix("view", scene.getViewMatrix());
|
|
413
|
+
}
|
|
414
|
+
// Fog
|
|
415
|
+
BindFogParameters(scene, mesh, this._activeEffect);
|
|
416
|
+
this._afterBind(mesh, this._activeEffect, subMesh);
|
|
290
417
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
418
|
+
getAnimatables() {
|
|
419
|
+
const results = [];
|
|
420
|
+
if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {
|
|
421
|
+
results.push(this.mixTexture);
|
|
422
|
+
}
|
|
423
|
+
return results;
|
|
296
424
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
425
|
+
getActiveTextures() {
|
|
426
|
+
const activeTextures = super.getActiveTextures();
|
|
427
|
+
if (this._mixTexture) {
|
|
428
|
+
activeTextures.push(this._mixTexture);
|
|
429
|
+
}
|
|
430
|
+
if (this._diffuseTexture1) {
|
|
431
|
+
activeTextures.push(this._diffuseTexture1);
|
|
432
|
+
}
|
|
433
|
+
if (this._diffuseTexture2) {
|
|
434
|
+
activeTextures.push(this._diffuseTexture2);
|
|
435
|
+
}
|
|
436
|
+
if (this._diffuseTexture3) {
|
|
437
|
+
activeTextures.push(this._diffuseTexture3);
|
|
438
|
+
}
|
|
439
|
+
if (this._bumpTexture1) {
|
|
440
|
+
activeTextures.push(this._bumpTexture1);
|
|
441
|
+
}
|
|
442
|
+
if (this._bumpTexture2) {
|
|
443
|
+
activeTextures.push(this._bumpTexture2);
|
|
444
|
+
}
|
|
445
|
+
if (this._bumpTexture3) {
|
|
446
|
+
activeTextures.push(this._bumpTexture3);
|
|
447
|
+
}
|
|
448
|
+
return activeTextures;
|
|
300
449
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
__decorate([
|
|
409
|
-
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
410
|
-
], TerrainMaterial.prototype, "diffuseTexture1", void 0);
|
|
411
|
-
__decorate([
|
|
412
|
-
serializeAsTexture("diffuseTexture2")
|
|
413
|
-
], TerrainMaterial.prototype, "_diffuseTexture2", void 0);
|
|
414
|
-
__decorate([
|
|
415
|
-
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
416
|
-
], TerrainMaterial.prototype, "diffuseTexture2", void 0);
|
|
417
|
-
__decorate([
|
|
418
|
-
serializeAsTexture("diffuseTexture3")
|
|
419
|
-
], TerrainMaterial.prototype, "_diffuseTexture3", void 0);
|
|
420
|
-
__decorate([
|
|
421
|
-
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
422
|
-
], TerrainMaterial.prototype, "diffuseTexture3", void 0);
|
|
423
|
-
__decorate([
|
|
424
|
-
serializeAsTexture("bumpTexture1")
|
|
425
|
-
], TerrainMaterial.prototype, "_bumpTexture1", void 0);
|
|
426
|
-
__decorate([
|
|
427
|
-
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
428
|
-
], TerrainMaterial.prototype, "bumpTexture1", void 0);
|
|
429
|
-
__decorate([
|
|
430
|
-
serializeAsTexture("bumpTexture2")
|
|
431
|
-
], TerrainMaterial.prototype, "_bumpTexture2", void 0);
|
|
432
|
-
__decorate([
|
|
433
|
-
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
434
|
-
], TerrainMaterial.prototype, "bumpTexture2", void 0);
|
|
435
|
-
__decorate([
|
|
436
|
-
serializeAsTexture("bumpTexture3")
|
|
437
|
-
], TerrainMaterial.prototype, "_bumpTexture3", void 0);
|
|
438
|
-
__decorate([
|
|
439
|
-
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
440
|
-
], TerrainMaterial.prototype, "bumpTexture3", void 0);
|
|
441
|
-
__decorate([
|
|
442
|
-
serializeAsColor3()
|
|
443
|
-
], TerrainMaterial.prototype, "diffuseColor", void 0);
|
|
444
|
-
__decorate([
|
|
445
|
-
serializeAsColor3()
|
|
446
|
-
], TerrainMaterial.prototype, "specularColor", void 0);
|
|
447
|
-
__decorate([
|
|
448
|
-
serialize()
|
|
449
|
-
], TerrainMaterial.prototype, "specularPower", void 0);
|
|
450
|
-
__decorate([
|
|
451
|
-
serialize("disableLighting")
|
|
452
|
-
], TerrainMaterial.prototype, "_disableLighting", void 0);
|
|
453
|
-
__decorate([
|
|
454
|
-
expandToProperty("_markAllSubMeshesAsLightsDirty")
|
|
455
|
-
], TerrainMaterial.prototype, "disableLighting", void 0);
|
|
456
|
-
__decorate([
|
|
457
|
-
serialize("maxSimultaneousLights")
|
|
458
|
-
], TerrainMaterial.prototype, "_maxSimultaneousLights", void 0);
|
|
459
|
-
__decorate([
|
|
460
|
-
expandToProperty("_markAllSubMeshesAsLightsDirty")
|
|
461
|
-
], TerrainMaterial.prototype, "maxSimultaneousLights", void 0);
|
|
450
|
+
hasTexture(texture) {
|
|
451
|
+
if (super.hasTexture(texture)) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
if (this._mixTexture === texture) {
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
if (this._diffuseTexture1 === texture) {
|
|
458
|
+
return true;
|
|
459
|
+
}
|
|
460
|
+
if (this._diffuseTexture2 === texture) {
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
if (this._diffuseTexture3 === texture) {
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
if (this._bumpTexture1 === texture) {
|
|
467
|
+
return true;
|
|
468
|
+
}
|
|
469
|
+
if (this._bumpTexture2 === texture) {
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
if (this._bumpTexture3 === texture) {
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
dispose(forceDisposeEffect) {
|
|
478
|
+
if (this.mixTexture) {
|
|
479
|
+
this.mixTexture.dispose();
|
|
480
|
+
}
|
|
481
|
+
super.dispose(forceDisposeEffect);
|
|
482
|
+
}
|
|
483
|
+
clone(name) {
|
|
484
|
+
return SerializationHelper.Clone(() => new _a(name, this.getScene()), this);
|
|
485
|
+
}
|
|
486
|
+
serialize() {
|
|
487
|
+
const serializationObject = super.serialize();
|
|
488
|
+
serializationObject.customType = "BABYLON.TerrainMaterial";
|
|
489
|
+
return serializationObject;
|
|
490
|
+
}
|
|
491
|
+
getClassName() {
|
|
492
|
+
return "TerrainMaterial";
|
|
493
|
+
}
|
|
494
|
+
// Statics
|
|
495
|
+
static Parse(source, scene, rootUrl) {
|
|
496
|
+
return SerializationHelper.Parse(() => new _a(source.name, scene), source, scene, rootUrl);
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
_TerrainMaterial_mixTexture_accessor_storage = new WeakMap(),
|
|
500
|
+
_TerrainMaterial_diffuseTexture1_accessor_storage = new WeakMap(),
|
|
501
|
+
_TerrainMaterial_diffuseTexture2_accessor_storage = new WeakMap(),
|
|
502
|
+
_TerrainMaterial_diffuseTexture3_accessor_storage = new WeakMap(),
|
|
503
|
+
_TerrainMaterial_bumpTexture1_accessor_storage = new WeakMap(),
|
|
504
|
+
_TerrainMaterial_bumpTexture2_accessor_storage = new WeakMap(),
|
|
505
|
+
_TerrainMaterial_bumpTexture3_accessor_storage = new WeakMap(),
|
|
506
|
+
_TerrainMaterial_disableLighting_accessor_storage = new WeakMap(),
|
|
507
|
+
_TerrainMaterial_maxSimultaneousLights_accessor_storage = new WeakMap(),
|
|
508
|
+
(() => {
|
|
509
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
510
|
+
__mixTexture_decorators = [serializeAsTexture("mixTexture")];
|
|
511
|
+
_mixTexture_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
512
|
+
__diffuseTexture1_decorators = [serializeAsTexture("diffuseTexture1")];
|
|
513
|
+
_diffuseTexture1_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
514
|
+
__diffuseTexture2_decorators = [serializeAsTexture("diffuseTexture2")];
|
|
515
|
+
_diffuseTexture2_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
516
|
+
__diffuseTexture3_decorators = [serializeAsTexture("diffuseTexture3")];
|
|
517
|
+
_diffuseTexture3_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
518
|
+
__bumpTexture1_decorators = [serializeAsTexture("bumpTexture1")];
|
|
519
|
+
_bumpTexture1_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
520
|
+
__bumpTexture2_decorators = [serializeAsTexture("bumpTexture2")];
|
|
521
|
+
_bumpTexture2_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
522
|
+
__bumpTexture3_decorators = [serializeAsTexture("bumpTexture3")];
|
|
523
|
+
_bumpTexture3_decorators = [expandToProperty("_markAllSubMeshesAsTexturesDirty")];
|
|
524
|
+
_diffuseColor_decorators = [serializeAsColor3()];
|
|
525
|
+
_specularColor_decorators = [serializeAsColor3()];
|
|
526
|
+
_specularPower_decorators = [serialize()];
|
|
527
|
+
__disableLighting_decorators = [serialize("disableLighting")];
|
|
528
|
+
_disableLighting_decorators = [expandToProperty("_markAllSubMeshesAsLightsDirty")];
|
|
529
|
+
__maxSimultaneousLights_decorators = [serialize("maxSimultaneousLights")];
|
|
530
|
+
_maxSimultaneousLights_decorators = [expandToProperty("_markAllSubMeshesAsLightsDirty")];
|
|
531
|
+
__esDecorate(_a, null, _mixTexture_decorators, { kind: "accessor", name: "mixTexture", static: false, private: false, access: { has: obj => "mixTexture" in obj, get: obj => obj.mixTexture, set: (obj, value) => { obj.mixTexture = value; } }, metadata: _metadata }, _mixTexture_initializers, _mixTexture_extraInitializers);
|
|
532
|
+
__esDecorate(_a, null, _diffuseTexture1_decorators, { kind: "accessor", name: "diffuseTexture1", static: false, private: false, access: { has: obj => "diffuseTexture1" in obj, get: obj => obj.diffuseTexture1, set: (obj, value) => { obj.diffuseTexture1 = value; } }, metadata: _metadata }, _diffuseTexture1_initializers, _diffuseTexture1_extraInitializers);
|
|
533
|
+
__esDecorate(_a, null, _diffuseTexture2_decorators, { kind: "accessor", name: "diffuseTexture2", static: false, private: false, access: { has: obj => "diffuseTexture2" in obj, get: obj => obj.diffuseTexture2, set: (obj, value) => { obj.diffuseTexture2 = value; } }, metadata: _metadata }, _diffuseTexture2_initializers, _diffuseTexture2_extraInitializers);
|
|
534
|
+
__esDecorate(_a, null, _diffuseTexture3_decorators, { kind: "accessor", name: "diffuseTexture3", static: false, private: false, access: { has: obj => "diffuseTexture3" in obj, get: obj => obj.diffuseTexture3, set: (obj, value) => { obj.diffuseTexture3 = value; } }, metadata: _metadata }, _diffuseTexture3_initializers, _diffuseTexture3_extraInitializers);
|
|
535
|
+
__esDecorate(_a, null, _bumpTexture1_decorators, { kind: "accessor", name: "bumpTexture1", static: false, private: false, access: { has: obj => "bumpTexture1" in obj, get: obj => obj.bumpTexture1, set: (obj, value) => { obj.bumpTexture1 = value; } }, metadata: _metadata }, _bumpTexture1_initializers, _bumpTexture1_extraInitializers);
|
|
536
|
+
__esDecorate(_a, null, _bumpTexture2_decorators, { kind: "accessor", name: "bumpTexture2", static: false, private: false, access: { has: obj => "bumpTexture2" in obj, get: obj => obj.bumpTexture2, set: (obj, value) => { obj.bumpTexture2 = value; } }, metadata: _metadata }, _bumpTexture2_initializers, _bumpTexture2_extraInitializers);
|
|
537
|
+
__esDecorate(_a, null, _bumpTexture3_decorators, { kind: "accessor", name: "bumpTexture3", static: false, private: false, access: { has: obj => "bumpTexture3" in obj, get: obj => obj.bumpTexture3, set: (obj, value) => { obj.bumpTexture3 = value; } }, metadata: _metadata }, _bumpTexture3_initializers, _bumpTexture3_extraInitializers);
|
|
538
|
+
__esDecorate(_a, null, _disableLighting_decorators, { kind: "accessor", name: "disableLighting", static: false, private: false, access: { has: obj => "disableLighting" in obj, get: obj => obj.disableLighting, set: (obj, value) => { obj.disableLighting = value; } }, metadata: _metadata }, _disableLighting_initializers, _disableLighting_extraInitializers);
|
|
539
|
+
__esDecorate(_a, null, _maxSimultaneousLights_decorators, { kind: "accessor", name: "maxSimultaneousLights", static: false, private: false, access: { has: obj => "maxSimultaneousLights" in obj, get: obj => obj.maxSimultaneousLights, set: (obj, value) => { obj.maxSimultaneousLights = value; } }, metadata: _metadata }, _maxSimultaneousLights_initializers, _maxSimultaneousLights_extraInitializers);
|
|
540
|
+
__esDecorate(null, null, __mixTexture_decorators, { kind: "field", name: "_mixTexture", static: false, private: false, access: { has: obj => "_mixTexture" in obj, get: obj => obj._mixTexture, set: (obj, value) => { obj._mixTexture = value; } }, metadata: _metadata }, __mixTexture_initializers, __mixTexture_extraInitializers);
|
|
541
|
+
__esDecorate(null, null, __diffuseTexture1_decorators, { kind: "field", name: "_diffuseTexture1", static: false, private: false, access: { has: obj => "_diffuseTexture1" in obj, get: obj => obj._diffuseTexture1, set: (obj, value) => { obj._diffuseTexture1 = value; } }, metadata: _metadata }, __diffuseTexture1_initializers, __diffuseTexture1_extraInitializers);
|
|
542
|
+
__esDecorate(null, null, __diffuseTexture2_decorators, { kind: "field", name: "_diffuseTexture2", static: false, private: false, access: { has: obj => "_diffuseTexture2" in obj, get: obj => obj._diffuseTexture2, set: (obj, value) => { obj._diffuseTexture2 = value; } }, metadata: _metadata }, __diffuseTexture2_initializers, __diffuseTexture2_extraInitializers);
|
|
543
|
+
__esDecorate(null, null, __diffuseTexture3_decorators, { kind: "field", name: "_diffuseTexture3", static: false, private: false, access: { has: obj => "_diffuseTexture3" in obj, get: obj => obj._diffuseTexture3, set: (obj, value) => { obj._diffuseTexture3 = value; } }, metadata: _metadata }, __diffuseTexture3_initializers, __diffuseTexture3_extraInitializers);
|
|
544
|
+
__esDecorate(null, null, __bumpTexture1_decorators, { kind: "field", name: "_bumpTexture1", static: false, private: false, access: { has: obj => "_bumpTexture1" in obj, get: obj => obj._bumpTexture1, set: (obj, value) => { obj._bumpTexture1 = value; } }, metadata: _metadata }, __bumpTexture1_initializers, __bumpTexture1_extraInitializers);
|
|
545
|
+
__esDecorate(null, null, __bumpTexture2_decorators, { kind: "field", name: "_bumpTexture2", static: false, private: false, access: { has: obj => "_bumpTexture2" in obj, get: obj => obj._bumpTexture2, set: (obj, value) => { obj._bumpTexture2 = value; } }, metadata: _metadata }, __bumpTexture2_initializers, __bumpTexture2_extraInitializers);
|
|
546
|
+
__esDecorate(null, null, __bumpTexture3_decorators, { kind: "field", name: "_bumpTexture3", static: false, private: false, access: { has: obj => "_bumpTexture3" in obj, get: obj => obj._bumpTexture3, set: (obj, value) => { obj._bumpTexture3 = value; } }, metadata: _metadata }, __bumpTexture3_initializers, __bumpTexture3_extraInitializers);
|
|
547
|
+
__esDecorate(null, null, _diffuseColor_decorators, { kind: "field", name: "diffuseColor", static: false, private: false, access: { has: obj => "diffuseColor" in obj, get: obj => obj.diffuseColor, set: (obj, value) => { obj.diffuseColor = value; } }, metadata: _metadata }, _diffuseColor_initializers, _diffuseColor_extraInitializers);
|
|
548
|
+
__esDecorate(null, null, _specularColor_decorators, { kind: "field", name: "specularColor", static: false, private: false, access: { has: obj => "specularColor" in obj, get: obj => obj.specularColor, set: (obj, value) => { obj.specularColor = value; } }, metadata: _metadata }, _specularColor_initializers, _specularColor_extraInitializers);
|
|
549
|
+
__esDecorate(null, null, _specularPower_decorators, { kind: "field", name: "specularPower", static: false, private: false, access: { has: obj => "specularPower" in obj, get: obj => obj.specularPower, set: (obj, value) => { obj.specularPower = value; } }, metadata: _metadata }, _specularPower_initializers, _specularPower_extraInitializers);
|
|
550
|
+
__esDecorate(null, null, __disableLighting_decorators, { kind: "field", name: "_disableLighting", static: false, private: false, access: { has: obj => "_disableLighting" in obj, get: obj => obj._disableLighting, set: (obj, value) => { obj._disableLighting = value; } }, metadata: _metadata }, __disableLighting_initializers, __disableLighting_extraInitializers);
|
|
551
|
+
__esDecorate(null, null, __maxSimultaneousLights_decorators, { kind: "field", name: "_maxSimultaneousLights", static: false, private: false, access: { has: obj => "_maxSimultaneousLights" in obj, get: obj => obj._maxSimultaneousLights, set: (obj, value) => { obj._maxSimultaneousLights = value; } }, metadata: _metadata }, __maxSimultaneousLights_initializers, __maxSimultaneousLights_extraInitializers);
|
|
552
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
553
|
+
})(),
|
|
554
|
+
_a;
|
|
555
|
+
})();
|
|
556
|
+
export { TerrainMaterial };
|
|
462
557
|
RegisterClass("BABYLON.TerrainMaterial", TerrainMaterial);
|
|
463
558
|
//# sourceMappingURL=terrainMaterial.js.map
|