t3d-3dtiles 0.3.0 → 0.4.0

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.
@@ -4685,12 +4685,18 @@
4685
4685
  `;
4686
4686
  const instancing_normal_vert = `
4687
4687
  #ifdef USE_INSTANCING
4688
- mat4 instancingNormalMatrix = transposeMat4(inverseMat4(instancingMatrix));
4688
+ mat3 im = mat3(instancingMatrix);
4689
4689
 
4690
- objectNormal = (instancingNormalMatrix * vec4(objectNormal, 0.0)).xyz;
4690
+ // mirrored? (determinant sign: -1 or +1)
4691
+ float detSign = (dot(im[0], cross(im[1], im[2])) < 0.0) ? -1.0 : 1.0;
4692
+
4693
+ // squared scale per basis (for non-uniform scale correction)
4694
+ vec3 invScale = vec3(dot(im[0], im[0]), dot(im[1], im[1]), dot(im[2], im[2]));
4695
+
4696
+ objectNormal = (im * (objectNormal / invScale)) * detSign;
4691
4697
 
4692
4698
  #ifdef USE_TANGENT
4693
- objectTangent = (instancingNormalMatrix * vec4(objectTangent, 0.0)).xyz;
4699
+ objectTangent = (im * (objectTangent / invScale)) * detSign;
4694
4700
  #endif
4695
4701
  #endif
4696
4702
  `;
@@ -7958,7 +7964,7 @@ ${instancing_normal_vert}
7958
7964
  const {
7959
7965
  pointerTracker
7960
7966
  } = this;
7961
- if (!this.enabled || pointerTracker.getPointerCount() === 0) {
7967
+ if (!this.enabled) {
7962
7968
  return;
7963
7969
  }
7964
7970
  e.preventDefault();
@@ -8078,10 +8084,7 @@ ${instancing_normal_vert}
8078
8084
  };
8079
8085
  const pointerleaveCallback = e => {
8080
8086
  // exit early if the controls are disabled
8081
- const {
8082
- pointerTracker
8083
- } = this;
8084
- if (!this.enabled || pointerTracker.getPointerCount() === 0) {
8087
+ if (!this.enabled) {
8085
8088
  return;
8086
8089
  }
8087
8090
  this.resetState();
@@ -10776,12 +10779,6 @@ ${instancing_normal_vert}
10776
10779
  }
10777
10780
  return new t3d.Attribute(new t3d.Buffer(geometryPosition.buffer.array.length / 3 > 65536 ? new Uint32Array(indices) : new Uint16Array(indices), 1));
10778
10781
  }
10779
-
10780
- // deprecated since v0.2.0, add warning since v0.3.0
10781
- static mergeBufferAttributes(attributes) {
10782
- console.warn('GeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes().');
10783
- return this.mergeAttributes(attributes);
10784
- }
10785
10782
  }
10786
10783
  const _vec3_1 = new t3d.Vector3();
10787
10784
  const _mat3_1 = new t3d.Matrix3();