@onerjs/core 8.50.1 → 8.50.2

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.
Files changed (52) hide show
  1. package/Engines/abstractEngine.js +2 -2
  2. package/Engines/abstractEngine.js.map +1 -1
  3. package/Engines/engine.d.ts +49 -1118
  4. package/Layers/thinSelectionOutlineLayer.js +25 -1
  5. package/Layers/thinSelectionOutlineLayer.js.map +1 -1
  6. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +13 -2
  7. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  8. package/Materials/Textures/baseTexture.d.ts +1 -0
  9. package/Materials/Textures/baseTexture.js +1 -0
  10. package/Materials/Textures/baseTexture.js.map +1 -1
  11. package/Materials/Textures/texture.d.ts +1 -1
  12. package/Materials/Textures/texture.js.map +1 -1
  13. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +37 -3
  14. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +107 -20
  15. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
  16. package/Misc/tools.js +1 -1
  17. package/Misc/tools.js.map +1 -1
  18. package/Particles/IParticleSystem.d.ts +7 -1
  19. package/Particles/IParticleSystem.js.map +1 -1
  20. package/Particles/baseParticleSystem.d.ts +18 -2
  21. package/Particles/baseParticleSystem.js +53 -11
  22. package/Particles/baseParticleSystem.js.map +1 -1
  23. package/Particles/computeShaderParticleSystem.js +16 -0
  24. package/Particles/computeShaderParticleSystem.js.map +1 -1
  25. package/Particles/gpuParticleSystem.d.ts +14 -72
  26. package/Particles/gpuParticleSystem.js +130 -106
  27. package/Particles/gpuParticleSystem.js.map +1 -1
  28. package/Particles/particleSystem.d.ts +0 -80
  29. package/Particles/particleSystem.functions.d.ts +16 -0
  30. package/Particles/particleSystem.functions.js +18 -0
  31. package/Particles/particleSystem.functions.js.map +1 -1
  32. package/Particles/particleSystem.js +0 -114
  33. package/Particles/particleSystem.js.map +1 -1
  34. package/Particles/webgl2ParticleSystem.js +12 -0
  35. package/Particles/webgl2ParticleSystem.js.map +1 -1
  36. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  37. package/Rendering/objectRenderer.d.ts +2 -0
  38. package/Rendering/objectRenderer.js +10 -0
  39. package/Rendering/objectRenderer.js.map +1 -1
  40. package/Shaders/ShadersInclude/gaussianSplatting.js +25 -4
  41. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  42. package/Shaders/gaussianSplatting.vertex.js +3 -0
  43. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  44. package/Shaders/gpuUpdateParticles.vertex.js +13 -0
  45. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  46. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +37 -5
  47. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  48. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -0
  49. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  50. package/ShadersWGSL/gpuUpdateParticles.compute.js +19 -0
  51. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  52. package/package.json +1 -1
@@ -157,7 +157,34 @@ var PLYValue;
157
157
  PLYValue[PLYValue["SH_42"] = 82] = "SH_42";
158
158
  PLYValue[PLYValue["SH_43"] = 83] = "SH_43";
159
159
  PLYValue[PLYValue["SH_44"] = 84] = "SH_44";
