@babylonjs/core 9.12.0 → 9.13.0

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 (127) hide show
  1. package/Behaviors/Cameras/interpolatingBehavior.d.ts +17 -2
  2. package/Behaviors/Cameras/interpolatingBehavior.js +53 -23
  3. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  4. package/Cameras/Inputs/flyCameraKeyboardInput.js +9 -1
  5. package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
  6. package/Cameras/Inputs/flyCameraMouseInput.d.ts +2 -0
  7. package/Cameras/Inputs/flyCameraMouseInput.js +14 -2
  8. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  9. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +25 -5
  10. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  11. package/Cameras/Inputs/freeCameraMouseInput.d.ts +14 -0
  12. package/Cameras/Inputs/freeCameraMouseInput.js +26 -4
  13. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  14. package/Cameras/Inputs/freeCameraTouchInput.js +16 -5
  15. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  16. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +8 -1
  17. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
  18. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  19. package/Cameras/flyCamera.pure.d.ts +8 -0
  20. package/Cameras/flyCamera.pure.js.map +1 -1
  21. package/Cameras/freeCamera.pure.d.ts +8 -0
  22. package/Cameras/freeCamera.pure.js.map +1 -1
  23. package/Cameras/geospatialCamera.pure.d.ts +30 -7
  24. package/Cameras/geospatialCamera.pure.js +39 -14
  25. package/Cameras/geospatialCamera.pure.js.map +1 -1
  26. package/Cameras/geospatialCameraMovement.js +2 -2
  27. package/Cameras/geospatialCameraMovement.js.map +1 -1
  28. package/Cameras/index.d.ts +1 -0
  29. package/Cameras/index.js +1 -0
  30. package/Cameras/index.js.map +1 -1
  31. package/Cameras/pure.d.ts +1 -0
  32. package/Cameras/pure.js +1 -0
  33. package/Cameras/pure.js.map +1 -1
  34. package/Cameras/targetCamera.pure.d.ts +25 -0
  35. package/Cameras/targetCamera.pure.js +83 -25
  36. package/Cameras/targetCamera.pure.js.map +1 -1
  37. package/Cameras/targetCameraMovement.d.ts +56 -0
  38. package/Cameras/targetCameraMovement.js +63 -0
  39. package/Cameras/targetCameraMovement.js.map +1 -0
  40. package/Collisions/gpuPicker.d.ts +111 -4
  41. package/Collisions/gpuPicker.js +673 -106
  42. package/Collisions/gpuPicker.js.map +1 -1
  43. package/Engines/AbstractEngine/abstractEngine.scissor.d.ts +18 -0
  44. package/Engines/AbstractEngine/abstractEngine.scissor.js +2 -0
  45. package/Engines/AbstractEngine/abstractEngine.scissor.js.map +1 -0
  46. package/Engines/Native/nativeInterfaces.d.ts +1 -0
  47. package/Engines/Native/nativeInterfaces.js.map +1 -1
  48. package/Engines/abstractEngine.pure.js +2 -2
  49. package/Engines/abstractEngine.pure.js.map +1 -1
  50. package/Engines/engine.d.ts +1 -0
  51. package/Engines/engine.js +1 -0
  52. package/Engines/engine.js.map +1 -1
  53. package/Engines/engine.pure.d.ts +0 -12
  54. package/Engines/engine.pure.js +0 -20
  55. package/Engines/engine.pure.js.map +1 -1
  56. package/Engines/nullEngine.pure.d.ts +66 -0
  57. package/Engines/nullEngine.pure.js +97 -0
  58. package/Engines/nullEngine.pure.js.map +1 -1
  59. package/Engines/pure.d.ts +1 -0
  60. package/Engines/pure.js +1 -0
  61. package/Engines/pure.js.map +1 -1
  62. package/Engines/thinEngine.scissor.d.ts +6 -0
  63. package/Engines/thinEngine.scissor.js +9 -0
  64. package/Engines/thinEngine.scissor.js.map +1 -0
  65. package/Engines/thinEngine.scissor.pure.d.ts +6 -0
  66. package/Engines/thinEngine.scissor.pure.js +24 -0
  67. package/Engines/thinEngine.scissor.pure.js.map +1 -0
  68. package/Engines/thinNativeEngine.d.ts +0 -1
  69. package/Engines/thinNativeEngine.js +0 -1
  70. package/Engines/thinNativeEngine.js.map +1 -1
  71. package/Engines/thinNativeEngine.pure.d.ts +3 -0
  72. package/Engines/thinNativeEngine.pure.js +50 -4
  73. package/Engines/thinNativeEngine.pure.js.map +1 -1
  74. package/Engines/webgpuEngine.pure.js.map +1 -1
  75. package/Loading/sceneLoader.d.ts +5 -1
  76. package/Loading/sceneLoader.js +298 -401
  77. package/Loading/sceneLoader.js.map +1 -1
  78. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.d.ts +15 -0
  79. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +34 -1
  80. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
  81. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +9 -0
  82. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +26 -2
  83. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  84. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +10 -3
  85. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -1
  86. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +3 -1
  87. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
  88. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +18 -8
  89. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  90. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +77 -1
  91. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +243 -104
  92. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  93. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +39 -0
  94. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +308 -0
  95. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -0
  96. package/Meshes/geometry.js +30 -15
  97. package/Meshes/geometry.js.map +1 -1
  98. package/Meshes/mesh.pure.js +26 -14
  99. package/Meshes/mesh.pure.js.map +1 -1
  100. package/Misc/tools.pure.js +1 -1
  101. package/Misc/tools.pure.js.map +1 -1
  102. package/Shaders/ShadersInclude/gaussianSplatting.js +1 -0
  103. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  104. package/Shaders/gaussianSplatting.fragment.js +17 -1
  105. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  106. package/Shaders/gaussianSplatting.vertex.js +1 -1
  107. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  108. package/Shaders/gaussianSplattingDepth.vertex.js +1 -1
  109. package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
  110. package/Shaders/greasedLine.vertex.js +19 -3
  111. package/Shaders/greasedLine.vertex.js.map +1 -1
  112. package/Shaders/picking.fragment.js +39 -3
  113. package/Shaders/picking.fragment.js.map +1 -1
  114. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +3 -1
  115. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  116. package/ShadersWGSL/gaussianSplatting.fragment.js +14 -1
  117. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  118. package/ShadersWGSL/gaussianSplatting.vertex.js +2 -2
  119. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  120. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
  121. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  122. package/ShadersWGSL/picking.fragment.js +22 -1
  123. package/ShadersWGSL/picking.fragment.js.map +1 -1
  124. package/package.json +3 -2
  125. package/scene.pure.d.ts +12 -0
  126. package/scene.pure.js +36 -0
  127. package/scene.pure.js.map +1 -1
@@ -6,6 +6,7 @@ import { Quaternion, Matrix, Vector3, Vector2, TmpVectors } from "../Maths/math.
6
6
  import { Epsilon } from "../Maths/math.constants.js";
7
7
  import { Axis } from "../Maths/math.axis.js";
8
8
  import { Node } from "../node.js";
9
+ import { TargetCameraMovement } from "./targetCameraMovement.js";
9
10
  // Temporary cache variables to avoid allocations.
10
11
  const TmpMatrix = /*#__PURE__*/ Matrix.Zero();
11
12
  const TmpQuaternion = /*#__PURE__*/ Quaternion.Identity();
@@ -15,6 +16,32 @@ const TmpQuaternion = /*#__PURE__*/ Quaternion.Identity();
15
16
  * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
16
17
  */
