playcanvas 2.24.0-beta.34 → 2.24.0-beta.36
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/build/playcanvas/src/core/core.js +2 -2
- package/build/playcanvas/src/framework/lightmapper/lightmapper.js +3 -0
- package/build/playcanvas/src/scene/lighting/lighting-params.d.ts +58 -0
- package/build/playcanvas/src/scene/lighting/lighting-params.js +35 -1
- package/build/playcanvas/src/scene/lighting/lights-buffer.d.ts +7 -1
- package/build/playcanvas/src/scene/lighting/lights-buffer.js +6 -4
- package/build/playcanvas/src/scene/lighting/world-clusters.js +2 -2
- package/build/playcanvas/src/scene/materials/lit-material-options-builder.js +5 -2
- package/build/playcanvas/src/scene/materials/lit-material.js +1 -0
- package/build/playcanvas/src/scene/materials/standard-material-options-builder.d.ts +0 -19
- package/build/playcanvas/src/scene/materials/standard-material-options-builder.js +11 -15
- package/build/playcanvas/src/scene/materials/standard-material-parameters.d.ts +1 -1
- package/build/playcanvas/src/scene/materials/standard-material-parameters.js +1 -1
- package/build/playcanvas/src/scene/materials/standard-material.d.ts +3 -11
- package/build/playcanvas/src/scene/materials/standard-material.js +8 -32
- package/build/playcanvas/src/scene/shader-lib/glsl/chunks/lit/frag/clusteredLight.d.ts +1 -1
- package/build/playcanvas/src/scene/shader-lib/glsl/chunks/lit/frag/clusteredLight.js +58 -32
- package/build/playcanvas/src/scene/shader-lib/glsl/chunks/lit/frag/lighting/lightFunctionLight.d.ts +1 -1
- package/build/playcanvas/src/scene/shader-lib/glsl/chunks/lit/frag/lighting/lightFunctionLight.js +3 -3
- package/build/playcanvas/src/scene/shader-lib/glsl/chunks/lit/frag/ltc.d.ts +1 -1
- package/build/playcanvas/src/scene/shader-lib/glsl/chunks/lit/frag/ltc.js +13 -2
- package/build/playcanvas/src/scene/shader-lib/glsl/chunks/lit/frag/pass-forward/litForwardBackend.d.ts +1 -1
- package/build/playcanvas/src/scene/shader-lib/glsl/chunks/lit/frag/pass-forward/litForwardBackend.js +6 -4
- package/build/playcanvas/src/scene/shader-lib/programs/lit-shader-options.d.ts +8 -0
- package/build/playcanvas/src/scene/shader-lib/programs/lit-shader-options.js +11 -1
- package/build/playcanvas/src/scene/shader-lib/programs/lit-shader.js +10 -1
- package/build/playcanvas/src/scene/shader-lib/wgsl/chunks/lit/frag/clusteredLight.d.ts +1 -1
- package/build/playcanvas/src/scene/shader-lib/wgsl/chunks/lit/frag/clusteredLight.js +59 -32
- package/build/playcanvas/src/scene/shader-lib/wgsl/chunks/lit/frag/lighting/lightFunctionLight.d.ts +1 -1
- package/build/playcanvas/src/scene/shader-lib/wgsl/chunks/lit/frag/lighting/lightFunctionLight.js +3 -3
- package/build/playcanvas/src/scene/shader-lib/wgsl/chunks/lit/frag/ltc.d.ts +1 -1
- package/build/playcanvas/src/scene/shader-lib/wgsl/chunks/lit/frag/ltc.js +13 -2
- package/build/playcanvas/src/scene/shader-lib/wgsl/chunks/lit/frag/pass-forward/litForwardBackend.d.ts +1 -1
- package/build/playcanvas/src/scene/shader-lib/wgsl/chunks/lit/frag/pass-forward/litForwardBackend.js +6 -4
- package/build/playcanvas.d.ts +76 -31
- package/build/playcanvas.dbg/src/core/core.js +2 -2
- package/build/playcanvas.dbg/src/framework/lightmapper/lightmapper.js +3 -0
- package/build/playcanvas.dbg/src/scene/lighting/lighting-params.js +83 -1
- package/build/playcanvas.dbg/src/scene/lighting/lights-buffer.js +12 -4
- package/build/playcanvas.dbg/src/scene/lighting/world-clusters.js +2 -2
- package/build/playcanvas.dbg/src/scene/materials/lit-material-options-builder.js +5 -2
- package/build/playcanvas.dbg/src/scene/materials/lit-material.js +1 -0
- package/build/playcanvas.dbg/src/scene/materials/standard-material-options-builder.js +13 -38
- package/build/playcanvas.dbg/src/scene/materials/standard-material-parameters.js +1 -1
- package/build/playcanvas.dbg/src/scene/materials/standard-material.js +8 -32
- package/build/playcanvas.dbg/src/scene/shader-lib/glsl/chunks/lit/frag/clusteredLight.js +75 -39
- package/build/playcanvas.dbg/src/scene/shader-lib/glsl/chunks/lit/frag/lighting/lightFunctionLight.js +4 -3
- package/build/playcanvas.dbg/src/scene/shader-lib/glsl/chunks/lit/frag/ltc.js +17 -2
- package/build/playcanvas.dbg/src/scene/shader-lib/glsl/chunks/lit/frag/pass-forward/litForwardBackend.js +10 -6
- package/build/playcanvas.dbg/src/scene/shader-lib/programs/lit-shader-options.js +18 -1
- package/build/playcanvas.dbg/src/scene/shader-lib/programs/lit-shader.js +10 -1
- package/build/playcanvas.dbg/src/scene/shader-lib/wgsl/chunks/lit/frag/clusteredLight.js +76 -39
- package/build/playcanvas.dbg/src/scene/shader-lib/wgsl/chunks/lit/frag/lighting/lightFunctionLight.js +4 -3
- package/build/playcanvas.dbg/src/scene/shader-lib/wgsl/chunks/lit/frag/ltc.js +17 -2
- package/build/playcanvas.dbg/src/scene/shader-lib/wgsl/chunks/lit/frag/pass-forward/litForwardBackend.js +10 -6
- package/build/playcanvas.dbg.js +357 -179
- package/build/playcanvas.dbg.mjs +357 -179
- package/build/playcanvas.js +244 -144
- package/build/playcanvas.min.js +923 -844
- package/build/playcanvas.min.mjs +918 -839
- package/build/playcanvas.mjs +244 -143
- package/build/playcanvas.prf/src/core/core.js +2 -2
- package/build/playcanvas.prf/src/framework/lightmapper/lightmapper.js +3 -0
- package/build/playcanvas.prf/src/scene/lighting/lighting-params.js +35 -1
- package/build/playcanvas.prf/src/scene/lighting/lights-buffer.js +6 -4
- package/build/playcanvas.prf/src/scene/lighting/world-clusters.js +2 -2
- package/build/playcanvas.prf/src/scene/materials/lit-material-options-builder.js +5 -2
- package/build/playcanvas.prf/src/scene/materials/lit-material.js +1 -0
- package/build/playcanvas.prf/src/scene/materials/standard-material-options-builder.js +11 -15
- package/build/playcanvas.prf/src/scene/materials/standard-material-parameters.js +1 -1
- package/build/playcanvas.prf/src/scene/materials/standard-material.js +8 -32
- package/build/playcanvas.prf/src/scene/shader-lib/glsl/chunks/lit/frag/clusteredLight.js +58 -32
- package/build/playcanvas.prf/src/scene/shader-lib/glsl/chunks/lit/frag/lighting/lightFunctionLight.js +3 -3
- package/build/playcanvas.prf/src/scene/shader-lib/glsl/chunks/lit/frag/ltc.js +13 -2
- package/build/playcanvas.prf/src/scene/shader-lib/glsl/chunks/lit/frag/pass-forward/litForwardBackend.js +6 -4
- package/build/playcanvas.prf/src/scene/shader-lib/programs/lit-shader-options.js +11 -1
- package/build/playcanvas.prf/src/scene/shader-lib/programs/lit-shader.js +10 -1
- package/build/playcanvas.prf/src/scene/shader-lib/wgsl/chunks/lit/frag/clusteredLight.js +59 -32
- package/build/playcanvas.prf/src/scene/shader-lib/wgsl/chunks/lit/frag/lighting/lightFunctionLight.js +3 -3
- package/build/playcanvas.prf/src/scene/shader-lib/wgsl/chunks/lit/frag/ltc.js +13 -2
- package/build/playcanvas.prf/src/scene/shader-lib/wgsl/chunks/lit/frag/pass-forward/litForwardBackend.js +6 -4
- package/build/playcanvas.prf.js +244 -144
- package/build/playcanvas.prf.mjs +244 -143
- package/package.json +1 -1
|
@@ -130,6 +130,9 @@ class Lightmapper {
|
|
|
130
130
|
lightingParams.cookiesEnabled = srcParams.cookiesEnabled;
|
|
131
131
|
lightingParams.cookieAtlasResolution = srcParams.cookieAtlasResolution;
|
|
132
132
|
lightingParams.areaLightsEnabled = srcParams.areaLightsEnabled;
|
|
133
|
+
lightingParams.areaLightRectEnabled = srcParams.areaLightRectEnabled;
|
|
134
|
+
lightingParams.areaLightDiskEnabled = srcParams.areaLightDiskEnabled;
|
|
135
|
+
lightingParams.areaLightSphereEnabled = srcParams.areaLightSphereEnabled;
|
|
133
136
|
lightingParams.cells = new Vec3(3, 3, 3);
|
|
134
137
|
lightingParams.maxLightsPerCell = 4;
|
|
135
138
|
this.worldClusters = new WorldClusters(device);
|
|
@@ -14,6 +14,12 @@ export class LightingParams {
|
|
|
14
14
|
/** @private */
|
|
15
15
|
private _areaLightsEnabled;
|
|
16
16
|
/** @private */
|
|
17
|
+
private _areaLightRectEnabled;
|
|
18
|
+
/** @private */
|
|
19
|
+
private _areaLightDiskEnabled;
|
|
20
|
+
/** @private */
|
|
21
|
+
private _areaLightSphereEnabled;
|
|
22
|
+
/** @private */
|
|
17
23
|
private _cells;
|
|
18
24
|
/** @private */
|
|
19
25
|
private _maxLightsPerCell;
|
|
@@ -174,5 +180,57 @@ export class LightingParams {
|
|
|
174
180
|
* @type {Vec3}
|
|
175
181
|
*/
|
|
176
182
|
get cells(): Vec3;
|
|
183
|
+
/**
|
|
184
|
+
* Sets whether clustered lighting supports area lights of rectangular shape
|
|
185
|
+
* ({@link LIGHTSHAPE_RECT}). The lit shaders only include the code of the enabled area light
|
|
186
|
+
* shapes, so disabling the shapes a scene does not use makes them faster to compile, most
|
|
187
|
+
* noticeably on Windows. Area lights of a disabled shape are rendered as punctual lights. Only
|
|
188
|
+
* used when {@link LightingParams#areaLightsEnabled} is true. Defaults to true.
|
|
189
|
+
*
|
|
190
|
+
* @type {boolean}
|
|
191
|
+
*/
|
|
192
|
+
set areaLightRectEnabled(value: boolean);
|
|
193
|
+
/**
|
|
194
|
+
* Gets whether clustered lighting supports area lights of rectangular shape.
|
|
195
|
+
*
|
|
196
|
+
* @type {boolean}
|
|
197
|
+
*/
|
|
198
|
+
get areaLightRectEnabled(): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Sets whether clustered lighting supports area lights of disk shape ({@link LIGHTSHAPE_DISK}).
|
|
201
|
+
* Area lights of a disabled shape are rendered as punctual lights, see
|
|
202
|
+
* {@link LightingParams#areaLightRectEnabled}. Defaults to true.
|
|
203
|
+
*
|
|
204
|
+
* @type {boolean}
|
|
205
|
+
*/
|
|
206
|
+
set areaLightDiskEnabled(value: boolean);
|
|
207
|
+
/**
|
|
208
|
+
* Gets whether clustered lighting supports area lights of disk shape.
|
|
209
|
+
*
|
|
210
|
+
* @type {boolean}
|
|
211
|
+
*/
|
|
212
|
+
get areaLightDiskEnabled(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Sets whether clustered lighting supports area lights of sphere shape
|
|
215
|
+
* ({@link LIGHTSHAPE_SPHERE}). Area lights of a disabled shape are rendered as punctual lights,
|
|
216
|
+
* see {@link LightingParams#areaLightRectEnabled}. Defaults to true.
|
|
217
|
+
*
|
|
218
|
+
* @type {boolean}
|
|
219
|
+
*/
|
|
220
|
+
set areaLightSphereEnabled(value: boolean);
|
|
221
|
+
/**
|
|
222
|
+
* Gets whether clustered lighting supports area lights of sphere shape.
|
|
223
|
+
*
|
|
224
|
+
* @type {boolean}
|
|
225
|
+
*/
|
|
226
|
+
get areaLightSphereEnabled(): boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Bit mask (1 << shape) of the area light shapes the clustered lighting supports, 0 when area
|
|
229
|
+
* lights are disabled.
|
|
230
|
+
*
|
|
231
|
+
* @type {number}
|
|
232
|
+
* @ignore
|
|
233
|
+
*/
|
|
234
|
+
get areaLightShapes(): number;
|
|
177
235
|
}
|
|
178
236
|
import { Vec3 } from '../../core/math/vec3.js';
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { math } from "../../core/math/math.js";
|
|
2
2
|
import { Vec3 } from "../../core/math/vec3.js";
|
|
3
|
-
import { SHADOW_PCF3_32F } from "../constants.js";
|
|
3
|
+
import { LIGHTSHAPE_DISK, LIGHTSHAPE_RECT, LIGHTSHAPE_SPHERE, SHADOW_PCF3_32F } from "../constants.js";
|
|
4
4
|
class LightingParams {
|
|
5
5
|
_areaLightsEnabled = false;
|
|
6
|
+
_areaLightRectEnabled = true;
|
|
7
|
+
_areaLightDiskEnabled = true;
|
|
8
|
+
_areaLightSphereEnabled = true;
|
|
6
9
|
_cells = new Vec3(10, 3, 10);
|
|
7
10
|
_maxLightsPerCell = 255;
|
|
8
11
|
_maxLights = 255;
|
|
@@ -90,6 +93,37 @@ class LightingParams {
|
|
|
90
93
|
get areaLightsEnabled() {
|
|
91
94
|
return this._areaLightsEnabled;
|
|
92
95
|
}
|
|
96
|
+
set areaLightRectEnabled(value) {
|
|
97
|
+
if (this._areaLightRectEnabled !== value) {
|
|
98
|
+
this._areaLightRectEnabled = value;
|
|
99
|
+
this._dirtyLightsFnc();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
get areaLightRectEnabled() {
|
|
103
|
+
return this._areaLightRectEnabled;
|
|
104
|
+
}
|
|
105
|
+
set areaLightDiskEnabled(value) {
|
|
106
|
+
if (this._areaLightDiskEnabled !== value) {
|
|
107
|
+
this._areaLightDiskEnabled = value;
|
|
108
|
+
this._dirtyLightsFnc();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
get areaLightDiskEnabled() {
|
|
112
|
+
return this._areaLightDiskEnabled;
|
|
113
|
+
}
|
|
114
|
+
set areaLightSphereEnabled(value) {
|
|
115
|
+
if (this._areaLightSphereEnabled !== value) {
|
|
116
|
+
this._areaLightSphereEnabled = value;
|
|
117
|
+
this._dirtyLightsFnc();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
get areaLightSphereEnabled() {
|
|
121
|
+
return this._areaLightSphereEnabled;
|
|
122
|
+
}
|
|
123
|
+
get areaLightShapes() {
|
|
124
|
+
if (!this._areaLightsEnabled) return 0;
|
|
125
|
+
return (this._areaLightRectEnabled ? 1 << LIGHTSHAPE_RECT : 0) | (this._areaLightDiskEnabled ? 1 << LIGHTSHAPE_DISK : 0) | (this._areaLightSphereEnabled ? 1 << LIGHTSHAPE_SPHERE : 0);
|
|
126
|
+
}
|
|
93
127
|
set shadowsEnabled(value) {
|
|
94
128
|
if (this._shadowsEnabled !== value) {
|
|
95
129
|
this._shadowsEnabled = value;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export class LightsBuffer {
|
|
2
2
|
constructor(device: any);
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Bit mask (1 << shape) of the area light shapes the lit shaders support, 0 when area lights
|
|
5
|
+
* are disabled.
|
|
6
|
+
*
|
|
7
|
+
* @type {number}
|
|
8
|
+
*/
|
|
9
|
+
areaLightShapes: number;
|
|
4
10
|
/**
|
|
5
11
|
* Texture storing properties of all lights, one row of pixels per light.
|
|
6
12
|
*
|
|
@@ -49,7 +49,7 @@ const lightBufferDefines = `
|
|
|
49
49
|
${buildShaderDefines(enums, "")}
|
|
50
50
|
`;
|
|
51
51
|
class LightsBuffer {
|
|
52
|
-
|
|
52
|
+
areaLightShapes = 0;
|
|
53
53
|
lightsTexture = null;
|
|
54
54
|
_maxLights = 0;
|
|
55
55
|
constructor(device) {
|
|
@@ -58,7 +58,7 @@ class LightsBuffer {
|
|
|
58
58
|
ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("lightBufferDefinesPS", lightBufferDefines);
|
|
59
59
|
this.cookiesEnabled = false;
|
|
60
60
|
this.shadowsEnabled = false;
|
|
61
|
-
this.
|
|
61
|
+
this.areaLightShapes = 0;
|
|
62
62
|
this._lightsTextureId = this.device.scope.resolve("lightsTexture");
|
|
63
63
|
this.maxLights = 256;
|
|
64
64
|
this.invMaxColorValue = 0;
|
|
@@ -133,7 +133,7 @@ class LightsBuffer {
|
|
|
133
133
|
const isSpot = light._type === LIGHTTYPE_SPOT;
|
|
134
134
|
const hasAtlasViewport = light.atlasViewportAllocated;
|
|
135
135
|
const isCookie = this.cookiesEnabled && !!light._cookie && hasAtlasViewport;
|
|
136
|
-
const isArea = this.
|
|
136
|
+
const isArea = (this.areaLightShapes & 1 << light.shape) !== 0;
|
|
137
137
|
const castShadows = this.shadowsEnabled && light.castShadows && hasAtlasViewport;
|
|
138
138
|
const pos = light._node.getPosition();
|
|
139
139
|
let lightProjectionMatrix = null;
|
|
@@ -174,7 +174,9 @@ class LightsBuffer {
|
|
|
174
174
|
dataFloat[dataFloatStart + 4 * TextureIndexFloat.DIRECTION_FLAGS + 1] = tempVec3.y;
|
|
175
175
|
dataFloat[dataFloatStart + 4 * TextureIndexFloat.DIRECTION_FLAGS + 2] = tempVec3.z;
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
let flags = light.getClusteredFlags(castShadows, isCookie);
|
|
178
|
+
if (!isArea) flags &= ~(3 << 28);
|
|
179
|
+
dataUint[dataFloatStart + 4 * TextureIndexFloat.DIRECTION_FLAGS + 3] = flags;
|
|
178
180
|
if (lightProjectionMatrix) {
|
|
179
181
|
const matData = lightProjectionMatrix.data;
|
|
180
182
|
for (let m = 0; m < 16; m++) {
|
|
@@ -104,7 +104,7 @@ class WorldClusters {
|
|
|
104
104
|
this.maxLights = lightingParams.maxLights;
|
|
105
105
|
this.lightsBuffer.cookiesEnabled = lightingParams.cookiesEnabled;
|
|
106
106
|
this.lightsBuffer.shadowsEnabled = lightingParams.shadowsEnabled;
|
|
107
|
-
this.lightsBuffer.
|
|
107
|
+
this.lightsBuffer.areaLightShapes = lightingParams.areaLightShapes;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
updateCells() {
|
|
@@ -226,7 +226,7 @@ class WorldClusters {
|
|
|
226
226
|
updateClusters(lightingParams) {
|
|
227
227
|
this.counts.fill(0);
|
|
228
228
|
this.clusters.fill(0);
|
|
229
|
-
this.lightsBuffer.
|
|
229
|
+
this.lightsBuffer.areaLightShapes = lightingParams ? lightingParams.areaLightShapes : 0;
|
|
230
230
|
const divX = this._cells.x;
|
|
231
231
|
const divZ = this._cells.z;
|
|
232
232
|
const counts = this.counts;
|
|
@@ -51,12 +51,15 @@ class LitMaterialOptionsBuilder {
|
|
|
51
51
|
litOptions.clusteredLightingCookiesEnabled = scene.lighting.cookiesEnabled;
|
|
52
52
|
litOptions.clusteredLightingShadowsEnabled = scene.lighting.shadowsEnabled;
|
|
53
53
|
litOptions.clusteredLightingShadowType = scene.lighting.shadowType;
|
|
54
|
-
|
|
54
|
+
const areaLightShapes = scene.lighting.areaLightShapes;
|
|
55
|
+
litOptions.clusteredLightingAreaLightsEnabled = areaLightShapes !== 0;
|
|
56
|
+
litOptions.clusteredLightingAreaLightShapes = areaLightShapes;
|
|
55
57
|
} else {
|
|
56
58
|
litOptions.clusteredLightingEnabled = false;
|
|
57
59
|
litOptions.clusteredLightingCookiesEnabled = false;
|
|
58
60
|
litOptions.clusteredLightingShadowsEnabled = false;
|
|
59
61
|
litOptions.clusteredLightingAreaLightsEnabled = false;
|
|
62
|
+
litOptions.clusteredLightingAreaLightShapes = 0;
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
static updateMaterialOptions(litOptions, material) {
|
|
@@ -64,7 +67,7 @@ class LitMaterialOptionsBuilder {
|
|
|
64
67
|
litOptions.pixelSnap = material.pixelSnap;
|
|
65
68
|
litOptions.ambientSH = material.ambientSH;
|
|
66
69
|
litOptions.occludeSpecular = material.occludeSpecular;
|
|
67
|
-
litOptions.occludeSpecularFloat =
|
|
70
|
+
litOptions.occludeSpecularFloat = true;
|
|
68
71
|
litOptions.useMsdf = false;
|
|
69
72
|
litOptions.msdfTextAttribute = false;
|
|
70
73
|
litOptions.alphaToCoverage = material.alphaToCoverage;
|
|
@@ -51,6 +51,7 @@ class LitMaterial extends Material {
|
|
|
51
51
|
super.updateUniforms(device, scene);
|
|
52
52
|
this.setParameter("material_occludeDirect", this.occludeDirect ? 1 : 0);
|
|
53
53
|
this.setParameter("material_twoSidedLighting", this.twoSidedLighting ? 1 : 0);
|
|
54
|
+
this.setParameter("material_occludeSpecularIntensity", this.occludeSpecularIntensity);
|
|
54
55
|
}
|
|
55
56
|
getShaderVariant(params) {
|
|
56
57
|
options.usedUvs = this.usedUvs.slice();
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
export class StandardMaterialOptionsBuilder {
|
|
2
|
-
/**
|
|
3
|
-
* The refraction index for which the shader uses a built-in constant instead of the
|
|
4
|
-
* material_refractionIndex uniform. Shared with StandardMaterial, which needs to invalidate its
|
|
5
|
-
* shaders when refractionIndex moves across this value.
|
|
6
|
-
*
|
|
7
|
-
* @type {number}
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
static DEFAULT_REFRACTION_INDEX: number;
|
|
11
|
-
/**
|
|
12
|
-
* Compares two material numbers with the tolerance used to decide whether a shader constant can
|
|
13
|
-
* replace a uniform.
|
|
14
|
-
*
|
|
15
|
-
* @param {number} a - The first value.
|
|
16
|
-
* @param {number} b - The second value.
|
|
17
|
-
* @returns {boolean} True when the values are equal within tolerance.
|
|
18
|
-
* @ignore
|
|
19
|
-
*/
|
|
20
|
-
static equalish(a: number, b: number): boolean;
|
|
21
2
|
updateMinRef(options: any, scene: any, stdMat: any, objDefs: any, pass: any, lightList: any, vertexFormat: any, outlinePass?: boolean): void;
|
|
22
3
|
updateRef(options: any, scene: any, cameraShaderParams: any, stdMat: any, objDefs: any, pass: any, lightList: any, vertexFormat: any): void;
|
|
23
4
|
_updateSharedOptions(options: any, scene: any, stdMat: any, objDefs: any, pass: any, cameraShaderParams: any): void;
|
|
@@ -44,10 +44,6 @@ const notBlack = (color) => {
|
|
|
44
44
|
return color.r !== 0 || color.g !== 0 || color.b !== 0;
|
|
45
45
|
};
|
|
46
46
|
class StandardMaterialOptionsBuilder {
|
|
47
|
-
static DEFAULT_REFRACTION_INDEX = 1 / 1.5;
|
|
48
|
-
static equalish(a, b) {
|
|
49
|
-
return Math.abs(a - b) < 1e-4;
|
|
50
|
-
}
|
|
51
47
|
// Minimal options for Depth and Shadow passes, and the outline pass
|
|
52
48
|
updateMinRef(options, scene, stdMat, objDefs, pass, lightList, vertexFormat, outlinePass = false) {
|
|
53
49
|
this._updateSharedOptions(options, scene, stdMat, objDefs, pass);
|
|
@@ -86,12 +82,15 @@ class StandardMaterialOptionsBuilder {
|
|
|
86
82
|
options.litOptions.clusteredLightingCookiesEnabled = scene.lighting.cookiesEnabled;
|
|
87
83
|
options.litOptions.clusteredLightingShadowsEnabled = scene.lighting.shadowsEnabled;
|
|
88
84
|
options.litOptions.clusteredLightingShadowType = scene.lighting.shadowType;
|
|
89
|
-
|
|
85
|
+
const areaLightShapes = scene.lighting.areaLightShapes;
|
|
86
|
+
options.litOptions.clusteredLightingAreaLightsEnabled = areaLightShapes !== 0;
|
|
87
|
+
options.litOptions.clusteredLightingAreaLightShapes = areaLightShapes;
|
|
90
88
|
} else {
|
|
91
89
|
options.litOptions.clusteredLightingEnabled = false;
|
|
92
90
|
options.litOptions.clusteredLightingCookiesEnabled = false;
|
|
93
91
|
options.litOptions.clusteredLightingShadowsEnabled = false;
|
|
94
92
|
options.litOptions.clusteredLightingAreaLightsEnabled = false;
|
|
93
|
+
options.litOptions.clusteredLightingAreaLightShapes = 0;
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
_updateUVOptions(options, stdMat, objDefs, vertexFormat, minimalOptions, cameraShaderParams) {
|
|
@@ -166,20 +165,20 @@ class StandardMaterialOptionsBuilder {
|
|
|
166
165
|
_updateMaterialOptions(options, stdMat, scene) {
|
|
167
166
|
const useSpecular = !!(stdMat.useMetalness || stdMat.specularMap || stdMat.sphereMap || stdMat.cubeMap || stdMat.planarReflectionMap || notBlack(stdMat.specular) || stdMat.specularityFactor > 0 && stdMat.useMetalness || stdMat.enableGGXSpecular || stdMat.clearCoat > 0);
|
|
168
167
|
const useSpecularColor = !stdMat.useMetalness || stdMat.useMetalnessSpecularColor;
|
|
169
|
-
const specularityFactorTint = useSpecular && stdMat.useMetalnessSpecularColor
|
|
168
|
+
const specularityFactorTint = useSpecular && stdMat.useMetalnessSpecularColor;
|
|
170
169
|
const isPackedNormalMap = (texture) => texture ? texture.format === PIXELFORMAT_DXT5 || texture.type === TEXTURETYPE_SWIZZLEGGGR : false;
|
|
171
|
-
const { equalish, DEFAULT_REFRACTION_INDEX } = StandardMaterialOptionsBuilder;
|
|
172
|
-
options.specularityFactorTint = specularityFactorTint;
|
|
173
170
|
options.metalnessTint = stdMat.useMetalness;
|
|
174
171
|
options.glossTint = true;
|
|
172
|
+
options.iorTint = true;
|
|
173
|
+
options.refractionTint = true;
|
|
174
|
+
options.thicknessTint = true;
|
|
175
|
+
options.iridescenceTint = true;
|
|
176
|
+
options.specularityFactorTint = specularityFactorTint;
|
|
175
177
|
options.diffuseEncoding = stdMat.diffuseMap?.encoding;
|
|
176
178
|
options.diffuseDetailEncoding = stdMat.diffuseDetailMap?.encoding;
|
|
177
179
|
options.emissiveEncoding = stdMat.emissiveMap?.encoding;
|
|
178
180
|
options.lightMapEncoding = stdMat.lightMap?.encoding;
|
|
179
181
|
options.packedNormal = isPackedNormalMap(stdMat.normalMap);
|
|
180
|
-
options.refractionTint = !equalish(stdMat.refraction, 1);
|
|
181
|
-
options.refractionIndexTint = !equalish(stdMat.refractionIndex, DEFAULT_REFRACTION_INDEX);
|
|
182
|
-
options.thicknessTint = stdMat.useDynamicRefraction && stdMat.thickness !== 1;
|
|
183
182
|
options.specularEncoding = stdMat.specularMap?.encoding;
|
|
184
183
|
options.sheenEncoding = stdMat.sheenMap?.encoding;
|
|
185
184
|
options.diffuseTransmissionColorEncoding = stdMat.diffuseTransmissionColorMap?.encoding;
|
|
@@ -189,10 +188,7 @@ class StandardMaterialOptionsBuilder {
|
|
|
189
188
|
options.normalDetailPackedNormal = isPackedNormalMap(stdMat.normalDetailMap);
|
|
190
189
|
options.diffuseDetailMode = stdMat.diffuseDetailMode;
|
|
191
190
|
options.aoDetailMode = stdMat.aoDetailMode;
|
|
192
|
-
options.clearCoatGloss = !!stdMat.clearCoatGloss;
|
|
193
191
|
options.clearCoatPackedNormal = isPackedNormalMap(stdMat.clearCoatNormalMap);
|
|
194
|
-
options.iorTint = !equalish(stdMat.refractionIndex, DEFAULT_REFRACTION_INDEX);
|
|
195
|
-
options.iridescenceTint = stdMat.iridescence !== 1;
|
|
196
192
|
options.glossInvert = stdMat.glossInvert;
|
|
197
193
|
options.sheenGlossInvert = stdMat.sheenGlossInvert;
|
|
198
194
|
options.clearCoatGlossInvert = stdMat.clearCoatGlossInvert;
|
|
@@ -201,7 +197,7 @@ class StandardMaterialOptionsBuilder {
|
|
|
201
197
|
options.litOptions.pixelSnap = stdMat.pixelSnap;
|
|
202
198
|
options.litOptions.ambientSH = !!stdMat.ambientSH;
|
|
203
199
|
options.litOptions.occludeSpecular = stdMat.occludeSpecular;
|
|
204
|
-
options.litOptions.occludeSpecularFloat =
|
|
200
|
+
options.litOptions.occludeSpecularFloat = true;
|
|
205
201
|
options.litOptions.useMsdf = !!stdMat.msdfMap;
|
|
206
202
|
options.litOptions.msdfTextAttribute = !!stdMat.msdfTextAttribute;
|
|
207
203
|
options.litOptions.alphaToCoverage = stdMat.alphaToCoverage;
|
|
@@ -75,7 +75,6 @@ export namespace standardMaterialParameterTypes {
|
|
|
75
75
|
let metalnessTint: string;
|
|
76
76
|
let occludeSpecular: string;
|
|
77
77
|
let specularityFactor: string;
|
|
78
|
-
let specularityFactorTint: string;
|
|
79
78
|
let diffuseDetailMode: string;
|
|
80
79
|
let vertexColorGamma: string;
|
|
81
80
|
let specular: string;
|
|
@@ -111,5 +110,6 @@ export namespace standardMaterialRemovedParameters {
|
|
|
111
110
|
let useGamma: string;
|
|
112
111
|
let useGammaTonemap: string;
|
|
113
112
|
let sheenGlossTint: string;
|
|
113
|
+
let specularityFactorTint: string;
|
|
114
114
|
let anisotropy: string;
|
|
115
115
|
}
|
|
@@ -34,7 +34,6 @@ const standardMaterialParameterTypes = {
|
|
|
34
34
|
..._textureParameter("specular"),
|
|
35
35
|
occludeSpecular: "enum:occludeSpecular",
|
|
36
36
|
specularityFactor: "number",
|
|
37
|
-
specularityFactorTint: "boolean",
|
|
38
37
|
..._textureParameter("specularityFactor"),
|
|
39
38
|
useMetalness: "boolean",
|
|
40
39
|
metalness: "number",
|
|
@@ -180,6 +179,7 @@ const standardMaterialRemovedParameters = {
|
|
|
180
179
|
useGamma: "boolean",
|
|
181
180
|
useGammaTonemap: "boolean",
|
|
182
181
|
sheenGlossTint: "boolean",
|
|
182
|
+
specularityFactorTint: "boolean",
|
|
183
183
|
anisotropy: "boolean"
|
|
184
184
|
};
|
|
185
185
|
export {
|
|
@@ -96,10 +96,6 @@ export type UpdateShaderCallback = (options: StandardMaterialOptions) => Standar
|
|
|
96
96
|
* @property {boolean} specularVertexColor Multiply specular by the mesh vertex colors.
|
|
97
97
|
* @property {string} specularVertexColorChannel Vertex color channels to use for specular. Can be
|
|
98
98
|
* "r", "g", "b", "a", "rgb" or any swizzled combination.
|
|
99
|
-
* @property {boolean} specularityFactorTint Force inclusion of the constant `specularityFactor`
|
|
100
|
-
* when compositing with `specularityFactorMap` and/or specularity factor vertex colors. Defaults
|
|
101
|
-
* to `false`. Setting this to `true` is rarely needed - the constant is automatically applied
|
|
102
|
-
* whenever `specularityFactor` differs from 1. Provided as an explicit override.
|
|
103
99
|
* @property {Texture|null} specularityFactorMap The factor of specularity as a texture (default is
|
|
104
100
|
* null).
|
|
105
101
|
* @property {number} specularityFactorMapUv Specularity factor map UV channel. Valid values are 0 to 7.
|
|
@@ -108,8 +104,8 @@ export type UpdateShaderCallback = (options: StandardMaterialOptions) => Standar
|
|
|
108
104
|
* between 0 and 1.
|
|
109
105
|
* @property {number} specularityFactorMapRotation Controls the 2D rotation (in degrees) of the specularity factor map.
|
|
110
106
|
* @property {string} specularityFactorMapChannel The channel used by the specularity factor texture to sample from (default is 'a').
|
|
111
|
-
* @property {boolean} specularityFactorVertexColor Use mesh vertex colors for specularity factor.
|
|
112
|
-
*
|
|
107
|
+
* @property {boolean} specularityFactorVertexColor Use mesh vertex colors for specularity factor.
|
|
108
|
+
* They are multiplied by `specularityFactor`, and by `specularityFactorMap` if set.
|
|
113
109
|
* @property {string} specularityFactorVertexColorChannel Vertex color channels to use for specularity factor. Can be
|
|
114
110
|
* "r", "g", "b", "a", "rgb" or any swizzled combination.
|
|
115
111
|
* @property {boolean} enableGGXSpecular Enables GGX specular. Also enables
|
|
@@ -1302,11 +1298,7 @@ export class StandardMaterial extends Material {
|
|
|
1302
1298
|
set specularityFactorMapUv(arg: number);
|
|
1303
1299
|
get specularityFactorMapUv(): number;
|
|
1304
1300
|
|
|
1305
|
-
/**
|
|
1306
|
-
set specularityFactorTint(arg: boolean);
|
|
1307
|
-
get specularityFactorTint(): boolean;
|
|
1308
|
-
|
|
1309
|
-
/** Use mesh vertex colors for specularity factor. If specularityFactorMap or are specularityFactorTint are set, they'll be multiplied by vertex colors. */
|
|
1301
|
+
/** Use mesh vertex colors for specularity factor. They are multiplied by `specularityFactor`, and by `specularityFactorMap` if set. */
|
|
1310
1302
|
set specularityFactorVertexColor(arg: boolean);
|
|
1311
1303
|
get specularityFactorVertexColor(): boolean;
|
|
1312
1304
|
|
|
@@ -115,10 +115,6 @@ const _propertiesByUniform = new Map(_propertyList.map((property) => [property.u
|
|
|
115
115
|
const isBlack = (color) => {
|
|
116
116
|
return color.r === 0 && color.g === 0 && color.b === 0;
|
|
117
117
|
};
|
|
118
|
-
const dirtyShaderOnZeroOrOne = (oldValue, newValue) => {
|
|
119
|
-
return oldValue === 0 || oldValue === 1 || newValue === 0 || newValue === 1;
|
|
120
|
-
};
|
|
121
|
-
const { equalish, DEFAULT_REFRACTION_INDEX } = StandardMaterialOptionsBuilder;
|
|
122
118
|
class StandardMaterial extends Material {
|
|
123
119
|
_usesViewTextures = true;
|
|
124
120
|
static TEXTURE_PARAMETERS = standardMaterialTextureParameters;
|
|
@@ -237,7 +233,7 @@ class StandardMaterial extends Material {
|
|
|
237
233
|
}
|
|
238
234
|
set specularityFactor(value) {
|
|
239
235
|
if (this._specularityFactor !== value) {
|
|
240
|
-
this._dirtyShader = this._dirtyShader ||
|
|
236
|
+
this._dirtyShader = this._dirtyShader || this._specularityFactor > 0 !== value > 0;
|
|
241
237
|
this._specularityFactor = value;
|
|
242
238
|
this._markPropertyModified(_properties.specularityFactor);
|
|
243
239
|
}
|
|
@@ -247,7 +243,6 @@ class StandardMaterial extends Material {
|
|
|
247
243
|
}
|
|
248
244
|
set sheenGloss(value) {
|
|
249
245
|
if (this._sheenGloss !== value) {
|
|
250
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._sheenGloss, value);
|
|
251
246
|
this._sheenGloss = value;
|
|
252
247
|
this._markPropertyModified(_properties.sheenGloss);
|
|
253
248
|
}
|
|
@@ -257,7 +252,6 @@ class StandardMaterial extends Material {
|
|
|
257
252
|
}
|
|
258
253
|
set gloss(value) {
|
|
259
254
|
if (this._gloss !== value) {
|
|
260
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._gloss, value);
|
|
261
255
|
this._gloss = value;
|
|
262
256
|
this._markPropertyModified(_properties.gloss);
|
|
263
257
|
}
|
|
@@ -267,7 +261,6 @@ class StandardMaterial extends Material {
|
|
|
267
261
|
}
|
|
268
262
|
set aoIntensity(value) {
|
|
269
263
|
if (this._aoIntensity !== value) {
|
|
270
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._aoIntensity, value);
|
|
271
264
|
this._aoIntensity = value;
|
|
272
265
|
this._markPropertyModified(_properties.aoIntensity);
|
|
273
266
|
}
|
|
@@ -286,7 +279,6 @@ class StandardMaterial extends Material {
|
|
|
286
279
|
}
|
|
287
280
|
set parallaxSamples(value) {
|
|
288
281
|
if (this._parallaxSamples !== value) {
|
|
289
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._parallaxSamples, value);
|
|
290
282
|
this._parallaxSamples = value;
|
|
291
283
|
this._markPropertyModified(_properties.parallaxSamples);
|
|
292
284
|
}
|
|
@@ -306,7 +298,6 @@ class StandardMaterial extends Material {
|
|
|
306
298
|
}
|
|
307
299
|
set opacity(value) {
|
|
308
300
|
if (this._opacity !== value) {
|
|
309
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._opacity, value);
|
|
310
301
|
this._opacity = value;
|
|
311
302
|
this._markPropertyModified(_properties.opacity);
|
|
312
303
|
this._markPropertyModified(_properties.alphaDither);
|
|
@@ -317,7 +308,6 @@ class StandardMaterial extends Material {
|
|
|
317
308
|
}
|
|
318
309
|
set alphaFade(value) {
|
|
319
310
|
if (this._alphaFade !== value) {
|
|
320
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._alphaFade, value);
|
|
321
311
|
this._alphaFade = value;
|
|
322
312
|
this._markPropertyModified(_properties.alphaFade);
|
|
323
313
|
}
|
|
@@ -327,7 +317,6 @@ class StandardMaterial extends Material {
|
|
|
327
317
|
}
|
|
328
318
|
set bumpiness(value) {
|
|
329
319
|
if (this._bumpiness !== value) {
|
|
330
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._bumpiness, value);
|
|
331
320
|
this._bumpiness = value;
|
|
332
321
|
this._markPropertyModified(_properties.bumpiness);
|
|
333
322
|
}
|
|
@@ -337,7 +326,6 @@ class StandardMaterial extends Material {
|
|
|
337
326
|
}
|
|
338
327
|
set normalDetailMapBumpiness(value) {
|
|
339
328
|
if (this._normalDetailMapBumpiness !== value) {
|
|
340
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._normalDetailMapBumpiness, value);
|
|
341
329
|
this._normalDetailMapBumpiness = value;
|
|
342
330
|
this._markPropertyModified(_properties.normalDetailMapBumpiness);
|
|
343
331
|
}
|
|
@@ -347,7 +335,6 @@ class StandardMaterial extends Material {
|
|
|
347
335
|
}
|
|
348
336
|
set reflectivity(value) {
|
|
349
337
|
if (this._reflectivity !== value) {
|
|
350
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._reflectivity, value);
|
|
351
338
|
this._reflectivity = value;
|
|
352
339
|
this._markPropertyModified(_properties.reflectivity);
|
|
353
340
|
}
|
|
@@ -357,7 +344,6 @@ class StandardMaterial extends Material {
|
|
|
357
344
|
}
|
|
358
345
|
set occludeSpecularIntensity(value) {
|
|
359
346
|
if (this._occludeSpecularIntensity !== value) {
|
|
360
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._occludeSpecularIntensity, value);
|
|
361
347
|
this._occludeSpecularIntensity = value;
|
|
362
348
|
this._markPropertyModified(_properties.occludeSpecularIntensity);
|
|
363
349
|
}
|
|
@@ -367,7 +353,7 @@ class StandardMaterial extends Material {
|
|
|
367
353
|
}
|
|
368
354
|
set refraction(value) {
|
|
369
355
|
if (this._refraction !== value) {
|
|
370
|
-
this._dirtyShader = this._dirtyShader ||
|
|
356
|
+
this._dirtyShader = this._dirtyShader || this._refraction !== 0 !== (value !== 0);
|
|
371
357
|
this._refraction = value;
|
|
372
358
|
this._markPropertyModified(_properties.refraction);
|
|
373
359
|
}
|
|
@@ -377,7 +363,6 @@ class StandardMaterial extends Material {
|
|
|
377
363
|
}
|
|
378
364
|
set refractionIndex(value) {
|
|
379
365
|
if (this._refractionIndex !== value) {
|
|
380
|
-
this._dirtyShader = this._dirtyShader || equalish(this._refractionIndex, DEFAULT_REFRACTION_INDEX) !== equalish(value, DEFAULT_REFRACTION_INDEX);
|
|
381
366
|
this._refractionIndex = value;
|
|
382
367
|
this._markPropertyModified(_properties.refractionIndex);
|
|
383
368
|
}
|
|
@@ -387,7 +372,7 @@ class StandardMaterial extends Material {
|
|
|
387
372
|
}
|
|
388
373
|
set dispersion(value) {
|
|
389
374
|
if (this._dispersion !== value) {
|
|
390
|
-
this._dirtyShader = this._dirtyShader ||
|
|
375
|
+
this._dirtyShader = this._dirtyShader || this._dispersion > 0 !== value > 0;
|
|
391
376
|
this._dispersion = value;
|
|
392
377
|
this._markPropertyModified(_properties.dispersion);
|
|
393
378
|
}
|
|
@@ -397,7 +382,6 @@ class StandardMaterial extends Material {
|
|
|
397
382
|
}
|
|
398
383
|
set thickness(value) {
|
|
399
384
|
if (this._thickness !== value) {
|
|
400
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._thickness, value);
|
|
401
385
|
this._thickness = value;
|
|
402
386
|
this._markPropertyModified(_properties.thickness);
|
|
403
387
|
}
|
|
@@ -416,7 +400,7 @@ class StandardMaterial extends Material {
|
|
|
416
400
|
}
|
|
417
401
|
set anisotropyIntensity(value) {
|
|
418
402
|
if (this._anisotropyIntensity !== value) {
|
|
419
|
-
this._dirtyShader = this._dirtyShader ||
|
|
403
|
+
this._dirtyShader = this._dirtyShader || this.enableGGXSpecular && !this.anisotropyMap && this._anisotropyIntensity > 0 !== value > 0;
|
|
420
404
|
this._anisotropyIntensity = value;
|
|
421
405
|
this._markPropertyModified(_properties.anisotropyIntensity);
|
|
422
406
|
}
|
|
@@ -426,7 +410,7 @@ class StandardMaterial extends Material {
|
|
|
426
410
|
}
|
|
427
411
|
set clearCoat(value) {
|
|
428
412
|
if (this._clearCoat !== value) {
|
|
429
|
-
this._dirtyShader = this._dirtyShader ||
|
|
413
|
+
this._dirtyShader = this._dirtyShader || this._clearCoat !== 0 !== (value !== 0) || this._clearCoat > 0 !== value > 0;
|
|
430
414
|
this._clearCoat = value;
|
|
431
415
|
this._markPropertyModified(_properties.clearCoat);
|
|
432
416
|
}
|
|
@@ -436,7 +420,6 @@ class StandardMaterial extends Material {
|
|
|
436
420
|
}
|
|
437
421
|
set clearCoatGloss(value) {
|
|
438
422
|
if (this._clearCoatGloss !== value) {
|
|
439
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._clearCoatGloss, value);
|
|
440
423
|
this._clearCoatGloss = value;
|
|
441
424
|
this._markPropertyModified(_properties.clearCoatGloss);
|
|
442
425
|
}
|
|
@@ -446,7 +429,6 @@ class StandardMaterial extends Material {
|
|
|
446
429
|
}
|
|
447
430
|
set clearCoatBumpiness(value) {
|
|
448
431
|
if (this._clearCoatBumpiness !== value) {
|
|
449
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._clearCoatBumpiness, value);
|
|
450
432
|
this._clearCoatBumpiness = value;
|
|
451
433
|
this._markPropertyModified(_properties.clearCoatBumpiness);
|
|
452
434
|
}
|
|
@@ -456,7 +438,7 @@ class StandardMaterial extends Material {
|
|
|
456
438
|
}
|
|
457
439
|
set iridescence(value) {
|
|
458
440
|
if (this._iridescence !== value) {
|
|
459
|
-
this._dirtyShader = this._dirtyShader ||
|
|
441
|
+
this._dirtyShader = this._dirtyShader || this.useIridescence && this._iridescence !== 0 !== (value !== 0);
|
|
460
442
|
this._iridescence = value;
|
|
461
443
|
this._markPropertyModified(_properties.iridescence);
|
|
462
444
|
}
|
|
@@ -466,7 +448,6 @@ class StandardMaterial extends Material {
|
|
|
466
448
|
}
|
|
467
449
|
set iridescenceRefractionIndex(value) {
|
|
468
450
|
if (this._iridescenceRefractionIndex !== value) {
|
|
469
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._iridescenceRefractionIndex, value);
|
|
470
451
|
this._iridescenceRefractionIndex = value;
|
|
471
452
|
this._markPropertyModified(_properties.iridescenceRefractionIndex);
|
|
472
453
|
}
|
|
@@ -476,7 +457,6 @@ class StandardMaterial extends Material {
|
|
|
476
457
|
}
|
|
477
458
|
set iridescenceThicknessMin(value) {
|
|
478
459
|
if (this._iridescenceThicknessMin !== value) {
|
|
479
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._iridescenceThicknessMin, value);
|
|
480
460
|
this._iridescenceThicknessMin = value;
|
|
481
461
|
this._markPropertyModified(_properties.iridescenceThicknessMin);
|
|
482
462
|
}
|
|
@@ -486,7 +466,6 @@ class StandardMaterial extends Material {
|
|
|
486
466
|
}
|
|
487
467
|
set iridescenceThicknessMax(value) {
|
|
488
468
|
if (this._iridescenceThicknessMax !== value) {
|
|
489
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._iridescenceThicknessMax, value);
|
|
490
469
|
this._iridescenceThicknessMax = value;
|
|
491
470
|
this._markPropertyModified(_properties.iridescenceThicknessMax);
|
|
492
471
|
}
|
|
@@ -516,7 +495,6 @@ class StandardMaterial extends Material {
|
|
|
516
495
|
}
|
|
517
496
|
set anisotropyRotation(value) {
|
|
518
497
|
if (this._anisotropyRotation !== value) {
|
|
519
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._anisotropyRotation, value);
|
|
520
498
|
this._anisotropyRotation = value;
|
|
521
499
|
this._markPropertyModified(_properties.anisotropyRotation);
|
|
522
500
|
}
|
|
@@ -526,7 +504,6 @@ class StandardMaterial extends Material {
|
|
|
526
504
|
}
|
|
527
505
|
set attenuationDistance(value) {
|
|
528
506
|
if (this._attenuationDistance !== value) {
|
|
529
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._attenuationDistance, value);
|
|
530
507
|
this._attenuationDistance = value;
|
|
531
508
|
this._markPropertyModified(_properties.attenuationDistance);
|
|
532
509
|
}
|
|
@@ -536,7 +513,6 @@ class StandardMaterial extends Material {
|
|
|
536
513
|
}
|
|
537
514
|
set heightMapFactor(value) {
|
|
538
515
|
if (this._heightMapFactor !== value) {
|
|
539
|
-
this._dirtyShader = this._dirtyShader || dirtyShaderOnZeroOrOne(this._heightMapFactor, value);
|
|
540
516
|
this._heightMapFactor = value;
|
|
541
517
|
this._markPropertyModified(_properties.heightMapFactor);
|
|
542
518
|
}
|
|
@@ -912,7 +888,7 @@ function _defineMaterialProps() {
|
|
|
912
888
|
registerProp("reflectivity", () => 1);
|
|
913
889
|
registerProp("occludeSpecularIntensity", () => 1);
|
|
914
890
|
registerProp("refraction", () => 0);
|
|
915
|
-
registerProp("refractionIndex", () =>
|
|
891
|
+
registerProp("refractionIndex", () => 1 / 1.5);
|
|
916
892
|
registerProp("dispersion", () => 0);
|
|
917
893
|
registerProp("thickness", () => 0);
|
|
918
894
|
registerProp("metalness", () => 1);
|
|
@@ -933,7 +909,6 @@ function _defineMaterialProps() {
|
|
|
933
909
|
registerProp("planarReflectionMatrix", () => new Mat4(), true);
|
|
934
910
|
registerProp("alphaTest", () => 0);
|
|
935
911
|
_defineObject("ambientSH");
|
|
936
|
-
_defineFlag("specularityFactorTint", false);
|
|
937
912
|
_defineFlag("useMetalness", false);
|
|
938
913
|
_defineFlag("useMetalnessSpecularColor", false);
|
|
939
914
|
_defineFlag("useSheen", false);
|
|
@@ -1067,6 +1042,7 @@ _defineRemovedTint("diffuseTint");
|
|
|
1067
1042
|
_defineRemovedTint("emissiveTint");
|
|
1068
1043
|
_defineRemovedTint("ambientTint");
|
|
1069
1044
|
_defineRemovedTint("specularTint");
|
|
1045
|
+
_defineRemovedTint("specularityFactorTint");
|
|
1070
1046
|
_defineDeprecatedAlias("aoVertexColor", "aoMapVertexColor");
|
|
1071
1047
|
_defineDeprecatedAlias("diffuseVertexColor", "diffuseMapVertexColor");
|
|
1072
1048
|
_defineDeprecatedAlias("specularVertexColor", "specularMapVertexColor");
|