@xeokit/xeokit-sdk 2.4.0-alpha-71 → 2.4.0-alpha-73

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.
@@ -62642,7 +62642,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
62642
62642
  src.push("bool isPerspectiveMatrix(mat4 m) {");
62643
62643
  src.push(" return (m[2][3] == - 1.0);");
62644
62644
  src.push("}");
62645
- src.push("in float isPerspective;");
62645
+ src.push("out float isPerspective;");
62646
62646
  }
62647
62647
  if (clipping) {
62648
62648
  src.push("out vec4 vWorldPosition;");
@@ -99476,9 +99476,9 @@ class Viewer {
99476
99476
  * @param {Boolean} [cfg.alphaDepthMask=true] Whether writing into the depth buffer is enabled or disabled when rendering transparent objects.
99477
99477
  * @param {Boolean} [cfg.entityOffsetsEnabled=false] Whether to enable {@link Entity#offset}. For best performance, only set this ````true```` when you need to use {@link Entity#offset}.
99478
99478
  * @param {Boolean} [cfg.pickSurfacePrecisionEnabled=false] Whether to enable full-precision accuracy when surface picking with {@link Scene#pick}. Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer. The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````.
99479
- * @param {Boolean} [cfg.logarithmicDepthBufferEnabled=false] Whether to enable logarithmic depth buffer. When this is true,
99479
+ * @param {Boolean} [cfg.logarithmicDepthBufferEnabled=true] Whether to enable logarithmic depth buffer. When this is true,
99480
99480
  * you can set huge values for {@link Perspective#far} and {@link Ortho#far}, to push the far clipping plane back so
99481
- * that it does not clip huge models.
99481
+ * that it does not clip huge models. Enabling this also allows snap-picking to work more accurately when the model is far from the viewpoint.
99482
99482
  * @param {Boolean} [cfg.colorTextureEnabled=true] Whether to enable base color texture rendering.
99483
99483
  * @param {Boolean} [cfg.pbrEnabled=false] Whether to enable physically-based rendering.
99484
99484
  * @param {LocaleService} [cfg.localeService=null] Optional locale-based translation service.
@@ -99540,7 +99540,7 @@ class Viewer {
99540
99540
  alphaDepthMask: (cfg.alphaDepthMask !== false),
99541
99541
  entityOffsetsEnabled: (!!cfg.entityOffsetsEnabled),
99542
99542
  pickSurfacePrecisionEnabled: (!!cfg.pickSurfacePrecisionEnabled),
99543
- logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
99543
+ logarithmicDepthBufferEnabled: (cfg.logarithmicDepthBufferEnabled !== false),
99544
99544
  pbrEnabled: (!!cfg.pbrEnabled),
99545
99545
  lodEnabled: (!!cfg.lodEnabled),
99546
99546
  vfcCulling: (!!cfg.vfcEnabled),
@@ -62638,7 +62638,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
62638
62638
  src.push("bool isPerspectiveMatrix(mat4 m) {");
62639
62639
  src.push(" return (m[2][3] == - 1.0);");
62640
62640
  src.push("}");
62641
- src.push("in float isPerspective;");
62641
+ src.push("out float isPerspective;");
62642
62642
  }
62643
62643
  if (clipping) {
62644
62644
  src.push("out vec4 vWorldPosition;");
@@ -99472,9 +99472,9 @@ class Viewer {
99472
99472
  * @param {Boolean} [cfg.alphaDepthMask=true] Whether writing into the depth buffer is enabled or disabled when rendering transparent objects.
99473
99473
  * @param {Boolean} [cfg.entityOffsetsEnabled=false] Whether to enable {@link Entity#offset}. For best performance, only set this ````true```` when you need to use {@link Entity#offset}.
99474
99474
  * @param {Boolean} [cfg.pickSurfacePrecisionEnabled=false] Whether to enable full-precision accuracy when surface picking with {@link Scene#pick}. Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer. The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````.
99475
- * @param {Boolean} [cfg.logarithmicDepthBufferEnabled=false] Whether to enable logarithmic depth buffer. When this is true,
99475
+ * @param {Boolean} [cfg.logarithmicDepthBufferEnabled=true] Whether to enable logarithmic depth buffer. When this is true,
99476
99476
  * you can set huge values for {@link Perspective#far} and {@link Ortho#far}, to push the far clipping plane back so
99477
- * that it does not clip huge models.
99477
+ * that it does not clip huge models. Enabling this also allows snap-picking to work more accurately when the model is far from the viewpoint.
99478
99478
  * @param {Boolean} [cfg.colorTextureEnabled=true] Whether to enable base color texture rendering.
99479
99479
  * @param {Boolean} [cfg.pbrEnabled=false] Whether to enable physically-based rendering.
99480
99480
  * @param {LocaleService} [cfg.localeService=null] Optional locale-based translation service.
@@ -99536,7 +99536,7 @@ class Viewer {
99536
99536
  alphaDepthMask: (cfg.alphaDepthMask !== false),
99537
99537
  entityOffsetsEnabled: (!!cfg.entityOffsetsEnabled),
99538
99538
  pickSurfacePrecisionEnabled: (!!cfg.pickSurfacePrecisionEnabled),
99539
- logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
99539
+ logarithmicDepthBufferEnabled: (cfg.logarithmicDepthBufferEnabled !== false),
99540
99540
  pbrEnabled: (!!cfg.pbrEnabled),
99541
99541
  lodEnabled: (!!cfg.lodEnabled),
99542
99542
  vfcCulling: (!!cfg.vfcEnabled),
@@ -16339,7 +16339,7 @@ src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != ren
16339
16339
  src.push("} else {");src.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");src.push(" vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); ");src.push(" vec3 worldNormal = vec3(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2));");src.push(" vWorldNormal = worldNormal;");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push("#version 300 es");src.push("// Batched geometry normals fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i251=0;_i251<sectionPlanesState.sectionPlanes.length;_i251++){src.push("uniform bool sectionPlaneActive"+_i251+";");src.push("uniform vec3 sectionPlanePos"+_i251+";");src.push("uniform vec3 sectionPlaneDir"+_i251+";");}}src.push("in vec3 vWorldNormal;");src.push("out vec4 outColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var i=0;i<sectionPlanesState.sectionPlanes.length;i++){src.push("if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push("}");}src.push("if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" outColor = vec4((vWorldNormal * 0.5) + 0.5, 1.0);");src.push("}");return src;}}]);return TrianglesInstancingPickNormalsRenderer;}(VBOSceneModelTriangleInstancingRenderer);/**
16340
16340
  * @private
16341
16341
  */var TrianglesInstancingOcclusionRenderer=/*#__PURE__*/function(_VBOSceneModelTriangl26){_inherits(TrianglesInstancingOcclusionRenderer,_VBOSceneModelTriangl26);var _super92=_createSuper(TrianglesInstancingOcclusionRenderer);function TrianglesInstancingOcclusionRenderer(){_classCallCheck(this,TrianglesInstancingOcclusionRenderer);return _super92.apply(this,arguments);}_createClass(TrianglesInstancingOcclusionRenderer,[{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push("#version 300 es");src.push("// Instancing occlusion vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in vec4 color;");src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
16342
- src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._addMatricesUniformBlockLines(src);if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("in float isPerspective;");}if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
16342
+ src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._addMatricesUniformBlockLines(src);if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
16343
16343
  // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT
16344
16344
  src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");src.push("} else {");src.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push("#version 300 es");src.push("// Instancing occlusion fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i252=0;_i252<sectionPlanesState.sectionPlanes.length;_i252++){src.push("uniform bool sectionPlaneActive"+_i252+";");src.push("uniform vec3 sectionPlanePos"+_i252+";");src.push("uniform vec3 sectionPlaneDir"+_i252+";");}}src.push("out vec4 outColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i253=0;_i253<sectionPlanesState.sectionPlanes.length;_i253++){src.push("if (sectionPlaneActive"+_i253+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i253+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i253+".xyz), 0.0, 1000.0);");src.push("}");}src.push("if (dist > 0.0) { discard; }");src.push("}");}src.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); ");// Occluders are blue
16345
16345
  if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);return TrianglesInstancingOcclusionRenderer;}(VBOSceneModelTriangleInstancingRenderer);/**
@@ -21733,9 +21733,9 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
21733
21733
  * @param {Boolean} [cfg.alphaDepthMask=true] Whether writing into the depth buffer is enabled or disabled when rendering transparent objects.
21734
21734
  * @param {Boolean} [cfg.entityOffsetsEnabled=false] Whether to enable {@link Entity#offset}. For best performance, only set this ````true```` when you need to use {@link Entity#offset}.
21735
21735
  * @param {Boolean} [cfg.pickSurfacePrecisionEnabled=false] Whether to enable full-precision accuracy when surface picking with {@link Scene#pick}. Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer. The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````.
21736
- * @param {Boolean} [cfg.logarithmicDepthBufferEnabled=false] Whether to enable logarithmic depth buffer. When this is true,
21736
+ * @param {Boolean} [cfg.logarithmicDepthBufferEnabled=true] Whether to enable logarithmic depth buffer. When this is true,
21737
21737
  * you can set huge values for {@link Perspective#far} and {@link Ortho#far}, to push the far clipping plane back so
21738
- * that it does not clip huge models.
21738
+ * that it does not clip huge models. Enabling this also allows snap-picking to work more accurately when the model is far from the viewpoint.
21739
21739
  * @param {Boolean} [cfg.colorTextureEnabled=true] Whether to enable base color texture rendering.
21740
21740
  * @param {Boolean} [cfg.pbrEnabled=false] Whether to enable physically-based rendering.
21741
21741
  * @param {LocaleService} [cfg.localeService=null] Optional locale-based translation service.
@@ -21763,7 +21763,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
21763
21763
  * The Viewer's {@link Scene}.
21764
21764
  * @property scene
21765
21765
  * @type {Scene}
21766
- */this.scene=new Scene(this,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,keyboardEventsElement:cfg.keyboardEventsElement,contextAttr:{preserveDrawingBuffer:cfg.preserveDrawingBuffer!==false,premultipliedAlpha:!!cfg.premultipliedAlpha,antialias:cfg.antialias!==false},spinnerElementId:cfg.spinnerElementId,transparent:cfg.transparent!==false,gammaInput:true,gammaOutput:false,backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,ticksPerRender:1,ticksPerOcclusionTest:20,units:cfg.units,scale:cfg.scale,origin:cfg.origin,saoEnabled:cfg.saoEnabled,alphaDepthMask:cfg.alphaDepthMask!==false,entityOffsetsEnabled:!!cfg.entityOffsetsEnabled,pickSurfacePrecisionEnabled:!!cfg.pickSurfacePrecisionEnabled,logarithmicDepthBufferEnabled:!!cfg.logarithmicDepthBufferEnabled,pbrEnabled:!!cfg.pbrEnabled,lodEnabled:!!cfg.lodEnabled,vfcCulling:!!cfg.vfcEnabled,colorTextureEnabled:cfg.colorTextureEnabled!==false,dtxEnabled:!!cfg.dtxEnabled});/**
21766
+ */this.scene=new Scene(this,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,keyboardEventsElement:cfg.keyboardEventsElement,contextAttr:{preserveDrawingBuffer:cfg.preserveDrawingBuffer!==false,premultipliedAlpha:!!cfg.premultipliedAlpha,antialias:cfg.antialias!==false},spinnerElementId:cfg.spinnerElementId,transparent:cfg.transparent!==false,gammaInput:true,gammaOutput:false,backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,ticksPerRender:1,ticksPerOcclusionTest:20,units:cfg.units,scale:cfg.scale,origin:cfg.origin,saoEnabled:cfg.saoEnabled,alphaDepthMask:cfg.alphaDepthMask!==false,entityOffsetsEnabled:!!cfg.entityOffsetsEnabled,pickSurfacePrecisionEnabled:!!cfg.pickSurfacePrecisionEnabled,logarithmicDepthBufferEnabled:cfg.logarithmicDepthBufferEnabled!==false,pbrEnabled:!!cfg.pbrEnabled,lodEnabled:!!cfg.lodEnabled,vfcCulling:!!cfg.vfcEnabled,colorTextureEnabled:cfg.colorTextureEnabled!==false,dtxEnabled:!!cfg.dtxEnabled});/**
21767
21767
  * Metadata about the {@link Scene} and the models and objects within it.
21768
21768
  * @property metaScene
21769
21769
  * @type {MetaScene}