@rings-webgpu/core 1.0.16 → 1.0.17

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.
@@ -35500,8 +35500,8 @@ class GLTFSubParserConverter {
35500
35500
  baseColorFactor[3]
35501
35501
  )
35502
35502
  );
35503
- physicMaterial.setUniformFloat("roughness", roughnessFactor);
35504
- physicMaterial.setUniformFloat("metallic", metallicFactor);
35503
+ physicMaterial.setUniformFloat("roughness", roughnessFactor ?? 1);
35504
+ physicMaterial.setUniformFloat("metallic", metallicFactor ?? 0);
35505
35505
  physicMaterial.setUniformFloat("ao", 1);
35506
35506
  physicMaterial.doubleSide = doubleSided;
35507
35507
  if (baseColorTexture) {
@@ -35512,6 +35512,11 @@ class GLTFSubParserConverter {
35512
35512
  }
35513
35513
  if (metallicRoughnessTexture) {
35514
35514
  physicMaterial.setTexture("maskMap", metallicRoughnessTexture);
35515
+ physicMaterial.shader.setDefine("USE_ROUGHNESS_G", true);
35516
+ physicMaterial.shader.setDefine("USE_METALLIC_B", true);
35517
+ } else {
35518
+ physicMaterial.shader.setDefine("USE_ROUGHNESS_G", false);
35519
+ physicMaterial.shader.setDefine("USE_METALLIC_B", false);
35515
35520
  }
35516
35521
  if (emissiveTexture) {
35517
35522
  physicMaterial.setTexture("emissiveMap", emissiveTexture);
@@ -35561,7 +35566,8 @@ class GLTFSubParserConverter {
35561
35566
  numComponents: 1
35562
35567
  };
35563
35568
  }
35564
- if (!attribArrays[`normal`]) {
35569
+ let needsNormalComputation = !attribArrays[`normal`];
35570
+ if (needsNormalComputation) {
35565
35571
  let normal = [];
35566
35572
  let count = attribArrays["position"].data.length / 3;
35567
35573
  for (let i2 = 0; i2 < count; i2++) {
@@ -35590,6 +35596,9 @@ class GLTFSubParserConverter {
35590
35596
  nodeInfo.skin
35591
35597
  );
35592
35598
  this.gltf.resources[meshName2] = geometry;
35599
+ if (needsNormalComputation && attribArrays[`indices`]?.data && attribArrays[`indices`].data.length > 0) {
35600
+ geometry.computeNormals();
35601
+ }
35593
35602
  let skeletonNode = this.gltf.nodes[nodeInfo.skin.skeleton];
35594
35603
  if (skeletonNode.dnode && skeletonNode.dnode["nodeObj"]) {
35595
35604
  this.convertSkeletonAnim(node, nodeInfo.skin);
@@ -35606,6 +35615,9 @@ class GLTFSubParserConverter {
35606
35615
  primitive
35607
35616
  );
35608
35617
  this.gltf.resources[meshName2] = geometry;
35618
+ if (needsNormalComputation && attribArrays[`indices`]?.data && attribArrays[`indices`].data.length > 0) {
35619
+ geometry.computeNormals();
35620
+ }
35609
35621
  if (geometry.hasAttribute(VertexAttributeName.joints0)) {
35610
35622
  geometry.vertexAttributeMap.delete(VertexAttributeName.joints0);
35611
35623
  }
@@ -38959,7 +38971,9 @@ class B3DMParser extends ParserBase {
38959
38971
  static format = ParserFormat.BIN;
38960
38972
  async parseBuffer(buffer) {
38961
38973
  let loader = new B3DMLoader();
38962
- loader.adjustmentTransform = this.userData;
38974
+ if (this.userData) {
38975
+ loader.adjustmentTransform = this.userData;
38976
+ }
38963
38977
  this.data = await loader.parse(buffer);
38964
38978
  }
38965
38979
  verification() {
@@ -41043,7 +41057,7 @@ class PostProcessingComponent extends ComponentBase {
41043
41057
  }
41044
41058
  }
41045
41059
 
41046
- const version = "1.0.16";
41060
+ const version = "1.0.17";
41047
41061
 
41048
41062
  class Engine3D {
41049
41063
  /**
@@ -62046,9 +62060,17 @@ class TilesRenderer {
62046
62060
  }
62047
62061
  }
62048
62062
  if (!parentTile) {
62049
- transform.rawData[12] -= boundCenter.x;
62050
- transform.rawData[13] -= boundCenter.y;
62051
- transform.rawData[14] -= boundCenter.z;
62063
+ const tmpMat = new Matrix4();
62064
+ tmpMat.copyFrom(transform);
62065
+ tmpMat.rawData[12] = 0;
62066
+ tmpMat.rawData[13] = 0;
62067
+ tmpMat.rawData[14] = 0;
62068
+ const position = new Vector3();
62069
+ position.copyFrom(boundCenter);
62070
+ position.applyMatrix4(tmpMat);
62071
+ transform.rawData[12] = -position.x;
62072
+ transform.rawData[13] = -position.y;
62073
+ transform.rawData[14] = -position.z;
62052
62074
  }
62053
62075
  const worldTransform = transform.clone();
62054
62076
  if (parentTile && parentTile.cached.worldTransform) {
@@ -62574,6 +62596,7 @@ class TilesRenderer {
62574
62596
  this.frameCount = 0;
62575
62597
  this.isLoading = false;
62576
62598
  this.resetCacheStats();
62599
+ this.group.destroy();
62577
62600
  }
62578
62601
  /**
62579
62602
  * Rings-specific: Add camera