@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.
@@ -35507,8 +35507,8 @@ else if (typeof exports === 'object')
35507
35507
  baseColorFactor[3]
35508
35508
  )
35509
35509
  );
35510
- physicMaterial.setUniformFloat("roughness", roughnessFactor);
35511
- physicMaterial.setUniformFloat("metallic", metallicFactor);
35510
+ physicMaterial.setUniformFloat("roughness", roughnessFactor ?? 1);
35511
+ physicMaterial.setUniformFloat("metallic", metallicFactor ?? 0);
35512
35512
  physicMaterial.setUniformFloat("ao", 1);
35513
35513
  physicMaterial.doubleSide = doubleSided;
35514
35514
  if (baseColorTexture) {
@@ -35519,6 +35519,11 @@ else if (typeof exports === 'object')
35519
35519
  }
35520
35520
  if (metallicRoughnessTexture) {
35521
35521
  physicMaterial.setTexture("maskMap", metallicRoughnessTexture);
35522
+ physicMaterial.shader.setDefine("USE_ROUGHNESS_G", true);
35523
+ physicMaterial.shader.setDefine("USE_METALLIC_B", true);
35524
+ } else {
35525
+ physicMaterial.shader.setDefine("USE_ROUGHNESS_G", false);
35526
+ physicMaterial.shader.setDefine("USE_METALLIC_B", false);
35522
35527
  }
35523
35528
  if (emissiveTexture) {
35524
35529
  physicMaterial.setTexture("emissiveMap", emissiveTexture);
@@ -35568,7 +35573,8 @@ else if (typeof exports === 'object')
35568
35573
  numComponents: 1
35569
35574
  };
35570
35575
  }
35571
- if (!attribArrays[`normal`]) {
35576
+ let needsNormalComputation = !attribArrays[`normal`];
35577
+ if (needsNormalComputation) {
35572
35578
  let normal = [];
35573
35579
  let count = attribArrays["position"].data.length / 3;
35574
35580
  for (let i2 = 0; i2 < count; i2++) {
@@ -35597,6 +35603,9 @@ else if (typeof exports === 'object')
35597
35603
  nodeInfo.skin
35598
35604
  );
35599
35605
  this.gltf.resources[meshName2] = geometry;
35606
+ if (needsNormalComputation && attribArrays[`indices`]?.data && attribArrays[`indices`].data.length > 0) {
35607
+ geometry.computeNormals();
35608
+ }
35600
35609
  let skeletonNode = this.gltf.nodes[nodeInfo.skin.skeleton];
35601
35610
  if (skeletonNode.dnode && skeletonNode.dnode["nodeObj"]) {
35602
35611
  this.convertSkeletonAnim(node, nodeInfo.skin);
@@ -35613,6 +35622,9 @@ else if (typeof exports === 'object')
35613
35622
  primitive
35614
35623
  );
35615
35624
  this.gltf.resources[meshName2] = geometry;
35625
+ if (needsNormalComputation && attribArrays[`indices`]?.data && attribArrays[`indices`].data.length > 0) {
35626
+ geometry.computeNormals();
35627
+ }
35616
35628
  if (geometry.hasAttribute(VertexAttributeName.joints0)) {
35617
35629
  geometry.vertexAttributeMap.delete(VertexAttributeName.joints0);
35618
35630
  }
@@ -38966,7 +38978,9 @@ else if (typeof exports === 'object')
38966
38978
  static format = ParserFormat.BIN;
38967
38979
  async parseBuffer(buffer) {
38968
38980
  let loader = new B3DMLoader();
38969
- loader.adjustmentTransform = this.userData;
38981
+ if (this.userData) {
38982
+ loader.adjustmentTransform = this.userData;
38983
+ }
38970
38984
  this.data = await loader.parse(buffer);
38971
38985
  }
38972
38986
  verification() {
@@ -41050,7 +41064,7 @@ else if (typeof exports === 'object')
41050
41064
  }
41051
41065
  }
41052
41066
 
41053
- const version = "1.0.16";
41067
+ const version = "1.0.17";
41054
41068
 
41055
41069
  class Engine3D {
41056
41070
  /**
@@ -62053,9 +62067,17 @@ fn frag(){
62053
62067
  }
62054
62068
  }
62055
62069
  if (!parentTile) {
62056
- transform.rawData[12] -= boundCenter.x;
62057
- transform.rawData[13] -= boundCenter.y;
62058
- transform.rawData[14] -= boundCenter.z;
62070
+ const tmpMat = new Matrix4();
62071
+ tmpMat.copyFrom(transform);
62072
+ tmpMat.rawData[12] = 0;
62073
+ tmpMat.rawData[13] = 0;
62074
+ tmpMat.rawData[14] = 0;
62075
+ const position = new Vector3();
62076
+ position.copyFrom(boundCenter);
62077
+ position.applyMatrix4(tmpMat);
62078
+ transform.rawData[12] = -position.x;
62079
+ transform.rawData[13] = -position.y;
62080
+ transform.rawData[14] = -position.z;
62059
62081
  }
62060
62082
  const worldTransform = transform.clone();
62061
62083
  if (parentTile && parentTile.cached.worldTransform) {
@@ -62581,6 +62603,7 @@ fn frag(){
62581
62603
  this.frameCount = 0;
62582
62604
  this.isLoading = false;
62583
62605
  this.resetCacheStats();
62606
+ this.group.destroy();
62584
62607
  }
62585
62608
  /**
62586
62609
  * Rings-specific: Add camera
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rings-webgpu/core",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Rings webgpu Engine",
5
5
  "main": "index.js",
6
6
  "exports": {