17
18
  export class TargetCamera extends Camera {
19
+ /**
20
+ * Defines the inertia (decay coefficient applied per reference frame at 60fps) of the camera.
21
+ * This helps giving a smooth feeling to the camera movement.
22
+ *
23
+ * Override of {@link Camera.inertia} that writes through to the {@link movement} system so the
24
+ * framerate-independent pan/rotation glide stays in sync. Setting this updates the movement
25
+ * system immediately (matching the accessor convergence used by {@link ArcRotateCamera}).
26
+ *
27
+ * Backed by a local field rather than `super.inertia`: the shipped UMD bundle is compiled with
28
+ * TypeScript at `target: ES5`, and ES5 downleveling of `super` access inside a decorated accessor
29
+ * (the base {@link Camera.inertia} carries `@serialize()`) mis-compiles to `undefined`. That would
30
+ * feed `NaN` into the movement decay and freeze the camera. It only breaks in the ES5 UMD bundle;
31
+ * native-ESM dev keeps real `super`. See the `babylonjs/no-super-in-accessor` lint rule.
32
+ */
33
+ get inertia() {
34
+ return this._targetInertia;
35
+ }
36
+ set inertia(value) {
37
+ this._targetInertia = value;
38
+ // `movement` is constructed in this class' constructor; guard for the base-constructor
39
+ // assignment that runs before it exists.
40
+ if (this.movement) {
41
+ this.movement.panInertia = value;
42
+ this.movement.rotationInertia = value;
43
+ }
44
+ }
18
45
  /**
19
46
  * Instantiates a target camera that takes a mesh or position as a target and continues to look at it while it moves.
20
47
  * This is the base of the follow, arc rotate cameras and Free camera
@@ -34,6 +61,7 @@ export class TargetCamera extends Camera {
34
61
  * Define the current rotation the camera is rotating to
35
62
  */
36
63
  this.cameraRotation = new Vector2(0, 0);
64
+ this._targetInertia = 0.9;
37
65
  /**
38
66
  * When set, the up vector of the camera will be updated by the rotation of the camera
39
67
  */
@@ -91,6 +119,11 @@ export class TargetCamera extends Camera {
91
119
  this._referencePoint = Vector3.Forward(this.getScene().useRightHandedSystem);
92
120
  // Set the y component of the rotation to Math.PI in right-handed system for backwards compatibility.
93
121
  this.rotation = new Vector3(0, this.getScene().useRightHandedSystem ? Math.PI : 0, 0);
122
+ this.movement = new TargetCameraMovement(this.getScene(), this.position);
123
+ // Seed movement-system inertia from the value set during base/subclass construction.
124
+ // After this point, the `inertia` setter on this class pushes directly to movement.
125
+ this.movement.panInertia = this.inertia;
126
+ this.movement.rotationInertia = this.inertia;
94
127
  }
95
128
  /**
96
129
  * Gets the position in front of the camera at a given distance.
@@ -266,9 +299,52 @@ export class TargetCamera extends Camera {
266
299
  }
267
300
  /** @internal */
268
301
  _checkInputs() {
302
+ // Fold this frame's raw input — written to `cameraDirection`/`cameraRotation` by the input
303
+ // classes (and honored from direct external writes) — into the movement system, then let it
304
+ // produce framerate-independent per-frame deltas (input plus inertial glide). The applied
305
+ // delta is written back into `cameraDirection`/`cameraRotation` purely as a within-frame
306
+ // hand-off so the collision, gravity, and rotation-constraint logic below reads it unchanged.
307
+ // Both fields are reset to 0 at the end of this method (the inertial glide now lives in the
308
+ // movement system's velocity, not in these fields), so external code polling them *after*
309
+ // `_checkInputs()` reads 0 rather than the legacy residual glide value.
310
+ const movement = this.movement;
311
+ // Capture whether there is raw input on each channel THIS frame, before it is folded into the
312
+ // movement system. This gates the legacy glide cutoff below so it only ends a decaying inertial
313
+ // tail and never discards a small but legitimate active-input delta.
314
+ const hasPanInput = this.cameraDirection.x !== 0 || this.cameraDirection.y !== 0 || this.cameraDirection.z !== 0;
315
+ const hasRotationInput = this.cameraRotation.x !== 0 || this.cameraRotation.y !== 0;
316
+ movement.panAccumulatedPixels.addInPlace(this.cameraDirection);
317
+ movement.rotationAccumulatedPixels.x += this.cameraRotation.x;
318
+ movement.rotationAccumulatedPixels.y += this.cameraRotation.y;
319
+ movement.computeCurrentFrameDeltas();
320
+ this.cameraDirection.copyFrom(movement.panDeltaCurrentFrame);
321
+ this.cameraRotation.set(movement.rotationDeltaCurrentFrame.x, movement.rotationDeltaCurrentFrame.y);
322
+ // Backward-compat glide cutoff: honor the legacy `_panningEpsilon` / `_rotationEpsilon` knobs.
323
+ // Legacy `_checkInputs` snapped `cameraDirection`/`cameraRotation` to 0 once a glide component
324
+ // fell below `speed * _panningEpsilon` / `speed * _rotationEpsilon`, ending the inertial glide
325
+ // at that threshold. The framerate-independent port moved glide into the movement system's
326
+ // velocity, so we mirror that cutoff here and reset the velocity so the glide terminates at the
327
+ // same point (and the public knobs stay meaningful). This is gated on `!hasPanInput` /
328
+ // `!hasRotationInput` so it only fires on the decaying tail: on an active-input frame the
329
+ // emitted delta is always applied, even when it is below the limit. Without that gate, ordinary
330
+ // mouse-look (whose per-frame rotation is typically below `speed * _rotationEpsilon`) would be
331
+ // discarded and the camera would feel unresponsive.
332
+ const inertialPanningLimit = this.speed * this._panningEpsilon;
333
+ if (!hasPanInput &&
334
+ Math.abs(this.cameraDirection.x) < inertialPanningLimit &&
335
+ Math.abs(this.cameraDirection.y) < inertialPanningLimit &&
336
+ Math.abs(this.cameraDirection.z) < inertialPanningLimit) {
337
+ this.cameraDirection.setAll(0);
338
+ movement.resetPanVelocity();
339
+ }
340
+ const inertialRotationLimit = this.speed * this._rotationEpsilon;
341
+ if (!hasRotationInput && Math.abs(this.cameraRotation.x) < inertialRotationLimit && Math.abs(this.cameraRotation.y) < inertialRotationLimit) {
342
+ this.cameraRotation.set(0, 0);
343
+ movement.resetRotationVelocity();
344
+ }
269
345
  const directionMultiplier = this.invertRotation ? -this.inverseRotationSpeed : 1.0;
270
346
  const needToMove = this._decideIfNeedsToMove();
271
- const needToRotate = this.cameraRotation.x || this.cameraRotation.y;
347
+ const needToRotate = !!(this.cameraRotation.x || this.cameraRotation.y);
272
348
  this._deferredUpdated = false;
273
349
  this._deferredRotationUpdate.copyFrom(this.rotation);
274
350
  this._deferredPositionUpdate.copyFrom(this.position);
@@ -317,30 +393,12 @@ export class TargetCamera extends Camera {
317
393
  }
318
394
  }
319
395
  }
320
- const inertialPanningLimit = this.speed * this._panningEpsilon;
321
- const inertialRotationLimit = this.speed * this._rotationEpsilon;
322
- // Inertia
323
- if (needToMove) {
324
- if (Math.abs(this.cameraDirection.x) < inertialPanningLimit) {
325
- this.cameraDirection.x = 0;
326
- }
327
- if (Math.abs(this.cameraDirection.y) < inertialPanningLimit) {
328
- this.cameraDirection.y = 0;
329
- }
330
- if (Math.abs(this.cameraDirection.z) < inertialPanningLimit) {
331
- this.cameraDirection.z = 0;
332
- }
333
- this.cameraDirection.scaleInPlace(this.inertia);
334
- }
335
- if (needToRotate) {
336
- if (Math.abs(this.cameraRotation.x) < inertialRotationLimit) {
337
- this.cameraRotation.x = 0;
338
- }
339
- if (Math.abs(this.cameraRotation.y) < inertialRotationLimit) {
340
- this.cameraRotation.y = 0;
341
- }
342
- this.cameraRotation.scaleInPlace(this.inertia);
343
- }
396
+ // The movement system now owns inertial decay (framerate-independent), so reset the
397
+ // per-frame delta surfaces. Glide persists inside the movement velocity and is re-emitted
398
+ // next frame via `computeCurrentFrameDeltas`; zeroing here prevents the just-applied delta
399
+ // from being re-folded into the accumulators on the next frame.
400
+ this.cameraDirection.setAll(0);
401
+ this.cameraRotation.set(0, 0);
344
402
  super._checkInputs();
345
403
  }
