@xeokit/xeokit-sdk 2.6.111 → 2.6.113

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/README.md CHANGED
@@ -4,8 +4,7 @@
4
4
  [![](https://data.jsdelivr.com/v1/package/npm/@xeokit/xeokit-sdk/badge)](https://www.jsdelivr.com/package/npm/@xeokit/xeokit-sdk)
5
5
  [![CodeSee](https://github.com/xeokit/xeokit-sdk/actions/workflows/codesee-arch-diagram.yml/badge.svg)](https://github.com/xeokit/xeokit-sdk/actions/workflows/codesee-arch-diagram.yml)
6
6
 
7
- [xeokit](http://xeokit.io) is a JavaScript software development kit created by [xeolabs](http://xeolabs.com) and supported by [Creoox AG](https://creoox.com) for viewing
8
- high-detail, full-precision 3D engineering and BIM models in the browser.
7
+ [xeokit](http://xeokit.io) is a JavaScript software development kit by [Creoox AG](https://creoox.com) for viewing high-detail, full-precision 3D engineering and BIM models in the browser.
9
8
 
10
9
  ## Resources
11
10
 
@@ -1,11 +1,11 @@
1
1
  /**
2
- * xeokit-sdk v2.6.111
3
- * Commit: f70838c6581084cf8401daf800ff7c14582ec11a
4
- * Built: 2026-05-27T11:07:01.143Z
2
+ * xeokit-sdk v2.6.113
3
+ * Commit: 35015312cd61fbe9a764d8874667ca89dadefeb0
4
+ * Built: 2026-08-20T08:03:36.951Z
5
5
  */
6
6
 
7
7
  if (typeof window !== 'undefined') {
8
- window.__XEOKIT__ = { version: '2.6.111', commit: 'f70838c6581084cf8401daf800ff7c14582ec11a', built: '2026-05-27T11:07:01.143Z' };
8
+ window.__XEOKIT__ = { version: '2.6.113', commit: '35015312cd61fbe9a764d8874667ca89dadefeb0', built: '2026-08-20T08:03:36.951Z' };
9
9
  }
10
10
 
11
11
  'use strict';
@@ -31621,14 +31621,10 @@ const FlatColorProgram = function(programVariables, geometry, logarithmicDepthBu
31621
31621
  };
31622
31622
  };
31623
31623
 
31624
- const OcclusionProgram = function(programVariables, logarithmicDepthBufferEnabled) {
31624
+ const OcclusionProgram = function(programVariables) {
31625
31625
  const outColor = programVariables.createOutput("vec4", "outColor");
31626
31626
  return {
31627
31627
  programName: "Occlusion",
31628
- // Logarithmic depth buffer involves an accuracy tradeoff, sacrificing
31629
- // accuracy at close range to improve accuracy at long range. This can
31630
- // mess up accuracy for occlusion tests, so we'll disable for now.
31631
- getLogDepth: false ,
31632
31628
  renderPassFlag: 0, // COLOR_OPAQUE // Only opaque objects can be occluders
31633
31629
  appendFragmentOutputs: (src) => src.push(`${outColor} = vec4(0.0, 0.0, 1.0, 1.0);`) // Occluders are blue
31634
31630
  };
@@ -32262,7 +32258,7 @@ const getRenderers = (function() {
32262
32258
  if (primitive === "points") {
32263
32259
  cache[sceneId] = {
32264
32260
  colorRenderers: { "sao-": { "vertex": lazy((vars, geo, c) => c(makeColorProgram(vars, geo, null, null))) } },
32265
- occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars, scene.logarithmicDepthBufferEnabled))),
32261
+ occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars))),
32266
32262
  pickDepthRenderer: lazy(makePickDepthProgram),
32267
32263
  pickMeshRenderer: lazy(makePickMeshProgram),
32268
32264
  // VBOBatchingPointsShadowRenderer has been implemented by 14e973df6268369b00baef60e468939e062ac320,
@@ -32324,7 +32320,7 @@ const getRenderers = (function() {
32324
32320
  uniform: lazy((vars, geo, c) => c(EdgesProgram(vars, geo, scene.logarithmicDepthBufferEnabled, true)), { vertices: false }),
32325
32321
  vertex: lazy((vars, geo, c) => c(EdgesProgram(vars, geo, scene.logarithmicDepthBufferEnabled, false)), { vertices: false })
32326
32322
  },
32327
- occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars, scene.logarithmicDepthBufferEnabled))),
32323
+ occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars))),
32328
32324
  pickDepthRenderer: eager(makePickDepthProgram),