160
- PLYValue[PLYValue["UNDEFINED"] = 85] = "UNDEFINED";
160
+ PLYValue[PLYValue["SH_45"] = 85] = "SH_45";
161
+ PLYValue[PLYValue["SH_46"] = 86] = "SH_46";
162
+ PLYValue[PLYValue["SH_47"] = 87] = "SH_47";
163
+ PLYValue[PLYValue["SH_48"] = 88] = "SH_48";
164
+ PLYValue[PLYValue["SH_49"] = 89] = "SH_49";
165
+ PLYValue[PLYValue["SH_50"] = 90] = "SH_50";
166
+ PLYValue[PLYValue["SH_51"] = 91] = "SH_51";
167
+ PLYValue[PLYValue["SH_52"] = 92] = "SH_52";
168
+ PLYValue[PLYValue["SH_53"] = 93] = "SH_53";
169
+ PLYValue[PLYValue["SH_54"] = 94] = "SH_54";
170
+ PLYValue[PLYValue["SH_55"] = 95] = "SH_55";
171
+ PLYValue[PLYValue["SH_56"] = 96] = "SH_56";
172
+ PLYValue[PLYValue["SH_57"] = 97] = "SH_57";
173
+ PLYValue[PLYValue["SH_58"] = 98] = "SH_58";
174
+ PLYValue[PLYValue["SH_59"] = 99] = "SH_59";
175
+ PLYValue[PLYValue["SH_60"] = 100] = "SH_60";
176
+ PLYValue[PLYValue["SH_61"] = 101] = "SH_61";
177
+ PLYValue[PLYValue["SH_62"] = 102] = "SH_62";
178
+ PLYValue[PLYValue["SH_63"] = 103] = "SH_63";
179
+ PLYValue[PLYValue["SH_64"] = 104] = "SH_64";
180
+ PLYValue[PLYValue["SH_65"] = 105] = "SH_65";
181
+ PLYValue[PLYValue["SH_66"] = 106] = "SH_66";
182
+ PLYValue[PLYValue["SH_67"] = 107] = "SH_67";
183
+ PLYValue[PLYValue["SH_68"] = 108] = "SH_68";
184
+ PLYValue[PLYValue["SH_69"] = 109] = "SH_69";
185
+ PLYValue[PLYValue["SH_70"] = 110] = "SH_70";
186
+ PLYValue[PLYValue["SH_71"] = 111] = "SH_71";
187
+ PLYValue[PLYValue["UNDEFINED"] = 112] = "UNDEFINED";
161
188
  })(PLYValue || (PLYValue = {}));
162
189
  /**
163
190
  * Base class for Gaussian Splatting meshes. Contains all single-cloud rendering logic.
@@ -197,7 +224,7 @@ export class GaussianSplattingMeshBase extends Mesh {
197
224
  return this._shDegree;
198
225
  }
199
226
  set shDegree(value) {
200
- const maxDegree = this._shTextures?.length ?? 0;
227
+ const maxDegree = this._maxShDegree;
201
228
  const clamped = Math.max(0, Math.min(Math.round(value), maxDegree));
202
229
  if (this._shDegree === clamped) {
203
230
  return;
@@ -209,7 +236,7 @@ export class GaussianSplattingMeshBase extends Mesh {
209
236
  * Maximum SH degree available from the loaded data.
210
237
  */
211
238
  get maxShDegree() {
212
- return this._shTextures?.length ?? 0;
239
+ return this._maxShDegree;
213
240
  }
214
241
  /**
215
242
  * Number of splats in the mesh
@@ -352,6 +379,7 @@ export class GaussianSplattingMeshBase extends Mesh {
352
379
  this._cachedBoundingMax = null;
353
380
  /** @internal */
354
381
  this._shDegree = 0;
382
+ this._maxShDegree = 0;
355
383
  this._cameraViewInfos = new Map();
356
384
  /**
357
385
  * Cosine value of the angle threshold to update view dependent splat sorting. Default is 0.0001.
@@ -775,8 +803,62 @@ export class GaussianSplattingMeshBase extends Mesh {
775
803
  return 83 /* PLYValue.SH_43 */;
776
804
  case "f_rest_44":
777
805
  return 84 /* PLYValue.SH_44 */;
