@onerjs/core 8.54.3 → 8.54.4

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 (45) hide show
  1. package/DeviceInput/webDeviceInputSystem.js +4 -0
  2. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  3. package/Engines/abstractEngine.pure.js +2 -2
  4. package/Engines/abstractEngine.pure.js.map +1 -1
  5. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +3 -1
  6. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  7. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +21 -2
  8. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  9. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +17 -4
  10. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  11. package/Meshes/abstractMesh.pure.js +5 -3
  12. package/Meshes/abstractMesh.pure.js.map +1 -1
  13. package/Misc/tools.pure.js +1 -1
  14. package/Misc/tools.pure.js.map +1 -1
  15. package/Physics/v2/Plugins/havokPlugin.d.ts +15 -0
  16. package/Physics/v2/Plugins/havokPlugin.js +16 -6
  17. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  18. package/Physics/v2/characterController.js +2 -2
  19. package/Physics/v2/characterController.js.map +1 -1
  20. package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.d.ts +5 -0
  21. package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.js +29 -0
  22. package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.js.map +1 -0
  23. package/ShadersWGSL/ShadersInclude/lightFragment.js +2 -3
  24. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  25. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
  26. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +2 -17
  27. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  28. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.d.ts +6 -0
  29. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js +123 -0
  30. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -0
  31. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.d.ts +1 -1
  32. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +2 -111
  33. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  34. package/ShadersWGSL/background.fragment.js +2 -1
  35. package/ShadersWGSL/background.fragment.js.map +1 -1
  36. package/ShadersWGSL/default.fragment.js +2 -1
  37. package/ShadersWGSL/default.fragment.js.map +1 -1
  38. package/ShadersWGSL/openpbr.fragment.js +2 -1
  39. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  40. package/ShadersWGSL/pbr.fragment.js +2 -1
  41. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  42. package/package.json +1 -1
  43. package/scene.pure.d.ts +7 -0
  44. package/scene.pure.js +8 -0
  45. package/scene.pure.js.map +1 -1
@@ -249,6 +249,13 @@ class TriggerEvent {
249
249
  * The Havok Physics plugin
250
250
  */
251
251
  export class HavokPlugin {
252
+ /**
253
+ * Whether floating origin world regions are enabled for the current scene.
254
+ * @returns true when the scene uses floating origin mode and world regions are not disabled
255
+ */
256
+ _areFloatingOriginWorldRegionsEnabled() {
257
+ return !this._disableWorldRegions && !!FloatingOriginCurrentScene.getScene()?.floatingOriginMode;
258
+ }
252
259
  /**
253
260
  * Finds an existing world region that contains the given world position,
254
261
  * or creates a new world region centered at that position.
@@ -262,8 +269,7 @@ export class HavokPlugin {
262
269
  */
263
270
  _getOrCreateWorldRegion(worldPosition) {
264
271
  // Check if floating origin mode is enabled
265
- const scene = FloatingOriginCurrentScene.getScene();
266
- if (!scene?.floatingOriginMode) {
272
+ if (!this._areFloatingOriginWorldRegionsEnabled()) {
267
273
  // When floating origin mode is disabled, use the default world region
268
274
  return this._worldRegions[0];
269
275
  }
@@ -358,8 +364,7 @@ export class HavokPlugin {
358
364
  * @returns null if no existing region contains it (does NOT create a new one).
359
365
  */
360
366
  _findExistingRegion(worldPosition) {
361
- const scene = FloatingOriginCurrentScene.getScene();
362
- if (!scene?.floatingOriginMode) {
367
+ if (!this._areFloatingOriginWorldRegionsEnabled()) {
363
368
  return this._worldRegions[0];
364
369
  }
365
370
  for (const region of this._worldRegions) {
@@ -435,6 +440,10 @@ export class HavokPlugin {
435
440
  * Bodies within this radius of a world region's origin will use that world.
436
441
  */
437
442
  this._floatingOriginWorldRadius = 100000;
443
+ /**
444
+ * Whether Havok world regions are disabled.
445
+ */
446
+ this._disableWorldRegions = false;
438
447
  /**
439
448
  * Observable for collision started and collision continued events
440
449
  */
@@ -467,6 +476,7 @@ export class HavokPlugin {
467
476
  });
468
477
  this._queryCollector = this._hknp.HP_QueryCollector_Create(1)[1];
469
478
  this.setMaxQueryCollectorHits(parameters.maxQueryCollectorHits ?? 1);
479
+ this._disableWorldRegions = parameters.disableWorldRegions ?? false;
470
480
  this._floatingOriginWorldRadius = parameters.floatingOriginWorldRadius ?? 100000;
471
481
  }
472
482
  /**
@@ -594,7 +604,7 @@ export class HavokPlugin {
594
604
  // Re-region bodies that have moved outside their current world region
595
605
  // BEFORE pre-step and stepping, so the body participates in the correct
596
606
  // world's step and its body buffer transform is valid when sync reads it.
597
- if (this._worldRegions.length > 1 || FloatingOriginCurrentScene.getScene()?.floatingOriginMode) {
607
+ if (this._areFloatingOriginWorldRegionsEnabled()) {
598
608
  for (const physicsBody of physicsBodies) {
599
609
  if (physicsBody._pluginDataInstances.length > 0) {
600
610
  for (const instance of physicsBody._pluginDataInstances) {
@@ -1455,7 +1465,7 @@ export class HavokPlugin {
1455
1465
  // the transform node) immediately land in the correct region with
1456
1466
  // correct local coordinates, avoiding a one-frame precision glitch.
1457
1467
  const pluginData = body._pluginData;
1458
- if (pluginData.worldRegion && (this._worldRegions.length > 1 || FloatingOriginCurrentScene.getScene()?.floatingOriginMode)) {
1468
+ if (pluginData.worldRegion && this._areFloatingOriginWorldRegionsEnabled()) {
1459
1469
  // Get world position of the node
1460
1470
  const worldPos = TmpVectors.Vector3[3];
1461
1471
  if (node.parent) {