@onerjs/core 8.47.1 → 8.47.3

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 (47) hide show
  1. package/Animations/animation.js +2 -2
  2. package/Animations/animation.js.map +1 -1
  3. package/Animations/animationGroup.js +1 -1
  4. package/Animations/animationGroup.js.map +1 -1
  5. package/Animations/animatorAvatar.js +13 -12
  6. package/Animations/animatorAvatar.js.map +1 -1
  7. package/Animations/easing.js +1 -1
  8. package/Animations/easing.js.map +1 -1
  9. package/Animations/pathCursor.js +1 -2
  10. package/Animations/pathCursor.js.map +1 -1
  11. package/Cameras/geospatialCameraMovement.js +4 -5
  12. package/Cameras/geospatialCameraMovement.js.map +1 -1
  13. package/Layers/selectionOutlineLayer.d.ts +7 -0
  14. package/Layers/selectionOutlineLayer.js +18 -1
  15. package/Layers/selectionOutlineLayer.js.map +1 -1
  16. package/Layers/thinSelectionOutlineLayer.d.ts +1 -0
  17. package/Layers/thinSelectionOutlineLayer.js +31 -6
  18. package/Layers/thinSelectionOutlineLayer.js.map +1 -1
  19. package/Lights/Clustered/clusteredLightContainer.d.ts +6 -0
  20. package/Lights/Clustered/clusteredLightContainer.js +42 -0
  21. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  22. package/Lights/light.d.ts +7 -0
  23. package/Lights/light.js +10 -0
  24. package/Lights/light.js.map +1 -1
  25. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +13 -3
  26. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  27. package/Materials/Textures/cubeTexture.js +10 -0
  28. package/Materials/Textures/cubeTexture.js.map +1 -1
  29. package/Meshes/abstractMesh.d.ts +8 -1
  30. package/Meshes/abstractMesh.js +9 -2
  31. package/Meshes/abstractMesh.js.map +1 -1
  32. package/Meshes/mesh.js +31 -4
  33. package/Meshes/mesh.js.map +1 -1
  34. package/Misc/greasedLineTools.js +5 -0
  35. package/Misc/greasedLineTools.js.map +1 -1
  36. package/Particles/EmitterTypes/coneParticleEmitter.js +2 -4
  37. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  38. package/Physics/v2/characterController.d.ts +5 -0
  39. package/Physics/v2/characterController.js +6 -0
  40. package/Physics/v2/characterController.js.map +1 -1
  41. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
  42. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  43. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
  44. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  45. package/XR/webXRSessionManager.js +7 -5
  46. package/XR/webXRSessionManager.js.map +1 -1
  47. package/package.json +1 -1
package/Meshes/mesh.js CHANGED
@@ -3398,7 +3398,7 @@ export class Mesh extends AbstractMesh {
3398
3398
  // Physics
3399
3399
  //TODO implement correct serialization for physics impostors.
3400
3400
  if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {
3401
- const impostor = this.getPhysicsImpostor();
3401
+ const impostor = this.getPhysicsImpostor?.();
3402
3402
  if (impostor) {
3403
3403
  serializationObject.physicsMass = impostor.getParam("mass");
3404
3404
  serializationObject.physicsFriction = impostor.getParam("friction");
@@ -3439,7 +3439,7 @@ export class Mesh extends AbstractMesh {
3439
3439
  // Physics
3440
3440
  //TODO implement correct serialization for physics impostors.
3441
3441
  if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {
3442
- const impostor = instance.getPhysicsImpostor();
3442
+ const impostor = instance.getPhysicsImpostor?.();
3443
3443
  if (impostor) {
3444
3444
  serializationInstance.physicsMass = impostor.getParam("mass");
3445
3445
  serializationInstance.physicsFriction = impostor.getParam("friction");
@@ -4110,8 +4110,14 @@ export class Mesh extends AbstractMesh {
4110
4110
  }
4111
4111
  }
4112
4112
  }
4113
+ // Preserve the caller's first mesh for naming and property copying,
4114
+ // since sorting below may reorder the array.
4115
+ const source = meshes[0];
4113
4116
  if (multiMultiMaterials) {
4114
4117
  subdivideWithSubMeshes = false;
4118
+ // Sort meshes by material so that meshes sharing the same material are adjacent.
4119
+ // This produces contiguous index ranges per material, enabling submesh consolidation below.
4120
+ meshes.sort((a, b) => (a.material?.uniqueId ?? -1) - (b.material?.uniqueId ?? -1));
4115
4121
  }
4116
4122
  const materialArray = new Array();
4117
4123
  const materialIndexArray = new Array();
@@ -4168,13 +4174,34 @@ export class Mesh extends AbstractMesh {
4168
4174
  }
4169
4175
  }
4170
4176
  }
4171
- const source = meshes[0];
4177
+ // Consolidate consecutive submesh entries that share the same material and
4178
+ // have contiguous index ranges. Same-material entries are not guaranteed to
4179
+ // be gap-free, so only merge when the next range starts exactly where the
4180
+ // current one ends.
4181
+ if (multiMultiMaterials && indiceArray.length > 1) {
4182
+ let writeIdx = 0;
4183
+ for (let readIdx = 1; readIdx < indiceArray.length; readIdx++) {
4184
+ const previousIndice = indiceArray[writeIdx];
4185
+ const currentIndice = indiceArray[readIdx];
4186
+ if (materialIndexArray[readIdx] === materialIndexArray[writeIdx] && previousIndice.start + previousIndice.count === currentIndice.start) {
4187
+ // Extend the previous entry only when this range is contiguous
4188
+ previousIndice.count += currentIndice.count;
4189
+ }
4190
+ else {
4191
+ writeIdx++;
4192
+ indiceArray[writeIdx] = currentIndice;
4193
+ materialIndexArray[writeIdx] = materialIndexArray[readIdx];
4194
+ }
4195
+ }
4196
+ indiceArray.length = writeIdx + 1;
4197
+ materialIndexArray.length = writeIdx + 1;
4198
+ }
4172
4199
  const getVertexDataFromMesh = (mesh) => {
4173
4200
  const wm = mesh.computeWorldMatrix(true);
4174
4201
  const vertexData = VertexData.ExtractFromMesh(mesh, false, false);
4175
4202
  return { vertexData, transform: wm };
4176
4203
  };
4177
- const { vertexData: sourceVertexData, transform: sourceTransform } = getVertexDataFromMesh(source);
4204
+ const { vertexData: sourceVertexData, transform: sourceTransform } = getVertexDataFromMesh(meshes[0]);
4178
4205
  if (isAsync) {
4179
4206
  yield;
4180
4207
  }