778
- }
779
- return 85 /* PLYValue.UNDEFINED */;
806
+ case "f_rest_45":
807
+ return 85 /* PLYValue.SH_45 */;
808
+ case "f_rest_46":
809
+ return 86 /* PLYValue.SH_46 */;
810
+ case "f_rest_47":
811
+ return 87 /* PLYValue.SH_47 */;
812
+ case "f_rest_48":
813
+ return 88 /* PLYValue.SH_48 */;
814
+ case "f_rest_49":
815
+ return 89 /* PLYValue.SH_49 */;
816
+ case "f_rest_50":
817
+ return 90 /* PLYValue.SH_50 */;
818
+ case "f_rest_51":
819
+ return 91 /* PLYValue.SH_51 */;
820
+ case "f_rest_52":
821
+ return 92 /* PLYValue.SH_52 */;
822
+ case "f_rest_53":
823
+ return 93 /* PLYValue.SH_53 */;
824
+ case "f_rest_54":
825
+ return 94 /* PLYValue.SH_54 */;
826
+ case "f_rest_55":
827
+ return 95 /* PLYValue.SH_55 */;
828
+ case "f_rest_56":
829
+ return 96 /* PLYValue.SH_56 */;
830
+ case "f_rest_57":
831
+ return 97 /* PLYValue.SH_57 */;
832
+ case "f_rest_58":
833
+ return 98 /* PLYValue.SH_58 */;
834
+ case "f_rest_59":
835
+ return 99 /* PLYValue.SH_59 */;
836
+ case "f_rest_60":
837
+ return 100 /* PLYValue.SH_60 */;
838
+ case "f_rest_61":
839
+ return 101 /* PLYValue.SH_61 */;
840
+ case "f_rest_62":
841
+ return 102 /* PLYValue.SH_62 */;
842
+ case "f_rest_63":
843
+ return 103 /* PLYValue.SH_63 */;
844
+ case "f_rest_64":
845
+ return 104 /* PLYValue.SH_64 */;
846
+ case "f_rest_65":
847
+ return 105 /* PLYValue.SH_65 */;
848
+ case "f_rest_66":
849
+ return 106 /* PLYValue.SH_66 */;
850
+ case "f_rest_67":
851
+ return 107 /* PLYValue.SH_67 */;
852
+ case "f_rest_68":
853
+ return 108 /* PLYValue.SH_68 */;
854
+ case "f_rest_69":
855
+ return 109 /* PLYValue.SH_69 */;
856
+ case "f_rest_70":
857
+ return 110 /* PLYValue.SH_70 */;
858
+ case "f_rest_71":
859
+ return 111 /* PLYValue.SH_71 */;
860
+ }
861
+ return 112 /* PLYValue.UNDEFINED */;
780
862
  }
