@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.
- package/Animations/animation.js +2 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.js +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animatorAvatar.js +13 -12
- package/Animations/animatorAvatar.js.map +1 -1
- package/Animations/easing.js +1 -1
- package/Animations/easing.js.map +1 -1
- package/Animations/pathCursor.js +1 -2
- package/Animations/pathCursor.js.map +1 -1
- package/Cameras/geospatialCameraMovement.js +4 -5
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Layers/selectionOutlineLayer.d.ts +7 -0
- package/Layers/selectionOutlineLayer.js +18 -1
- package/Layers/selectionOutlineLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +1 -0
- package/Layers/thinSelectionOutlineLayer.js +31 -6
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.d.ts +6 -0
- package/Lights/Clustered/clusteredLightContainer.js +42 -0
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Lights/light.d.ts +7 -0
- package/Lights/light.js +10 -0
- package/Lights/light.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +13 -3
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +10 -0
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +8 -1
- package/Meshes/abstractMesh.js +9 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.js +31 -4
- package/Meshes/mesh.js.map +1 -1
- package/Misc/greasedLineTools.js +5 -0
- package/Misc/greasedLineTools.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.js +2 -4
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Physics/v2/characterController.d.ts +5 -0
- package/Physics/v2/characterController.js +6 -0
- package/Physics/v2/characterController.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/XR/webXRSessionManager.js +7 -5
- package/XR/webXRSessionManager.js.map +1 -1
- 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
|
-
|
|
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(
|
|
4204
|
+
const { vertexData: sourceVertexData, transform: sourceTransform } = getVertexDataFromMesh(meshes[0]);
|
|
4178
4205
|
if (isAsync) {
|
|
4179
4206
|
yield;
|
|
4180
4207
|
}
|