346
404
  _updateCameraRotationMatrix() {
@@ -1 +1 @@
1
- {"version":3,"file":"targetCamera.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/targetCamera.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EAAE,MAAM,EAAE,MAA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MAAM,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;QAEnH,YAAY,CAAC,sBAAsB,CAAC,aAAa,CAAC,YAAY,CAAC,sBAAsB,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;QAE5H,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,sBAAsB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC1G,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,cAAc,CAAC;IAC1B,CAAC;;AA7jBc,mCAAsB,GAAiB,IAAI,MAAM,EAAE,AAA7B,CAA8B;AACpD,mCAAsB,GAAiB,IAAI,MAAM,EAAE,AAA7B,CAA8B;AACpD,8BAAiB,GAAiB,IAAI,OAAO,EAAE,AAA9B,CAA+B;AAexD;IADN,SAAS,EAAE;gEAC8B;AAMnC;IADN,kBAAkB,EAAE;8CACI;AAWlB;IADN,SAAS,EAAE;2CACO;AAqCZ;IADN,wBAAwB,CAAC,gBAAgB,CAAC;kDACX;AAyfpC,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAChC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACpD,OAAO,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize, serializeAsVector3, serializeAsMeshReference } from \"../Misc/decorators\";\r\nimport { type Nullable } from \"../types\";\r\nimport { Camera } from \"./camera.pure\";\r\nimport { type Scene } from \"../scene.pure\";\r\nimport { Quaternion, Matrix, Vector3, Vector2, TmpVectors } from \"../Maths/math.vector.pure\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Axis } from \"../Maths/math.axis\";\r\nimport { type AbstractMesh } from \"../Meshes/abstractMesh.pure\";\r\nimport { Node } from \"../node\";\r\n\r\n// Temporary cache variables to avoid allocations.\r\nconst TmpMatrix = /*#__PURE__*/ Matrix.Zero();\r\nconst TmpQuaternion = /*#__PURE__*/ Quaternion.Identity();\r\n\r\n/**\r\n * A target camera takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\r\n */\r\nexport class TargetCamera extends Camera {\r\n private static _RigCamTransformMatrix = /*#__PURE__*/ new Matrix();\r\n private static _TargetTransformMatrix = /*#__PURE__*/ new Matrix();\r\n private static _TargetFocalPoint = /*#__PURE__*/ new Vector3();\r\n\r\n /**\r\n * Define the current direction the camera is moving to\r\n */\r\n public cameraDirection = new Vector3(0, 0, 0);\r\n /**\r\n * Define the current rotation the camera is rotating to\r\n */\r\n public cameraRotation = new Vector2(0, 0);\r\n\r\n /**\r\n * When set, the up vector of the camera will be updated by the rotation of the camera\r\n */\r\n @serialize()\r\n public updateUpVectorFromRotation = false;\r\n\r\n /**\r\n * Define the current rotation of the camera\r\n */\r\n @serializeAsVector3()\r\n public rotation: Vector3;\r\n\r\n /**\r\n * Define the current rotation of the camera as a quaternion to prevent Gimbal lock\r\n */\r\n public rotationQuaternion: Nullable<Quaternion>;\r\n\r\n /**\r\n * Define the current speed of the camera\r\n */\r\n @serialize()\r\n public speed = 2.0;\r\n\r\n /**\r\n * Add constraint to the camera to prevent it to move freely in all directions and\r\n * around all axis.\r\n */\r\n public noRotationConstraint = false;\r\n\r\n /**\r\n * Reverses mouselook direction to 'natural' panning as opposed to traditional direct\r\n * panning\r\n */\r\n public invertRotation = false;\r\n\r\n /**\r\n * Speed multiplier for inverse camera panning\r\n */\r\n public inverseRotationSpeed = 0.2;\r\n\r\n /**\r\n * @internal\r\n * @experimental\r\n * Can be used to change clamping behavior for inertia. Hook into onBeforeRenderObservable to change the value per-frame\r\n */\r\n public _panningEpsilon = Epsilon;\r\n /**\r\n * @internal\r\n * @experimental\r\n * Can be used to change clamping behavior for inertia. Hook into onBeforeRenderObservable to change the value per-frame\r\n */\r\n public _rotationEpsilon = Epsilon;\r\n\r\n /**\r\n * Define the current target of the camera as an object or a position.\r\n * Please note that locking a target will disable panning.\r\n */\r\n @serializeAsMeshReference(\"lockedTargetId\")\r\n public lockedTarget: any = null;\r\n\r\n protected readonly _currentTarget = Vector3.Zero();\r\n protected _initialFocalDistance = 1;\r\n protected readonly _viewMatrix = Matrix.Zero();\r\n\r\n /** @internal */\r\n public readonly _cameraTransformMatrix = Matrix.Zero();\r\n /** @internal */\r\n public readonly _cameraRotationMatrix = Matrix.Zero();\r\n\r\n protected readonly _referencePoint: Vector3;\r\n protected readonly _transformedReferencePoint = Vector3.Zero();\r\n\r\n protected readonly _deferredPositionUpdate = new Vector3();\r\n protected readonly _deferredRotationQuaternionUpdate = new Quaternion();\r\n protected readonly _deferredRotationUpdate = new Vector3();\r\n protected _deferredUpdated = false;\r\n protected _deferOnly: boolean = false;\r\n\r\n /** @internal */\r\n public _reset: () => void;\r\n\r\n /**\r\n * Instantiates a target camera that takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the start position of the camera in the scene\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines whether the camera should be marked as active if not other active cameras have been defined\r\n */\r\n constructor(name: string, position: Vector3, scene?: Scene, setActiveOnSceneIfNoneActive = true) {\r\n super(name, position, scene, setActiveOnSceneIfNoneActive);\r\n\r\n this._referencePoint = Vector3.Forward(this.getScene().useRightHandedSystem);\r\n\r\n // Set the y component of the rotation to Math.PI in right-handed system for backwards compatibility.\r\n this.rotation = new Vector3(0, this.getScene().useRightHandedSystem ? Math.PI : 0, 0);\r\n }\r\n\r\n /**\r\n * Gets the position in front of the camera at a given distance.\r\n * @param distance The distance from the camera we want the position to be\r\n * @returns the position\r\n */\r\n public getFrontPosition(distance: number): Vector3 {\r\n this.getWorldMatrix();\r\n const worldForward = TmpVectors.Vector3[0];\r\n const localForward = TmpVectors.Vector3[1];\r\n localForward.set(0, 0, this._scene.useRightHandedSystem ? -1.0 : 1.0);\r\n this.getDirectionToRef(localForward, worldForward);\r\n worldForward.scaleInPlace(distance);\r\n return this.globalPosition.add(worldForward);\r\n }\r\n\r\n /** @internal */\r\n public _getLockedTargetPosition(): Nullable<Vector3> {\r\n if (!this.lockedTarget) {\r\n return null;\r\n }\r\n\r\n if (this.lockedTarget.absolutePosition) {\r\n const lockedTarget = this.lockedTarget as AbstractMesh;\r\n const m = lockedTarget.computeWorldMatrix();\r\n // in some cases the absolute position resets externally, but doesn't update since the matrix is cached.\r\n m.getTranslationToRef(lockedTarget.absolutePosition);\r\n }\r\n\r\n return this.lockedTarget.absolutePosition || this.lockedTarget;\r\n }\r\n\r\n private _storedPosition: Vector3;\r\n private _storedRotation: Vector3;\r\n private _storedRotationQuaternion: Nullable<Quaternion>;\r\n\r\n /**\r\n * Store current camera state of the camera (fov, position, rotation, etc..)\r\n * @returns the camera\r\n */\r\n public override storeState(): Camera {\r\n this._storedPosition = this.position.clone();\r\n this._storedRotation = this.rotation.clone();\r\n if (this.rotationQuaternion) {\r\n this._storedRotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n\r\n return super.storeState();\r\n }\r\n\r\n /**\r\n * Restored camera state. You must call storeState() first\r\n * @returns whether it was successful or not\r\n * @internal\r\n */\r\n public override _restoreStateValues(): boolean {\r\n if (!super._restoreStateValues()) {\r\n return false;\r\n }\r\n\r\n this.position = this._storedPosition.clone();\r\n this.rotation = this._storedRotation.clone();\r\n\r\n if (this.rotationQuaternion && this._storedRotationQuaternion) {\r\n this.rotationQuaternion = this._storedRotationQuaternion.clone();\r\n }\r\n\r\n this.cameraDirection.copyFromFloats(0, 0, 0);\r\n this.cameraRotation.copyFromFloats(0, 0);\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public override _initCache() {\r\n super._initCache();\r\n this._cache.lockedTarget = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotation = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotationQuaternion = new Quaternion(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _updateCache(ignoreParentClass?: boolean): void {\r\n if (!ignoreParentClass) {\r\n super._updateCache();\r\n }\r\n\r\n const lockedTargetPosition = this._getLockedTargetPosition();\r\n if (!lockedTargetPosition) {\r\n this._cache.lockedTarget = null;\r\n } else {\r\n if (!this._cache.lockedTarget) {\r\n this._cache.lockedTarget = lockedTargetPosition.clone();\r\n } else {\r\n this._cache.lockedTarget.copyFrom(lockedTargetPosition);\r\n }\r\n }\r\n\r\n this._cache.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n }\r\n\r\n // Synchronized\r\n /** @internal */\r\n public override _isSynchronizedViewMatrix(): boolean {\r\n if (!super._isSynchronizedViewMatrix()) {\r\n return false;\r\n }\r\n\r\n const lockedTargetPosition = this._getLockedTargetPosition();\r\n\r\n return (\r\n (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition) &&\r\n (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation))\r\n );\r\n }\r\n\r\n // Methods\r\n /** @internal */\r\n public _computeLocalCameraSpeed(): number {\r\n const engine = this.getEngine();\r\n return this.speed * Math.sqrt(engine.getDeltaTime() / (engine.getFps() * 100.0));\r\n }\r\n\r\n // Target\r\n\r\n /**\r\n * Defines the target the camera should look at.\r\n * @param target Defines the new target as a Vector\r\n */\r\n public setTarget(target: Vector3): void {\r\n this.upVector.normalize();\r\n\r\n this._initialFocalDistance = target.subtract(this.position).length();\r\n\r\n if (this.position.z === target.z) {\r\n this.position.z += Epsilon;\r\n }\r\n\r\n this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(this.position, target, Vector3.UpReadOnly, TmpMatrix);\r\n } else {\r\n Matrix.LookAtLHToRef(this.position, target, Vector3.UpReadOnly, TmpMatrix);\r\n }\r\n TmpMatrix.invert();\r\n\r\n const rotationQuaternion = this.rotationQuaternion || TmpQuaternion;\r\n Quaternion.FromRotationMatrixToRef(TmpMatrix, rotationQuaternion);\r\n\r\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\r\n\r\n // Explicitly set z to 0 to match previous behavior.\r\n this.rotation.z = 0;\r\n }\r\n\r\n /**\r\n * Defines the target point of the camera.\r\n * The camera looks towards it form the radius distance.\r\n */\r\n public get target(): Vector3 {\r\n return this.getTarget();\r\n }\r\n public set target(value: Vector3) {\r\n this.setTarget(value);\r\n }\r\n\r\n /**\r\n * Return the current target position of the camera. This value is expressed in local space.\r\n * @returns the target position\r\n */\r\n public getTarget(): Vector3 {\r\n return this._currentTarget;\r\n }\r\n\r\n /** @internal */\r\n public _decideIfNeedsToMove(): boolean {\r\n return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n }\r\n\r\n /** @internal */\r\n public _updatePosition(): void {\r\n if (this.parent) {\r\n this.parent.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n Vector3.TransformNormalToRef(this.cameraDirection, TmpVectors.Matrix[0], TmpVectors.Vector3[0]);\r\n this._deferredPositionUpdate.addInPlace(TmpVectors.Vector3[0]);\r\n if (!this._deferOnly) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n return;\r\n }\r\n this._deferredPositionUpdate.addInPlace(this.cameraDirection);\r\n if (!this._deferOnly) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override _checkInputs(): void {\r\n const directionMultiplier = this.invertRotation ? -this.inverseRotationSpeed : 1.0;\r\n const needToMove = this._decideIfNeedsToMove();\r\n const needToRotate = this.cameraRotation.x || this.cameraRotation.y;\r\n\r\n this._deferredUpdated = false;\r\n this._deferredRotationUpdate.copyFrom(this.rotation);\r\n this._deferredPositionUpdate.copyFrom(this.position);\r\n if (this.rotationQuaternion) {\r\n this._deferredRotationQuaternionUpdate.copyFrom(this.rotationQuaternion);\r\n }\r\n\r\n // Move\r\n if (needToMove) {\r\n this._updatePosition();\r\n }\r\n\r\n // Rotate\r\n if (needToRotate) {\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toEulerAnglesToRef(this._deferredRotationUpdate);\r\n }\r\n\r\n this._deferredRotationUpdate.x += this.cameraRotation.x * directionMultiplier;\r\n this._deferredRotationUpdate.y += this.cameraRotation.y * directionMultiplier;\r\n\r\n // Apply constraints\r\n if (!this.noRotationConstraint) {\r\n const limit = 1.570796;\r\n\r\n if (this._deferredRotationUpdate.x > limit) {\r\n this._deferredRotationUpdate.x = limit;\r\n }\r\n if (this._deferredRotationUpdate.x < -limit) {\r\n this._deferredRotationUpdate.x = -limit;\r\n }\r\n }\r\n\r\n if (!this._deferOnly) {\r\n this.rotation.copyFrom(this._deferredRotationUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n const len = this._deferredRotationUpdate.lengthSquared();\r\n if (len) {\r\n Quaternion.RotationYawPitchRollToRef(\r\n this._deferredRotationUpdate.y,\r\n this._deferredRotationUpdate.x,\r\n this._deferredRotationUpdate.z,\r\n this._deferredRotationQuaternionUpdate\r\n );\r\n if (!this._deferOnly) {\r\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n const inertialPanningLimit = this.speed * this._panningEpsilon;\r\n const inertialRotationLimit = this.speed * this._rotationEpsilon;\r\n // Inertia\r\n if (needToMove) {\r\n if (Math.abs(this.cameraDirection.x) < inertialPanningLimit) {\r\n this.cameraDirection.x = 0;\r\n }\r\n\r\n if (Math.abs(this.cameraDirection.y) < inertialPanningLimit) {\r\n this.cameraDirection.y = 0;\r\n }\r\n\r\n if (Math.abs(this.cameraDirection.z) < inertialPanningLimit) {\r\n this.cameraDirection.z = 0;\r\n }\r\n\r\n this.cameraDirection.scaleInPlace(this.inertia);\r\n }\r\n if (needToRotate) {\r\n if (Math.abs(this.cameraRotation.x) < inertialRotationLimit) {\r\n this.cameraRotation.x = 0;\r\n }\r\n\r\n if (Math.abs(this.cameraRotation.y) < inertialRotationLimit) {\r\n this.cameraRotation.y = 0;\r\n }\r\n this.cameraRotation.scaleInPlace(this.inertia);\r\n }\r\n\r\n super._checkInputs();\r\n }\r\n\r\n protected _updateCameraRotationMatrix() {\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);\r\n } else {\r\n Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);\r\n }\r\n }\r\n\r\n /**\r\n * Update the up vector to apply the rotation of the camera (So if you changed the camera rotation.z this will let you update the up vector as well)\r\n * @returns the current camera\r\n */\r\n private _rotateUpVectorWithCameraRotationMatrix(): TargetCamera {\r\n Vector3.TransformNormalToRef(Vector3.UpReadOnly, this._cameraRotationMatrix, this.upVector);\r\n return this;\r\n }\r\n\r\n private _cachedRotationZ = 0;\r\n private _cachedQuaternionRotationZ = 0;\r\n /** @internal */\r\n public override _getViewMatrix(): Matrix {\r\n if (this.lockedTarget) {\r\n this.setTarget(this._getLockedTargetPosition()!);\r\n }\r\n\r\n // Compute\r\n this._updateCameraRotationMatrix();\r\n\r\n // Apply the changed rotation to the upVector\r\n if (this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedQuaternionRotationZ = this.rotationQuaternion.z;\r\n } else if (this._cachedRotationZ !== this.rotation.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedRotationZ = this.rotation.z;\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\r\n\r\n // Computing target and final matrix\r\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\r\n if (this.updateUpVectorFromRotation) {\r\n if (this.rotationQuaternion) {\r\n Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);\r\n } else {\r\n Quaternion.FromEulerVectorToRef(this.rotation, TmpQuaternion);\r\n Axis.Y.rotateByQuaternionToRef(TmpQuaternion, this.upVector);\r\n }\r\n }\r\n this._computeViewMatrix(this.position, this._currentTarget, this.upVector);\r\n return this._viewMatrix;\r\n }\r\n\r\n protected _computeViewMatrix(position: Vector3, target: Vector3, up: Vector3): void {\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(position, target, up, this._viewMatrix);\r\n } else {\r\n Matrix.LookAtLHToRef(position, target, up, this._viewMatrix);\r\n }\r\n\r\n if (this.parent) {\r\n const parentWorldMatrix = this.parent.getWorldMatrix();\r\n this._viewMatrix.invert();\r\n this._viewMatrix.multiplyToRef(parentWorldMatrix, this._viewMatrix);\r\n this._viewMatrix.invert();\r\n\r\n this._markSyncedWithParent();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public override createRigCamera(name: string, cameraIndex: number): Nullable<Camera> {\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n const rigCamera = new TargetCamera(name, this.position.clone(), this.getScene());\r\n rigCamera.isRigCamera = true;\r\n rigCamera.rigParent = this;\r\n if (this.cameraRigMode === Camera.RIG_MODE_VR) {\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = new Quaternion();\r\n }\r\n rigCamera._cameraRigParams = {};\r\n rigCamera.rotationQuaternion = new Quaternion();\r\n }\r\n\r\n rigCamera.mode = this.mode;\r\n rigCamera.orthoLeft = this.orthoLeft;\r\n rigCamera.orthoRight = this.orthoRight;\r\n rigCamera.orthoTop = this.orthoTop;\r\n rigCamera.orthoBottom = this.orthoBottom;\r\n\r\n return rigCamera;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _updateRigCameras() {\r\n const camLeft = <TargetCamera>this._rigCameras[0];\r\n const camRight = <TargetCamera>this._rigCameras[1];\r\n\r\n this.computeWorldMatrix();\r\n\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED: {\r\n //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:\r\n const leftSign = this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? 1 : -1;\r\n const rightSign = this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? -1 : 1;\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);\r\n break;\r\n }\r\n case Camera.RIG_MODE_VR:\r\n if (camLeft.rotationQuaternion && camRight.rotationQuaternion && this.rotationQuaternion) {\r\n camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n } else {\r\n camLeft.rotation.copyFrom(this.rotation);\r\n camRight.rotation.copyFrom(this.rotation);\r\n }\r\n camLeft.position.copyFrom(this.position);\r\n camRight.position.copyFrom(this.position);\r\n\r\n break;\r\n }\r\n super._updateRigCameras();\r\n }\r\n\r\n private _getRigCamPositionAndTarget(halfSpace: number, rigCamera: TargetCamera) {\r\n const target = this.getTarget();\r\n target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);\r\n\r\n TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n const newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);\r\n\r\n Matrix.TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._TargetTransformMatrix.multiplyToRef(Matrix.RotationAxis(rigCamera.upVector, halfSpace), TargetCamera._RigCamTransformMatrix);\r\n Matrix.TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n\r\n TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);\r\n\r\n Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);\r\n rigCamera.setTarget(newFocalTarget);\r\n }\r\n\r\n /**\r\n * Gets the current object class name.\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"TargetCamera\";\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for targetCamera.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterTargetCamera(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Node.AddNodeConstructor(\"TargetCamera\", (name, scene) => {\r\n return () => new TargetCamera(name, Vector3.Zero(), scene);\r\n });\r\n}\r\n"]}
1
+ {"version":3,"file":"targetCamera.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/targetCamera.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,kDAAkD;AAClD,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC9C,MAAM,aAAa,GAAG,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;AAE1D;;;;GAIG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IAwBpC;;;;;;;;;;;;;OAaG;IACH,IAAoB,OAAO;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED,IAAoB,OAAO,CAAC,KAAa;QACrC,IAAI,CAAC,cAAc,GAAG,K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AC,aAAa,CAAC,YAAY,CAAC,sBAAsB,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;QAE5H,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,sBAAsB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC1G,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,cAAc,CAAC;IAC1B,CAAC;;AAloBc,mCAAsB,GAAiB,IAAI,MAAM,EAAE,AAA7B,CAA8B;AACpD,mCAAsB,GAAiB,IAAI,MAAM,EAAE,AAA7B,CAA8B;AACpD,8BAAiB,GAAiB,IAAI,OAAO,EAAE,AAA9B,CAA+B;AAqDxD;IADN,SAAS,EAAE;gEAC8B;AAMnC;IADN,kBAAkB,EAAE;8CACI;AAWlB;IADN,SAAS,EAAE;2CACO;AAqCZ;IADN,wBAAwB,CAAC,gBAAgB,CAAC;kDACX;AAwhBpC,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAChC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACpD,OAAO,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize, serializeAsVector3, serializeAsMeshReference } from \"../Misc/decorators\";\r\nimport { type Nullable } from \"../types\";\r\nimport { Camera } from \"./camera.pure\";\r\nimport { type Scene } from \"../scene.pure\";\r\nimport { Quaternion, Matrix, Vector3, Vector2, TmpVectors } from \"../Maths/math.vector.pure\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Axis } from \"../Maths/math.axis\";\r\nimport { type AbstractMesh } from \"../Meshes/abstractMesh.pure\";\r\nimport { Node } from \"../node\";\r\nimport { type CameraMovement } from \"./cameraMovement\";\r\nimport { TargetCameraMovement } from \"./targetCameraMovement\";\r\n\r\n// Temporary cache variables to avoid allocations.\r\nconst TmpMatrix = /*#__PURE__*/ Matrix.Zero();\r\nconst TmpQuaternion = /*#__PURE__*/ Quaternion.Identity();\r\n\r\n/**\r\n * A target camera takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\r\n */\r\nexport class TargetCamera extends Camera {\r\n private static _RigCamTransformMatrix = /*#__PURE__*/ new Matrix();\r\n private static _TargetTransformMatrix = /*#__PURE__*/ new Matrix();\r\n private static _TargetFocalPoint = /*#__PURE__*/ new Vector3();\r\n\r\n /**\r\n * Define the current direction the camera is moving to\r\n */\r\n public cameraDirection = new Vector3(0, 0, 0);\r\n /**\r\n * Define the current rotation the camera is rotating to\r\n */\r\n public cameraRotation = new Vector2(0, 0);\r\n\r\n /**\r\n * Framerate-independent movement controller shared by the TargetCamera family\r\n * (FreeCamera/FlyCamera/FollowCamera). Provides inertial physics and the configurable\r\n * input map. Subclasses may replace it with a specialized {@link CameraMovement}\r\n * (for example ArcRotateCamera uses ArcRotateCameraMovement).\r\n */\r\n public movement: CameraMovement;\r\n\r\n private _targetInertia = 0.9;\r\n\r\n /**\r\n * Defines the inertia (decay coefficient applied per reference frame at 60fps) of the camera.\r\n * This helps giving a smooth feeling to the camera movement.\r\n *\r\n * Override of {@link Camera.inertia} that writes through to the {@link movement} system so the\r\n * framerate-independent pan/rotation glide stays in sync. Setting this updates the movement\r\n * system immediately (matching the accessor convergence used by {@link ArcRotateCamera}).\r\n *\r\n * Backed by a local field rather than `super.inertia`: the shipped UMD bundle is compiled with\r\n * TypeScript at `target: ES5`, and ES5 downleveling of `super` access inside a decorated accessor\r\n * (the base {@link Camera.inertia} carries `@serialize()`) mis-compiles to `undefined`. That would\r\n * feed `NaN` into the movement decay and freeze the camera. It only breaks in the ES5 UMD bundle;\r\n * native-ESM dev keeps real `super`. See the `babylonjs/no-super-in-accessor` lint rule.\r\n */\r\n public override get inertia(): number {\r\n return this._targetInertia;\r\n }\r\n\r\n public override set inertia(value: number) {\r\n this._targetInertia = value;\r\n // `movement` is constructed in this class' constructor; guard for the base-constructor\r\n // assignment that runs before it exists.\r\n if (this.movement) {\r\n this.movement.panInertia = value;\r\n this.movement.rotationInertia = value;\r\n }\r\n }\r\n\r\n /**\r\n * When set, the up vector of the camera will be updated by the rotation of the camera\r\n */\r\n @serialize()\r\n public updateUpVectorFromRotation = false;\r\n\r\n /**\r\n * Define the current rotation of the camera\r\n */\r\n @serializeAsVector3()\r\n public rotation: Vector3;\r\n\r\n /**\r\n * Define the current rotation of the camera as a quaternion to prevent Gimbal lock\r\n */\r\n public rotationQuaternion: Nullable<Quaternion>;\r\n\r\n /**\r\n * Define the current speed of the camera\r\n */\r\n @serialize()\r\n public speed = 2.0;\r\n\r\n /**\r\n * Add constraint to the camera to prevent it to move freely in all directions and\r\n * around all axis.\r\n */\r\n public noRotationConstraint = false;\r\n\r\n /**\r\n * Reverses mouselook direction to 'natural' panning as opposed to traditional direct\r\n * panning\r\n */\r\n public invertRotation = false;\r\n\r\n /**\r\n * Speed multiplier for inverse camera panning\r\n */\r\n public inverseRotationSpeed = 0.2;\r\n\r\n /**\r\n * @internal\r\n * @experimental\r\n * Can be used to change clamping behavior for inertia. Hook into onBeforeRenderObservable to change the value per-frame\r\n */\r\n public _panningEpsilon = Epsilon;\r\n /**\r\n * @internal\r\n * @experimental\r\n * Can be used to change clamping behavior for inertia. Hook into onBeforeRenderObservable to change the value per-frame\r\n */\r\n public _rotationEpsilon = Epsilon;\r\n\r\n /**\r\n * Define the current target of the camera as an object or a position.\r\n * Please note that locking a target will disable panning.\r\n */\r\n @serializeAsMeshReference(\"lockedTargetId\")\r\n public lockedTarget: any = null;\r\n\r\n protected readonly _currentTarget = Vector3.Zero();\r\n protected _initialFocalDistance = 1;\r\n protected readonly _viewMatrix = Matrix.Zero();\r\n\r\n /** @internal */\r\n public readonly _cameraTransformMatrix = Matrix.Zero();\r\n /** @internal */\r\n public readonly _cameraRotationMatrix = Matrix.Zero();\r\n\r\n protected readonly _referencePoint: Vector3;\r\n protected readonly _transformedReferencePoint = Vector3.Zero();\r\n\r\n protected readonly _deferredPositionUpdate = new Vector3();\r\n protected readonly _deferredRotationQuaternionUpdate = new Quaternion();\r\n protected readonly _deferredRotationUpdate = new Vector3();\r\n protected _deferredUpdated = false;\r\n protected _deferOnly: boolean = false;\r\n\r\n /** @internal */\r\n public _reset: () => void;\r\n\r\n /**\r\n * Instantiates a target camera that takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the start position of the camera in the scene\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines whether the camera should be marked as active if not other active cameras have been defined\r\n */\r\n constructor(name: string, position: Vector3, scene?: Scene, setActiveOnSceneIfNoneActive = true) {\r\n super(name, position, scene, setActiveOnSceneIfNoneActive);\r\n\r\n this._referencePoint = Vector3.Forward(this.getScene().useRightHandedSystem);\r\n\r\n // Set the y component of the rotation to Math.PI in right-handed system for backwards compatibility.\r\n this.rotation = new Vector3(0, this.getScene().useRightHandedSystem ? Math.PI : 0, 0);\r\n\r\n this.movement = new TargetCameraMovement(this.getScene(), this.position);\r\n // Seed movement-system inertia from the value set during base/subclass construction.\r\n // After this point, the `inertia` setter on this class pushes directly to movement.\r\n this.movement.panInertia = this.inertia;\r\n this.movement.rotationInertia = this.inertia;\r\n }\r\n\r\n /**\r\n * Gets the position in front of the camera at a given distance.\r\n * @param distance The distance from the camera we want the position to be\r\n * @returns the position\r\n */\r\n public getFrontPosition(distance: number): Vector3 {\r\n this.getWorldMatrix();\r\n const worldForward = TmpVectors.Vector3[0];\r\n const localForward = TmpVectors.Vector3[1];\r\n localForward.set(0, 0, this._scene.useRightHandedSystem ? -1.0 : 1.0);\r\n this.getDirectionToRef(localForward, worldForward);\r\n worldForward.scaleInPlace(distance);\r\n return this.globalPosition.add(worldForward);\r\n }\r\n\r\n /** @internal */\r\n public _getLockedTargetPosition(): Nullable<Vector3> {\r\n if (!this.lockedTarget) {\r\n return null;\r\n }\r\n\r\n if (this.lockedTarget.absolutePosition) {\r\n const lockedTarget = this.lockedTarget as AbstractMesh;\r\n const m = lockedTarget.computeWorldMatrix();\r\n // in some cases the absolute position resets externally, but doesn't update since the matrix is cached.\r\n m.getTranslationToRef(lockedTarget.absolutePosition);\r\n }\r\n\r\n return this.lockedTarget.absolutePosition || this.lockedTarget;\r\n }\r\n\r\n private _storedPosition: Vector3;\r\n private _storedRotation: Vector3;\r\n private _storedRotationQuaternion: Nullable<Quaternion>;\r\n\r\n /**\r\n * Store current camera state of the camera (fov, position, rotation, etc..)\r\n * @returns the camera\r\n */\r\n public override storeState(): Camera {\r\n this._storedPosition = this.position.clone();\r\n this._storedRotation = this.rotation.clone();\r\n if (this.rotationQuaternion) {\r\n this._storedRotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n\r\n return super.storeState();\r\n }\r\n\r\n /**\r\n * Restored camera state. You must call storeState() first\r\n * @returns whether it was successful or not\r\n * @internal\r\n */\r\n public override _restoreStateValues(): boolean {\r\n if (!super._restoreStateValues()) {\r\n return false;\r\n }\r\n\r\n this.position = this._storedPosition.clone();\r\n this.rotation = this._storedRotation.clone();\r\n\r\n if (this.rotationQuaternion && this._storedRotationQuaternion) {\r\n this.rotationQuaternion = this._storedRotationQuaternion.clone();\r\n }\r\n\r\n this.cameraDirection.copyFromFloats(0, 0, 0);\r\n this.cameraRotation.copyFromFloats(0, 0);\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public override _initCache() {\r\n super._initCache();\r\n this._cache.lockedTarget = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotation = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotationQuaternion = new Quaternion(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _updateCache(ignoreParentClass?: boolean): void {\r\n if (!ignoreParentClass) {\r\n super._updateCache();\r\n }\r\n\r\n const lockedTargetPosition = this._getLockedTargetPosition();\r\n if (!lockedTargetPosition) {\r\n this._cache.lockedTarget = null;\r\n } else {\r\n if (!this._cache.lockedTarget) {\r\n this._cache.lockedTarget = lockedTargetPosition.clone();\r\n } else {\r\n this._cache.lockedTarget.copyFrom(lockedTargetPosition);\r\n }\r\n }\r\n\r\n this._cache.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n }\r\n\r\n // Synchronized\r\n /** @internal */\r\n public override _isSynchronizedViewMatrix(): boolean {\r\n if (!super._isSynchronizedViewMatrix()) {\r\n return false;\r\n }\r\n\r\n const lockedTargetPosition = this._getLockedTargetPosition();\r\n\r\n return (\r\n (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition) &&\r\n (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation))\r\n );\r\n }\r\n\r\n // Methods\r\n /** @internal */\r\n public _computeLocalCameraSpeed(): number {\r\n const engine = this.getEngine();\r\n return this.speed * Math.sqrt(engine.getDeltaTime() / (engine.getFps() * 100.0));\r\n }\r\n\r\n // Target\r\n\r\n /**\r\n * Defines the target the camera should look at.\r\n * @param target Defines the new target as a Vector\r\n */\r\n public setTarget(target: Vector3): void {\r\n this.upVector.normalize();\r\n\r\n this._initialFocalDistance = target.subtract(this.position).length();\r\n\r\n if (this.position.z === target.z) {\r\n this.position.z += Epsilon;\r\n }\r\n\r\n this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(this.position, target, Vector3.UpReadOnly, TmpMatrix);\r\n } else {\r\n Matrix.LookAtLHToRef(this.position, target, Vector3.UpReadOnly, TmpMatrix);\r\n }\r\n TmpMatrix.invert();\r\n\r\n const rotationQuaternion = this.rotationQuaternion || TmpQuaternion;\r\n Quaternion.FromRotationMatrixToRef(TmpMatrix, rotationQuaternion);\r\n\r\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\r\n\r\n // Explicitly set z to 0 to match previous behavior.\r\n this.rotation.z = 0;\r\n }\r\n\r\n /**\r\n * Defines the target point of the camera.\r\n * The camera looks towards it form the radius distance.\r\n */\r\n public get target(): Vector3 {\r\n return this.getTarget();\r\n }\r\n public set target(value: Vector3) {\r\n this.setTarget(value);\r\n }\r\n\r\n /**\r\n * Return the current target position of the camera. This value is expressed in local space.\r\n * @returns the target position\r\n */\r\n public getTarget(): Vector3 {\r\n return this._currentTarget;\r\n }\r\n\r\n /** @internal */\r\n public _decideIfNeedsToMove(): boolean {\r\n return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n }\r\n\r\n /** @internal */\r\n public _updatePosition(): void {\r\n if (this.parent) {\r\n this.parent.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n Vector3.TransformNormalToRef(this.cameraDirection, TmpVectors.Matrix[0], TmpVectors.Vector3[0]);\r\n this._deferredPositionUpdate.addInPlace(TmpVectors.Vector3[0]);\r\n if (!this._deferOnly) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n return;\r\n }\r\n this._deferredPositionUpdate.addInPlace(this.cameraDirection);\r\n if (!this._deferOnly) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override _checkInputs(): void {\r\n // Fold this frame's raw input — written to `cameraDirection`/`cameraRotation` by the input\r\n // classes (and honored from direct external writes) — into the movement system, then let it\r\n // produce framerate-independent per-frame deltas (input plus inertial glide). The applied\r\n // delta is written back into `cameraDirection`/`cameraRotation` purely as a within-frame\r\n // hand-off so the collision, gravity, and rotation-constraint logic below reads it unchanged.\r\n // Both fields are reset to 0 at the end of this method (the inertial glide now lives in the\r\n // movement system's velocity, not in these fields), so external code polling them *after*\r\n // `_checkInputs()` reads 0 rather than the legacy residual glide value.\r\n const movement = this.movement;\r\n // Capture whether there is raw input on each channel THIS frame, before it is folded into the\r\n // movement system. This gates the legacy glide cutoff below so it only ends a decaying inertial\r\n // tail and never discards a small but legitimate active-input delta.\r\n const hasPanInput = this.cameraDirection.x !== 0 || this.cameraDirection.y !== 0 || this.cameraDirection.z !== 0;\r\n const hasRotationInput = this.cameraRotation.x !== 0 || this.cameraRotation.y !== 0;\r\n movement.panAccumulatedPixels.addInPlace(this.cameraDirection);\r\n movement.rotationAccumulatedPixels.x += this.cameraRotation.x;\r\n movement.rotationAccumulatedPixels.y += this.cameraRotation.y;\r\n movement.computeCurrentFrameDeltas();\r\n this.cameraDirection.copyFrom(movement.panDeltaCurrentFrame);\r\n this.cameraRotation.set(movement.rotationDeltaCurrentFrame.x, movement.rotationDeltaCurrentFrame.y);\r\n\r\n // Backward-compat glide cutoff: honor the legacy `_panningEpsilon` / `_rotationEpsilon` knobs.\r\n // Legacy `_checkInputs` snapped `cameraDirection`/`cameraRotation` to 0 once a glide component\r\n // fell below `speed * _panningEpsilon` / `speed * _rotationEpsilon`, ending the inertial glide\r\n // at that threshold. The framerate-independent port moved glide into the movement system's\r\n // velocity, so we mirror that cutoff here and reset the velocity so the glide terminates at the\r\n // same point (and the public knobs stay meaningful). This is gated on `!hasPanInput` /\r\n // `!hasRotationInput` so it only fires on the decaying tail: on an active-input frame the\r\n // emitted delta is always applied, even when it is below the limit. Without that gate, ordinary\r\n // mouse-look (whose per-frame rotation is typically below `speed * _rotationEpsilon`) would be\r\n // discarded and the camera would feel unresponsive.\r\n const inertialPanningLimit = this.speed * this._panningEpsilon;\r\n if (\r\n !hasPanInput &&\r\n Math.abs(this.cameraDirection.x) < inertialPanningLimit &&\r\n Math.abs(this.cameraDirection.y) < inertialPanningLimit &&\r\n Math.abs(this.cameraDirection.z) < inertialPanningLimit\r\n ) {\r\n this.cameraDirection.setAll(0);\r\n movement.resetPanVelocity();\r\n }\r\n const inertialRotationLimit = this.speed * this._rotationEpsilon;\r\n if (!hasRotationInput && Math.abs(this.cameraRotation.x) < inertialRotationLimit && Math.abs(this.cameraRotation.y) < inertialRotationLimit) {\r\n this.cameraRotation.set(0, 0);\r\n movement.resetRotationVelocity();\r\n }\r\n\r\n const directionMultiplier = this.invertRotation ? -this.inverseRotationSpeed : 1.0;\r\n const needToMove = this._decideIfNeedsToMove();\r\n const needToRotate = !!(this.cameraRotation.x || this.cameraRotation.y);\r\n\r\n this._deferredUpdated = false;\r\n this._deferredRotationUpdate.copyFrom(this.rotation);\r\n this._deferredPositionUpdate.copyFrom(this.position);\r\n if (this.rotationQuaternion) {\r\n this._deferredRotationQuaternionUpdate.copyFrom(this.rotationQuaternion);\r\n }\r\n\r\n // Move\r\n if (needToMove) {\r\n this._updatePosition();\r\n }\r\n\r\n // Rotate\r\n if (needToRotate) {\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toEulerAnglesToRef(this._deferredRotationUpdate);\r\n }\r\n\r\n this._deferredRotationUpdate.x += this.cameraRotation.x * directionMultiplier;\r\n this._deferredRotationUpdate.y += this.cameraRotation.y * directionMultiplier;\r\n\r\n // Apply constraints\r\n if (!this.noRotationConstraint) {\r\n const limit = 1.570796;\r\n\r\n if (this._deferredRotationUpdate.x > limit) {\r\n this._deferredRotationUpdate.x = limit;\r\n }\r\n if (this._deferredRotationUpdate.x < -limit) {\r\n this._deferredRotationUpdate.x = -limit;\r\n }\r\n }\r\n\r\n if (!this._deferOnly) {\r\n this.rotation.copyFrom(this._deferredRotationUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n const len = this._deferredRotationUpdate.lengthSquared();\r\n if (len) {\r\n Quaternion.RotationYawPitchRollToRef(\r\n this._deferredRotationUpdate.y,\r\n this._deferredRotationUpdate.x,\r\n this._deferredRotationUpdate.z,\r\n this._deferredRotationQuaternionUpdate\r\n );\r\n if (!this._deferOnly) {\r\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\r\n } else {\r\n this._deferredUpdated = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // The movement system now owns inertial decay (framerate-independent), so reset the\r\n // per-frame delta surfaces. Glide persists inside the movement velocity and is re-emitted\r\n // next frame via `computeCurrentFrameDeltas`; zeroing here prevents the just-applied delta\r\n // from being re-folded into the accumulators on the next frame.\r\n this.cameraDirection.setAll(0);\r\n this.cameraRotation.set(0, 0);\r\n\r\n super._checkInputs();\r\n }\r\n\r\n protected _updateCameraRotationMatrix() {\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);\r\n } else {\r\n Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);\r\n }\r\n }\r\n\r\n /**\r\n * Update the up vector to apply the rotation of the camera (So if you changed the camera rotation.z this will let you update the up vector as well)\r\n * @returns the current camera\r\n */\r\n private _rotateUpVectorWithCameraRotationMatrix(): TargetCamera {\r\n Vector3.TransformNormalToRef(Vector3.UpReadOnly, this._cameraRotationMatrix, this.upVector);\r\n return this;\r\n }\r\n\r\n private _cachedRotationZ = 0;\r\n private _cachedQuaternionRotationZ = 0;\r\n /** @internal */\r\n public override _getViewMatrix(): Matrix {\r\n if (this.lockedTarget) {\r\n this.setTarget(this._getLockedTargetPosition()!);\r\n }\r\n\r\n // Compute\r\n this._updateCameraRotationMatrix();\r\n\r\n // Apply the changed rotation to the upVector\r\n if (this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedQuaternionRotationZ = this.rotationQuaternion.z;\r\n } else if (this._cachedRotationZ !== this.rotation.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedRotationZ = this.rotation.z;\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\r\n\r\n // Computing target and final matrix\r\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\r\n if (this.updateUpVectorFromRotation) {\r\n if (this.rotationQuaternion) {\r\n Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);\r\n } else {\r\n Quaternion.FromEulerVectorToRef(this.rotation, TmpQuaternion);\r\n Axis.Y.rotateByQuaternionToRef(TmpQuaternion, this.upVector);\r\n }\r\n }\r\n this._computeViewMatrix(this.position, this._currentTarget, this.upVector);\r\n return this._viewMatrix;\r\n }\r\n\r\n protected _computeViewMatrix(position: Vector3, target: Vector3, up: Vector3): void {\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(position, target, up, this._viewMatrix);\r\n } else {\r\n Matrix.LookAtLHToRef(position, target, up, this._viewMatrix);\r\n }\r\n\r\n if (this.parent) {\r\n const parentWorldMatrix = this.parent.getWorldMatrix();\r\n this._viewMatrix.invert();\r\n this._viewMatrix.multiplyToRef(parentWorldMatrix, this._viewMatrix);\r\n this._viewMatrix.invert();\r\n\r\n this._markSyncedWithParent();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public override createRigCamera(name: string, cameraIndex: number): Nullable<Camera> {\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n const rigCamera = new TargetCamera(name, this.position.clone(), this.getScene());\r\n rigCamera.isRigCamera = true;\r\n rigCamera.rigParent = this;\r\n if (this.cameraRigMode === Camera.RIG_MODE_VR) {\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = new Quaternion();\r\n }\r\n rigCamera._cameraRigParams = {};\r\n rigCamera.rotationQuaternion = new Quaternion();\r\n }\r\n\r\n rigCamera.mode = this.mode;\r\n rigCamera.orthoLeft = this.orthoLeft;\r\n rigCamera.orthoRight = this.orthoRight;\r\n rigCamera.orthoTop = this.orthoTop;\r\n rigCamera.orthoBottom = this.orthoBottom;\r\n\r\n return rigCamera;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _updateRigCameras() {\r\n const camLeft = <TargetCamera>this._rigCameras[0];\r\n const camRight = <TargetCamera>this._rigCameras[1];\r\n\r\n this.computeWorldMatrix();\r\n\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED: {\r\n //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:\r\n const leftSign = this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? 1 : -1;\r\n const rightSign = this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? -1 : 1;\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);\r\n break;\r\n }\r\n case Camera.RIG_MODE_VR:\r\n if (camLeft.rotationQuaternion && camRight.rotationQuaternion && this.rotationQuaternion) {\r\n camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n } else {\r\n camLeft.rotation.copyFrom(this.rotation);\r\n camRight.rotation.copyFrom(this.rotation);\r\n }\r\n camLeft.position.copyFrom(this.position);\r\n camRight.position.copyFrom(this.position);\r\n\r\n break;\r\n }\r\n super._updateRigCameras();\r\n }\r\n\r\n private _getRigCamPositionAndTarget(halfSpace: number, rigCamera: TargetCamera) {\r\n const target = this.getTarget();\r\n target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);\r\n\r\n TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n const newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);\r\n\r\n Matrix.TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._TargetTransformMatrix.multiplyToRef(Matrix.RotationAxis(rigCamera.upVector, halfSpace), TargetCamera._RigCamTransformMatrix);\r\n Matrix.TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n\r\n TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);\r\n\r\n Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);\r\n rigCamera.setTarget(newFocalTarget);\r\n }\r\n\r\n /**\r\n * Gets the current object class name.\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"TargetCamera\";\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for targetCamera.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterTargetCamera(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Node.AddNodeConstructor(\"TargetCamera\", (name, scene) => {\r\n return () => new TargetCamera(name, Vector3.Zero(), scene);\r\n });\r\n}\r\n"]}
@@ -0,0 +1,56 @@
1
+ /** This file must only contain pure code and pure imports */
2
+ import { CameraMovement } from "./cameraMovement.js";
3
+ import { type Scene } from "../scene.pure.js";
4
+ import { type Vector3 } from "../Maths/math.vector.pure.js";
5
+ import { type InterpolatingBehavior } from "../Behaviors/Cameras/interpolatingBehavior.js";
6
+ import { InputMapper } from "./inputMapper.js";
7
+ /**
8
+ * Handler shape for target/free camera interactions.
9
+ * Property names are the canonical interaction type strings used in inputMap entries.
10
+ * All handlers are plain functions since none need multi-method lifecycle.
11
+ */
12
+ export type TargetCameraHandlers = {
13
+ /**
14
+ * Translate the camera by world-space deltas (already oriented; the camera applies them directly).
15
+ * Mirrors the legacy `cameraDirection` accumulation surface, which input classes populate after
16
+ * transforming their local intent (e.g. keyboard strafe) into world space.
17
+ */
18
+ translate: (deltaX: number, deltaY: number, deltaZ: number) => void;
19
+ /**
20
+ * Rotate the camera by pitch/yaw deltas.
21
+ * pitch rotates around the local X axis (look up/down), yaw around the local Y axis (look left/right).
22
+ * Mirrors the legacy `cameraRotation` accumulation surface (x = pitch, y = yaw).
23
+ */
24
+ rotate: (pitch: number, yaw: number) => void;
25
+ };
26
+ /** Interaction type string for target/free camera, derived from handler property names */
27
+ export type TargetCameraInteraction = keyof TargetCameraHandlers;
28
+ /**
29
+ * Shared movement system for {@link TargetCamera} and its subclasses (FreeCamera, FlyCamera,
30
+ * FollowCamera). Provides framerate-independent physics (via {@link CameraMovement}) and a
31
+ * declarative {@link InputMapper} for configuring which physical inputs trigger which interactions.
32
+ *
33
+ * Accumulator mapping for this camera family:
34
+ * - `translate` feeds `panAccumulatedPixels` as a WORLD-space direction (input classes orient local
35
+ * intent into world space before populating it, mirroring the legacy `cameraDirection` surface).
36
+ * - `rotate` feeds `rotationAccumulatedPixels` (x=pitch, y=yaw), mirroring legacy `cameraRotation`.
37
+ *
38
+ * These camera classes have no separate zoom channel: mouse-wheel input folds into translation/rotation
39
+ * just like the legacy inputs, so there is no `zoom` interaction here.
40
+ *
41
+ * Input classes inject deltas using the same scaling they applied historically and the movement
42
+ * system leaves all speed multipliers at 1, so at the reference framerate the per-frame applied
43
+ * delta matches the legacy value exactly while inertial glide becomes framerate-independent.
44
+ */
45
+ export declare class TargetCameraMovement extends CameraMovement {
46
+ /** Input system that maps physical inputs to interactions and dispatches to handlers. */
47
+ readonly input: InputMapper<TargetCameraHandlers>;
48
+ /**
49
+ * Creates a movement system for the {@link TargetCamera} family.
50
+ * @param scene The scene the owning camera belongs to.
51
+ * @param cameraPosition The owning camera's position vector (shared by reference).
52
+ * @param behavior Optional interpolating behavior used to suppress input while animating.
53
+ */
54
+ constructor(scene: Scene, cameraPosition: Vector3, behavior?: InterpolatingBehavior);
55
+ private _createDefaultInputMap;
56
+ }
@@ -0,0 +1,63 @@
1
+ /** This file must only contain pure code and pure imports */
2
+ import { CameraMovement } from "./cameraMovement.js";
3
+ import { InputMapper } from "./inputMapper.js";
4
+ /**
5
+ * Shared movement system for {@link TargetCamera} and its subclasses (FreeCamera, FlyCamera,
6
+ * FollowCamera). Provides framerate-independent physics (via {@link CameraMovement}) and a
7
+ * declarative {@link InputMapper} for configuring which physical inputs trigger which interactions.
8
+ *
9
+ * Accumulator mapping for this camera family:
10
+ * - `translate` feeds `panAccumulatedPixels` as a WORLD-space direction (input classes orient local
11
+ * intent into world space before populating it, mirroring the legacy `cameraDirection` surface).
12
+ * - `rotate` feeds `rotationAccumulatedPixels` (x=pitch, y=yaw), mirroring legacy `cameraRotation`.
13
+ *
14
+ * These camera classes have no separate zoom channel: mouse-wheel input folds into translation/rotation
15
+ * just like the legacy inputs, so there is no `zoom` interaction here.
16
+ *
17
+ * Input classes inject deltas using the same scaling they applied historically and the movement
18
+ * system leaves all speed multipliers at 1, so at the reference framerate the per-frame applied
19
+ * delta matches the legacy value exactly while inertial glide becomes framerate-independent.
20
+ */
21
+ export class TargetCameraMovement extends CameraMovement {
22
+ /**
23
+ * Creates a movement system for the {@link TargetCamera} family.
24
+ * @param scene The scene the owning camera belongs to.
25
+ * @param cameraPosition The owning camera's position vector (shared by reference).
26
+ * @param behavior Optional interpolating behavior used to suppress input while animating.
27
+ */
28
+ constructor(scene, cameraPosition, behavior) {
29
+ super(scene, cameraPosition, behavior);
30
+ this.input = new InputMapper({
31
+ translate: (deltaX, deltaY, deltaZ) => {
32
+ this.panAccumulatedPixels.x += deltaX;
33
+ this.panAccumulatedPixels.y += deltaY;
34
+ this.panAccumulatedPixels.z += deltaZ;
35
+ },
36
+ rotate: (pitch, yaw) => {
37
+ this.rotationAccumulatedPixels.x += pitch;
38
+ this.rotationAccumulatedPixels.y += yaw;
39
+ },
40
+ }, () => this._createDefaultInputMap());
41
+ }
42
+ _createDefaultInputMap() {
43
+ // Default entries leave `sensitivity` unset so each input class falls back to its legacy
44
+ // sensibility properties (`angularSensibility`, `rotationSpeed`, `touchAngularSensibility`,
45
+ // etc.) for backward compatibility. Setting `sensitivity` on an entry overrides those.
46
+ //
47
+ // These entries declare which interactions each source is allowed to drive; the input
48
+ // classes still decide *direction* from their own configuration (keyboard key lists,
49
+ // touch single/multi-finger mode, mouse-wheel per-axis actions). Removing an entry
50
+ // disables that source→interaction pairing without otherwise changing the input class.
51
+ return [
52
+ // Mouse drag → look (any button; FreeCameraMouseInput gates on its own `buttons` list).
53
+ { source: "pointer", interaction: "rotate" },
54
+ // Keyboard movement keys → translate, rotation keys → look.
55
+ { source: "keyboard", interaction: "translate" },
56
+ { source: "keyboard", interaction: "rotate" },
57
+ // Touch drag → look or move depending on the input's single/multi-finger mode.
58
+ { source: "touch", interaction: "rotate" },
59
+ { source: "touch", interaction: "translate" },
60
+ ];
61
+ }
62
+ }
63
+ //# sourceMappingURL=targetCameraMovement.js.map
@@ -0,0 +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AAU,EAAE,WAAW,EAAE,WAAW,EAAE;YAChD,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE;YAC7C,+EAA+E;YAC/E,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;YAC1C,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE;SAChD,CAAC;IACN,CAAC;CACJ","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { CameraMovement } from \"./cameraMovement\";\r\nimport { type Scene } from \"../scene.pure\";\r\nimport { type Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { type InterpolatingBehavior } from \"../Behaviors/Cameras/interpolatingBehavior\";\r\nimport { type InputMapEntry, InputMapper } from \"./inputMapper\";\r\n\r\n// ── TargetCamera handler types ─────────────────────────────────────\r\n\r\n/**\r\n * Handler shape for target/free camera interactions.\r\n * Property names are the canonical interaction type strings used in inputMap entries.\r\n * All handlers are plain functions since none need multi-method lifecycle.\r\n */\r\nexport type TargetCameraHandlers = {\r\n /**\r\n * Translate the camera by world-space deltas (already oriented; the camera applies them directly).\r\n * Mirrors the legacy `cameraDirection` accumulation surface, which input classes populate after\r\n * transforming their local intent (e.g. keyboard strafe) into world space.\r\n */\r\n translate: (deltaX: number, deltaY: number, deltaZ: number) => void;\r\n /**\r\n * Rotate the camera by pitch/yaw deltas.\r\n * pitch rotates around the local X axis (look up/down), yaw around the local Y axis (look left/right).\r\n * Mirrors the legacy `cameraRotation` accumulation surface (x = pitch, y = yaw).\r\n */\r\n rotate: (pitch: number, yaw: number) => void;\r\n};\r\n\r\n/** Interaction type string for target/free camera, derived from handler property names */\r\nexport type TargetCameraInteraction = keyof TargetCameraHandlers;\r\n\r\n/**\r\n * Shared movement system for {@link TargetCamera} and its subclasses (FreeCamera, FlyCamera,\r\n * FollowCamera). Provides framerate-independent physics (via {@link CameraMovement}) and a\r\n * declarative {@link InputMapper} for configuring which physical inputs trigger which interactions.\r\n *\r\n * Accumulator mapping for this camera family:\r\n * - `translate` feeds `panAccumulatedPixels` as a WORLD-space direction (input classes orient local\r\n * intent into world space before populating it, mirroring the legacy `cameraDirection` surface).\r\n * - `rotate` feeds `rotationAccumulatedPixels` (x=pitch, y=yaw), mirroring legacy `cameraRotation`.\r\n *\r\n * These camera classes have no separate zoom channel: mouse-wheel input folds into translation/rotation\r\n * just like the legacy inputs, so there is no `zoom` interaction here.\r\n *\r\n * Input classes inject deltas using the same scaling they applied historically and the movement\r\n * system leaves all speed multipliers at 1, so at the reference framerate the per-frame applied\r\n * delta matches the legacy value exactly while inertial glide becomes framerate-independent.\r\n */\r\nexport class TargetCameraMovement extends CameraMovement {\r\n /** Input system that maps physical inputs to interactions and dispatches to handlers. */\r\n public readonly input: InputMapper<TargetCameraHandlers>;\r\n\r\n /**\r\n * Creates a movement system for the {@link TargetCamera} family.\r\n * @param scene The scene the owning camera belongs to.\r\n * @param cameraPosition The owning camera's position vector (shared by reference).\r\n * @param behavior Optional interpolating behavior used to suppress input while animating.\r\n */\r\n constructor(scene: Scene, cameraPosition: Vector3, behavior?: InterpolatingBehavior) {\r\n super(scene, cameraPosition, behavior);\r\n\r\n this.input = new InputMapper<TargetCameraHandlers>(\r\n {\r\n translate: (deltaX, deltaY, deltaZ) => {\r\n this.panAccumulatedPixels.x += deltaX;\r\n this.panAccumulatedPixels.y += deltaY;\r\n this.panAccumulatedPixels.z += deltaZ;\r\n },\r\n rotate: (pitch, yaw) => {\r\n this.rotationAccumulatedPixels.x += pitch;\r\n this.rotationAccumulatedPixels.y += yaw;\r\n },\r\n },\r\n () => this._createDefaultInputMap()\r\n );\r\n }\r\n\r\n private _createDefaultInputMap(): InputMapEntry<TargetCameraInteraction>[] {\r\n // Default entries leave `sensitivity` unset so each input class falls back to its legacy\r\n // sensibility properties (`angularSensibility`, `rotationSpeed`, `touchAngularSensibility`,\r\n // etc.) for backward compatibility. Setting `sensitivity` on an entry overrides those.\r\n //\r\n // These entries declare which interactions each source is allowed to drive; the input\r\n // classes still decide *direction* from their own configuration (keyboard key lists,\r\n // touch single/multi-finger mode, mouse-wheel per-axis actions). Removing an entry\r\n // disables that source→interaction pairing without otherwise changing the input class.\r\n return [\r\n // Mouse drag → look (any button; FreeCameraMouseInput gates on its own `buttons` list).\r\n { source: \"pointer\", interaction: \"rotate\" },\r\n // Keyboard movement keys → translate, rotation keys → look.\r\n { source: \"keyboard\", interaction: \"translate\" },\r\n { source: \"keyboard\", interaction: \"rotate\" },\r\n // Touch drag → look or move depending on the input's single/multi-finger mode.\r\n { source: \"touch\", interaction: \"rotate\" },\r\n { source: \"touch\", interaction: \"translate\" },\r\n ];\r\n }\r\n}\r\n"]}