781
863
  /**
782
864
  * Parse a PLY file header and returns metas infos on splats and chunks
@@ -826,12 +908,15 @@ export class GaussianSplattingMeshBase extends Mesh {
826
908
  if (prop.startsWith("property ")) {
827
909
  const [, typeName, name] = prop.split(" ");
828
910
  const value = GaussianSplattingMeshBase._ValueNameToEnum(name);
829
- if (value != 85 /* PLYValue.UNDEFINED */) {
830
- // SH degree 1,2 or 3 for 9, 24 or 45 values
831
- if (value >= 84 /* PLYValue.SH_44 */) {
832
- shDegree = 3;
911
+ if (value != 112 /* PLYValue.UNDEFINED */) {
912
+ // SH degree 1,2,3 or 4 for 9, 24, 45 or 72 values
913
+ if (value >= 111 /* PLYValue.SH_71 */) {
914
+ shDegree = 4;
915
+ }
916
+ else if (value >= 84 /* PLYValue.SH_44 */) {
917
+ shDegree = Math.max(shDegree, 3);
833
918
  }
834
- else if (value >= 64 /* PLYValue.SH_24 */) {
919
+ else if (value >= 63 /* PLYValue.SH_23 */) {
835
920
  shDegree = Math.max(shDegree, 2);
836
921
  }
837
922
  else if (value >= 48 /* PLYValue.SH_8 */) {
@@ -1115,7 +1200,7 @@ export class GaussianSplattingMeshBase extends Mesh {
1115
1200
  r3 = value;
1116
1201
  break;
1117
1202
  }
1118
- if (sh && property.value >= 40 /* PLYValue.SH_0 */ && property.value <= 84 /* PLYValue.SH_44 */) {
1203
+ if (sh && property.value >= 40 /* PLYValue.SH_0 */ && property.value <= 111 /* PLYValue.SH_71 */) {
1119
1204
  const shIndex = property.value - 40 /* PLYValue.SH_0 */;
1120
1205
  if (property.type == 4 /* PLYType.UCHAR */ && header.chunkCount) {
1121
1206
  // compressed ply. dataView points to beginning of vertex
@@ -1131,7 +1216,7 @@ export class GaussianSplattingMeshBase extends Mesh {
1131
1216
  }
1132
1217
  }
1133
1218
  if (sh) {
1134
- const shDim = header.shDegree == 1 ? 3 : header.shDegree == 2 ? 8 : 15;
1219
+ const shDim = header.shDegree == 1 ? 3 : header.shDegree == 2 ? 8 : header.shDegree == 3 ? 15 : 24;
1135
1220
  for (let j = 0; j < shDim; j++) {
1136
1221
  sh[j * 3 + 0] = plySH[j];
1137
1222
  sh[j * 3 + 1] = plySH[j + shDim];
@@ -1196,7 +1281,7 @@ export class GaussianSplattingMeshBase extends Mesh {
1196
1281
  }
1197
1282
  }
1198
1283
  }
1199
- return { buffer: header.buffer, sh: sh };
1284
+ return { buffer: header.buffer, sh: sh, shDegree: header.shDegree };
1200
1285
  }
1201
1286
  /**
1202
1287
  * Converts a .ply data array buffer to splat
@@ -1527,7 +1612,7 @@ export class GaussianSplattingMeshBase extends Mesh {
1527
1612
  }
1528
1613
  this._sortIsDirty = true;
1529
1614
  }
1530
- *_updateData(data, isAsync, sh, partIndices, { flipY = false, previousVertexCount = 0 } = {}) {
1615
+ *_updateData(data, isAsync, sh, partIndices, { flipY = false, previousVertexCount = 0 } = {}, shDegree) {
1531
1616
  if (!this._covariancesATexture) {
1532
1617
  this._readyToDisplay = false;
1533
1618
  }
@@ -1551,8 +1636,8 @@ export class GaussianSplattingMeshBase extends Mesh {
1551
1636
  this._updateSplatIndexBuffer(vertexCount);
1552
1637
  }
1553
1638
  this._vertexCount = vertexCount;
1554
- // degree == 1 for 1 texture (3 terms), 2 for 2 textures (8 terms) and 3 for 3 textures (15 terms)
1555
- this._shDegree = sh ? sh.length : 0;
1639
+ this._maxShDegree = sh ? (shDegree ?? 0) : 0;
1640
+ this._shDegree = this._maxShDegree;
1556
1641
  const textureSize = this._getTextureSize(vertexCount);
1557
1642
  const textureLength = textureSize.x * textureSize.y;
1558
1643
  const lineCountUpdate = GaussianSplattingMeshBase.ProgressiveUpdateAmount ?? textureSize.y;
@@ -1657,10 +1742,11 @@ export class GaussianSplattingMeshBase extends Mesh {
1657
1742
  * @param data array buffer containing center, color, orientation and scale of splats
1658
1743
  * @param sh optional array of uint8 array for SH data
1659
1744
  * @param partIndices optional array of uint8 for rig node indices
1745
+ * @param shDegree optional SH degree of the data
1660
1746
  * @returns a promise
1661
1747
  */
1662
- async updateDataAsync(data, sh, partIndices) {
1663
- return await runCoroutineAsync(this._updateData(data, true, sh, partIndices), createYieldingScheduler());
1748
+ async updateDataAsync(data, sh, partIndices, shDegree) {
1749
+ return await runCoroutineAsync(this._updateData(data, true, sh, partIndices, undefined, shDegree), createYieldingScheduler());
1664
1750
  }
1665
1751
  /**
1666
1752
  * @experimental
@@ -1669,9 +1755,10 @@ export class GaussianSplattingMeshBase extends Mesh {
1669
1755
  * @param sh optional array of uint8 array for SH data
1670
1756
  * @param options optional informations on how to treat data (needs to be 3rd for backward compatibility)
1671
1757
  * @param partIndices optional array of uint8 for rig node indices
1758
+ * @param shDegree optional SH degree of the data
1672
1759
  */
1673
- updateData(data, sh, options = { flipY: true }, partIndices) {
1674
- runCoroutineSync(this._updateData(data, false, sh, partIndices, options));
1760
+ updateData(data, sh, options = { flipY: true }, partIndices, shDegree) {
1761
+ runCoroutineSync(this._updateData(data, false, sh, partIndices, options, shDegree));
1675
1762
  }
1676
1763
  /**
1677
1764
  * Refreshes the bounding info, taking into account all the thin instances defined