@xeokit/xeokit-sdk 2.3.0-beta-29 → 2.3.0-beta-32
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/dist/xeokit-sdk.cjs.js +69 -9
- package/dist/xeokit-sdk.es.js +69 -9
- package/dist/xeokit-sdk.es5.js +27539 -0
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/dist/xeokit-sdk.min.es5.js +1 -0
- package/package.json +4 -1
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -57891,7 +57891,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
57891
57891
|
|
|
57892
57892
|
_getHash() {
|
|
57893
57893
|
const scene = this._scene;
|
|
57894
|
-
return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? "sao" : "nosao")].join(";");
|
|
57894
|
+
return [scene.gammaOutput, scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? "sao" : "nosao")].join(";");
|
|
57895
57895
|
}
|
|
57896
57896
|
|
|
57897
57897
|
drawLayer(frameCtx, batchingLayer, renderPass) {
|
|
@@ -58028,6 +58028,8 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58028
58028
|
this._uViewMatrix = program.getLocation("viewMatrix");
|
|
58029
58029
|
this._uProjMatrix = program.getLocation("projMatrix");
|
|
58030
58030
|
|
|
58031
|
+
this._uGammaFactor = program.getLocation("gammaFactor");
|
|
58032
|
+
|
|
58031
58033
|
this._uLightAmbient = program.getLocation("lightAmbient");
|
|
58032
58034
|
this._uLightColor = [];
|
|
58033
58035
|
this._uLightDir = [];
|
|
@@ -58125,6 +58127,10 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58125
58127
|
const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);
|
|
58126
58128
|
gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
|
|
58127
58129
|
}
|
|
58130
|
+
|
|
58131
|
+
if (this._uGammaFactor) {
|
|
58132
|
+
gl.uniform1f(this._uGammaFactor, scene.gammaFactor);
|
|
58133
|
+
}
|
|
58128
58134
|
}
|
|
58129
58135
|
|
|
58130
58136
|
_buildShader() {
|
|
@@ -58215,6 +58221,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58215
58221
|
|
|
58216
58222
|
_buildFragmentShader() {
|
|
58217
58223
|
const scene = this._scene;
|
|
58224
|
+
const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
|
|
58218
58225
|
const lightsState = scene._lightsState;
|
|
58219
58226
|
const sectionPlanesState = scene._sectionPlanesState;
|
|
58220
58227
|
const clipping = sectionPlanesState.sectionPlanes.length > 0;
|
|
@@ -58249,6 +58256,21 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58249
58256
|
src.push(" return dot( v, unPackFactors );");
|
|
58250
58257
|
src.push("}");
|
|
58251
58258
|
}
|
|
58259
|
+
src.push("uniform float gammaFactor;");
|
|
58260
|
+
src.push("vec4 linearToLinear( in vec4 value ) {");
|
|
58261
|
+
src.push(" return value;");
|
|
58262
|
+
src.push("}");
|
|
58263
|
+
src.push("vec4 sRGBToLinear( in vec4 value ) {");
|
|
58264
|
+
src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");
|
|
58265
|
+
src.push("}");
|
|
58266
|
+
src.push("vec4 gammaToLinear( in vec4 value) {");
|
|
58267
|
+
src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");
|
|
58268
|
+
src.push("}");
|
|
58269
|
+
if (gammaOutput) {
|
|
58270
|
+
src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");
|
|
58271
|
+
src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");
|
|
58272
|
+
src.push("}");
|
|
58273
|
+
}
|
|
58252
58274
|
if (clipping) {
|
|
58253
58275
|
src.push("in vec4 vWorldPosition;");
|
|
58254
58276
|
src.push("in vec4 vFlags2;");
|
|
@@ -58341,7 +58363,11 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58341
58363
|
}
|
|
58342
58364
|
|
|
58343
58365
|
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");
|
|
58344
|
-
|
|
58366
|
+
if (gammaOutput) {
|
|
58367
|
+
src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");
|
|
58368
|
+
} else {
|
|
58369
|
+
src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");
|
|
58370
|
+
}
|
|
58345
58371
|
src.push("float opacity = color.a;");
|
|
58346
58372
|
|
|
58347
58373
|
if (this._withSAO) {
|
|
@@ -58359,6 +58385,10 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58359
58385
|
src.push(" outColor = vec4(colorTexel.rgb, opacity);");
|
|
58360
58386
|
}
|
|
58361
58387
|
|
|
58388
|
+
if (gammaOutput) {
|
|
58389
|
+
src.push("outColor = linearToGamma(outColor, gammaFactor);");
|
|
58390
|
+
}
|
|
58391
|
+
|
|
58362
58392
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
58363
58393
|
src.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
58364
58394
|
}
|
|
@@ -63542,8 +63572,8 @@ class TrianglesInstancingOcclusionRenderer {
|
|
|
63542
63572
|
src.push("in float isPerspective;");
|
|
63543
63573
|
}
|
|
63544
63574
|
if (clipping) {
|
|
63545
|
-
src.push("
|
|
63546
|
-
src.push("
|
|
63575
|
+
src.push("out vec4 vWorldPosition;");
|
|
63576
|
+
src.push("out vec4 vFlags2;");
|
|
63547
63577
|
}
|
|
63548
63578
|
src.push("void main(void) {");
|
|
63549
63579
|
|
|
@@ -63595,8 +63625,8 @@ class TrianglesInstancingOcclusionRenderer {
|
|
|
63595
63625
|
src.push("out float vFragDepth;");
|
|
63596
63626
|
}
|
|
63597
63627
|
if (clipping) {
|
|
63598
|
-
src.push("
|
|
63599
|
-
src.push("
|
|
63628
|
+
src.push("in vec4 vWorldPosition;");
|
|
63629
|
+
src.push("in vec4 vFlags2;");
|
|
63600
63630
|
for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
|
|
63601
63631
|
src.push("uniform bool sectionPlaneActive" + i + ";");
|
|
63602
63632
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
@@ -65817,7 +65847,7 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
65817
65847
|
|
|
65818
65848
|
_getHash() {
|
|
65819
65849
|
const scene = this._scene;
|
|
65820
|
-
return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? "sao" : "nosao")].join(";");
|
|
65850
|
+
return [scene.gammaOutput, scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? "sao" : "nosao")].join(";");
|
|
65821
65851
|
}
|
|
65822
65852
|
|
|
65823
65853
|
drawLayer(frameCtx, instancingLayer, renderPass) {
|
|
@@ -65974,6 +66004,8 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
65974
66004
|
this._uViewMatrix = program.getLocation("viewMatrix");
|
|
65975
66005
|
this._uProjMatrix = program.getLocation("projMatrix");
|
|
65976
66006
|
|
|
66007
|
+
this._uGammaFactor = program.getLocation("gammaFactor");
|
|
66008
|
+
|
|
65977
66009
|
this._uLightAmbient = program.getLocation("lightAmbient");
|
|
65978
66010
|
this._uLightColor = [];
|
|
65979
66011
|
this._uLightDir = [];
|
|
@@ -66073,6 +66105,10 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66073
66105
|
const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);
|
|
66074
66106
|
gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
|
|
66075
66107
|
}
|
|
66108
|
+
|
|
66109
|
+
if (this._uGammaFactor) {
|
|
66110
|
+
gl.uniform1f(this._uGammaFactor, scene.gammaFactor);
|
|
66111
|
+
}
|
|
66076
66112
|
}
|
|
66077
66113
|
|
|
66078
66114
|
_buildShader() {
|
|
@@ -66169,6 +66205,7 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66169
66205
|
|
|
66170
66206
|
_buildFragmentShader() {
|
|
66171
66207
|
const scene = this._scene;
|
|
66208
|
+
const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
|
|
66172
66209
|
const sectionPlanesState = scene._sectionPlanesState;
|
|
66173
66210
|
const lightsState = scene._lightsState;
|
|
66174
66211
|
let i;
|
|
@@ -66204,7 +66241,21 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66204
66241
|
src.push(" return dot( v, unPackFactors );");
|
|
66205
66242
|
src.push("}");
|
|
66206
66243
|
}
|
|
66207
|
-
|
|
66244
|
+
src.push("uniform float gammaFactor;");
|
|
66245
|
+
src.push("vec4 linearToLinear( in vec4 value ) {");
|
|
66246
|
+
src.push(" return value;");
|
|
66247
|
+
src.push("}");
|
|
66248
|
+
src.push("vec4 sRGBToLinear( in vec4 value ) {");
|
|
66249
|
+
src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");
|
|
66250
|
+
src.push("}");
|
|
66251
|
+
src.push("vec4 gammaToLinear( in vec4 value) {");
|
|
66252
|
+
src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");
|
|
66253
|
+
src.push("}");
|
|
66254
|
+
if (gammaOutput) {
|
|
66255
|
+
src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");
|
|
66256
|
+
src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");
|
|
66257
|
+
src.push("}");
|
|
66258
|
+
}
|
|
66208
66259
|
if (clipping) {
|
|
66209
66260
|
src.push("in vec4 vWorldPosition;");
|
|
66210
66261
|
src.push("in vec4 vFlags2;");
|
|
@@ -66296,7 +66347,11 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66296
66347
|
}
|
|
66297
66348
|
|
|
66298
66349
|
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");
|
|
66299
|
-
|
|
66350
|
+
if (gammaOutput) {
|
|
66351
|
+
src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");
|
|
66352
|
+
} else {
|
|
66353
|
+
src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");
|
|
66354
|
+
}
|
|
66300
66355
|
src.push("float opacity = color.a;");
|
|
66301
66356
|
|
|
66302
66357
|
if (this._withSAO) {
|
|
@@ -66313,6 +66368,10 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66313
66368
|
src.push(" outColor = vec4(vColor.rgb * colorTexel.rgb, opacity);");
|
|
66314
66369
|
}
|
|
66315
66370
|
|
|
66371
|
+
if (gammaOutput) {
|
|
66372
|
+
src.push("outColor = linearToGamma(outColor, gammaFactor);");
|
|
66373
|
+
}
|
|
66374
|
+
|
|
66316
66375
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
66317
66376
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
66318
66377
|
}
|
|
@@ -79829,6 +79888,7 @@ class VBOSceneModel extends Component {
|
|
|
79829
79888
|
const image = new Image();
|
|
79830
79889
|
image.onload = () => {
|
|
79831
79890
|
texture.setImage(image, {minFilter, magFilter, wrapS, wrapT, flipY: cfg.flipY, encoding});
|
|
79891
|
+
this.glRedraw();
|
|
79832
79892
|
};
|
|
79833
79893
|
image.src = cfg.src; // URL or Base64 string
|
|
79834
79894
|
break;
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -57887,7 +57887,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
57887
57887
|
|
|
57888
57888
|
_getHash() {
|
|
57889
57889
|
const scene = this._scene;
|
|
57890
|
-
return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? "sao" : "nosao")].join(";");
|
|
57890
|
+
return [scene.gammaOutput, scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? "sao" : "nosao")].join(";");
|
|
57891
57891
|
}
|
|
57892
57892
|
|
|
57893
57893
|
drawLayer(frameCtx, batchingLayer, renderPass) {
|
|
@@ -58024,6 +58024,8 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58024
58024
|
this._uViewMatrix = program.getLocation("viewMatrix");
|
|
58025
58025
|
this._uProjMatrix = program.getLocation("projMatrix");
|
|
58026
58026
|
|
|
58027
|
+
this._uGammaFactor = program.getLocation("gammaFactor");
|
|
58028
|
+
|
|
58027
58029
|
this._uLightAmbient = program.getLocation("lightAmbient");
|
|
58028
58030
|
this._uLightColor = [];
|
|
58029
58031
|
this._uLightDir = [];
|
|
@@ -58121,6 +58123,10 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58121
58123
|
const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);
|
|
58122
58124
|
gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
|
|
58123
58125
|
}
|
|
58126
|
+
|
|
58127
|
+
if (this._uGammaFactor) {
|
|
58128
|
+
gl.uniform1f(this._uGammaFactor, scene.gammaFactor);
|
|
58129
|
+
}
|
|
58124
58130
|
}
|
|
58125
58131
|
|
|
58126
58132
|
_buildShader() {
|
|
@@ -58211,6 +58217,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58211
58217
|
|
|
58212
58218
|
_buildFragmentShader() {
|
|
58213
58219
|
const scene = this._scene;
|
|
58220
|
+
const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
|
|
58214
58221
|
const lightsState = scene._lightsState;
|
|
58215
58222
|
const sectionPlanesState = scene._sectionPlanesState;
|
|
58216
58223
|
const clipping = sectionPlanesState.sectionPlanes.length > 0;
|
|
@@ -58245,6 +58252,21 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58245
58252
|
src.push(" return dot( v, unPackFactors );");
|
|
58246
58253
|
src.push("}");
|
|
58247
58254
|
}
|
|
58255
|
+
src.push("uniform float gammaFactor;");
|
|
58256
|
+
src.push("vec4 linearToLinear( in vec4 value ) {");
|
|
58257
|
+
src.push(" return value;");
|
|
58258
|
+
src.push("}");
|
|
58259
|
+
src.push("vec4 sRGBToLinear( in vec4 value ) {");
|
|
58260
|
+
src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");
|
|
58261
|
+
src.push("}");
|
|
58262
|
+
src.push("vec4 gammaToLinear( in vec4 value) {");
|
|
58263
|
+
src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");
|
|
58264
|
+
src.push("}");
|
|
58265
|
+
if (gammaOutput) {
|
|
58266
|
+
src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");
|
|
58267
|
+
src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");
|
|
58268
|
+
src.push("}");
|
|
58269
|
+
}
|
|
58248
58270
|
if (clipping) {
|
|
58249
58271
|
src.push("in vec4 vWorldPosition;");
|
|
58250
58272
|
src.push("in vec4 vFlags2;");
|
|
@@ -58337,7 +58359,11 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58337
58359
|
}
|
|
58338
58360
|
|
|
58339
58361
|
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");
|
|
58340
|
-
|
|
58362
|
+
if (gammaOutput) {
|
|
58363
|
+
src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");
|
|
58364
|
+
} else {
|
|
58365
|
+
src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");
|
|
58366
|
+
}
|
|
58341
58367
|
src.push("float opacity = color.a;");
|
|
58342
58368
|
|
|
58343
58369
|
if (this._withSAO) {
|
|
@@ -58355,6 +58381,10 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
58355
58381
|
src.push(" outColor = vec4(colorTexel.rgb, opacity);");
|
|
58356
58382
|
}
|
|
58357
58383
|
|
|
58384
|
+
if (gammaOutput) {
|
|
58385
|
+
src.push("outColor = linearToGamma(outColor, gammaFactor);");
|
|
58386
|
+
}
|
|
58387
|
+
|
|
58358
58388
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
58359
58389
|
src.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
58360
58390
|
}
|
|
@@ -63538,8 +63568,8 @@ class TrianglesInstancingOcclusionRenderer {
|
|
|
63538
63568
|
src.push("in float isPerspective;");
|
|
63539
63569
|
}
|
|
63540
63570
|
if (clipping) {
|
|
63541
|
-
src.push("
|
|
63542
|
-
src.push("
|
|
63571
|
+
src.push("out vec4 vWorldPosition;");
|
|
63572
|
+
src.push("out vec4 vFlags2;");
|
|
63543
63573
|
}
|
|
63544
63574
|
src.push("void main(void) {");
|
|
63545
63575
|
|
|
@@ -63591,8 +63621,8 @@ class TrianglesInstancingOcclusionRenderer {
|
|
|
63591
63621
|
src.push("out float vFragDepth;");
|
|
63592
63622
|
}
|
|
63593
63623
|
if (clipping) {
|
|
63594
|
-
src.push("
|
|
63595
|
-
src.push("
|
|
63624
|
+
src.push("in vec4 vWorldPosition;");
|
|
63625
|
+
src.push("in vec4 vFlags2;");
|
|
63596
63626
|
for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
|
|
63597
63627
|
src.push("uniform bool sectionPlaneActive" + i + ";");
|
|
63598
63628
|
src.push("uniform vec3 sectionPlanePos" + i + ";");
|
|
@@ -65813,7 +65843,7 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
65813
65843
|
|
|
65814
65844
|
_getHash() {
|
|
65815
65845
|
const scene = this._scene;
|
|
65816
|
-
return [scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? "sao" : "nosao")].join(";");
|
|
65846
|
+
return [scene.gammaOutput, scene._lightsState.getHash(), scene._sectionPlanesState.getHash(), (this._withSAO ? "sao" : "nosao")].join(";");
|
|
65817
65847
|
}
|
|
65818
65848
|
|
|
65819
65849
|
drawLayer(frameCtx, instancingLayer, renderPass) {
|
|
@@ -65970,6 +66000,8 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
65970
66000
|
this._uViewMatrix = program.getLocation("viewMatrix");
|
|
65971
66001
|
this._uProjMatrix = program.getLocation("projMatrix");
|
|
65972
66002
|
|
|
66003
|
+
this._uGammaFactor = program.getLocation("gammaFactor");
|
|
66004
|
+
|
|
65973
66005
|
this._uLightAmbient = program.getLocation("lightAmbient");
|
|
65974
66006
|
this._uLightColor = [];
|
|
65975
66007
|
this._uLightDir = [];
|
|
@@ -66069,6 +66101,10 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66069
66101
|
const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);
|
|
66070
66102
|
gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
|
|
66071
66103
|
}
|
|
66104
|
+
|
|
66105
|
+
if (this._uGammaFactor) {
|
|
66106
|
+
gl.uniform1f(this._uGammaFactor, scene.gammaFactor);
|
|
66107
|
+
}
|
|
66072
66108
|
}
|
|
66073
66109
|
|
|
66074
66110
|
_buildShader() {
|
|
@@ -66165,6 +66201,7 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66165
66201
|
|
|
66166
66202
|
_buildFragmentShader() {
|
|
66167
66203
|
const scene = this._scene;
|
|
66204
|
+
const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
|
|
66168
66205
|
const sectionPlanesState = scene._sectionPlanesState;
|
|
66169
66206
|
const lightsState = scene._lightsState;
|
|
66170
66207
|
let i;
|
|
@@ -66200,7 +66237,21 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66200
66237
|
src.push(" return dot( v, unPackFactors );");
|
|
66201
66238
|
src.push("}");
|
|
66202
66239
|
}
|
|
66203
|
-
|
|
66240
|
+
src.push("uniform float gammaFactor;");
|
|
66241
|
+
src.push("vec4 linearToLinear( in vec4 value ) {");
|
|
66242
|
+
src.push(" return value;");
|
|
66243
|
+
src.push("}");
|
|
66244
|
+
src.push("vec4 sRGBToLinear( in vec4 value ) {");
|
|
66245
|
+
src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");
|
|
66246
|
+
src.push("}");
|
|
66247
|
+
src.push("vec4 gammaToLinear( in vec4 value) {");
|
|
66248
|
+
src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");
|
|
66249
|
+
src.push("}");
|
|
66250
|
+
if (gammaOutput) {
|
|
66251
|
+
src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");
|
|
66252
|
+
src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");
|
|
66253
|
+
src.push("}");
|
|
66254
|
+
}
|
|
66204
66255
|
if (clipping) {
|
|
66205
66256
|
src.push("in vec4 vWorldPosition;");
|
|
66206
66257
|
src.push("in vec4 vFlags2;");
|
|
@@ -66292,7 +66343,11 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66292
66343
|
}
|
|
66293
66344
|
|
|
66294
66345
|
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");
|
|
66295
|
-
|
|
66346
|
+
if (gammaOutput) {
|
|
66347
|
+
src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");
|
|
66348
|
+
} else {
|
|
66349
|
+
src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");
|
|
66350
|
+
}
|
|
66296
66351
|
src.push("float opacity = color.a;");
|
|
66297
66352
|
|
|
66298
66353
|
if (this._withSAO) {
|
|
@@ -66309,6 +66364,10 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
66309
66364
|
src.push(" outColor = vec4(vColor.rgb * colorTexel.rgb, opacity);");
|
|
66310
66365
|
}
|
|
66311
66366
|
|
|
66367
|
+
if (gammaOutput) {
|
|
66368
|
+
src.push("outColor = linearToGamma(outColor, gammaFactor);");
|
|
66369
|
+
}
|
|
66370
|
+
|
|
66312
66371
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
66313
66372
|
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
66314
66373
|
}
|
|
@@ -79825,6 +79884,7 @@ class VBOSceneModel extends Component {
|
|
|
79825
79884
|
const image = new Image();
|
|
79826
79885
|
image.onload = () => {
|
|
79827
79886
|
texture.setImage(image, {minFilter, magFilter, wrapS, wrapT, flipY: cfg.flipY, encoding});
|
|
79887
|
+
this.glRedraw();
|
|
79828
79888
|
};
|
|
79829
79889
|
image.src = cfg.src; // URL or Base64 string
|
|
79830
79890
|
break;
|