32329
32325
  pickMeshRenderer: eager(makePickMeshProgram),
32330
32326
  pickNormalsFlatRenderer: eager((vars, geo, c) => makePickNormalsProgram(vars, geo, c, true)),
@@ -46987,13 +46983,12 @@ class OcclusionTester {
46987
46983
  "OcclusionTester",
46988
46984
  {
46989
46985
  sectionPlanesState: sectionPlanesState,
46990
- getLogDepth: scene.logarithmicDepthBufferEnabled && (vFragDepth => vFragDepth),
46991
46986
  clippableTest: () => "true",
46992
46987
  getVertexData: () => {
46993
46988
  const src = [ ];
46994
46989
  src.push(`vec4 worldPosition = vec4(${position}, 1.0);`);
46995
46990
  src.push(`vec4 ${clipPos} = ${projMatrix} * ${viewMatrix} * worldPosition;`);
46996
- if ((! scene.logarithmicDepthBufferEnabled) && (scene.markerZOffset < 0.000)) {
46991
+ if (scene.markerZOffset < 0.000) {
46997
46992
  src.push(`${clipPos}.z += ${scene.markerZOffset};`);
46998
46993
  }
46999
46994
  return src;
@@ -54991,6 +54986,8 @@ class Scene extends Component {
54991
54986
  alphaDepthMask: alphaDepthMask
54992
54987
  });
54993
54988
 
54989
+ this.canvas._renderer = this._renderer;
54990
+
54994
54991
  this._sectionPlanesState = new (function () {
54995
54992
 
54996
54993
  this.sectionPlanes = [];
@@ -111591,11 +111588,12 @@ function getBasePath(src) {
111591
111588
  function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok, error) {
111592
111589
  const spinner = plugin.viewer.scene.canvas.spinner;
111593
111590
  spinner.processes++;
111594
- parse$4(gltf, GLTFLoader, {
111591
+ const loadersGl = options.loadersGl;
111592
+ (loadersGl ? loadersGl.core.parse : parse$4)(gltf, loadersGl ? loadersGl.gltf.GLTFLoader : GLTFLoader, {
111595
111593
  ...(options.parseOptions || { }),
111596
111594
  baseUri: options.basePath
111597
111595
  }).then((gltfData) => {
111598
- const processedGLTF = postProcessGLTF(gltfData);
111596
+ const processedGLTF = (loadersGl ? loadersGl.gltf.postProcessGLTF : postProcessGLTF)(gltfData);
111599
111597
  const ctx = {
111600
111598
  src: src,
111601
111599
  entityId: options.entityId,
@@ -112497,6 +112495,9 @@ class GLTFLoaderPlugin extends Plugin {
112497
112495
  * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models.
112498
112496
  * @param {*} [params.parseOptions={}] Options to pass to loaders.gl parse method, eg. ````{ gltf: { excludeExtensions: { "KHR_texture_transform": false } } }````.
112499
112497
  * @param {Boolean} [params.entityPerMesh=false] Create an entity for each mesh, instead of grouping leaf meshes under their common entity.
112498
+ * @param {*} [params.loadersGl={core,gltf}] Alternative user-provided loaders.gl library.
112499
+ * This feature has been tested with loaders.gl 4.3.4 version.
112500
+ * Because loaders.gl is supplied externally, xeokit cannot guarantee compatibility with all loaders.gl versions.
112500
112501
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
112501
112502
  */
112502
112503
  load(params = {}) {
@@ -121082,6 +121083,9 @@ class ViewCullPlugin extends Plugin {
121082
121083
  if (cullDirty) {
121083
121084
  const kdNode = this._kdRoot;
121084
121085
  if (kdNode) {
121086
+ for (let objectIdx = 0, len = this._objectCullStates.numObjects; objectIdx < len; objectIdx++) {
121087
+ this._objectCullStates.setObjectViewCulled(objectIdx, false);
121088
+ }
121085
121089
  this._visitKDNode(kdNode);
121086
121090
  }
121087
121091
  }
@@ -123543,7 +123547,7 @@ function load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
123543
123547
  if (!geometryArrays) {
123544
123548
 
123545
123549
  geometryArrays = {
123546
- batchThisMesh: (!options.reuseGeometries)
123550
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
123547
123551
  };
123548
123552
 
123549
123553
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
@@ -124057,7 +124061,7 @@ function load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
124057
124061
 
124058
124062
  if (!geometryArrays) {
124059
124063
  geometryArrays = {
124060
- batchThisMesh: (!options.reuseGeometries)
124064
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
124061
124065
  };
124062
124066
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
124063
124067
  let geometryValid = false;
@@ -124663,7 +124667,7 @@ function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
124663
124667
 
124664
124668
  if (!geometryArrays) {
124665
124669
  geometryArrays = {
124666
- batchThisMesh: (!options.reuseGeometries)
124670
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
124667
124671
  };
124668
124672
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
124669
124673
  let geometryValid = false;
@@ -125311,7 +125315,7 @@ function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
125311
125315
 
125312
125316
  if (!geometryArrays) {
125313
125317
  geometryArrays = {
125314
- batchThisMesh: (!options.reuseGeometries)
125318
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
125315
125319
  };
125316
125320
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
125317
125321
  let geometryValid = false;
@@ -126046,7 +126050,7 @@ function load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx)
126046
126050
 
126047
126051
  if (!geometryArrays) {
126048
126052
  geometryArrays = {
126049
- batchThisMesh: (!options.reuseGeometries)
126053
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
126050
126054
  };
126051
126055
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
126052
126056
  const axisLabel = eachGeometryAxisLabel[geometryIndex];
@@ -126982,7 +126986,7 @@ class XKTLoaderPlugin extends Plugin {
126982
126986
  * @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
126983
126987
  * @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
126984
126988
  * @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
126985
- * @param {Boolean} [cfg.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to internally expand
126989
+ * @param {Boolean|Function} [cfg.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to internally expand, a function will be called with a `{ instanceCount: <number> }` argument.
126986
126990
  * all geometry instances into batches (````false````), and not use instancing to render them. Setting this ````false```` can significantly
126987
126991
  * improve Viewer performance for models that have a lot of geometry reuse, but may also increase the amount of
126988
126992
  * browser and GPU memory they require. See [#769](https://github.com/xeokit/xeokit-sdk/issues/769) for more info.
@@ -127250,7 +127254,7 @@ class XKTLoaderPlugin extends Plugin {
127250
127254
  * @type {Boolean}
127251
127255
  */
127252
127256
  set reuseGeometries(value) {
127253
- this._reuseGeometries = value !== false;
127257
+ this._reuseGeometries = value;
127254
127258
  }
127255
127259
 
127256
127260
  /**
@@ -127292,9 +127296,9 @@ class XKTLoaderPlugin extends Plugin {
127292
127296
  * Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.
127293
127297
  * @param {Boolean} [params.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
127294
127298
  * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models. See {@link XKTLoaderPlugin#globalizeObjectIds} for more info.
127295
- * @param {Boolean} [params.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to expand
127296
- * all geometry instances into batches (````false````), and not use instancing to render them. Setting this ````false```` can significantly
127297
- * improve Viewer performance for models that have excessive geometry reuse, but may also increases the amount of
127299
+ * @param {Boolean|Function} [params.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to expand
127300
+ * all geometry instances into batches (````false````), and not use instancing to render them. A function will be called with a `{ instanceCount: <number> }` argument. Setting this ````false```` can significantly
127301
+ * improve Viewer performance for models that have excessive geometry reuse, but may also increase the amount of
127298
127302
  * browser and GPU memory used by the model. See [#769](https://github.com/xeokit/xeokit-sdk/issues/769) for more info.
127299
127303
  * @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to
127300
127304
  * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
@@ -127321,7 +127325,8 @@ class XKTLoaderPlugin extends Plugin {
127321
127325
  const includeIds = params.includeIds || this._includeIds;
127322
127326
  const objectDefaults = params.objectDefaults || this._objectDefaults;
127323
127327
 
127324
- options.reuseGeometries = (params.reuseGeometries !== null && params.reuseGeometries !== undefined) ? params.reuseGeometries : (this._reuseGeometries !== false);
127328
+ const reuseGeometries = params.reuseGeometries ?? this._reuseGeometries;
127329
+ options.reuseGeometries = (typeof reuseGeometries !== "function") ? (() => reuseGeometries) : reuseGeometries;
127325
127330
 
127326
127331
  if (includeTypes) {
127327
127332
  options.includeTypesMap = {};
@@ -1,11 +1,11 @@
1
1
  /**
2
- * xeokit-sdk v2.6.111
3
- * Commit: f70838c6581084cf8401daf800ff7c14582ec11a
4
- * Built: 2026-05-27T11:07:01.143Z
2
+ * xeokit-sdk v2.6.113
3
+ * Commit: 35015312cd61fbe9a764d8874667ca89dadefeb0
4
+ * Built: 2026-08-20T08:03:36.951Z
5
5
  */
6
6
 
7
7
  if (typeof window !== 'undefined') {
8
- window.__XEOKIT__ = { version: '2.6.111', commit: 'f70838c6581084cf8401daf800ff7c14582ec11a', built: '2026-05-27T11:07:01.143Z' };
8
+ window.__XEOKIT__ = { version: '2.6.113', commit: '35015312cd61fbe9a764d8874667ca89dadefeb0', built: '2026-08-20T08:03:36.951Z' };
9
9
  }
10
10
 
11
11
  /** @private */
@@ -31617,14 +31617,10 @@ const FlatColorProgram = function(programVariables, geometry, logarithmicDepthBu
31617
31617
  };
31618
31618
  };
31619
31619
 
31620
- const OcclusionProgram = function(programVariables, logarithmicDepthBufferEnabled) {
31620
+ const OcclusionProgram = function(programVariables) {
31621
31621
  const outColor = programVariables.createOutput("vec4", "outColor");
31622
31622
  return {
31623
31623
  programName: "Occlusion",
31624
- // Logarithmic depth buffer involves an accuracy tradeoff, sacrificing
31625
- // accuracy at close range to improve accuracy at long range. This can
31626
- // mess up accuracy for occlusion tests, so we'll disable for now.
31627
- getLogDepth: false ,
31628
31624
  renderPassFlag: 0, // COLOR_OPAQUE // Only opaque objects can be occluders
31629
31625
  appendFragmentOutputs: (src) => src.push(`${outColor} = vec4(0.0, 0.0, 1.0, 1.0);`) // Occluders are blue
31630
31626
  };
@@ -32258,7 +32254,7 @@ const getRenderers = (function() {
32258
32254
  if (primitive === "points") {
32259
32255
  cache[sceneId] = {
32260
32256
  colorRenderers: { "sao-": { "vertex": lazy((vars, geo, c) => c(makeColorProgram(vars, geo, null, null))) } },
32261
- occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars, scene.logarithmicDepthBufferEnabled))),
32257
+ occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars))),
32262
32258
  pickDepthRenderer: lazy(makePickDepthProgram),
32263
32259
  pickMeshRenderer: lazy(makePickMeshProgram),
32264
32260
  // VBOBatchingPointsShadowRenderer has been implemented by 14e973df6268369b00baef60e468939e062ac320,
@@ -32320,7 +32316,7 @@ const getRenderers = (function() {
32320
32316
  uniform: lazy((vars, geo, c) => c(EdgesProgram(vars, geo, scene.logarithmicDepthBufferEnabled, true)), { vertices: false }),
32321
32317
  vertex: lazy((vars, geo, c) => c(EdgesProgram(vars, geo, scene.logarithmicDepthBufferEnabled, false)), { vertices: false })
32322
32318
  },
32323
- occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars, scene.logarithmicDepthBufferEnabled))),
32319
+ occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars))),
32324
32320
  pickDepthRenderer: eager(makePickDepthProgram),
32325
32321
  pickMeshRenderer: eager(makePickMeshProgram),
32326
32322
  pickNormalsFlatRenderer: eager((vars, geo, c) => makePickNormalsProgram(vars, geo, c, true)),
@@ -46983,13 +46979,12 @@ class OcclusionTester {
46983
46979
  "OcclusionTester",
46984
46980
  {
46985
46981
  sectionPlanesState: sectionPlanesState,
46986
- getLogDepth: scene.logarithmicDepthBufferEnabled && (vFragDepth => vFragDepth),
46987
46982
  clippableTest: () => "true",
46988
46983
  getVertexData: () => {
46989
46984
  const src = [ ];
46990
46985
  src.push(`vec4 worldPosition = vec4(${position}, 1.0);`);
46991
46986
  src.push(`vec4 ${clipPos} = ${projMatrix} * ${viewMatrix} * worldPosition;`);
46992
- if ((! scene.logarithmicDepthBufferEnabled) && (scene.markerZOffset < 0.000)) {
46987
+ if (scene.markerZOffset < 0.000) {
46993
46988
  src.push(`${clipPos}.z += ${scene.markerZOffset};`);
46994
46989
  }
46995
46990
  return src;
@@ -54987,6 +54982,8 @@ class Scene extends Component {
54987
54982
  alphaDepthMask: alphaDepthMask
54988
54983
  });
54989
54984
 
54985
+ this.canvas._renderer = this._renderer;
54986
+
54990
54987
  this._sectionPlanesState = new (function () {
54991
54988
 
54992
54989
  this.sectionPlanes = [];
@@ -111587,11 +111584,12 @@ function getBasePath(src) {
111587
111584
  function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok, error) {
111588
111585
  const spinner = plugin.viewer.scene.canvas.spinner;
111589
111586
  spinner.processes++;
111590
- parse$4(gltf, GLTFLoader, {
111587
+ const loadersGl = options.loadersGl;
111588
+ (loadersGl ? loadersGl.core.parse : parse$4)(gltf, loadersGl ? loadersGl.gltf.GLTFLoader : GLTFLoader, {
111591
111589
  ...(options.parseOptions || { }),
111592
111590
  baseUri: options.basePath
111593
111591
  }).then((gltfData) => {
111594
- const processedGLTF = postProcessGLTF(gltfData);
111592
+ const processedGLTF = (loadersGl ? loadersGl.gltf.postProcessGLTF : postProcessGLTF)(gltfData);
111595
111593
  const ctx = {
111596
111594
  src: src,
111597
111595
  entityId: options.entityId,
@@ -112493,6 +112491,9 @@ class GLTFLoaderPlugin extends Plugin {
112493
112491
  * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models.
112494
112492
  * @param {*} [params.parseOptions={}] Options to pass to loaders.gl parse method, eg. ````{ gltf: { excludeExtensions: { "KHR_texture_transform": false } } }````.
112495
112493
  * @param {Boolean} [params.entityPerMesh=false] Create an entity for each mesh, instead of grouping leaf meshes under their common entity.
112494
+ * @param {*} [params.loadersGl={core,gltf}] Alternative user-provided loaders.gl library.
112495
+ * This feature has been tested with loaders.gl 4.3.4 version.
112496
+ * Because loaders.gl is supplied externally, xeokit cannot guarantee compatibility with all loaders.gl versions.
112496
112497
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
112497
112498
  */
112498
112499
  load(params = {}) {
@@ -121078,6 +121079,9 @@ class ViewCullPlugin extends Plugin {
121078
121079
  if (cullDirty) {
121079
121080
  const kdNode = this._kdRoot;
121080
121081
  if (kdNode) {
121082
+ for (let objectIdx = 0, len = this._objectCullStates.numObjects; objectIdx < len; objectIdx++) {
121083
+ this._objectCullStates.setObjectViewCulled(objectIdx, false);
121084
+ }
121081
121085
  this._visitKDNode(kdNode);
121082
121086
  }
121083
121087
  }
@@ -123539,7 +123543,7 @@ function load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
123539
123543
  if (!geometryArrays) {
123540
123544
 
123541
123545
  geometryArrays = {
123542
- batchThisMesh: (!options.reuseGeometries)
123546
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
123543
123547
  };
123544
123548
 
123545
123549
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
@@ -124053,7 +124057,7 @@ function load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
124053
124057
 
124054
124058
  if (!geometryArrays) {
124055
124059
  geometryArrays = {
124056
- batchThisMesh: (!options.reuseGeometries)
124060
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
124057
124061
  };
124058
124062
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
124059
124063
  let geometryValid = false;
@@ -124659,7 +124663,7 @@ function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
124659
124663
 
124660
124664
  if (!geometryArrays) {
124661
124665
  geometryArrays = {
124662
- batchThisMesh: (!options.reuseGeometries)
124666
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
124663
124667
  };
124664
124668
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
124665
124669
  let geometryValid = false;
@@ -125307,7 +125311,7 @@ function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
125307
125311
 
125308
125312
  if (!geometryArrays) {
125309
125313
  geometryArrays = {
125310
- batchThisMesh: (!options.reuseGeometries)
125314
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
125311
125315
  };
125312
125316
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
125313
125317
  let geometryValid = false;
@@ -126042,7 +126046,7 @@ function load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx)
126042
126046
 
126043
126047
  if (!geometryArrays) {
126044
126048
  geometryArrays = {
126045
- batchThisMesh: (!options.reuseGeometries)
126049
+ batchThisMesh: (!options.reuseGeometries({ instanceCount: geometryReuseCount }))
126046
126050
  };
126047
126051
  const primitiveType = eachGeometryPrimitiveType[geometryIndex];
126048
126052
  const axisLabel = eachGeometryAxisLabel[geometryIndex];
@@ -126978,7 +126982,7 @@ class XKTLoaderPlugin extends Plugin {
126978
126982
  * @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
126979
126983
  * @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
126980
126984
  * @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
126981
- * @param {Boolean} [cfg.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to internally expand
126985
+ * @param {Boolean|Function} [cfg.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to internally expand, a function will be called with a `{ instanceCount: <number> }` argument.
126982
126986
  * all geometry instances into batches (````false````), and not use instancing to render them. Setting this ````false```` can significantly
126983
126987
  * improve Viewer performance for models that have a lot of geometry reuse, but may also increase the amount of
126984
126988
  * browser and GPU memory they require. See [#769](https://github.com/xeokit/xeokit-sdk/issues/769) for more info.
@@ -127246,7 +127250,7 @@ class XKTLoaderPlugin extends Plugin {
127246
127250
  * @type {Boolean}
127247
127251
  */
127248
127252
  set reuseGeometries(value) {
127249
- this._reuseGeometries = value !== false;
127253
+ this._reuseGeometries = value;
127250
127254
  }
127251
127255
 
127252
127256
  /**
@@ -127288,9 +127292,9 @@ class XKTLoaderPlugin extends Plugin {
127288
127292
  * Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.
127289
127293
  * @param {Boolean} [params.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
127290
127294
  * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models. See {@link XKTLoaderPlugin#globalizeObjectIds} for more info.
127291
- * @param {Boolean} [params.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to expand
127292
- * all geometry instances into batches (````false````), and not use instancing to render them. Setting this ````false```` can significantly
127293
- * improve Viewer performance for models that have excessive geometry reuse, but may also increases the amount of
127295
+ * @param {Boolean|Function} [params.reuseGeometries=true] Indicates whether to enable geometry reuse (````true```` by default) or whether to expand
127296
+ * all geometry instances into batches (````false````), and not use instancing to render them. A function will be called with a `{ instanceCount: <number> }` argument. Setting this ````false```` can significantly
127297
+ * improve Viewer performance for models that have excessive geometry reuse, but may also increase the amount of
127294
127298
  * browser and GPU memory used by the model. See [#769](https://github.com/xeokit/xeokit-sdk/issues/769) for more info.
127295
127299
  * @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to
127296
127300
  * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
@@ -127317,7 +127321,8 @@ class XKTLoaderPlugin extends Plugin {
127317
127321
  const includeIds = params.includeIds || this._includeIds;
127318
127322
  const objectDefaults = params.objectDefaults || this._objectDefaults;
127319
127323
 
127320
- options.reuseGeometries = (params.reuseGeometries !== null && params.reuseGeometries !== undefined) ? params.reuseGeometries : (this._reuseGeometries !== false);
127324
+ const reuseGeometries = params.reuseGeometries ?? this._reuseGeometries;
127325
+ options.reuseGeometries = (typeof reuseGeometries !== "function") ? (() => reuseGeometries) : reuseGeometries;
127321
127326
 
127322
127327
  if (includeTypes) {
127323
127328
  options.includeTypesMap = {};