@yschindel/ara3d-webgl 1.3.14 → 1.3.16

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
@@ -1,6 +1,6 @@
1
1
  # Ara 3D WebGL - BIM Open Schema Viewer
2
2
 
3
- ![NPM Version](https://img.shields.io/npm/v/%40ara3d%2Fara3d-webgl)
3
+ [![NPM Version](https://img.shields.io/npm/v/%40ara3d%2Fara3d-webgl)](https://www.npmjs.com/package/@ara3d/ara3d-webgl)
4
4
 
5
5
  ## [Live Demo](https://ara3d.github.io/ara3d-webgl/)
6
6
 
@@ -24580,7 +24580,7 @@ class US extends sf {
24580
24580
  super(t);
24581
24581
  Q(this, "_idleDelayMs", 150);
24582
24582
  Q(this, "zoomSpeed", 1);
24583
- Q(this, "panSpeed", 100);
24583
+ Q(this, "panSpeed", 1);
24584
24584
  Q(this, "rotateSpeed", 1);
24585
24585
  Q(this, "orbitSpeed", 1);
24586
24586
  Q(this, "_buttonDown");
@@ -24674,7 +24674,7 @@ class US extends sf {
24674
24674
  this.camera.do().rotate(this.toRotation(t, this.rotateSpeed));
24675
24675
  break;
24676
24676
  case "pan":
24677
- this.camera.do().move2(t.multiplyScalar(this.panSpeed), "XY");
24677
+ this.camera.do().move2(this.toPanDelta(t).multiplyScalar(this.panSpeed), "XY");
24678
24678
  break;
24679
24679
  case "zoom":
24680
24680
  this.camera.do().zoom(1 + t.y * this.zoomSpeed);
@@ -24682,7 +24682,7 @@ class US extends sf {
24682
24682
  }
24683
24683
  }
24684
24684
  onMouseMiddleDrag(t) {
24685
- this.camera.do().move2(t.multiplyScalar(100), "XY");
24685
+ this.camera.do().move2(this.toPanDelta(t).multiplyScalar(this.panSpeed), "XY");
24686
24686
  }
24687
24687
  onMouseRightDrag(t) {
24688
24688
  this.camera.do().rotate(this.toRotation(t, this.rotateSpeed));
@@ -24693,6 +24693,10 @@ class US extends sf {
24693
24693
  getModifier(t) {
24694
24694
  return t.ctrlKey ? "ctrl" : t.shiftKey ? "shift" : "none";
24695
24695
  }
24696
+ toPanDelta(t) {
24697
+ const n = this.viewport.getSize(), i = n.y === 0 ? 1 : n.y, s = n.x / i, a = this.camera.frustrumSizeAt(this.camera.target).y * 2, c = a * s;
24698
+ return new he(t.x * c, t.y * a);
24699
+ }
24696
24700
  }
24697
24701
  var dg = {}, Cs = {};
24698
24702
  Object.defineProperty(Cs, "__esModule", { value: !0 });
@@ -35515,15 +35519,15 @@ const ZT = {
35515
35519
  LZ4: qT,
35516
35520
  LZ4_RAW: XT
35517
35521
  };
35518
- function Kg(r, e) {
35522
+ function Kg(r) {
35519
35523
  console.time("Building geometry");
35520
- const t = new Yn(), n = KT(r), i = jT(n), s = JT(n), o = YT(i);
35521
- let a = 0;
35522
- for (const c of s)
35523
- a += c.geometry.index.count / 3 * c.count, t.add(c);
35524
- for (const c of o)
35525
- a += c.geometry.index.count / 3, t.add(c);
35526
- return (e?.applyZUpToYUpRotation ?? !0) && (t.rotation.x = -Math.PI / 2), console.timeEnd("Building geometry"), t;
35524
+ const e = new Yn(), t = KT(r), n = jT(t), i = JT(t), s = YT(n);
35525
+ let o = 0;
35526
+ for (const a of i)
35527
+ o += a.geometry.index.count / 3 * a.count, e.add(a);
35528
+ for (const a of s)
35529
+ o += a.geometry.index.count / 3, e.add(a);
35530
+ return e.rotation.x = -Math.PI / 2, console.timeEnd("Building geometry"), e;
35527
35531
  }
35528
35532
  function YT(r) {
35529
35533
  const e = [];
@@ -35715,14 +35719,13 @@ class i2 {
35715
35719
  Q(this, "EntityParameters");
35716
35720
  Q(this, "SingleParameters");
35717
35721
  Q(this, "PointParameters");
35718
- Q(this, "geometryOptions", { applyZUpToYUpRotation: !0 });
35719
35722
  }
35720
35723
  rebuildGeometry(e) {
35721
- return Kg(e, this.geometryOptions);
35724
+ return Kg(e);
35722
35725
  }
35723
35726
  }
35724
35727
  class r2 {
35725
- constructor(e, t) {
35728
+ constructor(e) {
35726
35729
  Q(this, "Descriptors");
35727
35730
  Q(this, "Strings");
35728
35731
  Q(this, "Entities");
@@ -35731,7 +35734,7 @@ class r2 {
35731
35734
  Q(this, "BimGeometry");
35732
35735
  Q(this, "DescriptorCount");
35733
35736
  Q(this, "ParameterMap");
35734
- this.Data = e, this.Entities = e.Entities ?? {}, this.Strings = e.Strings ?? [], this.BimGeometry = e.BimGeometry, this.InstanceCount = this.BimGeometry?.InstanceEntityIndex?.length ?? 0, this.EntityCount = this.Entities?.Category?.length ?? 0, this.Descriptors = t?.skipDescriptorsAndParameters ? {} : e.Descriptors ?? {}, this.DescriptorCount = t?.skipDescriptorsAndParameters ? 0 : this.Descriptors?.Name?.length ?? 0, this.ParameterMap = /* @__PURE__ */ new Map(), t?.skipDescriptorsAndParameters || (console.time("Computing parameters"), e.IntegerParameters && this.ProcessParameters(e.IntegerParameters), e.SingleParameters && this.ProcessParameters(e.SingleParameters), e.StringParameters && this.ProcessParameters(e.StringParameters), e.EntityParameters && this.ProcessParameters(e.EntityParameters), console.timeEnd("Computing parameters"));
35737
+ this.Data = e, this.Entities = e.Entities ?? {}, this.Strings = e.Strings ?? [], this.BimGeometry = e.BimGeometry, this.InstanceCount = this.BimGeometry.InstanceEntityIndex.length, this.EntityCount = this.Entities.Category.length, this.Descriptors = e.Descriptors, this.DescriptorCount = 0, this.ParameterMap = /* @__PURE__ */ new Map(), this.Descriptors && (console.time("Computing parameters"), this.DescriptorCount = this.Descriptors.Name.length, this.ProcessParameters(e.IntegerParameters), this.ProcessParameters(e.SingleParameters), this.ProcessParameters(e.StringParameters), this.ProcessParameters(e.EntityParameters), console.timeEnd("Computing parameters"));
35735
35738
  }
35736
35739
  GetVal(e, t) {
35737
35740
  return t == 3 ? this.Strings[e] : t == 2 ? e >= 0 ? this.GetEntityName(e) : "" : e;
@@ -35829,8 +35832,6 @@ class s2 {
35829
35832
  constructor(e) {
35830
35833
  Q(this, "Resolver");
35831
35834
  this.Data = e, this.Resolver = new r2(e);
35832
- let t = this.Resolver.FindDescriptor("Rvt:Element:Level");
35833
- console.log("The level descriptor is ", t), e.EntityParameters.Descriptor;
35834
35835
  }
35835
35836
  FuncToInstances(e) {
35836
35837
  const t = /* @__PURE__ */ new Map();
@@ -35873,9 +35874,7 @@ class f2 {
35873
35874
  `Failed to fetch BOS from ${e}: ${n.status} ${n.statusText}`
35874
35875
  );
35875
35876
  const i = await n.arrayBuffer(), s = await UM.loadAsync(i), o = await o2(s, t);
35876
- return o.Instances = $T(o.BimGeometry), o.Query = new s2(o), o.Resolver = o.Query.Resolver, o.geometryOptions = {
35877
- applyZUpToYUpRotation: t?.applyZUpToYUpRotation ?? !0
35878
- }, o.ThreeGeometry = Kg(o.Instances, o.geometryOptions), o;
35877
+ return o.Instances = $T(o.BimGeometry), o.Query = new s2(o), o.Resolver = o.Query.Resolver, o.ThreeGeometry = Kg(o.Instances), o;
35879
35878
  }
35880
35879
  }
35881
35880
  async function o2(r, e) {
@@ -35913,13 +35912,14 @@ async function o2(r, e) {
35913
35912
  metadata: f,
35914
35913
  onChunk(d) {
35915
35914
  let m = d.columnData;
35916
- m instanceof BigInt64Array ? c === Int32Array ? m = Int32Array.from(m, (_) => Number(_)) : c === Float32Array ? m = Float32Array.from(m, (_) => Number(_)) : c === Uint32Array ? m = Uint32Array.from(m, (_) => Number(_)) : m = Array.from(m, (_) => Number(_)) : c && m.constructor.name != c.name && (m = new c(m)), a[d.columnName] = m;
35915
+ const g = typeof (m?.length ? m[0] : void 0) == "bigint";
35916
+ c && m.constructor.name != c.name && !g && (m = new c(m)), a[d.columnName] = m;
35917
35917
  }
35918
35918
  });
35919
35919
  }
35920
35920
  console.time("Reading parquet tables");
35921
35921
  const i = new i2(), s = {};
35922
- return await n("Instances", s, Int32Array), await n("VertexBuffer", s, Int32Array), await n("IndexBuffer", s, Uint32Array), await n("Meshes", s, Int32Array), await n("Materials", s, Uint8Array), await n("Transforms", s, Float32Array), i.BimGeometry = s, await n("Entities", i.Entities = {}, Int32Array), i.Descriptors = {}, e?.skipDescriptorsAndParameters || await n("Descriptors", i.Descriptors, void 0, !0), i.IntegerParameters = {}, i.SingleParameters = {}, i.StringParameters = {}, i.EntityParameters = {}, i.PointParameters = {}, e?.skipDescriptorsAndParameters || (await n("IntegerParameters", i.IntegerParameters, Int32Array, !0), await n("SingleParameters", i.SingleParameters, Int32Array, !0), await n("StringParameters", i.StringParameters, Int32Array, !0), await n("EntityParameters", i.EntityParameters, Int32Array, !0), await n("PointParameters", i.PointParameters, Int32Array, !0)), await n("Strings", i), i;
35922
+ return await n("Instances", s, Int32Array), await n("VertexBuffer", s, Int32Array), await n("IndexBuffer", s, Uint32Array), await n("Meshes", s, Int32Array), await n("Materials", s, Uint8Array), await n("Transforms", s, Float32Array), i.BimGeometry = s, await n("Entities", i.Entities = {}, Int32Array), e && e.loadParameters && (await n("Descriptors", i.Descriptors = {}), await n("IntegerParameters", i.IntegerParameters = {}, Int32Array), await n("SingleParameters", i.SingleParameters = {}, Int32Array), await n("StringParameters", i.StringParameters = {}, Int32Array), await n("EntityParameters", i.EntityParameters = {}, Int32Array), await n("PointParameters", i.PointParameters = {}, Int32Array)), await n("Strings", i), i;
35923
35923
  }
35924
35924
  export {
35925
35925
  f2 as BimOpenSchemaLoader,