@xeokit/xeokit-sdk 2.6.112 → 2.6.114

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.112",
3
+ "version": "2.6.114",
4
4
  "description": "3D BIM IFC Viewer SDK for AEC engineering applications. Open Source JavaScript Toolkit based on pure WebGL for top performance, real-world coordinates and full double precision",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -5,7 +5,7 @@ export * from "./AngleMeasurementsTouchControl.js";
5
5
 
6
6
  import {Component} from "../../viewer/scene/Component.js";
7
7
  import {math} from "../../viewer/scene/math/math.js";
8
- import {activateDraggableDots} from "../../../src/plugins/lib/ui/index.js";
8
+ import {activateDraggableDots} from "../lib/ui/index.js";
9
9
 
10
10
  class AngleMeasurementEditControl extends Component {
11
11
 
@@ -5,7 +5,7 @@ export * from "./DistanceMeasurementsTouchControl.js";
5
5
 
6
6
  import {Component} from "../../viewer/scene/Component.js";
7
7
  import {math} from "../../viewer/scene/math/math.js";
8
- import {activateDraggableDots} from "../../../src/plugins/lib/ui/index.js";
8
+ import {activateDraggableDots} from "../lib/ui/index.js";
9
9
 
10
10
  export class DistanceMeasurementEditControl extends Component {
11
11
 
@@ -896,7 +896,7 @@ class XKTLoaderPlugin extends Plugin {
896
896
  * @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
897
897
  * @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
898
898
  * @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
899
- * @param {Boolean} [params.loadIntoMetaScene=true] Whether to load metadata into MetaScene, otherwise expose as SceneModel::metadata.
899
+ * @param {Boolean|Function} [params.loadIntoMetaScene=true] Whether to load metadata into ````MetaScene````, otherwise expose as ````SceneModel::metadata````. If provided as a function, it will be called with either ````metaModelSrc````'s contents, ````metaModelData```` value, or xkt's embedded metadata, and the function's return value will be used as ````metaModel.loadData````'s input.
900
900
  * @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
901
901
  * multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info.
902
902
  * @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
@@ -995,10 +995,19 @@ class XKTLoaderPlugin extends Plugin {
995
995
 
996
996
  const loadIntoMetaScene = (! ("loadIntoMetaScene" in params)) || params.loadIntoMetaScene;
997
997
  const metaModel = (loadIntoMetaScene
998
- ? new MetaModel({
999
- id: modelId,
1000
- metaScene: this.viewer.metaScene
1001
- })
998
+ ? (() => {
999
+ const metaModel = new MetaModel({
1000
+ id: modelId,
1001
+ metaScene: this.viewer.metaScene
1002
+ });
1003
+ if (typeof loadIntoMetaScene === "function") {
1004
+ const origLoadData = metaModel.loadData;
1005
+ metaModel.loadData = function(metaModelData, options = {}) {
1006
+ return origLoadData.call(this, loadIntoMetaScene(metaModelData), options);
1007
+ };
1008
+ }
1009
+ return metaModel;
1010
+ })()
1002
1011
  : (function() {
1003
1012
  let firstMetadata = null;
1004
1013
  let modelMetadata = null;
@@ -5,7 +5,7 @@ import {ReadableGeometry} from "../../viewer/scene/geometry/ReadableGeometry.js"
5
5
  import {PhongMaterial} from "../../viewer/scene/materials/PhongMaterial.js";
6
6
  import {math} from "../../viewer/scene/math/math.js";
7
7
  import {Mesh} from "../../viewer/scene/mesh/Mesh.js";
8
- import {activateDraggableDots, Dot3D, marker3D, wire3D, touchPointSelector, transformToNode, triangulateEarClipping} from "../../../src/plugins/lib/ui/index.js";
8
+ import {activateDraggableDots, Dot3D, marker3D, wire3D, touchPointSelector, transformToNode, triangulateEarClipping} from "../lib/ui/index.js";
9
9
 
10
10
  const hex2rgb = function(color) {
11
11
  const rgb = idx => parseInt(color.substr(idx + 1, 2), 16) / 255;
@@ -338,7 +338,7 @@ export const getRenderers = (function() {
338
338
  if (primitive === "points") {
339
339
  cache[sceneId] = {
340
340
  colorRenderers: { "sao-": { "vertex": lazy((vars, geo, c) => c(makeColorProgram(vars, geo, null, null))) } },
341
- occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars, scene.logarithmicDepthBufferEnabled))),
341
+ occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars))),
342
342
  pickDepthRenderer: lazy(makePickDepthProgram),
343
343
  pickMeshRenderer: lazy(makePickMeshProgram),
344
344
  // VBOBatchingPointsShadowRenderer has been implemented by 14e973df6268369b00baef60e468939e062ac320,
@@ -400,7 +400,7 @@ export const getRenderers = (function() {
400
400
  uniform: lazy((vars, geo, c) => c(EdgesProgram(vars, geo, scene.logarithmicDepthBufferEnabled, true)), { vertices: false }),
401
401
  vertex: lazy((vars, geo, c) => c(EdgesProgram(vars, geo, scene.logarithmicDepthBufferEnabled, false)), { vertices: false })
402
402
  },
403
- occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars, scene.logarithmicDepthBufferEnabled))),
403
+ occlusionRenderer: lazy((vars, geo, c) => c(OcclusionProgram(vars))),
404
404
  pickDepthRenderer: eager(makePickDepthProgram),
405
405
  pickMeshRenderer: eager(makePickMeshProgram),
406
406
  pickNormalsFlatRenderer: eager((vars, geo, c) => makePickNormalsProgram(vars, geo, c, true)),
@@ -1,11 +1,7 @@
1
- export const OcclusionProgram = function(programVariables, logarithmicDepthBufferEnabled) {
1
+ export const OcclusionProgram = function(programVariables) {
2
2
  const outColor = programVariables.createOutput("vec4", "outColor");
3
3
  return {
4
4
  programName: "Occlusion",
5
- // Logarithmic depth buffer involves an accuracy tradeoff, sacrificing
6
- // accuracy at close range to improve accuracy at long range. This can
7
- // mess up accuracy for occlusion tests, so we'll disable for now.
8
- getLogDepth: false && logarithmicDepthBufferEnabled && (vFragDepth => vFragDepth),
9
5
  renderPassFlag: 0, // COLOR_OPAQUE // Only opaque objects can be occluders
10
6
  appendFragmentOutputs: (src) => src.push(`${outColor} = vec4(0.0, 0.0, 1.0, 1.0);`) // Occluders are blue
11
7
  };
@@ -636,6 +636,8 @@ class Scene extends Component {
636
636
  alphaDepthMask: alphaDepthMask
637
637
  });
638
638
 
639
+ this.canvas._renderer = this._renderer;
640
+
639
641
  this._sectionPlanesState = new (function () {
640
642
 
641
643
  this.sectionPlanes = [];
@@ -1,6 +1,6 @@
1
1
  import {Component} from '../Component.js';
2
2
  import {math} from "../math/math.js";
3
- import {SectionPlane} from "./SectionPlane";
3
+ import {SectionPlane} from "./SectionPlane.js";
4
4
 
5
5
  const tempVec3a = math.vec3();
6
6
 
@@ -132,13 +132,12 @@ export class OcclusionTester {
132
132
  "OcclusionTester",
133
133
  {
134
134
  sectionPlanesState: sectionPlanesState,
135
- getLogDepth: scene.logarithmicDepthBufferEnabled && (vFragDepth => vFragDepth),
136
135
  clippableTest: () => "true",
137
136
  getVertexData: () => {
138
137
  const src = [ ];
139
138
  src.push(`vec4 worldPosition = vec4(${position}, 1.0);`);
140
139
  src.push(`vec4 ${clipPos} = ${projMatrix} * ${viewMatrix} * worldPosition;`);
141
- if ((! scene.logarithmicDepthBufferEnabled) && (scene.markerZOffset < 0.000)) {
140
+ if (scene.markerZOffset < 0.000) {
142
141
  src.push(`${clipPos}.z += ${scene.markerZOffset};`);
143
142
  }
144
143
  return src;
@@ -36,8 +36,8 @@ export declare type LoadXKTModel = {
36
36
  metaModelSrc?: string;
37
37
  /** JSON model metadata, as an alternative to the ````metaModelSrc```` parameter. */
38
38
  metaModelData?: any;
39
- /** Whether to load metadata into MetaScene, otherwise expose as SceneModel::metadata. Defaults to `true`. */
40
- loadIntoMetaScene?: boolean;
39
+ /** Whether to load metadata into ````MetaScene````, otherwise expose as ````SceneModel::metadata````. If provided a function, the function will be called with either ````metaModelSrc````'s contents, ````metaModelData```` value, or xkt's embedded metadata, and the function's return value will be used as ````metaModel.loadData````'s input. Defaults to `true`. */
40
+ loadIntoMetaScene?: boolean | ((metadata: any) => any);
41
41
  /** Path or URL to a JSON manifest file that provides paths or URLs to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info.*/
42
42
  manifestSrc?: any;
43
43
  /** A JSON manifest object (as an alternative to a path or URL) that provides paths or URLs to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info. */