@xeokit/xeokit-sdk 2.3.0-beta-14 → 2.3.0-beta-17
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 +183 -232
- package/dist/xeokit-sdk.es.js +183 -232
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/package.json +1 -1
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -14605,7 +14605,8 @@ class SAODepthLimitedBlurRenderer {
|
|
|
14605
14605
|
}
|
|
14606
14606
|
|
|
14607
14607
|
outColor = packFloatToRGBA(occlusionSum / weightSum);
|
|
14608
|
-
}`
|
|
14608
|
+
}`
|
|
14609
|
+
]
|
|
14609
14610
|
});
|
|
14610
14611
|
|
|
14611
14612
|
if (this._program.errors) {
|
|
@@ -14695,7 +14696,7 @@ class SAODepthLimitedBlurRenderer {
|
|
|
14695
14696
|
|
|
14696
14697
|
gl.uniform1fv(this._uSampleWeights, sampleWeights);
|
|
14697
14698
|
|
|
14698
|
-
const depthTexture =
|
|
14699
|
+
const depthTexture = depthRenderBuffer.getDepthTexture();
|
|
14699
14700
|
const occlusionTexture = occlusionRenderBuffer.getTexture();
|
|
14700
14701
|
|
|
14701
14702
|
program.bindTexture(this._uDepthTexture, depthTexture, 0); // TODO: use FrameCtx.textureUnit
|
|
@@ -15995,22 +15996,6 @@ const Renderer = function (scene, options) {
|
|
|
15995
15996
|
gl.depthMask(false);
|
|
15996
15997
|
}
|
|
15997
15998
|
|
|
15998
|
-
// Transparent X-ray edges
|
|
15999
|
-
|
|
16000
|
-
if (xrayEdgesTransparentBinLen > 0) {
|
|
16001
|
-
for (i = 0; i < xrayEdgesTransparentBinLen; i++) {
|
|
16002
|
-
xrayEdgesTransparentBin[i].drawEdgesXRayed(frameCtx);
|
|
16003
|
-
}
|
|
16004
|
-
}
|
|
16005
|
-
|
|
16006
|
-
// Transparent X-ray fill
|
|
16007
|
-
|
|
16008
|
-
if (xrayedFillTransparentBinLen > 0) {
|
|
16009
|
-
for (i = 0; i < xrayedFillTransparentBinLen; i++) {
|
|
16010
|
-
xrayedFillTransparentBin[i].drawSilhouetteXRayed(frameCtx);
|
|
16011
|
-
}
|
|
16012
|
-
}
|
|
16013
|
-
|
|
16014
15999
|
// Transparent color edges
|
|
16015
16000
|
|
|
16016
16001
|
if (normalFillTransparentBinLen > 0 || normalEdgesTransparentBinLen > 0) {
|
|
@@ -16031,6 +16016,23 @@ const Renderer = function (scene, options) {
|
|
|
16031
16016
|
drawable.drawColorTransparent(frameCtx);
|
|
16032
16017
|
}
|
|
16033
16018
|
}
|
|
16019
|
+
|
|
16020
|
+
// Transparent X-ray edges
|
|
16021
|
+
|
|
16022
|
+
if (xrayEdgesTransparentBinLen > 0) {
|
|
16023
|
+
for (i = 0; i < xrayEdgesTransparentBinLen; i++) {
|
|
16024
|
+
xrayEdgesTransparentBin[i].drawEdgesXRayed(frameCtx);
|
|
16025
|
+
}
|
|
16026
|
+
}
|
|
16027
|
+
|
|
16028
|
+
// Transparent X-ray fill
|
|
16029
|
+
|
|
16030
|
+
if (xrayedFillTransparentBinLen > 0) {
|
|
16031
|
+
for (i = 0; i < xrayedFillTransparentBinLen; i++) {
|
|
16032
|
+
xrayedFillTransparentBin[i].drawSilhouetteXRayed(frameCtx);
|
|
16033
|
+
}
|
|
16034
|
+
}
|
|
16035
|
+
|
|
16034
16036
|
gl.disable(gl.BLEND);
|
|
16035
16037
|
if (!alphaDepthMask) {
|
|
16036
16038
|
gl.depthMask(true);
|
|
@@ -45603,10 +45605,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45603
45605
|
gl.uniform1i(this._uRenderPass, renderPass);
|
|
45604
45606
|
|
|
45605
45607
|
gl.uniformMatrix4fv(this._uViewMatrix, false, (origin) ? createRTCViewMat(camera.viewMatrix, origin) : camera.viewMatrix);
|
|
45606
|
-
gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
|
|
45607
|
-
|
|
45608
45608
|
gl.uniformMatrix4fv(this._uWorldMatrix, false, model.worldMatrix);
|
|
45609
|
-
gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);
|
|
45610
45609
|
|
|
45611
45610
|
const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
|
|
45612
45611
|
if (numSectionPlanes > 0) {
|
|
@@ -45640,10 +45639,6 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45640
45639
|
|
|
45641
45640
|
this._aPosition.bindArrayBuffer(state.positionsBuf);
|
|
45642
45641
|
|
|
45643
|
-
if (this._aNormal) {
|
|
45644
|
-
this._aNormal.bindArrayBuffer(state.normalsBuf);
|
|
45645
|
-
}
|
|
45646
|
-
|
|
45647
45642
|
if (this._aUV) {
|
|
45648
45643
|
this._aUV.bindArrayBuffer(state.uvBuf);
|
|
45649
45644
|
}
|
|
@@ -45714,9 +45709,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45714
45709
|
this._uPositionsDecodeMatrix = program.getLocation("positionsDecodeMatrix");
|
|
45715
45710
|
this._uUVDecodeMatrix = program.getLocation("uvDecodeMatrix");
|
|
45716
45711
|
this._uWorldMatrix = program.getLocation("worldMatrix");
|
|
45717
|
-
this._uWorldNormalMatrix = program.getLocation("worldNormalMatrix");
|
|
45718
45712
|
this._uViewMatrix = program.getLocation("viewMatrix");
|
|
45719
|
-
this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
|
|
45720
45713
|
this._uProjMatrix = program.getLocation("projMatrix");
|
|
45721
45714
|
|
|
45722
45715
|
this._uLightAmbient = program.getLocation("lightAmbient");
|
|
@@ -45763,7 +45756,6 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45763
45756
|
|
|
45764
45757
|
this._aPosition = program.getAttribute("position");
|
|
45765
45758
|
this._aOffset = program.getAttribute("offset");
|
|
45766
|
-
this._aNormal = program.getAttribute("normal");
|
|
45767
45759
|
this._aUV = program.getAttribute("uv");
|
|
45768
45760
|
this._aColor = program.getAttribute("color");
|
|
45769
45761
|
this._aFlags = program.getAttribute("flags");
|
|
@@ -45830,9 +45822,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45830
45822
|
|
|
45831
45823
|
const scene = this._scene;
|
|
45832
45824
|
const sectionPlanesState = scene._sectionPlanesState;
|
|
45833
|
-
const lightsState = scene._lightsState;
|
|
45834
45825
|
const clipping = sectionPlanesState.sectionPlanes.length > 0;
|
|
45835
|
-
let light;
|
|
45836
45826
|
const src = [];
|
|
45837
45827
|
src.push("#version 300 es");
|
|
45838
45828
|
src.push("// Triangles batching color texture vertex shader");
|
|
@@ -45840,7 +45830,6 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45840
45830
|
src.push("uniform int renderPass;");
|
|
45841
45831
|
|
|
45842
45832
|
src.push("in vec3 position;");
|
|
45843
|
-
src.push("in vec3 normal;");
|
|
45844
45833
|
src.push("in vec4 color;");
|
|
45845
45834
|
src.push("in vec2 uv;");
|
|
45846
45835
|
src.push("in vec4 flags;");
|
|
@@ -45851,11 +45840,9 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45851
45840
|
}
|
|
45852
45841
|
|
|
45853
45842
|
src.push("uniform mat4 worldMatrix;");
|
|
45854
|
-
src.push("uniform mat4 worldNormalMatrix;");
|
|
45855
45843
|
|
|
45856
45844
|
src.push("uniform mat4 viewMatrix;");
|
|
45857
45845
|
src.push("uniform mat4 projMatrix;");
|
|
45858
|
-
src.push("uniform mat4 viewNormalMatrix;");
|
|
45859
45846
|
src.push("uniform mat4 positionsDecodeMatrix;");
|
|
45860
45847
|
src.push("uniform mat3 uvDecodeMatrix;");
|
|
45861
45848
|
|
|
@@ -45868,38 +45855,11 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45868
45855
|
src.push("out float isPerspective;");
|
|
45869
45856
|
}
|
|
45870
45857
|
|
|
45871
|
-
src.push("uniform vec4 lightAmbient;");
|
|
45872
|
-
|
|
45873
|
-
for (let i = 0, len = lightsState.lights.length; i < len; i++) {
|
|
45874
|
-
light = lightsState.lights[i];
|
|
45875
|
-
if (light.type === "ambient") {
|
|
45876
|
-
continue;
|
|
45877
|
-
}
|
|
45878
|
-
src.push("uniform vec4 lightColor" + i + ";");
|
|
45879
|
-
if (light.type === "dir") {
|
|
45880
|
-
src.push("uniform vec3 lightDir" + i + ";");
|
|
45881
|
-
}
|
|
45882
|
-
if (light.type === "point") {
|
|
45883
|
-
src.push("uniform vec3 lightPos" + i + ";");
|
|
45884
|
-
}
|
|
45885
|
-
if (light.type === "spot") {
|
|
45886
|
-
src.push("uniform vec3 lightPos" + i + ";");
|
|
45887
|
-
src.push("uniform vec3 lightDir" + i + ";");
|
|
45888
|
-
}
|
|
45889
|
-
}
|
|
45890
|
-
|
|
45891
|
-
src.push("vec3 octDecode(vec2 oct) {");
|
|
45892
|
-
src.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));");
|
|
45893
|
-
src.push(" if (v.z < 0.0) {");
|
|
45894
|
-
src.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);");
|
|
45895
|
-
src.push(" }");
|
|
45896
|
-
src.push(" return normalize(v);");
|
|
45897
|
-
src.push("}");
|
|
45898
|
-
|
|
45899
45858
|
if (clipping) {
|
|
45900
45859
|
src.push("out vec4 vWorldPosition;");
|
|
45901
45860
|
src.push("out vec4 vFlags2;");
|
|
45902
45861
|
}
|
|
45862
|
+
src.push("out vec4 vViewPosition;");
|
|
45903
45863
|
src.push("out vec4 vColor;");
|
|
45904
45864
|
src.push("out vec2 vUV;");
|
|
45905
45865
|
|
|
@@ -45918,45 +45878,8 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45918
45878
|
src.push("worldPosition.xyz = worldPosition.xyz + offset;");
|
|
45919
45879
|
}
|
|
45920
45880
|
src.push("vec4 viewPosition = viewMatrix * worldPosition; ");
|
|
45921
|
-
src.push("
|
|
45922
|
-
src.push("
|
|
45923
|
-
|
|
45924
|
-
src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");
|
|
45925
|
-
src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");
|
|
45926
|
-
|
|
45927
|
-
src.push("float lambertian = 1.0;");
|
|
45928
|
-
for (let i = 0, len = lightsState.lights.length; i < len; i++) {
|
|
45929
|
-
light = lightsState.lights[i];
|
|
45930
|
-
if (light.type === "ambient") {
|
|
45931
|
-
continue;
|
|
45932
|
-
}
|
|
45933
|
-
if (light.type === "dir") {
|
|
45934
|
-
if (light.space === "view") {
|
|
45935
|
-
src.push("viewLightDir = normalize(lightDir" + i + ");");
|
|
45936
|
-
} else {
|
|
45937
|
-
src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir" + i + ", 0.0)).xyz);");
|
|
45938
|
-
}
|
|
45939
|
-
} else if (light.type === "point") {
|
|
45940
|
-
if (light.space === "view") {
|
|
45941
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " - viewPosition.xyz);");
|
|
45942
|
-
} else {
|
|
45943
|
-
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
45944
|
-
}
|
|
45945
|
-
} else if (light.type === "spot") {
|
|
45946
|
-
if (light.space === "view") {
|
|
45947
|
-
src.push("viewLightDir = normalize(lightDir" + i + ");");
|
|
45948
|
-
} else {
|
|
45949
|
-
src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir" + i + ", 0.0)).xyz);");
|
|
45950
|
-
}
|
|
45951
|
-
} else {
|
|
45952
|
-
continue;
|
|
45953
|
-
}
|
|
45954
|
-
src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");
|
|
45955
|
-
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
45956
|
-
}
|
|
45957
|
-
|
|
45958
|
-
src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");
|
|
45959
|
-
src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");
|
|
45881
|
+
src.push("vViewPosition = viewPosition;");
|
|
45882
|
+
src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");
|
|
45960
45883
|
src.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;");
|
|
45961
45884
|
|
|
45962
45885
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
@@ -45976,6 +45899,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45976
45899
|
|
|
45977
45900
|
_buildFragmentShader() {
|
|
45978
45901
|
const scene = this._scene;
|
|
45902
|
+
const lightsState = scene._lightsState;
|
|
45979
45903
|
const sectionPlanesState = scene._sectionPlanesState;
|
|
45980
45904
|
const clipping = sectionPlanesState.sectionPlanes.length > 0;
|
|
45981
45905
|
const src = [];
|
|
@@ -45995,9 +45919,7 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
45995
45919
|
src.push("uniform float logDepthBufFC;");
|
|
45996
45920
|
src.push("in float vFragDepth;");
|
|
45997
45921
|
}
|
|
45998
|
-
|
|
45999
45922
|
src.push("uniform sampler2D uColorMap;");
|
|
46000
|
-
|
|
46001
45923
|
if (this._withSAO) {
|
|
46002
45924
|
src.push("uniform sampler2D uOcclusionTexture;");
|
|
46003
45925
|
src.push("uniform vec4 uSAOParams;");
|
|
@@ -46011,7 +45933,6 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
46011
45933
|
src.push(" return dot( v, unPackFactors );");
|
|
46012
45934
|
src.push("}");
|
|
46013
45935
|
}
|
|
46014
|
-
|
|
46015
45936
|
if (clipping) {
|
|
46016
45937
|
src.push("in vec4 vWorldPosition;");
|
|
46017
45938
|
src.push("in vec4 vFlags2;");
|
|
@@ -46021,7 +45942,27 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
46021
45942
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
46022
45943
|
}
|
|
46023
45944
|
}
|
|
45945
|
+
src.push("uniform mat4 viewMatrix;");
|
|
45946
|
+
src.push("uniform vec4 lightAmbient;");
|
|
45947
|
+
for (let i = 0, len = lightsState.lights.length; i < len; i++) {
|
|
45948
|
+
const light = lightsState.lights[i];
|
|
45949
|
+
if (light.type === "ambient") {
|
|
45950
|
+
continue;
|
|
45951
|
+
}
|
|
45952
|
+
src.push("uniform vec4 lightColor" + i + ";");
|
|
45953
|
+
if (light.type === "dir") {
|
|
45954
|
+
src.push("uniform vec3 lightDir" + i + ";");
|
|
45955
|
+
}
|
|
45956
|
+
if (light.type === "point") {
|
|
45957
|
+
src.push("uniform vec3 lightPos" + i + ";");
|
|
45958
|
+
}
|
|
45959
|
+
if (light.type === "spot") {
|
|
45960
|
+
src.push("uniform vec3 lightPos" + i + ";");
|
|
45961
|
+
src.push("uniform vec3 lightDir" + i + ";");
|
|
45962
|
+
}
|
|
45963
|
+
}
|
|
46024
45964
|
|
|
45965
|
+
src.push("in vec4 vViewPosition;");
|
|
46025
45966
|
src.push("in vec4 vColor;");
|
|
46026
45967
|
src.push("in vec2 vUV;");
|
|
46027
45968
|
src.push("out vec4 outColor;");
|
|
@@ -46043,12 +45984,49 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
46043
45984
|
src.push("}");
|
|
46044
45985
|
}
|
|
46045
45986
|
|
|
46046
|
-
|
|
46047
|
-
|
|
45987
|
+
src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");
|
|
45988
|
+
src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");
|
|
45989
|
+
|
|
45990
|
+
src.push("float lambertian = 1.0;");
|
|
45991
|
+
|
|
45992
|
+
src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");
|
|
45993
|
+
src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");
|
|
45994
|
+
src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");
|
|
45995
|
+
|
|
45996
|
+
for (let i = 0, len = lightsState.lights.length; i < len; i++) {
|
|
45997
|
+
const light = lightsState.lights[i];
|
|
45998
|
+
if (light.type === "ambient") {
|
|
45999
|
+
continue;
|
|
46000
|
+
}
|
|
46001
|
+
if (light.type === "dir") {
|
|
46002
|
+
if (light.space === "view") {
|
|
46003
|
+
src.push("viewLightDir = normalize(lightDir" + i + ");");
|
|
46004
|
+
} else {
|
|
46005
|
+
src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir" + i + ", 0.0)).xyz);");
|
|
46006
|
+
}
|
|
46007
|
+
} else if (light.type === "point") {
|
|
46008
|
+
if (light.space === "view") {
|
|
46009
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - viewPosition.xyz);");
|
|
46010
|
+
} else {
|
|
46011
|
+
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
46012
|
+
}
|
|
46013
|
+
} else if (light.type === "spot") {
|
|
46014
|
+
if (light.space === "view") {
|
|
46015
|
+
src.push("viewLightDir = normalize(lightDir" + i + ");");
|
|
46016
|
+
} else {
|
|
46017
|
+
src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir" + i + ", 0.0)).xyz);");
|
|
46018
|
+
}
|
|
46019
|
+
} else {
|
|
46020
|
+
continue;
|
|
46021
|
+
}
|
|
46022
|
+
|
|
46023
|
+
src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");
|
|
46024
|
+
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
46048
46025
|
}
|
|
46049
46026
|
|
|
46050
|
-
src.push("vec4
|
|
46051
|
-
src.push("
|
|
46027
|
+
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");
|
|
46028
|
+
src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");
|
|
46029
|
+
src.push("float opacity = color.a;");
|
|
46052
46030
|
|
|
46053
46031
|
if (this._withSAO) {
|
|
46054
46032
|
// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
@@ -46065,6 +46043,10 @@ class TrianglesBatchingColorTextureRenderer {
|
|
|
46065
46043
|
src.push(" outColor = vec4(colorTexel.rgb, opacity);");
|
|
46066
46044
|
}
|
|
46067
46045
|
|
|
46046
|
+
if (scene.logarithmicDepthBufferEnabled) {
|
|
46047
|
+
src.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
46048
|
+
}
|
|
46049
|
+
|
|
46068
46050
|
src.push("}");
|
|
46069
46051
|
return src;
|
|
46070
46052
|
}
|
|
@@ -46451,6 +46433,11 @@ function quantizePositions(positions, aabb, positionsDecodeMatrix) { // http://c
|
|
|
46451
46433
|
*/
|
|
46452
46434
|
function transformAndOctEncodeNormals(worldNormalMatrix, normals, lenNormals, compressedNormals, lenCompressedNormals) {
|
|
46453
46435
|
// http://jcgt.org/published/0003/02/01/
|
|
46436
|
+
|
|
46437
|
+
function dot(array, vec3) {
|
|
46438
|
+
return array[0] * vec3[0] + array[1] * vec3[1] + array[2] * vec3[2];
|
|
46439
|
+
}
|
|
46440
|
+
|
|
46454
46441
|
let oct, dec, best, currentCos, bestCos;
|
|
46455
46442
|
let i;
|
|
46456
46443
|
let localNormal = new Float32Array([0, 0, 0, 0]);
|
|
@@ -46502,29 +46489,29 @@ function transformAndOctEncodeNormals(worldNormalMatrix, normals, lenNormals, co
|
|
|
46502
46489
|
function octEncodeNormals(normals) { // http://jcgt.org/published/0003/02/01/
|
|
46503
46490
|
const lenNormals = normals.length;
|
|
46504
46491
|
const compressedNormals = new Int8Array(lenNormals);
|
|
46505
|
-
let oct, best, currentCos, bestCos;
|
|
46492
|
+
let oct, dec, best, currentCos, bestCos;
|
|
46506
46493
|
for (let i = 0; i < lenNormals; i += 3) {
|
|
46507
46494
|
// Test various combinations of ceil and floor to minimize rounding errors
|
|
46508
46495
|
best = oct = octEncodeNormal(normals, i, "floor", "floor");
|
|
46509
|
-
octDecodeVec2(oct);
|
|
46510
|
-
currentCos = bestCos = dot(normals, i);
|
|
46496
|
+
dec = octDecodeVec2(oct);
|
|
46497
|
+
currentCos = bestCos = dot(normals, i, dec);
|
|
46511
46498
|
oct = octEncodeNormal(normals, i, "ceil", "floor");
|
|
46512
|
-
octDecodeVec2(oct);
|
|
46513
|
-
currentCos = dot(normals, i);
|
|
46499
|
+
dec = octDecodeVec2(oct);
|
|
46500
|
+
currentCos = dot(normals, i, dec);
|
|
46514
46501
|
if (currentCos > bestCos) {
|
|
46515
46502
|
best = oct;
|
|
46516
46503
|
bestCos = currentCos;
|
|
46517
46504
|
}
|
|
46518
46505
|
oct = octEncodeNormal(normals, i, "floor", "ceil");
|
|
46519
|
-
octDecodeVec2(oct);
|
|
46520
|
-
currentCos = dot(normals, i);
|
|
46506
|
+
dec = octDecodeVec2(oct);
|
|
46507
|
+
currentCos = dot(normals, i, dec);
|
|
46521
46508
|
if (currentCos > bestCos) {
|
|
46522
46509
|
best = oct;
|
|
46523
46510
|
bestCos = currentCos;
|
|
46524
46511
|
}
|
|
46525
46512
|
oct = octEncodeNormal(normals, i, "ceil", "ceil");
|
|
46526
|
-
octDecodeVec2(oct);
|
|
46527
|
-
currentCos = dot(normals, i);
|
|
46513
|
+
dec = octDecodeVec2(oct);
|
|
46514
|
+
currentCos = dot(normals, i, dec);
|
|
46528
46515
|
if (currentCos > bestCos) {
|
|
46529
46516
|
best = oct;
|
|
46530
46517
|
bestCos = currentCos;
|
|
@@ -46598,8 +46585,8 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
|
|
|
46598
46585
|
/**
|
|
46599
46586
|
* @private
|
|
46600
46587
|
*/
|
|
46601
|
-
function dot(
|
|
46602
|
-
return
|
|
46588
|
+
function dot(array, i, vec3) {
|
|
46589
|
+
return array[i] * vec3[0] + array[i + 1] * vec3[1] + array[i + 2] * vec3[2];
|
|
46603
46590
|
}
|
|
46604
46591
|
|
|
46605
46592
|
const tempMat4$2 = math.mat4();
|
|
@@ -47128,7 +47115,6 @@ class TrianglesBatchingLayer {
|
|
|
47128
47115
|
|
|
47129
47116
|
this._state.colorTextureSupported
|
|
47130
47117
|
= !!state.uvBuf
|
|
47131
|
-
&& !!state.normalsBuf
|
|
47132
47118
|
&& !!state.textureSet
|
|
47133
47119
|
&& !!state.textureSet.colorTexture;
|
|
47134
47120
|
|
|
@@ -48871,8 +48857,8 @@ class TrianglesInstancingFlatColorRenderer {
|
|
|
48871
48857
|
|
|
48872
48858
|
src.push("in vec4 vViewPosition;");
|
|
48873
48859
|
src.push("in vec4 vColor;");
|
|
48874
|
-
|
|
48875
48860
|
src.push("out vec4 outColor;");
|
|
48861
|
+
|
|
48876
48862
|
src.push("void main(void) {");
|
|
48877
48863
|
|
|
48878
48864
|
if (clipping) {
|
|
@@ -53545,10 +53531,7 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53545
53531
|
gl.uniform1i(this._uRenderPass, renderPass);
|
|
53546
53532
|
|
|
53547
53533
|
gl.uniformMatrix4fv(this._uViewMatrix, false, (origin) ? createRTCViewMat(camera.viewMatrix, origin) : camera.viewMatrix);
|
|
53548
|
-
gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
|
|
53549
|
-
|
|
53550
53534
|
gl.uniformMatrix4fv(this._uWorldMatrix, false, model.worldMatrix);
|
|
53551
|
-
gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);
|
|
53552
53535
|
|
|
53553
53536
|
const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
|
|
53554
53537
|
if (numSectionPlanes > 0) {
|
|
@@ -53588,16 +53571,7 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53588
53571
|
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);
|
|
53589
53572
|
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);
|
|
53590
53573
|
|
|
53591
|
-
this._aModelNormalMatrixCol0.bindArrayBuffer(state.modelNormalMatrixCol0Buf);
|
|
53592
|
-
this._aModelNormalMatrixCol1.bindArrayBuffer(state.modelNormalMatrixCol1Buf);
|
|
53593
|
-
this._aModelNormalMatrixCol2.bindArrayBuffer(state.modelNormalMatrixCol2Buf);
|
|
53594
|
-
|
|
53595
|
-
gl.vertexAttribDivisor(this._aModelNormalMatrixCol0.location, 1);
|
|
53596
|
-
gl.vertexAttribDivisor(this._aModelNormalMatrixCol1.location, 1);
|
|
53597
|
-
gl.vertexAttribDivisor(this._aModelNormalMatrixCol2.location, 1);
|
|
53598
|
-
|
|
53599
53574
|
this._aPosition.bindArrayBuffer(geometry.positionsBuf);
|
|
53600
|
-
this._aNormal.bindArrayBuffer(geometry.normalsBuf);
|
|
53601
53575
|
this._aUV.bindArrayBuffer(geometry.uvBuf);
|
|
53602
53576
|
|
|
53603
53577
|
this._aColor.bindArrayBuffer(state.colorsBuf);
|
|
@@ -53625,9 +53599,6 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53625
53599
|
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);
|
|
53626
53600
|
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);
|
|
53627
53601
|
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);
|
|
53628
|
-
gl.vertexAttribDivisor(this._aModelNormalMatrixCol0.location, 0);
|
|
53629
|
-
gl.vertexAttribDivisor(this._aModelNormalMatrixCol1.location, 0);
|
|
53630
|
-
gl.vertexAttribDivisor(this._aModelNormalMatrixCol2.location, 0);
|
|
53631
53602
|
gl.vertexAttribDivisor(this._aColor.location, 0);
|
|
53632
53603
|
gl.vertexAttribDivisor(this._aFlags.location, 0);
|
|
53633
53604
|
|
|
@@ -53683,10 +53654,8 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53683
53654
|
this._uUVDecodeMatrix = program.getLocation("uvDecodeMatrix");
|
|
53684
53655
|
|
|
53685
53656
|
this._uWorldMatrix = program.getLocation("worldMatrix");
|
|
53686
|
-
this._uWorldNormalMatrix = program.getLocation("worldNormalMatrix");
|
|
53687
53657
|
|
|
53688
53658
|
this._uViewMatrix = program.getLocation("viewMatrix");
|
|
53689
|
-
this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
|
|
53690
53659
|
this._uProjMatrix = program.getLocation("projMatrix");
|
|
53691
53660
|
|
|
53692
53661
|
this._uLightAmbient = program.getLocation("lightAmbient");
|
|
@@ -53732,7 +53701,6 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53732
53701
|
}
|
|
53733
53702
|
|
|
53734
53703
|
this._aPosition = program.getAttribute("position");
|
|
53735
|
-
this._aNormal = program.getAttribute("normal");
|
|
53736
53704
|
this._aColor = program.getAttribute("color");
|
|
53737
53705
|
this._aUV = program.getAttribute("uv");
|
|
53738
53706
|
this._aFlags = program.getAttribute("flags");
|
|
@@ -53743,10 +53711,6 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53743
53711
|
this._aModelMatrixCol1 = program.getAttribute("modelMatrixCol1");
|
|
53744
53712
|
this._aModelMatrixCol2 = program.getAttribute("modelMatrixCol2");
|
|
53745
53713
|
|
|
53746
|
-
this._aModelNormalMatrixCol0 = program.getAttribute("modelNormalMatrixCol0");
|
|
53747
|
-
this._aModelNormalMatrixCol1 = program.getAttribute("modelNormalMatrixCol1");
|
|
53748
|
-
this._aModelNormalMatrixCol2 = program.getAttribute("modelNormalMatrixCol2");
|
|
53749
|
-
|
|
53750
53714
|
this._uColorMap = "uColorMap";
|
|
53751
53715
|
|
|
53752
53716
|
this._uOcclusionTexture = "uOcclusionTexture";
|
|
@@ -53805,11 +53769,7 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53805
53769
|
_buildVertexShader() {
|
|
53806
53770
|
const scene = this._scene;
|
|
53807
53771
|
const sectionPlanesState = scene._sectionPlanesState;
|
|
53808
|
-
const lightsState = scene._lightsState;
|
|
53809
53772
|
const clipping = sectionPlanesState.sectionPlanes.length > 0;
|
|
53810
|
-
let i;
|
|
53811
|
-
let len;
|
|
53812
|
-
let light;
|
|
53813
53773
|
const src = [];
|
|
53814
53774
|
src.push("#version 300 es");
|
|
53815
53775
|
src.push("// Instancing geometry drawing vertex shader");
|
|
@@ -53817,7 +53777,6 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53817
53777
|
src.push("uniform int renderPass;");
|
|
53818
53778
|
|
|
53819
53779
|
src.push("in vec3 position;");
|
|
53820
|
-
src.push("in vec3 normal;");
|
|
53821
53780
|
src.push("in vec4 color;");
|
|
53822
53781
|
src.push("in vec2 uv;");
|
|
53823
53782
|
src.push("in vec4 flags;");
|
|
@@ -53831,14 +53790,8 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53831
53790
|
src.push("in vec4 modelMatrixCol1;");
|
|
53832
53791
|
src.push("in vec4 modelMatrixCol2;");
|
|
53833
53792
|
|
|
53834
|
-
src.push("in vec4 modelNormalMatrixCol0;");
|
|
53835
|
-
src.push("in vec4 modelNormalMatrixCol1;");
|
|
53836
|
-
src.push("in vec4 modelNormalMatrixCol2;");
|
|
53837
|
-
|
|
53838
53793
|
src.push("uniform mat4 worldMatrix;");
|
|
53839
|
-
src.push("uniform mat4 worldNormalMatrix;");
|
|
53840
53794
|
src.push("uniform mat4 viewMatrix;");
|
|
53841
|
-
src.push("uniform mat4 viewNormalMatrix;");
|
|
53842
53795
|
src.push("uniform mat4 projMatrix;");
|
|
53843
53796
|
src.push("uniform mat4 positionsDecodeMatrix;");
|
|
53844
53797
|
src.push("uniform mat3 uvDecodeMatrix;");
|
|
@@ -53852,38 +53805,11 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53852
53805
|
src.push("out float isPerspective;");
|
|
53853
53806
|
}
|
|
53854
53807
|
|
|
53855
|
-
src.push("uniform vec4 lightAmbient;");
|
|
53856
|
-
|
|
53857
|
-
for (i = 0, len = lightsState.lights.length; i < len; i++) {
|
|
53858
|
-
light = lightsState.lights[i];
|
|
53859
|
-
if (light.type === "ambient") {
|
|
53860
|
-
continue;
|
|
53861
|
-
}
|
|
53862
|
-
src.push("uniform vec4 lightColor" + i + ";");
|
|
53863
|
-
if (light.type === "dir") {
|
|
53864
|
-
src.push("uniform vec3 lightDir" + i + ";");
|
|
53865
|
-
}
|
|
53866
|
-
if (light.type === "point") {
|
|
53867
|
-
src.push("uniform vec3 lightPos" + i + ";");
|
|
53868
|
-
}
|
|
53869
|
-
if (light.type === "spot") {
|
|
53870
|
-
src.push("uniform vec3 lightPos" + i + ";");
|
|
53871
|
-
src.push("uniform vec3 lightDir" + i + ";");
|
|
53872
|
-
}
|
|
53873
|
-
}
|
|
53874
|
-
|
|
53875
|
-
src.push("vec3 octDecode(vec2 oct) {");
|
|
53876
|
-
src.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));");
|
|
53877
|
-
src.push(" if (v.z < 0.0) {");
|
|
53878
|
-
src.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);");
|
|
53879
|
-
src.push(" }");
|
|
53880
|
-
src.push(" return normalize(v);");
|
|
53881
|
-
src.push("}");
|
|
53882
|
-
|
|
53883
53808
|
if (clipping) {
|
|
53884
53809
|
src.push("out vec4 vWorldPosition;");
|
|
53885
53810
|
src.push("out vec4 vFlags2;");
|
|
53886
53811
|
}
|
|
53812
|
+
src.push("out vec4 vViewPosition;");
|
|
53887
53813
|
src.push("out vec4 vColor;");
|
|
53888
53814
|
src.push("out vec2 vUV;");
|
|
53889
53815
|
|
|
@@ -53904,47 +53830,8 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53904
53830
|
}
|
|
53905
53831
|
|
|
53906
53832
|
src.push("vec4 viewPosition = viewMatrix * worldPosition; ");
|
|
53907
|
-
|
|
53908
|
-
src.push("
|
|
53909
|
-
src.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);");
|
|
53910
|
-
src.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);");
|
|
53911
|
-
|
|
53912
|
-
src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");
|
|
53913
|
-
src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");
|
|
53914
|
-
|
|
53915
|
-
src.push("float lambertian = 1.0;");
|
|
53916
|
-
for (i = 0, len = lightsState.lights.length; i < len; i++) {
|
|
53917
|
-
light = lightsState.lights[i];
|
|
53918
|
-
if (light.type === "ambient") {
|
|
53919
|
-
continue;
|
|
53920
|
-
}
|
|
53921
|
-
if (light.type === "dir") {
|
|
53922
|
-
if (light.space === "view") {
|
|
53923
|
-
src.push("viewLightDir = normalize(lightDir" + i + ");");
|
|
53924
|
-
} else {
|
|
53925
|
-
src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir" + i + ", 0.0)).xyz);");
|
|
53926
|
-
}
|
|
53927
|
-
} else if (light.type === "point") {
|
|
53928
|
-
if (light.space === "view") {
|
|
53929
|
-
src.push("viewLightDir = -normalize(lightPos" + i + " - viewPosition.xyz);");
|
|
53930
|
-
} else {
|
|
53931
|
-
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
53932
|
-
}
|
|
53933
|
-
} else if (light.type === "spot") {
|
|
53934
|
-
if (light.space === "view") {
|
|
53935
|
-
src.push("viewLightDir = normalize(lightDir" + i + ");");
|
|
53936
|
-
} else {
|
|
53937
|
-
src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir" + i + ", 0.0)).xyz);");
|
|
53938
|
-
}
|
|
53939
|
-
} else {
|
|
53940
|
-
continue;
|
|
53941
|
-
}
|
|
53942
|
-
src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");
|
|
53943
|
-
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
53944
|
-
}
|
|
53945
|
-
|
|
53946
|
-
src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");
|
|
53947
|
-
src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");
|
|
53833
|
+
src.push("vViewPosition = viewPosition;");
|
|
53834
|
+
src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");
|
|
53948
53835
|
src.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;");
|
|
53949
53836
|
|
|
53950
53837
|
src.push("vec4 clipPos = projMatrix * viewPosition;");
|
|
@@ -53967,6 +53854,9 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
53967
53854
|
_buildFragmentShader() {
|
|
53968
53855
|
const scene = this._scene;
|
|
53969
53856
|
const sectionPlanesState = scene._sectionPlanesState;
|
|
53857
|
+
const lightsState = scene._lightsState;
|
|
53858
|
+
let i;
|
|
53859
|
+
let len;
|
|
53970
53860
|
const clipping = sectionPlanesState.sectionPlanes.length > 0;
|
|
53971
53861
|
const src = [];
|
|
53972
53862
|
src.push("#version 300 es");
|
|
@@ -54008,9 +53898,31 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
54008
53898
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
54009
53899
|
}
|
|
54010
53900
|
}
|
|
53901
|
+
src.push("uniform mat4 viewMatrix;");
|
|
53902
|
+
src.push("uniform vec4 lightAmbient;");
|
|
53903
|
+
for (i = 0, len = lightsState.lights.length; i < len; i++) {
|
|
53904
|
+
const light = lightsState.lights[i];
|
|
53905
|
+
if (light.type === "ambient") {
|
|
53906
|
+
continue;
|
|
53907
|
+
}
|
|
53908
|
+
src.push("uniform vec4 lightColor" + i + ";");
|
|
53909
|
+
if (light.type === "dir") {
|
|
53910
|
+
src.push("uniform vec3 lightDir" + i + ";");
|
|
53911
|
+
}
|
|
53912
|
+
if (light.type === "point") {
|
|
53913
|
+
src.push("uniform vec3 lightPos" + i + ";");
|
|
53914
|
+
}
|
|
53915
|
+
if (light.type === "spot") {
|
|
53916
|
+
src.push("uniform vec3 lightPos" + i + ";");
|
|
53917
|
+
src.push("uniform vec3 lightDir" + i + ";");
|
|
53918
|
+
}
|
|
53919
|
+
}
|
|
53920
|
+
|
|
53921
|
+
src.push("in vec4 vViewPosition;");
|
|
54011
53922
|
src.push("in vec4 vColor;");
|
|
54012
53923
|
src.push("in vec2 vUV;");
|
|
54013
53924
|
src.push("out vec4 outColor;");
|
|
53925
|
+
|
|
54014
53926
|
src.push("void main(void) {");
|
|
54015
53927
|
|
|
54016
53928
|
if (clipping) {
|
|
@@ -54028,17 +53940,52 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
54028
53940
|
src.push("}");
|
|
54029
53941
|
}
|
|
54030
53942
|
|
|
54031
|
-
|
|
54032
|
-
|
|
54033
|
-
}
|
|
53943
|
+
src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");
|
|
53944
|
+
src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");
|
|
54034
53945
|
|
|
54035
|
-
src.push("
|
|
54036
|
-
src.push("float opacity = vColor.a;");
|
|
53946
|
+
src.push("float lambertian = 1.0;");
|
|
54037
53947
|
|
|
54038
|
-
|
|
54039
|
-
|
|
53948
|
+
src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");
|
|
53949
|
+
src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");
|
|
53950
|
+
src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");
|
|
53951
|
+
|
|
53952
|
+
for (i = 0, len = lightsState.lights.length; i < len; i++) {
|
|
53953
|
+
const light = lightsState.lights[i];
|
|
53954
|
+
if (light.type === "ambient") {
|
|
53955
|
+
continue;
|
|
53956
|
+
}
|
|
53957
|
+
if (light.type === "dir") {
|
|
53958
|
+
if (light.space === "view") {
|
|
53959
|
+
src.push("viewLightDir = normalize(lightDir" + i + ");");
|
|
53960
|
+
} else {
|
|
53961
|
+
src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir" + i + ", 0.0)).xyz);");
|
|
53962
|
+
}
|
|
53963
|
+
} else if (light.type === "point") {
|
|
53964
|
+
if (light.space === "view") {
|
|
53965
|
+
src.push("viewLightDir = -normalize(lightPos" + i + " - viewPosition.xyz);");
|
|
53966
|
+
} else {
|
|
53967
|
+
src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos" + i + ", 0.0)).xyz);");
|
|
53968
|
+
}
|
|
53969
|
+
} else if (light.type === "spot") {
|
|
53970
|
+
if (light.space === "view") {
|
|
53971
|
+
src.push("viewLightDir = normalize(lightDir" + i + ");");
|
|
53972
|
+
} else {
|
|
53973
|
+
src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir" + i + ", 0.0)).xyz);");
|
|
53974
|
+
}
|
|
53975
|
+
} else {
|
|
53976
|
+
continue;
|
|
53977
|
+
}
|
|
53978
|
+
src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");
|
|
53979
|
+
src.push("reflectedColor += lambertian * (lightColor" + i + ".rgb * lightColor" + i + ".a);");
|
|
53980
|
+
}
|
|
53981
|
+
|
|
53982
|
+
src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");
|
|
53983
|
+
src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");
|
|
53984
|
+
src.push("float opacity = color.a;");
|
|
54040
53985
|
|
|
54041
53986
|
if (this._withSAO) {
|
|
53987
|
+
// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
|
|
53988
|
+
// Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
|
|
54042
53989
|
src.push(" float viewportWidth = uSAOParams[0];");
|
|
54043
53990
|
src.push(" float viewportHeight = uSAOParams[1];");
|
|
54044
53991
|
src.push(" float blendCutoff = uSAOParams[2];");
|
|
@@ -54049,6 +53996,11 @@ class TrianglesInstancingColorTextureRenderer {
|
|
|
54049
53996
|
} else {
|
|
54050
53997
|
src.push(" outColor = vec4(vColor.rgb * colorTexel.rgb, opacity);");
|
|
54051
53998
|
}
|
|
53999
|
+
|
|
54000
|
+
if (scene.logarithmicDepthBufferEnabled) {
|
|
54001
|
+
src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
|
|
54002
|
+
}
|
|
54003
|
+
|
|
54052
54004
|
src.push("}");
|
|
54053
54005
|
return src;
|
|
54054
54006
|
}
|
|
@@ -54704,7 +54656,6 @@ class TrianglesInstancingLayer {
|
|
|
54704
54656
|
|
|
54705
54657
|
this._state.colorTextureSupported
|
|
54706
54658
|
= !!geometry.uvBuf
|
|
54707
|
-
&& !!geometry.normalsBuf
|
|
54708
54659
|
&& !!textureSet
|
|
54709
54660
|
&& !!textureSet.colorTexture;
|
|
54710
54661
|
|
|
@@ -163370,7 +163321,7 @@ class CityJSONLoaderPlugin extends Plugin {
|
|
|
163370
163321
|
|
|
163371
163322
|
_parseGeometrySurfacesWithSharedMaterial(ctx, geometry, objectMaterial, meshIds) {
|
|
163372
163323
|
|
|
163373
|
-
ctx.
|
|
163324
|
+
const sceneModel = ctx.sceneModel;
|
|
163374
163325
|
const sharedIndices = [];
|
|
163375
163326
|
const geometryCfg = {
|
|
163376
163327
|
positions: [],
|
|
@@ -163416,7 +163367,7 @@ class CityJSONLoaderPlugin extends Plugin {
|
|
|
163416
163367
|
|
|
163417
163368
|
const meshId = "" + ctx.nextId++;
|
|
163418
163369
|
|
|
163419
|
-
|
|
163370
|
+
sceneModel.createMesh({
|
|
163420
163371
|
id: meshId,
|
|
163421
163372
|
primitive: "triangles",
|
|
163422
163373
|
positions: geometryCfg.positions,
|