@babylonjs/core 8.50.4 → 8.51.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 (265) hide show
  1. package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -2
  2. package/AudioV2/webAudio/webAudioSoundSource.js +12 -2
  3. package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
  4. package/Cameras/geospatialCamera.js +22 -21
  5. package/Cameras/geospatialCamera.js.map +1 -1
  6. package/Cameras/geospatialCameraMovement.d.ts +8 -1
  7. package/Cameras/geospatialCameraMovement.js +29 -8
  8. package/Cameras/geospatialCameraMovement.js.map +1 -1
  9. package/Engines/abstractEngine.js +2 -2
  10. package/Engines/abstractEngine.js.map +1 -1
  11. package/Instrumentation/engineInstrumentation.js +2 -1
  12. package/Instrumentation/engineInstrumentation.js.map +1 -1
  13. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +1 -0
  14. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +52 -12
  15. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  16. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +86 -0
  17. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +160 -0
  18. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -0
  19. package/Materials/index.d.ts +1 -0
  20. package/Materials/index.js +1 -0
  21. package/Materials/index.js.map +1 -1
  22. package/Maths/math.constants.d.ts +2 -1
  23. package/Maths/math.constants.js +3 -2
  24. package/Maths/math.constants.js.map +1 -1
  25. package/Meshes/Builders/capsuleBuilder.js +0 -3
  26. package/Meshes/Builders/capsuleBuilder.js.map +1 -1
  27. package/Meshes/Builders/cylinderBuilder.d.ts +1 -1
  28. package/Meshes/Builders/cylinderBuilder.js +1 -2
  29. package/Meshes/Builders/cylinderBuilder.js.map +1 -1
  30. package/Meshes/Builders/decalBuilder.js +2 -0
  31. package/Meshes/Builders/decalBuilder.js.map +1 -1
  32. package/Meshes/Builders/discBuilder.js +0 -1
  33. package/Meshes/Builders/discBuilder.js.map +1 -1
  34. package/Meshes/Builders/groundBuilder.d.ts +50 -54
  35. package/Meshes/Builders/groundBuilder.js +50 -54
  36. package/Meshes/Builders/groundBuilder.js.map +1 -1
  37. package/Meshes/Builders/tiledBoxBuilder.d.ts +0 -26
  38. package/Meshes/Builders/tiledBoxBuilder.js +0 -26
  39. package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
  40. package/Meshes/Builders/tiledPlaneBuilder.d.ts +0 -25
  41. package/Meshes/Builders/tiledPlaneBuilder.js +0 -25
  42. package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
  43. package/Meshes/Builders/torusBuilder.d.ts +0 -13
  44. package/Meshes/Builders/torusBuilder.js +0 -13
  45. package/Meshes/Builders/torusBuilder.js.map +1 -1
  46. package/Meshes/Builders/torusKnotBuilder.d.ts +0 -19
  47. package/Meshes/Builders/torusKnotBuilder.js +0 -19
  48. package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
  49. package/Meshes/Builders/tubeBuilder.d.ts +0 -12
  50. package/Meshes/Builders/tubeBuilder.js +0 -12
  51. package/Meshes/Builders/tubeBuilder.js.map +1 -1
  52. package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
  53. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  54. package/Meshes/Compression/dracoDecoder.types.d.ts +11 -0
  55. package/Meshes/Compression/dracoDecoder.types.js.map +1 -1
  56. package/Meshes/Compression/dracoEncoder.js.map +1 -1
  57. package/Meshes/Compression/meshoptCompression.js +0 -2
  58. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  59. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +4 -1
  60. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  61. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +0 -8
  62. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  63. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.d.ts +1 -0
  64. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +1 -0
  65. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  66. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +1 -0
  67. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +1 -0
  68. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  69. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +1 -0
  70. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -0
  71. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  72. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +1 -0
  73. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +1 -0
  74. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  75. package/Meshes/Node/Blocks/Matrices/scalingBlock.d.ts +1 -0
  76. package/Meshes/Node/Blocks/Matrices/scalingBlock.js +1 -0
  77. package/Meshes/Node/Blocks/Matrices/scalingBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/Matrices/translationBlock.d.ts +1 -0
  79. package/Meshes/Node/Blocks/Matrices/translationBlock.js +1 -0
  80. package/Meshes/Node/Blocks/Matrices/translationBlock.js.map +1 -1
  81. package/Meshes/Node/Blocks/Set/aggregatorBlock.d.ts +1 -0
  82. package/Meshes/Node/Blocks/Set/aggregatorBlock.js +1 -0
  83. package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -1
  84. package/Meshes/Node/Blocks/Set/latticeBlock.d.ts +1 -0
  85. package/Meshes/Node/Blocks/Set/latticeBlock.js +1 -0
  86. package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
  87. package/Meshes/Node/Blocks/Set/setColorsBlock.d.ts +1 -0
  88. package/Meshes/Node/Blocks/Set/setColorsBlock.js +1 -0
  89. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  90. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.d.ts +1 -0
  91. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +1 -0
  92. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  93. package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +1 -0
  94. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -0
  95. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  96. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +1 -0
  97. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +1 -0
  98. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  99. package/Meshes/Node/Blocks/Set/setTangentsBlock.d.ts +1 -0
  100. package/Meshes/Node/Blocks/Set/setTangentsBlock.js +1 -0
  101. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  102. package/Meshes/Node/Blocks/Set/setUVsBlock.d.ts +1 -0
  103. package/Meshes/Node/Blocks/Set/setUVsBlock.js +1 -0
  104. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  105. package/Meshes/Node/Blocks/Sources/boxBlock.d.ts +2 -0
  106. package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -0
  107. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  108. package/Meshes/Node/Blocks/Sources/capsuleBlock.d.ts +2 -0
  109. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -0
  110. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  111. package/Meshes/Node/Blocks/Sources/cylinderBlock.d.ts +2 -0
  112. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -0
  113. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  114. package/Meshes/Node/Blocks/Sources/discBlock.d.ts +2 -0
  115. package/Meshes/Node/Blocks/Sources/discBlock.js +2 -0
  116. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  117. package/Meshes/Node/Blocks/Sources/gridBlock.d.ts +2 -0
  118. package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -0
  119. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  120. package/Meshes/Node/Blocks/Sources/icoSphereBlock.d.ts +2 -0
  121. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -0
  122. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  123. package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +1 -0
  124. package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -0
  125. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  126. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +2 -0
  127. package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -0
  128. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  129. package/Meshes/Node/Blocks/Sources/pointListBlock.d.ts +2 -1
  130. package/Meshes/Node/Blocks/Sources/pointListBlock.js +2 -1
  131. package/Meshes/Node/Blocks/Sources/pointListBlock.js.map +1 -1
  132. package/Meshes/Node/Blocks/Sources/sphereBlock.d.ts +2 -0
  133. package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -0
  134. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  135. package/Meshes/Node/Blocks/Sources/torusBlock.d.ts +2 -0
  136. package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -0
  137. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  138. package/Meshes/Node/Blocks/Teleport/teleportInBlock.d.ts +1 -0
  139. package/Meshes/Node/Blocks/Teleport/teleportInBlock.js +1 -0
  140. package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  141. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.d.ts +3 -0
  142. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +3 -0
  143. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  144. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -0
  145. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
  146. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  147. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +1 -0
  148. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +1 -0
  149. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  150. package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +1 -0
  151. package/Meshes/Node/Blocks/booleanGeometryBlock.js +1 -1
  152. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  153. package/Meshes/Node/Blocks/cleanGeometryBlock.d.ts +1 -0
  154. package/Meshes/Node/Blocks/cleanGeometryBlock.js +1 -0
  155. package/Meshes/Node/Blocks/cleanGeometryBlock.js.map +1 -1
  156. package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
  157. package/Meshes/Node/Blocks/conditionBlock.js +2 -0
  158. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  159. package/Meshes/Node/Blocks/geometryClampBlock.d.ts +1 -0
  160. package/Meshes/Node/Blocks/geometryClampBlock.js +1 -0
  161. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  162. package/Meshes/Node/Blocks/geometryCollectionBlock.d.ts +1 -0
  163. package/Meshes/Node/Blocks/geometryCollectionBlock.js +1 -0
  164. package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
  165. package/Meshes/Node/Blocks/geometryCurveBlock.d.ts +2 -0
  166. package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -0
  167. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
  168. package/Meshes/Node/Blocks/geometryEaseBlock.d.ts +2 -0
  169. package/Meshes/Node/Blocks/geometryEaseBlock.js +2 -0
  170. package/Meshes/Node/Blocks/geometryEaseBlock.js.map +1 -1
  171. package/Meshes/Node/Blocks/geometryInputBlock.d.ts +3 -0
  172. package/Meshes/Node/Blocks/geometryInputBlock.js +3 -0
  173. package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
  174. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +1 -0
  175. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +1 -0
  176. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  177. package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +1 -0
  178. package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -0
  179. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  180. package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +2 -0
  181. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -0
  182. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  183. package/Meshes/Node/Blocks/mappingBlock.d.ts +1 -0
  184. package/Meshes/Node/Blocks/mappingBlock.js +1 -0
  185. package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
  186. package/Meshes/Node/Blocks/mathBlock.d.ts +1 -0
  187. package/Meshes/Node/Blocks/mathBlock.js +1 -0
  188. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  189. package/Meshes/Node/Blocks/mergeGeometryBlock.d.ts +1 -0
  190. package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -0
  191. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  192. package/Meshes/Node/Blocks/randomBlock.d.ts +2 -0
  193. package/Meshes/Node/Blocks/randomBlock.js +2 -0
  194. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  195. package/Meshes/Node/Blocks/subdivideBlock.d.ts +1 -0
  196. package/Meshes/Node/Blocks/subdivideBlock.js +1 -0
  197. package/Meshes/Node/Blocks/subdivideBlock.js.map +1 -1
  198. package/Meshes/Node/Interfaces/nodeGeometryTextureData.d.ts +3 -0
  199. package/Meshes/Node/Interfaces/nodeGeometryTextureData.js.map +1 -1
  200. package/Meshes/Node/nodeGeometry.js +0 -2
  201. package/Meshes/Node/nodeGeometry.js.map +1 -1
  202. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +0 -1
  203. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  204. package/Meshes/Node/nodeGeometryBuildState.js +0 -1
  205. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  206. package/Meshes/WebGL/webGLDataBuffer.d.ts +2 -0
  207. package/Meshes/WebGL/webGLDataBuffer.js +2 -0
  208. package/Meshes/WebGL/webGLDataBuffer.js.map +1 -1
  209. package/Meshes/WebGPU/webgpuDataBuffer.d.ts +4 -0
  210. package/Meshes/WebGPU/webgpuDataBuffer.js +4 -0
  211. package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
  212. package/Meshes/abstractMesh.d.ts +1 -0
  213. package/Meshes/abstractMesh.decalMap.d.ts +1 -0
  214. package/Meshes/abstractMesh.decalMap.js.map +1 -1
  215. package/Meshes/abstractMesh.js +1 -6
  216. package/Meshes/abstractMesh.js.map +1 -1
  217. package/Meshes/csg.js +0 -6
  218. package/Meshes/csg.js.map +1 -1
  219. package/Meshes/csg2.js +1 -2
  220. package/Meshes/csg2.js.map +1 -1
  221. package/Meshes/geodesicMesh.d.ts +26 -0
  222. package/Meshes/geodesicMesh.js +18 -3
  223. package/Meshes/geodesicMesh.js.map +1 -1
  224. package/Meshes/groundMesh.d.ts +1 -0
  225. package/Meshes/groundMesh.js +1 -0
  226. package/Meshes/groundMesh.js.map +1 -1
  227. package/Meshes/index.js +0 -2
  228. package/Meshes/index.js.map +1 -1
  229. package/Meshes/instancedMesh.d.ts +18 -3
  230. package/Meshes/instancedMesh.js +10 -3
  231. package/Meshes/instancedMesh.js.map +1 -1
  232. package/Meshes/mesh.d.ts +286 -204
  233. package/Meshes/mesh.js +251 -197
  234. package/Meshes/mesh.js.map +1 -1
  235. package/Meshes/mesh.vertexData.d.ts +15 -19
  236. package/Meshes/mesh.vertexData.js +15 -19
  237. package/Meshes/mesh.vertexData.js.map +1 -1
  238. package/Meshes/meshSimplification.d.ts +0 -1
  239. package/Meshes/meshSimplification.js +6 -1
  240. package/Meshes/meshSimplification.js.map +1 -1
  241. package/Meshes/meshSimplificationSceneComponent.d.ts +2 -0
  242. package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
  243. package/Meshes/meshUVSpaceRenderer.d.ts +1 -0
  244. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  245. package/Meshes/polygonMesh.js +4 -0
  246. package/Meshes/polygonMesh.js.map +1 -1
  247. package/Meshes/subMesh.project.d.ts +1 -0
  248. package/Meshes/subMesh.project.js.map +1 -1
  249. package/Meshes/thinInstanceMesh.d.ts +5 -0
  250. package/Meshes/thinInstanceMesh.js.map +1 -1
  251. package/Meshes/transformNode.d.ts +1 -1
  252. package/Meshes/transformNode.js +1 -1
  253. package/Meshes/transformNode.js.map +1 -1
  254. package/Misc/dataStorage.d.ts +13 -0
  255. package/Misc/dataStorage.js +25 -0
  256. package/Misc/dataStorage.js.map +1 -1
  257. package/Shaders/gaussianSplatting.fragment.js +8 -2
  258. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  259. package/Shaders/gaussianSplatting.vertex.js +8 -2
  260. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  261. package/ShadersWGSL/gaussianSplatting.fragment.js +7 -1
  262. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  263. package/ShadersWGSL/gaussianSplatting.vertex.js +8 -2
  264. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  265. package/package.json +1 -1
@@ -10,7 +10,7 @@ import type { IWebAudioInNode } from "./webAudioNode.js";
10
10
  export declare class _WebAudioSoundSource extends AbstractSoundSource {
11
11
  private _stereo;
12
12
  protected _subGraph: _WebAudioBusAndSoundSubGraph;
13
- protected _webAudioNode: AudioNode;
13
+ protected _webAudioNode: Nullable<AudioNode>;
14
14
  /** @internal */
15
15
  _audioContext: AudioContext | OfflineAudioContext;
16
16
  /** @internal */
@@ -20,7 +20,7 @@ export declare class _WebAudioSoundSource extends AbstractSoundSource {
20
20
  /** @internal */
21
21
  _initAsync(options: Partial<ISoundSourceOptions>): Promise<void>;
22
22
  /** @internal */
23
- get _inNode(): AudioNode;
23
+ get _inNode(): Nullable<AudioNode>;
24
24
  /** @internal */
25
25
  get _outNode(): Nullable<AudioNode>;
26
26
  /** @internal */
@@ -9,6 +9,7 @@ export class _WebAudioSoundSource extends AbstractSoundSource {
9
9
  constructor(name, webAudioNode, engine, options) {
10
10
  super(name, engine, options);
11
11
  this._stereo = null;
12
+ this._webAudioNode = null;
12
13
  this._audioContext = this.engine._audioContext;
13
14
  this._webAudioNode = webAudioNode;
14
15
  this._subGraph = new _WebAudioSoundSource._SubGraph(this);
@@ -43,6 +44,15 @@ export class _WebAudioSoundSource extends AbstractSoundSource {
43
44
  /** @internal */
44
45
  dispose() {
45
46
  super.dispose();
47
+ if (this._webAudioNode) {
48
+ if (this._webAudioNode instanceof MediaStreamAudioSourceNode) {
49
+ for (const track of this._webAudioNode.mediaStream.getTracks()) {
50
+ track.stop();
51
+ }
52
+ }
53
+ this._webAudioNode.disconnect();
54
+ this._webAudioNode = null;
55
+ }
46
56
  this._stereo = null;
47
57
  this._subGraph.dispose();
48
58
  this.engine._removeNode(this);
@@ -85,9 +95,9 @@ _WebAudioSoundSource._SubGraph = class extends _WebAudioBusAndSoundSubGraph {
85
95
  }
86
96
  _onSubNodesChanged() {
87
97
  super._onSubNodesChanged();
88
- this._owner._inNode.disconnect();
98
+ this._owner._inNode?.disconnect();
89
99
  if (this._owner._subGraph._inNode) {
90
- this._owner._inNode.connect(this._owner._subGraph._inNode);
100
+ this._owner._inNode?.connect(this._owner._subGraph._inNode);
91
101
  }
92
102
  }
93
103
  };
@@ -1 +1 @@
1
- {"version":3,"file":"webAudioSoundSource.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/webAudio/webAudioSoundSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAInE,gBAAgB;AAChB,MAAM,OAAO,oBAAqB,SAAQ,mBAAmB;IAYzD,gBAAgB;IAChB,YAAmB,IAAY,EAAE,YAAuB,EAAE,MAAuB,EAAE,OAAqC;QACpH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAbzB,YAAO,GAA2B,IAAI,CAAC;QAe3C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAElC,IAAI,CAAC,SAAS,GAAG,IAAI,oBAAoB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,gBAAgB;IACT,KAAK,CAAC,UAAU,CAAC,OAAqC;QACzD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACjC,CAAC;aAAM,IAAI,OAAO,CAAC,iBAAiB,KAAK,KAAK,EAAE,CAAC;YAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;YACjC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7C,CAAC;QAED,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,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AC,CAAC;QAE7C,IAAI,CAAC,YAAY,EAAE,CAAC;YAChB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEkB,sBAAsB,CAAC,UAAmB,EAAE,aAAqB;QAChF,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IAC3E,CAAC;;AAEc,8BAAS,GAAG,KAAM,SAAQ,4BAA4B;IAGjE,IAAc,gBAAgB;QAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAC;IAChD,CAAC;IAED,IAAc,cAAc;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;IAC9C,CAAC;IAEkB,kBAAkB;QACjC,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAE3B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAEjC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC/D,CAAC;IACL,CAAC;CACJ,AApBuB,CAoBtB","sourcesContent":["import type { Nullable } from \"../../types\";\nimport type { AbstractAudioNode } from \"../abstractAudio/abstractAudioNode\";\nimport type { ISoundSourceOptions } from \"../abstractAudio/abstractSoundSource\";\nimport { AbstractSoundSource } from \"../abstractAudio/abstractSoundSource\";\nimport type { AbstractSpatialAudio } from \"../abstractAudio/subProperties/abstractSpatialAudio\";\nimport { _HasSpatialAudioOptions } from \"../abstractAudio/subProperties/abstractSpatialAudio\";\nimport { _StereoAudio } from \"../abstractAudio/subProperties/stereoAudio\";\nimport { _WebAudioBusAndSoundSubGraph } from \"./subNodes/webAudioBusAndSoundSubGraph\";\nimport { _SpatialWebAudio } from \"./subProperties/spatialWebAudio\";\nimport type { _WebAudioEngine } from \"./webAudioEngine\";\nimport type { IWebAudioInNode } from \"./webAudioNode\";\n\n/** @internal */\nexport class _WebAudioSoundSource extends AbstractSoundSource {\n private _stereo: Nullable<_StereoAudio> = null;\n\n protected _subGraph: _WebAudioBusAndSoundSubGraph;\n protected _webAudioNode: AudioNode;\n\n /** @internal */\n public _audioContext: AudioContext | OfflineAudioContext;\n\n /** @internal */\n public override readonly engine: _WebAudioEngine;\n\n /** @internal */\n public constructor(name: string, webAudioNode: AudioNode, engine: _WebAudioEngine, options: Partial<ISoundSourceOptions>) {\n super(name, engine, options);\n\n this._audioContext = this.engine._audioContext;\n this._webAudioNode = webAudioNode;\n\n this._subGraph = new _WebAudioSoundSource._SubGraph(this);\n }\n\n /** @internal */\n public async _initAsync(options: Partial<ISoundSourceOptions>): Promise<void> {\n if (options.outBus) {\n this.outBus = options.outBus;\n } else if (options.outBusAutoDefault !== false) {\n await this.engine.isReadyPromise;\n this.outBus = this.engine.defaultMainBus;\n }\n\n await this._subGraph.initAsync(options);\n\n if (_HasSpatialAudioOptions(options)) {\n this._initSpatialProperty();\n }\n\n this.engine._addNode(this);\n }\n\n /** @internal */\n public get _inNode() {\n return this._webAudioNode;\n }\n\n /** @internal */\n public get _outNode() {\n return this._subGraph._outNode;\n }\n\n /** @internal */\n public override get stereo(): _StereoAudio {\n return this._stereo ?? (this._stereo = new _StereoAudio(this._subGraph));\n }\n\n /** @internal */\n public override dispose(): void {\n super.dispose();\n\n this._stereo = null;\n\n this._subGraph.dispose();\n\n this.engine._removeNode(this);\n }\n\n /** @internal */\n public getClassName(): string {\n return \"_WebAudioSoundSource\";\n }\n\n protected override _connect(node: IWebAudioInNode): boolean {\n const connected = super._connect(node);\n\n if (!connected) {\n return false;\n }\n\n // If the wrapped node is not available now, it will be connected later by the subgraph.\n if (node._inNode) {\n this._outNode?.connect(node._inNode);\n }\n\n return true;\n }\n\n protected override _disconnect(node: IWebAudioInNode): boolean {\n const disconnected = super._disconnect(node);\n\n if (!disconnected) {\n return false;\n }\n\n if (node._inNode) {\n this._outNode?.disconnect(node._inNode);\n }\n\n return true;\n }\n\n protected override _createSpatialProperty(autoUpdate: boolean, minUpdateTime: number): AbstractSpatialAudio {\n return new _SpatialWebAudio(this._subGraph, autoUpdate, minUpdateTime);\n }\n\n private static _SubGraph = class extends _WebAudioBusAndSoundSubGraph {\n protected override _owner: _WebAudioSoundSource;\n\n protected get _downstreamNodes(): Nullable<Set<AbstractAudioNode>> {\n return this._owner._downstreamNodes ?? null;\n }\n\n protected get _upstreamNodes(): Nullable<Set<AbstractAudioNode>> {\n return this._owner._upstreamNodes ?? null;\n }\n\n protected override _onSubNodesChanged(): void {\n super._onSubNodesChanged();\n\n this._owner._inNode.disconnect();\n\n if (this._owner._subGraph._inNode) {\n this._owner._inNode.connect(this._owner._subGraph._inNode);\n }\n }\n };\n}\n"]}
1
+ {"version":3,"file":"webAudioSoundSource.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/webAudio/webAudioSoundSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAInE,gBAAgB;AAChB,MAAM,OAAO,oBAAqB,SAAQ,mBAAmB;IAYzD,gBAAgB;IAChB,YAAmB,IAAY,EAAE,YAAuB,EAAE,MAAuB,EAAE,OAAqC;QACpH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,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AC,CAAC;QAC5C,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEkB,sBAAsB,CAAC,UAAmB,EAAE,aAAqB;QAChF,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IAC3E,CAAC;;AAEc,8BAAS,GAAG,KAAM,SAAQ,4BAA4B;IAGjE,IAAc,gBAAgB;QAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAC;IAChD,CAAC;IAED,IAAc,cAAc;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;IAC9C,CAAC;IAEkB,kBAAkB;QACjC,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAE3B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;QAElC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;IACL,CAAC;CACJ,AApBuB,CAoBtB","sourcesContent":["import type { Nullable } from \"../../types\";\nimport type { AbstractAudioNode } from \"../abstractAudio/abstractAudioNode\";\nimport type { ISoundSourceOptions } from \"../abstractAudio/abstractSoundSource\";\nimport { AbstractSoundSource } from \"../abstractAudio/abstractSoundSource\";\nimport type { AbstractSpatialAudio } from \"../abstractAudio/subProperties/abstractSpatialAudio\";\nimport { _HasSpatialAudioOptions } from \"../abstractAudio/subProperties/abstractSpatialAudio\";\nimport { _StereoAudio } from \"../abstractAudio/subProperties/stereoAudio\";\nimport { _WebAudioBusAndSoundSubGraph } from \"./subNodes/webAudioBusAndSoundSubGraph\";\nimport { _SpatialWebAudio } from \"./subProperties/spatialWebAudio\";\nimport type { _WebAudioEngine } from \"./webAudioEngine\";\nimport type { IWebAudioInNode } from \"./webAudioNode\";\n\n/** @internal */\nexport class _WebAudioSoundSource extends AbstractSoundSource {\n private _stereo: Nullable<_StereoAudio> = null;\n\n protected _subGraph: _WebAudioBusAndSoundSubGraph;\n protected _webAudioNode: Nullable<AudioNode> = null;\n\n /** @internal */\n public _audioContext: AudioContext | OfflineAudioContext;\n\n /** @internal */\n public override readonly engine: _WebAudioEngine;\n\n /** @internal */\n public constructor(name: string, webAudioNode: AudioNode, engine: _WebAudioEngine, options: Partial<ISoundSourceOptions>) {\n super(name, engine, options);\n\n this._audioContext = this.engine._audioContext;\n this._webAudioNode = webAudioNode;\n\n this._subGraph = new _WebAudioSoundSource._SubGraph(this);\n }\n\n /** @internal */\n public async _initAsync(options: Partial<ISoundSourceOptions>): Promise<void> {\n if (options.outBus) {\n this.outBus = options.outBus;\n } else if (options.outBusAutoDefault !== false) {\n await this.engine.isReadyPromise;\n this.outBus = this.engine.defaultMainBus;\n }\n\n await this._subGraph.initAsync(options);\n\n if (_HasSpatialAudioOptions(options)) {\n this._initSpatialProperty();\n }\n\n this.engine._addNode(this);\n }\n\n /** @internal */\n public get _inNode() {\n return this._webAudioNode;\n }\n\n /** @internal */\n public get _outNode() {\n return this._subGraph._outNode;\n }\n\n /** @internal */\n public override get stereo(): _StereoAudio {\n return this._stereo ?? (this._stereo = new _StereoAudio(this._subGraph));\n }\n\n /** @internal */\n public override dispose(): void {\n super.dispose();\n\n if (this._webAudioNode) {\n if (this._webAudioNode instanceof MediaStreamAudioSourceNode) {\n for (const track of this._webAudioNode.mediaStream.getTracks()) {\n track.stop();\n }\n }\n\n this._webAudioNode.disconnect();\n this._webAudioNode = null;\n }\n\n this._stereo = null;\n\n this._subGraph.dispose();\n\n this.engine._removeNode(this);\n }\n\n /** @internal */\n public getClassName(): string {\n return \"_WebAudioSoundSource\";\n }\n\n protected override _connect(node: IWebAudioInNode): boolean {\n const connected = super._connect(node);\n\n if (!connected) {\n return false;\n }\n\n // If the wrapped node is not available now, it will be connected later by the subgraph.\n if (node._inNode) {\n this._outNode?.connect(node._inNode);\n }\n\n return true;\n }\n\n protected override _disconnect(node: IWebAudioInNode): boolean {\n const disconnected = super._disconnect(node);\n\n if (!disconnected) {\n return false;\n }\n\n if (node._inNode) {\n this._outNode?.disconnect(node._inNode);\n }\n\n return true;\n }\n\n protected override _createSpatialProperty(autoUpdate: boolean, minUpdateTime: number): AbstractSpatialAudio {\n return new _SpatialWebAudio(this._subGraph, autoUpdate, minUpdateTime);\n }\n\n private static _SubGraph = class extends _WebAudioBusAndSoundSubGraph {\n protected override _owner: _WebAudioSoundSource;\n\n protected get _downstreamNodes(): Nullable<Set<AbstractAudioNode>> {\n return this._owner._downstreamNodes ?? null;\n }\n\n protected get _upstreamNodes(): Nullable<Set<AbstractAudioNode>> {\n return this._owner._upstreamNodes ?? null;\n }\n\n protected override _onSubNodesChanged(): void {\n super._onSubNodesChanged();\n\n this._owner._inNode?.disconnect();\n\n if (this._owner._subGraph._inNode) {\n this._owner._inNode?.connect(this._owner._subGraph._inNode);\n }\n }\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "../tslib.es6.js";
2
2
  import { GeospatialCameraInputsManager } from "./geospatialCameraInputsManager.js";
3
- import { Vector3, Matrix, TmpVectors, Quaternion } from "../Maths/math.vector.js";
3
+ import { Vector3, Matrix, TmpVectors } from "../Maths/math.vector.js";
4
4
  import { Epsilon } from "../Maths/math.constants.js";
5
5
  import { Camera } from "./camera.js";
6
6
  import { serialize, serializeAsVector3 } from "../Misc/decorators.js";
@@ -113,7 +113,7 @@ export class GeospatialCamera extends Camera {
113
113
  // Clamp to limits
114
114
  this._checkLimits();
115
115
  // Refresh local basis at center (treat these as read-only for the whole call)
116
- ComputeLocalBasisToRefs(this._center, this._tempEast, this._tempNorth, this._tempUp);
116
+ ComputeLocalBasisToRefs(this._center, this._tempEast, this._tempNorth, this._tempUp, this._scene.useRightHandedSystem);
117
117
  // Compute lookAt from yaw/pitch
118
118
  ComputeLookAtFromYawPitchToRef(this._yaw, this._pitch, this._center, this._scene.useRightHandedSystem, this._lookAtVector);
119
119
  // Build an orthonormal up aligned with geocentric Up
@@ -121,13 +121,14 @@ export class GeospatialCamera extends Camera {
121
121
  const right = TmpVectors.Vector3[10];
122
122
  Vector3.CrossToRef(this._tempUp, this._lookAtVector, right);
123
123
  if (right.lengthSquared() < Epsilon) {
124
- // Looking straight down (or up) - use quaternion rotation to compute horiz
125
- // Must use -yaw * yawScale to match ComputeLookAtFromYawPitchToRef formula
124
+ // horiz = north * cos(yaw) + east * sin(yaw)
125
+ // Using tempEast directly ensures handedness is taken into account
126
126
  const horiz = TmpVectors.Vector3[11];
127
- const yawScale = this._scene.useRightHandedSystem ? 1 : -1;
128
- const yawQuat = TmpVectors.Quaternion[1];
129
- Quaternion.RotationAxisToRef(this._tempUp, -this._yaw * yawScale, yawQuat);
130
- this._tempNorth.rotateByQuaternionToRef(yawQuat, horiz);
127
+ const t1 = TmpVectors.Vector3[12];
128
+ horiz
129
+ .copyFrom(this._tempNorth)
130
+ .scaleInPlace(Math.cos(this._yaw))
131
+ .addInPlace(t1.copyFrom(this._tempEast).scaleInPlace(Math.sin(this._yaw)));
131
132
  // right = cross(horiz, lookAt)
132
133
  Vector3.CrossToRef(horiz, this._lookAtVector, right);
133
134
  }
@@ -222,7 +223,7 @@ export class GeospatialCamera extends Camera {
222
223
  const zoomDistance = Vector3Distance(this.position, destination) * distanceScale;
223
224
  const newRadius = this._getCenterAndRadiusFromZoomToPoint(destination, zoomDistance, this._tempCenter);
224
225
  await this.flyToAsync(undefined, undefined, newRadius, this._tempCenter, durationMs, easingFn, centerHopScale);
225
- !this.isDisposed && this._recalculateCenter(false, true /** force */);
226
+ !this.isDisposed() && this._recalculateCenter(false, true /** force */);
226
227
  }
227
228
  get limits() {
228
229
  return this._limits;
@@ -472,18 +473,19 @@ export function ComputeLookAtFromYawPitchToRef(yaw, pitch, center, useRightHande
472
473
  const east = TmpVectors.Vector3[0];
473
474
  const north = TmpVectors.Vector3[1];
474
475
  const up = TmpVectors.Vector3[2];
475
- ComputeLocalBasisToRefs(center, east, north, up);
476
+ ComputeLocalBasisToRefs(center, east, north, up, useRightHandedSystem);
476
477
  const sinPitch = Math.sin(pitch);
477
478
  const cosPitch = Math.cos(pitch);
478
- // Use quaternion rotation to compute horiz = rotate(north, up, -yaw * yawScale)
479
- // Negating the angle produces: horiz = North*cos(yaw) + East*sin(yaw)
480
- const yawScale = useRightHandedSystem ? 1 : -1;
481
- const yawQuat = TmpVectors.Quaternion[0];
482
- Quaternion.RotationAxisToRef(up, -yaw * yawScale, yawQuat);
479
+ // horiz = north * cos(yaw) + east * sin(yaw)
480
+ // Handedness is taken into account when defining east vector via ComputeLocalBasisToRefs.
483
481
  const horiz = TmpVectors.Vector3[3];
484
- north.rotateByQuaternionToRef(yawQuat, horiz);
482
+ const t1 = TmpVectors.Vector3[4];
483
+ horiz
484
+ .copyFrom(north)
485
+ .scaleInPlace(Math.cos(yaw))
486
+ .addInPlace(t1.copyFrom(east).scaleInPlace(Math.sin(yaw)));
485
487
  // lookAt = horiz * sinPitch - up * cosPitch
486
- const t2 = TmpVectors.Vector3[4];
488
+ const t2 = TmpVectors.Vector3[5];
487
489
  result.copyFrom(horiz).scaleInPlace(sinPitch).addInPlace(t2.copyFrom(up).scaleInPlace(-cosPitch));
488
490
  return result.normalize();
489
491
  }
@@ -502,9 +504,9 @@ export function ComputeYawPitchFromLookAtToRef(lookAt, center, useRightHandedSys
502
504
  const east = TmpVectors.Vector3[6];
503
505
  const north = TmpVectors.Vector3[7];
504
506
  const up = TmpVectors.Vector3[8];
505
- ComputeLocalBasisToRefs(center, east, north, up);
507
+ ComputeLocalBasisToRefs(center, east, north, up, useRightHandedSystem);
506
508
  // lookAt = horiz*sinPitch - up*cosPitch
507
- // where horiz = rotate(north, up, yaw * yawScale) via quaternion
509
+ // where horiz = north*cos(yaw) + east*sin(yaw)
508
510
  //
509
511
  // The vertical component of lookAt (along up) gives us cosPitch:
510
512
  // lookAt · up = -cosPitch
@@ -532,8 +534,7 @@ export function ComputeYawPitchFromLookAtToRef(lookAt, center, useRightHandedSys
532
534
  // So: cosYaw = horiz · north, sinYaw = horiz · east
533
535
  const cosYaw = Vector3Dot(horiz, north);
534
536
  const sinYaw = Vector3Dot(horiz, east);
535
- const yawScale = useRightHandedSystem ? 1 : -1;
536
- result.x = Math.atan2(sinYaw, cosYaw) * yawScale;
537
+ result.x = Math.atan2(sinYaw, cosYaw);
537
538
  result.y = pitch;
538
539
  return result;
539
540
  }
@@ -1 +1 @@
1
- {"version":3,"file":"geospatialCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/geospatialCamera.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAInE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE5H,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACrH,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAInF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAalD;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,MAAM;IA2BxC,YAAY,IAAY,EAAE,KAAY,EAAE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AAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAErD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,OAAO,EAAE,CAAC;QAC/B,+DAA+D;QAC/D,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC;QACtB,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC;QACjB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,oCAAoC;IACpC,MAAM,KAAK,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;IAExD,mEAAmE;IACnE,oDAAoD;IACpD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEvC,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC;IACjD,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC;IACjB,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { GeospatialCameraInputsManager } from \"./geospatialCameraInputsManager\";\r\nimport { Vector3, Matrix, TmpVectors, Quaternion } from \"../Maths/math.vector\";\r\nimport type { Vector2 } from \"../Maths/math.vector\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Camera } from \"./camera\";\r\nimport { serialize, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { MeshPredicate } from \"../Culling/ray.core\";\r\nimport type { DeepImmutable } from \"../types\";\r\nimport { GeospatialLimits } from \"./Limits/geospatialLimits\";\r\nimport { ClampCenterFromPolesInPlace, ComputeLocalBasisToRefs, GeospatialCameraMovement } from \"./geospatialCameraMovement\";\r\nimport type { IVector3Like } from \"../Maths/math.like\";\r\nimport { Vector3CopyToRef, Vector3Distance, Vector3Dot, Vector3SubtractToRef } from \"../Maths/math.vector.functions\";\r\nimport { Clamp, NormalizeRadians } from \"../Maths/math.scalar.functions\";\r\nimport type { AllowedAnimValue } from \"../Behaviors/Cameras/interpolatingBehavior\";\r\nimport { InterpolatingBehavior } from \"../Behaviors/Cameras/interpolatingBehavior\";\r\nimport type { Collider } from \"../Collisions/collider\";\r\nimport type { EasingFunction } from \"../Animations/easing\";\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\nexport type GeospatialCameraOptions = {\r\n /**\r\n * Radius of the planet being orbited\r\n */\r\n planetRadius: number;\r\n /**\r\n * If supplied, will be used by the movement class when picking the globe. Can later update camera.movement.pickPredicate directly\r\n */\r\n pickPredicate?: MeshPredicate;\r\n};\r\n\r\n/**\r\n * Camera equipped to orbit a spherical planet centered at world origin\r\n */\r\nexport class GeospatialCamera extends Camera {\r\n override inputs: GeospatialCameraInputsManager;\r\n\r\n /** Movement controller that turns input pixelDeltas into currentFrameDeltas used by camera*/\r\n public readonly movement: GeospatialCameraMovement;\r\n\r\n // Temp vars\r\n private _tempPosition: Vector3 = new Vector3();\r\n private _tempCenter: Vector3 = new Vector3();\r\n\r\n private _viewMatrix = new Matrix();\r\n private _isViewMatrixDirty: boolean;\r\n private _lookAtVector: Vector3 = new Vector3();\r\n\r\n /** Behavior used for smooth flying animations */\r\n private _flyingBehavior: InterpolatingBehavior<GeospatialCamera>;\r\n private _flyToTargets: Map<keyof GeospatialCamera, AllowedAnimValue> = new Map();\r\n\r\n // Collision properties\r\n private _collider?: Collider;\r\n private _collisionVelocity: Vector3 = new Vector3();\r\n /** Public option to customize the collision offset applied each frame - vs the one calculated using internal CollisionCoordinator */\r\n public perFrameCollisionOffset: Vector3 = new Vector3();\r\n /** Enable or disable collision checking for this camera. Default is false. */\r\n @serialize()\r\n public checkCollisions: boolean = false;\r\n\r\n constructor(name: string, scene: Scene, options: GeospatialCameraOptions) {\r\n super(name, new Vector3(), scene);\r\n\r\n this._limits = new GeospatialLimits(options.planetRadius);\r\n this._resetToDefault(this._limits);\r\n\r\n this._flyingBehavior = new InterpolatingBehavior();\r\n this.addBehavior(this._flyingBehavior);\r\n\r\n this.movement = new GeospatialCameraMovement(scene, this._limits, this.position, this.center, this._lookAtVector, options.pickPredicate, this._flyingBehavior);\r\n\r\n this.inputs = new GeospatialCameraInputsManager(this);\r\n this.inputs.addMouse().addMouseWheel().addKeyboard();\r\n }\r\n\r\n @serializeAsVector3()\r\n private _center: Vector3 = new Vector3();\r\n /** The point on the globe that we are anchoring around. If no alternate rotation point is supplied, this will represent the center of screen*/\r\n public get center(): Vector3 {\r\n return this._center;\r\n }\r\n\r\n /**\r\n * Sets the camera position to orbit around a new center point\r\n * @param center The world position (ECEF) to orbit around\r\n */\r\n public set center(center: IVector3Like) {\r\n this._center.copyFromFloats(center.x, center.y, center.z);\r\n this._setOrientation(this._yaw, this._pitch, this._radius, this._center);\r\n }\r\n\r\n @serialize()\r\n private _yaw: number = 0;\r\n /**\r\n * Gets the camera's yaw (rotation around the geocentric normal) in radians\r\n */\r\n public get yaw(): number {\r\n return this._yaw;\r\n }\r\n\r\n /**\r\n * Sets the camera's yaw (rotation around the geocentric normal). Will wrap value to [-π, π)\r\n * @param yaw The desired yaw angle in radians (0 = north, π/2 = east)\r\n */\r\n public set yaw(yaw: number) {\r\n yaw !== this._yaw && this._setOrientation(yaw, this.pitch, this.radius, this.center);\r\n }\r\n\r\n @serialize()\r\n private _pitch: number = 0;\r\n\r\n /**\r\n * Gets the camera's pitch (angle from looking straight at globe)\r\n * Pitch is measured from looking straight down at planet center:\r\n * - zero pitch = looking straight at planet center (down)\r\n * - positive pitch = tilting up away from planet\r\n * - π/2 pitch = looking at horizon (perpendicular to geocentric normal)\r\n */\r\n public get pitch(): number {\r\n return this._pitch;\r\n }\r\n\r\n /**\r\n * Sets the camera's pitch (angle from looking straight at globe). Will wrap value to [-π, π)\r\n * @param pitch The desired pitch angle in radians (0 = looking at planet center, π/2 = looking at horizon)\r\n */\r\n public set pitch(pitch: number) {\r\n pitch !== this._pitch && this._setOrientation(this.yaw, pitch, this.radius, this.center);\r\n }\r\n\r\n @serialize()\r\n private _radius: number = 0;\r\n public get radius(): number {\r\n return this._radius;\r\n }\r\n\r\n /**\r\n * Sets the camera's distance from the current center point\r\n * @param radius The desired radius\r\n */\r\n public set radius(radius: number) {\r\n radius !== this._radius && this._setOrientation(this.yaw, this.pitch, radius, this.center);\r\n }\r\n\r\n protected _checkLimits() {\r\n const limits = this.limits;\r\n this._yaw = Clamp(this._yaw, limits.yawMin, limits.yawMax);\r\n const effectivePitchMax = limits.getEffectivePitchMax(this._radius);\r\n this._pitch = Clamp(this._pitch, limits.pitchMin, effectivePitchMax);\r\n this._radius = Clamp(this._radius, limits.radiusMin, limits.radiusMax);\r\n ClampCenterFromPolesInPlace(this._center);\r\n }\r\n\r\n private _tempVect = new Vector3();\r\n private _tempEast = new Vector3();\r\n private _tempNorth = new Vector3();\r\n private _tempUp = new Vector3();\r\n\r\n private _setOrientation(yaw: number, pitch: number, radius: number, center: DeepImmutable<IVector3Like>): void {\r\n // Wrap yaw and pitch to [-π, π)\r\n this._yaw = NormalizeRadians(yaw);\r\n this._pitch = NormalizeRadians(pitch);\r\n this._radius = radius;\r\n\r\n Vector3CopyToRef(center, this._center);\r\n\r\n // Clamp to limits\r\n this._checkLimits();\r\n\r\n // Refresh local basis at center (treat these as read-only for the whole call)\r\n ComputeLocalBasisToRefs(this._center, this._tempEast, this._tempNorth, this._tempUp);\r\n\r\n // Compute lookAt from yaw/pitch\r\n ComputeLookAtFromYawPitchToRef(this._yaw, this._pitch, this._center, this._scene.useRightHandedSystem, this._lookAtVector);\r\n\r\n // Build an orthonormal up aligned with geocentric Up\r\n // When looking straight down (pitch ≈ 0), lookAt is parallel to Up, so use the horizontal direction as the camera's up.\r\n const right = TmpVectors.Vector3[10];\r\n Vector3.CrossToRef(this._tempUp, this._lookAtVector, right);\r\n if (right.lengthSquared() < Epsilon) {\r\n // Looking straight down (or up) - use quaternion rotation to compute horiz\r\n // Must use -yaw * yawScale to match ComputeLookAtFromYawPitchToRef formula\r\n const horiz = TmpVectors.Vector3[11];\r\n const yawScale = this._scene.useRightHandedSystem ? 1 : -1;\r\n const yawQuat = TmpVectors.Quaternion[1];\r\n Quaternion.RotationAxisToRef(this._tempUp, -this._yaw * yawScale, yawQuat);\r\n this._tempNorth.rotateByQuaternionToRef(yawQuat, horiz);\r\n // right = cross(horiz, lookAt)\r\n Vector3.CrossToRef(horiz, this._lookAtVector, right);\r\n }\r\n right.normalize();\r\n\r\n // up = normalize(cross(look, right))\r\n Vector3.CrossToRef(this._lookAtVector, right, this.upVector);\r\n this.upVector.normalize();\r\n\r\n // Position = center - look * radius (preserve unit look)\r\n this._tempVect.copyFrom(this._lookAtVector).scaleInPlace(-this._radius);\r\n this._tempPosition.copyFrom(this._center).addInPlace(this._tempVect);\r\n\r\n // Recalculate collisionOffset to be applied later when viewMatrix is calculated (allowing camera users to modify the value in afterCheckInputsObservable)\r\n if (this.checkCollisions) {\r\n this.perFrameCollisionOffset = this._getCollisionOffset(this._tempPosition);\r\n }\r\n\r\n this._position.copyFrom(this._tempPosition);\r\n\r\n this._isViewMatrixDirty = true;\r\n }\r\n\r\n /**\r\n * If camera is actively in flight, will update the target properties and use up the remaining duration from original flyTo call\r\n *\r\n * To start a new flyTo curve entirely, call into flyToAsync again (it will stop the inflight animation)\r\n * @param targetYaw\r\n * @param targetPitch\r\n * @param targetRadius\r\n * @param targetCenter\r\n */\r\n public updateFlyToDestination(targetYaw?: number, targetPitch?: number, targetRadius?: number, targetCenter?: Vector3): void {\r\n this._flyToTargets.clear();\r\n\r\n // For yaw, use shortest path to target.\r\n const deltaYaw = targetYaw !== undefined ? NormalizeRadians(NormalizeRadians(targetYaw) - this._yaw) : 0;\r\n this._flyToTargets.set(\"yaw\", deltaYaw === 0 ? undefined : this._yaw + deltaYaw);\r\n this._flyToTargets.set(\"pitch\", targetPitch != undefined ? NormalizeRadians(targetPitch) : undefined);\r\n this._flyToTargets.set(\"radius\", targetRadius);\r\n this._flyToTargets.set(\"center\", targetCenter?.clone());\r\n\r\n this._flyingBehavior.updateProperties(this._flyToTargets);\r\n }\r\n\r\n /**\r\n * Animate camera towards passed in property values. If undefined, will use current value\r\n * @param targetYaw\r\n * @param targetPitch\r\n * @param targetRadius\r\n * @param targetCenter\r\n * @param flightDurationMs\r\n * @param easingFunction\r\n * @param centerHopScale If supplied, will define the parabolic hop height scale for center animation to create a \"bounce\" effect\r\n * @returns Promise that will return when the animation is complete (or interuppted by pointer input)\r\n */\r\n public async flyToAsync(\r\n targetYaw?: number,\r\n targetPitch?: number,\r\n targetRadius?: number,\r\n targetCenter?: Vector3,\r\n flightDurationMs: number = 1000,\r\n easingFunction?: EasingFunction,\r\n centerHopScale?: number\r\n ): Promise<void> {\r\n this._flyToTargets.clear();\r\n\r\n // For yaw, use shortest path to target.\r\n const deltaYaw = targetYaw !== undefined ? NormalizeRadians(NormalizeRadians(targetYaw) - this._yaw) : 0;\r\n this._flyToTargets.set(\"yaw\", deltaYaw === 0 ? undefined : this._yaw + deltaYaw);\r\n this._flyToTargets.set(\"pitch\", targetPitch !== undefined ? NormalizeRadians(targetPitch) : undefined);\r\n this._flyToTargets.set(\"radius\", targetRadius);\r\n this._flyToTargets.set(\"center\", targetCenter?.clone());\r\n\r\n let overrideAnimationFunction;\r\n if (targetCenter !== undefined && !targetCenter.equals(this.center)) {\r\n // Animate center directly with custom interpolation\r\n overrideAnimationFunction = (key: string, animation: Animation): void => {\r\n if (key === \"center\") {\r\n // Override the Vector3 interpolation to use SLERP + hop\r\n animation.vector3InterpolateFunction = (startValue, endValue, gradient) => {\r\n // gradient is the eased value (0 to 1) after easing function is applied\r\n\r\n // Slerp between start and end\r\n const newCenter = Vector3.SlerpToRef(startValue, endValue, gradient, this._tempCenter);\r\n\r\n // Apply parabolic hop if requested\r\n if (centerHopScale && centerHopScale > 0) {\r\n // Parabolic formula: peaks at t=0.5, returns to 0 at gradient=0 and gradient=1\r\n // if hopPeakT = .5 the denominator would be hopPeakT * hopPeakT - hopPeakT, which = -.25\r\n const hopPeakOffset = centerHopScale * Vector3Distance(startValue, endValue);\r\n const hopOffset = hopPeakOffset * Clamp((gradient * gradient - gradient) / -0.25);\r\n // Scale the center outward (away from origin)\r\n newCenter.scaleInPlace(1 + hopOffset / newCenter.length());\r\n }\r\n\r\n return newCenter;\r\n };\r\n }\r\n };\r\n }\r\n\r\n return await this._flyingBehavior.animatePropertiesAsync(this._flyToTargets, flightDurationMs, easingFunction, overrideAnimationFunction);\r\n }\r\n\r\n /**\r\n * Helper function to move camera towards a given point by `distanceScale` of the current camera-to-destination distance (by default 50%).\r\n * @param destination point to move towards\r\n * @param distanceScale value between 0 and 1, % of distance to move\r\n * @param durationMs duration of flight, default 1s\r\n * @param easingFn optional easing function for flight interpolation of properties\r\n * @param centerHopScale If supplied, will define the parabolic hop height scale for center animation to create a \"bounce\" effect\r\n */\r\n public async flyToPointAsync(destination: Vector3, distanceScale: number = 0.5, durationMs: number = 1000, easingFn?: EasingFunction, centerHopScale?: number) {\r\n // Move by a fraction of the camera-to-destination distance\r\n const zoomDistance = Vector3Distance(this.position, destination) * distanceScale;\r\n const newRadius = this._getCenterAndRadiusFromZoomToPoint(destination, zoomDistance, this._tempCenter);\r\n await this.flyToAsync(undefined, undefined, newRadius, this._tempCenter, durationMs, easingFn, centerHopScale);\r\n !this.isDisposed && this._recalculateCenter(false, true /** force */);\r\n }\r\n\r\n private _limits: GeospatialLimits;\r\n public get limits(): GeospatialLimits {\r\n return this._limits;\r\n }\r\n\r\n private _resetToDefault(limits: GeospatialLimits): void {\r\n // Camera configuration vars\r\n const restingAltitude = limits.radiusMax !== Infinity ? limits.radiusMax : limits.planetRadius * 4;\r\n this.position.copyFromFloats(restingAltitude, 0, 0);\r\n this._center.copyFromFloats(limits.planetRadius, 0, 0);\r\n this._radius = Vector3.Distance(this.position, this.center);\r\n\r\n // Temp vars\r\n this._tempPosition = new Vector3();\r\n\r\n // View matrix calculation vars\r\n this._viewMatrix = Matrix.Identity();\r\n this._center.subtractToRef(this._position, this._lookAtVector).normalize(); // Lookat vector of the camera\r\n this.upVector = Vector3.Up(); // Up vector of the camera (does work for -X look at)\r\n this._isViewMatrixDirty = true;\r\n\r\n this._setOrientation(this._yaw, this._pitch, this._radius, this._center);\r\n }\r\n\r\n /** @internal */\r\n override _getViewMatrix() {\r\n if (!this._isViewMatrixDirty) {\r\n return this._viewMatrix;\r\n }\r\n this._isViewMatrixDirty = false;\r\n\r\n // Ensure vectors are normalized\r\n this.upVector.normalize();\r\n this._lookAtVector.normalize();\r\n\r\n // Apply the same offset to both position and center to preserve orbital relationship\r\n // This keeps yaw/pitch/radius intact - just lifts the whole \"rig\"\r\n this._position.addInPlace(this.perFrameCollisionOffset);\r\n this._center.addInPlace(this.perFrameCollisionOffset);\r\n\r\n // Calculate view matrix with camera position and center\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(this.position, this._center, this.upVector, this._viewMatrix);\r\n } else {\r\n Matrix.LookAtLHToRef(this.position, this._center, this.upVector, this._viewMatrix);\r\n }\r\n\r\n return this._viewMatrix;\r\n }\r\n\r\n /** @internal */\r\n override _isSynchronizedViewMatrix(): boolean {\r\n if (!super._isSynchronizedViewMatrix() || this._isViewMatrixDirty) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n private _applyGeocentricTranslation() {\r\n // Store pending position (without any corrections applied)\r\n this.center.addToRef(this.movement.panDeltaCurrentFrame, this._tempPosition);\r\n\r\n if (!this.movement.isInterpolating) {\r\n // Calculate the position correction to keep camera at the same radius when applying translation\r\n this._tempPosition.normalize().scaleInPlace(this.center.length());\r\n }\r\n // Set center which will call _setOrientation\r\n this.center = this._tempPosition;\r\n }\r\n\r\n /**\r\n * This rotation keeps the camera oriented towards the globe as it orbits around it. This is different from cameraCentricRotation which is when the camera rotates around its own axis\r\n */\r\n private _applyGeocentricRotation(): void {\r\n const rotationDeltaCurrentFrame = this.movement.rotationDeltaCurrentFrame;\r\n if (rotationDeltaCurrentFrame.x !== 0 || rotationDeltaCurrentFrame.y !== 0) {\r\n const pitch = rotationDeltaCurrentFrame.x !== 0 ? Clamp(this._pitch + rotationDeltaCurrentFrame.x, 0, 0.5 * Math.PI - Epsilon) : this._pitch;\r\n const yaw = rotationDeltaCurrentFrame.y !== 0 ? this._yaw + rotationDeltaCurrentFrame.y : this._yaw;\r\n\r\n this._setOrientation(yaw, pitch, this._radius, this._center);\r\n }\r\n }\r\n\r\n private _getCenterAndRadiusFromZoomToPoint(targetPoint: DeepImmutable<IVector3Like>, distance: number, newCenterResult: Vector3): number {\r\n const directionToTarget = Vector3SubtractToRef(targetPoint, this._position, TmpVectors.Vector3[0]);\r\n const distanceToTarget = directionToTarget.length();\r\n\r\n // Don't zoom past the min radius limit.\r\n if (distanceToTarget < this.limits.radiusMin) {\r\n newCenterResult.copyFrom(this._center);\r\n const requestedRadius = this._radius - distance;\r\n const newRadius = Clamp(requestedRadius, this.limits.radiusMin, this.limits.radiusMax);\r\n return newRadius;\r\n }\r\n\r\n // Move the camera position towards targetPoint by distanceToTarget\r\n directionToTarget.scaleInPlace(distance / distanceToTarget);\r\n const newPosition = this._position.addToRef(directionToTarget, TmpVectors.Vector3[1]);\r\n\r\n // Project the movement onto the look vector to derive the new center/radius.\r\n const projectedDistance = Vector3Dot(directionToTarget, this._lookAtVector);\r\n const newRadius = this._radius - projectedDistance;\r\n const newRadiusClamped = Clamp(newRadius, this.limits.radiusMin, this.limits.radiusMax);\r\n newCenterResult.copyFrom(newPosition).addInPlace(this._lookAtVector.scale(newRadiusClamped));\r\n\r\n return newRadiusClamped;\r\n }\r\n\r\n /**\r\n * Apply zoom by moving the camera toward/away from a target point.\r\n */\r\n private _applyZoom() {\r\n let zoomDelta = this.movement.zoomDeltaCurrentFrame;\r\n const pickedPoint = this.movement.computedPerFrameZoomPickPoint;\r\n\r\n // Clamp zoom delta to limits before applying\r\n zoomDelta = this._clampZoomDelta(zoomDelta, pickedPoint);\r\n\r\n if (Math.abs(zoomDelta) < Epsilon) {\r\n return;\r\n }\r\n if (pickedPoint) {\r\n // Zoom toward the picked point under cursor\r\n this.zoomToPoint(pickedPoint, zoomDelta);\r\n } else {\r\n // Zoom along lookAt vector (fallback when no surface under cursor)\r\n this.zoomAlongLookAt(zoomDelta);\r\n }\r\n }\r\n\r\n private _clampZoomDelta(zoomDelta: number, pickedPoint?: Vector3): number {\r\n if (Math.abs(zoomDelta) < Epsilon) {\r\n return 0;\r\n }\r\n\r\n const distanceToTarget = pickedPoint ? Vector3Distance(this._position, pickedPoint) : undefined;\r\n return this.limits.clampZoomDistance(zoomDelta, this._radius, distanceToTarget);\r\n }\r\n\r\n public zoomToPoint(targetPoint: DeepImmutable<IVector3Like>, distance: number) {\r\n const newRadius = this._getCenterAndRadiusFromZoomToPoint(targetPoint, distance, this._tempCenter);\r\n // Apply the new orientation\r\n this._setOrientation(this._yaw, this._pitch, newRadius, this._tempCenter);\r\n }\r\n\r\n public zoomAlongLookAt(distance: number) {\r\n // Clamp radius to limits\r\n const requestedRadius = this._radius - distance;\r\n const newRadius = Clamp(requestedRadius, this.limits.radiusMin, this.limits.radiusMax);\r\n\r\n // Simply change radius without moving center\r\n this._setOrientation(this._yaw, this._pitch, newRadius, this._center);\r\n }\r\n\r\n override _checkInputs(): void {\r\n this.inputs.checkInputs();\r\n this.perFrameCollisionOffset.setAll(0);\r\n\r\n // Let movement class handle all per-frame logic\r\n this.movement.computeCurrentFrameDeltas();\r\n\r\n let isCenterMoving = false;\r\n if (this.movement.panDeltaCurrentFrame.lengthSquared() > 0) {\r\n this._applyGeocentricTranslation();\r\n // After a drag, recalculate the center point to ensure it's still on the surface.\r\n isCenterMoving = true;\r\n }\r\n if (this.movement.rotationDeltaCurrentFrame.lengthSquared() > 0) {\r\n this._applyGeocentricRotation();\r\n }\r\n\r\n if (Math.abs(this.movement.zoomDeltaCurrentFrame) > Epsilon) {\r\n this._applyZoom();\r\n isCenterMoving = true;\r\n }\r\n\r\n // After a movement impacting center or radius, recalculate the center point to ensure it's still on the surface.\r\n this._recalculateCenter(isCenterMoving);\r\n\r\n super._checkInputs();\r\n }\r\n\r\n private _wasCenterMovingLastFrame = false;\r\n\r\n private _recalculateCenter(isCenterMoving: boolean, forceRecalculate: boolean = false): void {\r\n const shouldRecalculateCenterAfterMove = this._wasCenterMovingLastFrame && !isCenterMoving;\r\n this._wasCenterMovingLastFrame = isCenterMoving;\r\n\r\n // Wait until movement impacting center is complete to avoid wasted raycasting\r\n if (shouldRecalculateCenterAfterMove || forceRecalculate) {\r\n const newCenter = this.movement.pickAlongVector(this._lookAtVector);\r\n if (newCenter?.pickedPoint) {\r\n // Direction from new center to origin\r\n const centerToOrigin = TmpVectors.Vector3[4];\r\n centerToOrigin.copyFrom(newCenter.pickedPoint).negateInPlace().normalize();\r\n\r\n // Check if this direction aligns with camera's lookAt vector\r\n const dotProduct = Vector3Dot(this._lookAtVector, centerToOrigin);\r\n\r\n // Only update if the center is looking toward the origin (dot product > 0) to avoid a center on the opposite side of globe\r\n if (dotProduct > 0) {\r\n // Compute the new radius as distance from camera position to new center\r\n const newRadius = Vector3Distance(this._position, newCenter.pickedPoint);\r\n\r\n // Only update if the new center is in front of the camera\r\n if (newRadius > Epsilon) {\r\n // Compute yaw/pitch that correspond to current lookAt at new center\r\n const yawPitch = TmpVectors.Vector2[0];\r\n ComputeYawPitchFromLookAtToRef(this._lookAtVector, newCenter.pickedPoint, this._scene.useRightHandedSystem, this._yaw, yawPitch);\r\n\r\n // Call _setOrientation with the computed yaw/pitch and new center\r\n this._setOrientation(yawPitch.x, yawPitch.y, newRadius, newCenter.pickedPoint);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Allows extended classes to override how collision offset is calculated\r\n * @param newPosition\r\n * @returns\r\n */\r\n protected _getCollisionOffset(newPosition: Vector3): Vector3 {\r\n const collisionOffset = TmpVectors.Vector3[6].setAll(0);\r\n if (!this.checkCollisions || !this._scene.collisionsEnabled) {\r\n return collisionOffset;\r\n }\r\n\r\n const coordinator = this.getScene().collisionCoordinator;\r\n if (!coordinator) {\r\n return collisionOffset;\r\n }\r\n\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius.setAll(this.limits.radiusMin);\r\n\r\n // Calculate velocity from old position to new position\r\n newPosition.subtractToRef(this._position, this._collisionVelocity);\r\n\r\n // Get the collision-adjusted position\r\n const adjustedPosition = coordinator.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, () => {}, this.uniqueId);\r\n\r\n // Calculate the collision offset (how much the position was pushed)\r\n adjustedPosition.subtractToRef(newPosition, collisionOffset);\r\n\r\n return collisionOffset;\r\n }\r\n\r\n override attachControl(noPreventDefault?: boolean): void {\r\n this.inputs.attachElement(noPreventDefault);\r\n }\r\n\r\n override detachControl(): void {\r\n this.inputs.detachElement();\r\n }\r\n\r\n /**\r\n * Gets the class name of the camera.\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"GeospatialCamera\";\r\n }\r\n}\r\n\r\n// Register Class Name\r\nRegisterClass(\"BABYLON.GeospatialCamera\", GeospatialCamera);\r\n\r\n/**\r\n * Compute the lookAt direction vector from yaw and pitch angles at a given center point.\r\n * This is the forward formula used by GeospatialCamera._setOrientation.\r\n * @param yaw - The yaw angle in radians (0 = north, π/2 = east)\r\n * @param pitch - The pitch angle in radians (0 = looking at planet center, π/2 = looking at horizon)\r\n * @param center - The center point on the globe\r\n * @param useRightHandedSystem - Whether the scene uses a right-handed coordinate system\r\n * @param result - The vector to store the result in\r\n * @returns The normalized lookAt direction vector (same as result)\r\n */\r\nexport function ComputeLookAtFromYawPitchToRef(yaw: number, pitch: number, center: Vector3, useRightHandedSystem: boolean, result: Vector3): Vector3 {\r\n const east = TmpVectors.Vector3[0];\r\n const north = TmpVectors.Vector3[1];\r\n const up = TmpVectors.Vector3[2];\r\n ComputeLocalBasisToRefs(center, east, north, up);\r\n\r\n const sinPitch = Math.sin(pitch);\r\n const cosPitch = Math.cos(pitch);\r\n\r\n // Use quaternion rotation to compute horiz = rotate(north, up, -yaw * yawScale)\r\n // Negating the angle produces: horiz = North*cos(yaw) + East*sin(yaw)\r\n const yawScale = useRightHandedSystem ? 1 : -1;\r\n const yawQuat = TmpVectors.Quaternion[0];\r\n Quaternion.RotationAxisToRef(up, -yaw * yawScale, yawQuat);\r\n\r\n const horiz = TmpVectors.Vector3[3];\r\n north.rotateByQuaternionToRef(yawQuat, horiz);\r\n\r\n // lookAt = horiz * sinPitch - up * cosPitch\r\n const t2 = TmpVectors.Vector3[4];\r\n result.copyFrom(horiz).scaleInPlace(sinPitch).addInPlace(t2.copyFrom(up).scaleInPlace(-cosPitch));\r\n return result.normalize();\r\n}\r\n\r\n/**\r\n * Given a lookAt direction and center, compute the yaw and pitch angles that would produce that lookAt.\r\n * This is the inverse of ComputeLookAtFromYawPitchToRef.\r\n * @param lookAt - The normalized lookAt direction vector\r\n * @param center - The center point on the globe\r\n * @param useRightHandedSystem - Whether the scene uses a right-handed coordinate system\r\n * @param currentYaw - The current yaw value to use as fallback when pitch is near 0 (looking straight down/up)\r\n * @param result - The Vector2 to store the result in (x = yaw, y = pitch)\r\n * @returns The result Vector2\r\n */\r\nexport function ComputeYawPitchFromLookAtToRef(lookAt: Vector3, center: Vector3, useRightHandedSystem: boolean, currentYaw: number, result: Vector2): Vector2 {\r\n // Compute local basis at center\r\n const east = TmpVectors.Vector3[6];\r\n const north = TmpVectors.Vector3[7];\r\n const up = TmpVectors.Vector3[8];\r\n ComputeLocalBasisToRefs(center, east, north, up);\r\n\r\n // lookAt = horiz*sinPitch - up*cosPitch\r\n // where horiz = rotate(north, up, yaw * yawScale) via quaternion\r\n //\r\n // The vertical component of lookAt (along up) gives us cosPitch:\r\n // lookAt · up = -cosPitch\r\n const lookDotUp = Vector3Dot(lookAt, up);\r\n const cosPitch = -lookDotUp;\r\n\r\n // Clamp cosPitch to valid range to avoid NaN from acos\r\n const clampedCosPitch = Clamp(cosPitch, -1, 1);\r\n const pitch = Math.acos(clampedCosPitch);\r\n\r\n // The horizontal component gives us yaw\r\n // lookHorizontal = lookAt + up*cosPitch = horiz*sinPitch\r\n const lookHorizontal = TmpVectors.Vector3[9];\r\n const scaledUp = TmpVectors.Vector3[10];\r\n scaledUp.copyFrom(up).scaleInPlace(cosPitch);\r\n lookHorizontal.copyFrom(lookAt).addInPlace(scaledUp);\r\n\r\n const sinPitch = Math.sin(pitch);\r\n if (Math.abs(sinPitch) < Epsilon) {\r\n // Looking straight down or up, yaw is undefined - keep current\r\n result.x = currentYaw;\r\n result.y = pitch;\r\n return result;\r\n }\r\n\r\n // horiz = lookHorizontal / sinPitch\r\n const horiz = lookHorizontal.scaleInPlace(1 / sinPitch);\r\n\r\n // From the forward formula: horiz = North*cos(yaw) + East*sin(yaw)\r\n // So: cosYaw = horiz · north, sinYaw = horiz · east\r\n const cosYaw = Vector3Dot(horiz, north);\r\n const sinYaw = Vector3Dot(horiz, east);\r\n\r\n const yawScale = useRightHandedSystem ? 1 : -1;\r\n result.x = Math.atan2(sinYaw, cosYaw) * yawScale;\r\n result.y = pitch;\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"geospatialCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/geospatialCamera.ts"],"names":[],"mappings":";AAAA,OAAO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/D,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC;QACtB,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC;QACjB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,oCAAoC;IACpC,MAAM,KAAK,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;IAExD,mEAAmE;IACnE,oDAAoD;IACpD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEvC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC;IACjB,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { GeospatialCameraInputsManager } from \"./geospatialCameraInputsManager\";\r\nimport { Vector3, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { Vector2 } from \"../Maths/math.vector\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Camera } from \"./camera\";\r\nimport { serialize, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { MeshPredicate } from \"../Culling/ray.core\";\r\nimport type { DeepImmutable } from \"../types\";\r\nimport { GeospatialLimits } from \"./Limits/geospatialLimits\";\r\nimport { ClampCenterFromPolesInPlace, ComputeLocalBasisToRefs, GeospatialCameraMovement } from \"./geospatialCameraMovement\";\r\nimport type { IVector3Like } from \"../Maths/math.like\";\r\nimport { Vector3CopyToRef, Vector3Distance, Vector3Dot, Vector3SubtractToRef } from \"../Maths/math.vector.functions\";\r\nimport { Clamp, NormalizeRadians } from \"../Maths/math.scalar.functions\";\r\nimport type { AllowedAnimValue } from \"../Behaviors/Cameras/interpolatingBehavior\";\r\nimport { InterpolatingBehavior } from \"../Behaviors/Cameras/interpolatingBehavior\";\r\nimport type { Collider } from \"../Collisions/collider\";\r\nimport type { EasingFunction } from \"../Animations/easing\";\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\nexport type GeospatialCameraOptions = {\r\n /**\r\n * Radius of the planet being orbited\r\n */\r\n planetRadius: number;\r\n /**\r\n * If supplied, will be used by the movement class when picking the globe. Can later update camera.movement.pickPredicate directly\r\n */\r\n pickPredicate?: MeshPredicate;\r\n};\r\n\r\n/**\r\n * Camera equipped to orbit a spherical planet centered at world origin\r\n */\r\nexport class GeospatialCamera extends Camera {\r\n override inputs: GeospatialCameraInputsManager;\r\n\r\n /** Movement controller that turns input pixelDeltas into currentFrameDeltas used by camera*/\r\n public readonly movement: GeospatialCameraMovement;\r\n\r\n // Temp vars\r\n private _tempPosition: Vector3 = new Vector3();\r\n private _tempCenter: Vector3 = new Vector3();\r\n\r\n private _viewMatrix = new Matrix();\r\n private _isViewMatrixDirty: boolean;\r\n private _lookAtVector: Vector3 = new Vector3();\r\n\r\n /** Behavior used for smooth flying animations */\r\n private _flyingBehavior: InterpolatingBehavior<GeospatialCamera>;\r\n private _flyToTargets: Map<keyof GeospatialCamera, AllowedAnimValue> = new Map();\r\n\r\n // Collision properties\r\n private _collider?: Collider;\r\n private _collisionVelocity: Vector3 = new Vector3();\r\n /** Public option to customize the collision offset applied each frame - vs the one calculated using internal CollisionCoordinator */\r\n public perFrameCollisionOffset: Vector3 = new Vector3();\r\n /** Enable or disable collision checking for this camera. Default is false. */\r\n @serialize()\r\n public checkCollisions: boolean = false;\r\n\r\n constructor(name: string, scene: Scene, options: GeospatialCameraOptions) {\r\n super(name, new Vector3(), scene);\r\n\r\n this._limits = new GeospatialLimits(options.planetRadius);\r\n this._resetToDefault(this._limits);\r\n\r\n this._flyingBehavior = new InterpolatingBehavior();\r\n this.addBehavior(this._flyingBehavior);\r\n\r\n this.movement = new GeospatialCameraMovement(scene, this._limits, this.position, this.center, this._lookAtVector, options.pickPredicate, this._flyingBehavior);\r\n\r\n this.inputs = new GeospatialCameraInputsManager(this);\r\n this.inputs.addMouse().addMouseWheel().addKeyboard();\r\n }\r\n\r\n @serializeAsVector3()\r\n private _center: Vector3 = new Vector3();\r\n /** The point on the globe that we are anchoring around. If no alternate rotation point is supplied, this will represent the center of screen*/\r\n public get center(): Vector3 {\r\n return this._center;\r\n }\r\n\r\n /**\r\n * Sets the camera position to orbit around a new center point\r\n * @param center The world position (ECEF) to orbit around\r\n */\r\n public set center(center: IVector3Like) {\r\n this._center.copyFromFloats(center.x, center.y, center.z);\r\n this._setOrientation(this._yaw, this._pitch, this._radius, this._center);\r\n }\r\n\r\n @serialize()\r\n private _yaw: number = 0;\r\n /**\r\n * Gets the camera's yaw (rotation around the geocentric normal) in radians\r\n */\r\n public get yaw(): number {\r\n return this._yaw;\r\n }\r\n\r\n /**\r\n * Sets the camera's yaw (rotation around the geocentric normal). Will wrap value to [-π, π)\r\n * @param yaw The desired yaw angle in radians (0 = north, π/2 = east)\r\n */\r\n public set yaw(yaw: number) {\r\n yaw !== this._yaw && this._setOrientation(yaw, this.pitch, this.radius, this.center);\r\n }\r\n\r\n @serialize()\r\n private _pitch: number = 0;\r\n\r\n /**\r\n * Gets the camera's pitch (angle from looking straight at globe)\r\n * Pitch is measured from looking straight down at planet center:\r\n * - zero pitch = looking straight at planet center (down)\r\n * - positive pitch = tilting up away from planet\r\n * - π/2 pitch = looking at horizon (perpendicular to geocentric normal)\r\n */\r\n public get pitch(): number {\r\n return this._pitch;\r\n }\r\n\r\n /**\r\n * Sets the camera's pitch (angle from looking straight at globe). Will wrap value to [-π, π)\r\n * @param pitch The desired pitch angle in radians (0 = looking at planet center, π/2 = looking at horizon)\r\n */\r\n public set pitch(pitch: number) {\r\n pitch !== this._pitch && this._setOrientation(this.yaw, pitch, this.radius, this.center);\r\n }\r\n\r\n @serialize()\r\n private _radius: number = 0;\r\n public get radius(): number {\r\n return this._radius;\r\n }\r\n\r\n /**\r\n * Sets the camera's distance from the current center point\r\n * @param radius The desired radius\r\n */\r\n public set radius(radius: number) {\r\n radius !== this._radius && this._setOrientation(this.yaw, this.pitch, radius, this.center);\r\n }\r\n\r\n protected _checkLimits() {\r\n const limits = this.limits;\r\n this._yaw = Clamp(this._yaw, limits.yawMin, limits.yawMax);\r\n const effectivePitchMax = limits.getEffectivePitchMax(this._radius);\r\n this._pitch = Clamp(this._pitch, limits.pitchMin, effectivePitchMax);\r\n this._radius = Clamp(this._radius, limits.radiusMin, limits.radiusMax);\r\n ClampCenterFromPolesInPlace(this._center);\r\n }\r\n\r\n private _tempVect = new Vector3();\r\n private _tempEast = new Vector3();\r\n private _tempNorth = new Vector3();\r\n private _tempUp = new Vector3();\r\n\r\n private _setOrientation(yaw: number, pitch: number, radius: number, center: DeepImmutable<IVector3Like>): void {\r\n // Wrap yaw and pitch to [-π, π)\r\n this._yaw = NormalizeRadians(yaw);\r\n this._pitch = NormalizeRadians(pitch);\r\n this._radius = radius;\r\n\r\n Vector3CopyToRef(center, this._center);\r\n\r\n // Clamp to limits\r\n this._checkLimits();\r\n\r\n // Refresh local basis at center (treat these as read-only for the whole call)\r\n ComputeLocalBasisToRefs(this._center, this._tempEast, this._tempNorth, this._tempUp, this._scene.useRightHandedSystem);\r\n\r\n // Compute lookAt from yaw/pitch\r\n ComputeLookAtFromYawPitchToRef(this._yaw, this._pitch, this._center, this._scene.useRightHandedSystem, this._lookAtVector);\r\n\r\n // Build an orthonormal up aligned with geocentric Up\r\n // When looking straight down (pitch ≈ 0), lookAt is parallel to Up, so use the horizontal direction as the camera's up.\r\n const right = TmpVectors.Vector3[10];\r\n Vector3.CrossToRef(this._tempUp, this._lookAtVector, right);\r\n if (right.lengthSquared() < Epsilon) {\r\n // horiz = north * cos(yaw) + east * sin(yaw)\r\n // Using tempEast directly ensures handedness is taken into account\r\n const horiz = TmpVectors.Vector3[11];\r\n const t1 = TmpVectors.Vector3[12];\r\n horiz\r\n .copyFrom(this._tempNorth)\r\n .scaleInPlace(Math.cos(this._yaw))\r\n .addInPlace(t1.copyFrom(this._tempEast).scaleInPlace(Math.sin(this._yaw)));\r\n // right = cross(horiz, lookAt)\r\n Vector3.CrossToRef(horiz, this._lookAtVector, right);\r\n }\r\n right.normalize();\r\n\r\n // up = normalize(cross(look, right))\r\n Vector3.CrossToRef(this._lookAtVector, right, this.upVector);\r\n this.upVector.normalize();\r\n\r\n // Position = center - look * radius (preserve unit look)\r\n this._tempVect.copyFrom(this._lookAtVector).scaleInPlace(-this._radius);\r\n this._tempPosition.copyFrom(this._center).addInPlace(this._tempVect);\r\n\r\n // Recalculate collisionOffset to be applied later when viewMatrix is calculated (allowing camera users to modify the value in afterCheckInputsObservable)\r\n if (this.checkCollisions) {\r\n this.perFrameCollisionOffset = this._getCollisionOffset(this._tempPosition);\r\n }\r\n\r\n this._position.copyFrom(this._tempPosition);\r\n\r\n this._isViewMatrixDirty = true;\r\n }\r\n\r\n /**\r\n * If camera is actively in flight, will update the target properties and use up the remaining duration from original flyTo call\r\n *\r\n * To start a new flyTo curve entirely, call into flyToAsync again (it will stop the inflight animation)\r\n * @param targetYaw\r\n * @param targetPitch\r\n * @param targetRadius\r\n * @param targetCenter\r\n */\r\n public updateFlyToDestination(targetYaw?: number, targetPitch?: number, targetRadius?: number, targetCenter?: Vector3): void {\r\n this._flyToTargets.clear();\r\n\r\n // For yaw, use shortest path to target.\r\n const deltaYaw = targetYaw !== undefined ? NormalizeRadians(NormalizeRadians(targetYaw) - this._yaw) : 0;\r\n this._flyToTargets.set(\"yaw\", deltaYaw === 0 ? undefined : this._yaw + deltaYaw);\r\n this._flyToTargets.set(\"pitch\", targetPitch != undefined ? NormalizeRadians(targetPitch) : undefined);\r\n this._flyToTargets.set(\"radius\", targetRadius);\r\n this._flyToTargets.set(\"center\", targetCenter?.clone());\r\n\r\n this._flyingBehavior.updateProperties(this._flyToTargets);\r\n }\r\n\r\n /**\r\n * Animate camera towards passed in property values. If undefined, will use current value\r\n * @param targetYaw\r\n * @param targetPitch\r\n * @param targetRadius\r\n * @param targetCenter\r\n * @param flightDurationMs\r\n * @param easingFunction\r\n * @param centerHopScale If supplied, will define the parabolic hop height scale for center animation to create a \"bounce\" effect\r\n * @returns Promise that will return when the animation is complete (or interuppted by pointer input)\r\n */\r\n public async flyToAsync(\r\n targetYaw?: number,\r\n targetPitch?: number,\r\n targetRadius?: number,\r\n targetCenter?: Vector3,\r\n flightDurationMs: number = 1000,\r\n easingFunction?: EasingFunction,\r\n centerHopScale?: number\r\n ): Promise<void> {\r\n this._flyToTargets.clear();\r\n\r\n // For yaw, use shortest path to target.\r\n const deltaYaw = targetYaw !== undefined ? NormalizeRadians(NormalizeRadians(targetYaw) - this._yaw) : 0;\r\n this._flyToTargets.set(\"yaw\", deltaYaw === 0 ? undefined : this._yaw + deltaYaw);\r\n this._flyToTargets.set(\"pitch\", targetPitch !== undefined ? NormalizeRadians(targetPitch) : undefined);\r\n this._flyToTargets.set(\"radius\", targetRadius);\r\n this._flyToTargets.set(\"center\", targetCenter?.clone());\r\n\r\n let overrideAnimationFunction;\r\n if (targetCenter !== undefined && !targetCenter.equals(this.center)) {\r\n // Animate center directly with custom interpolation\r\n overrideAnimationFunction = (key: string, animation: Animation): void => {\r\n if (key === \"center\") {\r\n // Override the Vector3 interpolation to use SLERP + hop\r\n animation.vector3InterpolateFunction = (startValue, endValue, gradient) => {\r\n // gradient is the eased value (0 to 1) after easing function is applied\r\n\r\n // Slerp between start and end\r\n const newCenter = Vector3.SlerpToRef(startValue, endValue, gradient, this._tempCenter);\r\n\r\n // Apply parabolic hop if requested\r\n if (centerHopScale && centerHopScale > 0) {\r\n // Parabolic formula: peaks at t=0.5, returns to 0 at gradient=0 and gradient=1\r\n // if hopPeakT = .5 the denominator would be hopPeakT * hopPeakT - hopPeakT, which = -.25\r\n const hopPeakOffset = centerHopScale * Vector3Distance(startValue, endValue);\r\n const hopOffset = hopPeakOffset * Clamp((gradient * gradient - gradient) / -0.25);\r\n // Scale the center outward (away from origin)\r\n newCenter.scaleInPlace(1 + hopOffset / newCenter.length());\r\n }\r\n\r\n return newCenter;\r\n };\r\n }\r\n };\r\n }\r\n\r\n return await this._flyingBehavior.animatePropertiesAsync(this._flyToTargets, flightDurationMs, easingFunction, overrideAnimationFunction);\r\n }\r\n\r\n /**\r\n * Helper function to move camera towards a given point by `distanceScale` of the current camera-to-destination distance (by default 50%).\r\n * @param destination point to move towards\r\n * @param distanceScale value between 0 and 1, % of distance to move\r\n * @param durationMs duration of flight, default 1s\r\n * @param easingFn optional easing function for flight interpolation of properties\r\n * @param centerHopScale If supplied, will define the parabolic hop height scale for center animation to create a \"bounce\" effect\r\n */\r\n public async flyToPointAsync(destination: Vector3, distanceScale: number = 0.5, durationMs: number = 1000, easingFn?: EasingFunction, centerHopScale?: number) {\r\n // Move by a fraction of the camera-to-destination distance\r\n const zoomDistance = Vector3Distance(this.position, destination) * distanceScale;\r\n const newRadius = this._getCenterAndRadiusFromZoomToPoint(destination, zoomDistance, this._tempCenter);\r\n await this.flyToAsync(undefined, undefined, newRadius, this._tempCenter, durationMs, easingFn, centerHopScale);\r\n !this.isDisposed() && this._recalculateCenter(false, true /** force */);\r\n }\r\n\r\n private _limits: GeospatialLimits;\r\n public get limits(): GeospatialLimits {\r\n return this._limits;\r\n }\r\n\r\n private _resetToDefault(limits: GeospatialLimits): void {\r\n // Camera configuration vars\r\n const restingAltitude = limits.radiusMax !== Infinity ? limits.radiusMax : limits.planetRadius * 4;\r\n this.position.copyFromFloats(restingAltitude, 0, 0);\r\n this._center.copyFromFloats(limits.planetRadius, 0, 0);\r\n this._radius = Vector3.Distance(this.position, this.center);\r\n\r\n // Temp vars\r\n this._tempPosition = new Vector3();\r\n\r\n // View matrix calculation vars\r\n this._viewMatrix = Matrix.Identity();\r\n this._center.subtractToRef(this._position, this._lookAtVector).normalize(); // Lookat vector of the camera\r\n this.upVector = Vector3.Up(); // Up vector of the camera (does work for -X look at)\r\n this._isViewMatrixDirty = true;\r\n\r\n this._setOrientation(this._yaw, this._pitch, this._radius, this._center);\r\n }\r\n\r\n /** @internal */\r\n override _getViewMatrix() {\r\n if (!this._isViewMatrixDirty) {\r\n return this._viewMatrix;\r\n }\r\n this._isViewMatrixDirty = false;\r\n\r\n // Ensure vectors are normalized\r\n this.upVector.normalize();\r\n this._lookAtVector.normalize();\r\n\r\n // Apply the same offset to both position and center to preserve orbital relationship\r\n // This keeps yaw/pitch/radius intact - just lifts the whole \"rig\"\r\n this._position.addInPlace(this.perFrameCollisionOffset);\r\n this._center.addInPlace(this.perFrameCollisionOffset);\r\n\r\n // Calculate view matrix with camera position and center\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(this.position, this._center, this.upVector, this._viewMatrix);\r\n } else {\r\n Matrix.LookAtLHToRef(this.position, this._center, this.upVector, this._viewMatrix);\r\n }\r\n\r\n return this._viewMatrix;\r\n }\r\n\r\n /** @internal */\r\n override _isSynchronizedViewMatrix(): boolean {\r\n if (!super._isSynchronizedViewMatrix() || this._isViewMatrixDirty) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n private _applyGeocentricTranslation() {\r\n // Store pending position (without any corrections applied)\r\n this.center.addToRef(this.movement.panDeltaCurrentFrame, this._tempPosition);\r\n\r\n if (!this.movement.isInterpolating) {\r\n // Calculate the position correction to keep camera at the same radius when applying translation\r\n this._tempPosition.normalize().scaleInPlace(this.center.length());\r\n }\r\n // Set center which will call _setOrientation\r\n this.center = this._tempPosition;\r\n }\r\n\r\n /**\r\n * This rotation keeps the camera oriented towards the globe as it orbits around it. This is different from cameraCentricRotation which is when the camera rotates around its own axis\r\n */\r\n private _applyGeocentricRotation(): void {\r\n const rotationDeltaCurrentFrame = this.movement.rotationDeltaCurrentFrame;\r\n if (rotationDeltaCurrentFrame.x !== 0 || rotationDeltaCurrentFrame.y !== 0) {\r\n const pitch = rotationDeltaCurrentFrame.x !== 0 ? Clamp(this._pitch + rotationDeltaCurrentFrame.x, 0, 0.5 * Math.PI - Epsilon) : this._pitch;\r\n const yaw = rotationDeltaCurrentFrame.y !== 0 ? this._yaw + rotationDeltaCurrentFrame.y : this._yaw;\r\n\r\n this._setOrientation(yaw, pitch, this._radius, this._center);\r\n }\r\n }\r\n\r\n private _getCenterAndRadiusFromZoomToPoint(targetPoint: DeepImmutable<IVector3Like>, distance: number, newCenterResult: Vector3): number {\r\n const directionToTarget = Vector3SubtractToRef(targetPoint, this._position, TmpVectors.Vector3[0]);\r\n const distanceToTarget = directionToTarget.length();\r\n\r\n // Don't zoom past the min radius limit.\r\n if (distanceToTarget < this.limits.radiusMin) {\r\n newCenterResult.copyFrom(this._center);\r\n const requestedRadius = this._radius - distance;\r\n const newRadius = Clamp(requestedRadius, this.limits.radiusMin, this.limits.radiusMax);\r\n return newRadius;\r\n }\r\n\r\n // Move the camera position towards targetPoint by distanceToTarget\r\n directionToTarget.scaleInPlace(distance / distanceToTarget);\r\n const newPosition = this._position.addToRef(directionToTarget, TmpVectors.Vector3[1]);\r\n\r\n // Project the movement onto the look vector to derive the new center/radius.\r\n const projectedDistance = Vector3Dot(directionToTarget, this._lookAtVector);\r\n const newRadius = this._radius - projectedDistance;\r\n const newRadiusClamped = Clamp(newRadius, this.limits.radiusMin, this.limits.radiusMax);\r\n newCenterResult.copyFrom(newPosition).addInPlace(this._lookAtVector.scale(newRadiusClamped));\r\n\r\n return newRadiusClamped;\r\n }\r\n\r\n /**\r\n * Apply zoom by moving the camera toward/away from a target point.\r\n */\r\n private _applyZoom() {\r\n let zoomDelta = this.movement.zoomDeltaCurrentFrame;\r\n const pickedPoint = this.movement.computedPerFrameZoomPickPoint;\r\n\r\n // Clamp zoom delta to limits before applying\r\n zoomDelta = this._clampZoomDelta(zoomDelta, pickedPoint);\r\n\r\n if (Math.abs(zoomDelta) < Epsilon) {\r\n return;\r\n }\r\n if (pickedPoint) {\r\n // Zoom toward the picked point under cursor\r\n this.zoomToPoint(pickedPoint, zoomDelta);\r\n } else {\r\n // Zoom along lookAt vector (fallback when no surface under cursor)\r\n this.zoomAlongLookAt(zoomDelta);\r\n }\r\n }\r\n\r\n private _clampZoomDelta(zoomDelta: number, pickedPoint?: Vector3): number {\r\n if (Math.abs(zoomDelta) < Epsilon) {\r\n return 0;\r\n }\r\n\r\n const distanceToTarget = pickedPoint ? Vector3Distance(this._position, pickedPoint) : undefined;\r\n return this.limits.clampZoomDistance(zoomDelta, this._radius, distanceToTarget);\r\n }\r\n\r\n public zoomToPoint(targetPoint: DeepImmutable<IVector3Like>, distance: number) {\r\n const newRadius = this._getCenterAndRadiusFromZoomToPoint(targetPoint, distance, this._tempCenter);\r\n // Apply the new orientation\r\n this._setOrientation(this._yaw, this._pitch, newRadius, this._tempCenter);\r\n }\r\n\r\n public zoomAlongLookAt(distance: number) {\r\n // Clamp radius to limits\r\n const requestedRadius = this._radius - distance;\r\n const newRadius = Clamp(requestedRadius, this.limits.radiusMin, this.limits.radiusMax);\r\n\r\n // Simply change radius without moving center\r\n this._setOrientation(this._yaw, this._pitch, newRadius, this._center);\r\n }\r\n\r\n override _checkInputs(): void {\r\n this.inputs.checkInputs();\r\n this.perFrameCollisionOffset.setAll(0);\r\n\r\n // Let movement class handle all per-frame logic\r\n this.movement.computeCurrentFrameDeltas();\r\n\r\n let isCenterMoving = false;\r\n if (this.movement.panDeltaCurrentFrame.lengthSquared() > 0) {\r\n this._applyGeocentricTranslation();\r\n // After a drag, recalculate the center point to ensure it's still on the surface.\r\n isCenterMoving = true;\r\n }\r\n if (this.movement.rotationDeltaCurrentFrame.lengthSquared() > 0) {\r\n this._applyGeocentricRotation();\r\n }\r\n\r\n if (Math.abs(this.movement.zoomDeltaCurrentFrame) > Epsilon) {\r\n this._applyZoom();\r\n isCenterMoving = true;\r\n }\r\n\r\n // After a movement impacting center or radius, recalculate the center point to ensure it's still on the surface.\r\n this._recalculateCenter(isCenterMoving);\r\n\r\n super._checkInputs();\r\n }\r\n\r\n private _wasCenterMovingLastFrame = false;\r\n\r\n private _recalculateCenter(isCenterMoving: boolean, forceRecalculate: boolean = false): void {\r\n const shouldRecalculateCenterAfterMove = this._wasCenterMovingLastFrame && !isCenterMoving;\r\n this._wasCenterMovingLastFrame = isCenterMoving;\r\n\r\n // Wait until movement impacting center is complete to avoid wasted raycasting\r\n if (shouldRecalculateCenterAfterMove || forceRecalculate) {\r\n const newCenter = this.movement.pickAlongVector(this._lookAtVector);\r\n if (newCenter?.pickedPoint) {\r\n // Direction from new center to origin\r\n const centerToOrigin = TmpVectors.Vector3[4];\r\n centerToOrigin.copyFrom(newCenter.pickedPoint).negateInPlace().normalize();\r\n\r\n // Check if this direction aligns with camera's lookAt vector\r\n const dotProduct = Vector3Dot(this._lookAtVector, centerToOrigin);\r\n\r\n // Only update if the center is looking toward the origin (dot product > 0) to avoid a center on the opposite side of globe\r\n if (dotProduct > 0) {\r\n // Compute the new radius as distance from camera position to new center\r\n const newRadius = Vector3Distance(this._position, newCenter.pickedPoint);\r\n\r\n // Only update if the new center is in front of the camera\r\n if (newRadius > Epsilon) {\r\n // Compute yaw/pitch that correspond to current lookAt at new center\r\n const yawPitch = TmpVectors.Vector2[0];\r\n ComputeYawPitchFromLookAtToRef(this._lookAtVector, newCenter.pickedPoint, this._scene.useRightHandedSystem, this._yaw, yawPitch);\r\n\r\n // Call _setOrientation with the computed yaw/pitch and new center\r\n this._setOrientation(yawPitch.x, yawPitch.y, newRadius, newCenter.pickedPoint);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Allows extended classes to override how collision offset is calculated\r\n * @param newPosition\r\n * @returns\r\n */\r\n protected _getCollisionOffset(newPosition: Vector3): Vector3 {\r\n const collisionOffset = TmpVectors.Vector3[6].setAll(0);\r\n if (!this.checkCollisions || !this._scene.collisionsEnabled) {\r\n return collisionOffset;\r\n }\r\n\r\n const coordinator = this.getScene().collisionCoordinator;\r\n if (!coordinator) {\r\n return collisionOffset;\r\n }\r\n\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius.setAll(this.limits.radiusMin);\r\n\r\n // Calculate velocity from old position to new position\r\n newPosition.subtractToRef(this._position, this._collisionVelocity);\r\n\r\n // Get the collision-adjusted position\r\n const adjustedPosition = coordinator.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, () => {}, this.uniqueId);\r\n\r\n // Calculate the collision offset (how much the position was pushed)\r\n adjustedPosition.subtractToRef(newPosition, collisionOffset);\r\n\r\n return collisionOffset;\r\n }\r\n\r\n override attachControl(noPreventDefault?: boolean): void {\r\n this.inputs.attachElement(noPreventDefault);\r\n }\r\n\r\n override detachControl(): void {\r\n this.inputs.detachElement();\r\n }\r\n\r\n /**\r\n * Gets the class name of the camera.\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"GeospatialCamera\";\r\n }\r\n}\r\n\r\n// Register Class Name\r\nRegisterClass(\"BABYLON.GeospatialCamera\", GeospatialCamera);\r\n\r\n/**\r\n * Compute the lookAt direction vector from yaw and pitch angles at a given center point.\r\n * This is the forward formula used by GeospatialCamera._setOrientation.\r\n * @param yaw - The yaw angle in radians (0 = north, π/2 = east)\r\n * @param pitch - The pitch angle in radians (0 = looking at planet center, π/2 = looking at horizon)\r\n * @param center - The center point on the globe\r\n * @param useRightHandedSystem - Whether the scene uses a right-handed coordinate system\r\n * @param result - The vector to store the result in\r\n * @returns The normalized lookAt direction vector (same as result)\r\n */\r\nexport function ComputeLookAtFromYawPitchToRef(yaw: number, pitch: number, center: Vector3, useRightHandedSystem: boolean, result: Vector3): Vector3 {\r\n const east = TmpVectors.Vector3[0];\r\n const north = TmpVectors.Vector3[1];\r\n const up = TmpVectors.Vector3[2];\r\n ComputeLocalBasisToRefs(center, east, north, up, useRightHandedSystem);\r\n\r\n const sinPitch = Math.sin(pitch);\r\n const cosPitch = Math.cos(pitch);\r\n\r\n // horiz = north * cos(yaw) + east * sin(yaw)\r\n // Handedness is taken into account when defining east vector via ComputeLocalBasisToRefs.\r\n const horiz = TmpVectors.Vector3[3];\r\n const t1 = TmpVectors.Vector3[4];\r\n horiz\r\n .copyFrom(north)\r\n .scaleInPlace(Math.cos(yaw))\r\n .addInPlace(t1.copyFrom(east).scaleInPlace(Math.sin(yaw)));\r\n\r\n // lookAt = horiz * sinPitch - up * cosPitch\r\n const t2 = TmpVectors.Vector3[5];\r\n result.copyFrom(horiz).scaleInPlace(sinPitch).addInPlace(t2.copyFrom(up).scaleInPlace(-cosPitch));\r\n return result.normalize();\r\n}\r\n\r\n/**\r\n * Given a lookAt direction and center, compute the yaw and pitch angles that would produce that lookAt.\r\n * This is the inverse of ComputeLookAtFromYawPitchToRef.\r\n * @param lookAt - The normalized lookAt direction vector\r\n * @param center - The center point on the globe\r\n * @param useRightHandedSystem - Whether the scene uses a right-handed coordinate system\r\n * @param currentYaw - The current yaw value to use as fallback when pitch is near 0 (looking straight down/up)\r\n * @param result - The Vector2 to store the result in (x = yaw, y = pitch)\r\n * @returns The result Vector2\r\n */\r\nexport function ComputeYawPitchFromLookAtToRef(lookAt: Vector3, center: Vector3, useRightHandedSystem: boolean, currentYaw: number, result: Vector2): Vector2 {\r\n // Compute local basis at center\r\n const east = TmpVectors.Vector3[6];\r\n const north = TmpVectors.Vector3[7];\r\n const up = TmpVectors.Vector3[8];\r\n ComputeLocalBasisToRefs(center, east, north, up, useRightHandedSystem);\r\n\r\n // lookAt = horiz*sinPitch - up*cosPitch\r\n // where horiz = north*cos(yaw) + east*sin(yaw)\r\n //\r\n // The vertical component of lookAt (along up) gives us cosPitch:\r\n // lookAt · up = -cosPitch\r\n const lookDotUp = Vector3Dot(lookAt, up);\r\n const cosPitch = -lookDotUp;\r\n\r\n // Clamp cosPitch to valid range to avoid NaN from acos\r\n const clampedCosPitch = Clamp(cosPitch, -1, 1);\r\n const pitch = Math.acos(clampedCosPitch);\r\n\r\n // The horizontal component gives us yaw\r\n // lookHorizontal = lookAt + up*cosPitch = horiz*sinPitch\r\n const lookHorizontal = TmpVectors.Vector3[9];\r\n const scaledUp = TmpVectors.Vector3[10];\r\n scaledUp.copyFrom(up).scaleInPlace(cosPitch);\r\n lookHorizontal.copyFrom(lookAt).addInPlace(scaledUp);\r\n\r\n const sinPitch = Math.sin(pitch);\r\n if (Math.abs(sinPitch) < Epsilon) {\r\n // Looking straight down or up, yaw is undefined - keep current\r\n result.x = currentYaw;\r\n result.y = pitch;\r\n return result;\r\n }\r\n\r\n // horiz = lookHorizontal / sinPitch\r\n const horiz = lookHorizontal.scaleInPlace(1 / sinPitch);\r\n\r\n // From the forward formula: horiz = North*cos(yaw) + East*sin(yaw)\r\n // So: cosYaw = horiz · north, sinYaw = horiz · east\r\n const cosYaw = Vector3Dot(horiz, north);\r\n const sinYaw = Vector3Dot(horiz, east);\r\n\r\n result.x = Math.atan2(sinYaw, cosYaw);\r\n result.y = pitch;\r\n return result;\r\n}\r\n"]}
@@ -57,6 +57,13 @@ export declare class GeospatialCameraMovement extends CameraMovement {
57
57
  export declare function ClampCenterFromPolesInPlace(center: Vector3): Vector3;
58
58
  /**
59
59
  * Helper to build east/north/up basis vectors at a world position.
60
+ * Cross product order is swapped based on handedness so that the east vector
61
+ * encodes the coordinate-system convention, removing the need for a separate yawScale.
62
+ * @param worldPos - The position on the globe
63
+ * @param refEast - Receives the east direction
64
+ * @param refNorth - Receives the north direction
65
+ * @param refUp - Receives the up (outward) direction
66
+ * @param useRightHandedSystem - Whether the scene uses a right-handed coordinate system (default: false)
60
67
  * @internal
61
68
  */
62
- export declare function ComputeLocalBasisToRefs(worldPos: Vector3, refEast: Vector3, refNorth: Vector3, refUp: Vector3): void;
69
+ export declare function ComputeLocalBasisToRefs(worldPos: Vector3, refEast: Vector3, refNorth: Vector3, refUp: Vector3, useRightHandedSystem?: boolean): void;
@@ -65,7 +65,7 @@ export class GeospatialCameraMovement extends CameraMovement {
65
65
  this._cameraPosition.normalizeToRef(this._dragPlaneNormal);
66
66
  this._dragPlaneNormal.scaleToRef(hitPointRadius, this._dragPlaneOriginPointEcef);
67
67
  // The dragPlaneOffsetVector will later be recalculated when drag occurs, and the delta between the offset vectors will be applied to localTranslation
68
- ComputeLocalBasisToRefs(this._dragPlaneOriginPointEcef, TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]);
68
+ ComputeLocalBasisToRefs(this._dragPlaneOriginPointEcef, TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2], this._scene.useRightHandedSystem);
69
69
  const localToEcef = Matrix.FromXYZAxesToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2], localToEcefResult);
70
70
  localToEcef.setTranslationFromFloats(this._dragPlaneOriginPointEcef.x, this._dragPlaneOriginPointEcef.y, this._dragPlaneOriginPointEcef.z);
71
71
  const ecefToLocal = localToEcef.invertToRef(TmpVectors.Matrix[1]);
@@ -184,22 +184,43 @@ function IntersectRayWithPlaneToRef(ray, plane, ref) {
184
184
  }
185
185
  /**
186
186
  * Helper to build east/north/up basis vectors at a world position.
187
+ * Cross product order is swapped based on handedness so that the east vector
188
+ * encodes the coordinate-system convention, removing the need for a separate yawScale.
189
+ * @param worldPos - The position on the globe
190
+ * @param refEast - Receives the east direction
191
+ * @param refNorth - Receives the north direction
192
+ * @param refUp - Receives the up (outward) direction
193
+ * @param useRightHandedSystem - Whether the scene uses a right-handed coordinate system (default: false)
187
194
  * @internal
188
195
  */
189
- export function ComputeLocalBasisToRefs(worldPos, refEast, refNorth, refUp) {
196
+ export function ComputeLocalBasisToRefs(worldPos, refEast, refNorth, refUp, useRightHandedSystem = false) {
190
197
  // up = normalized position (geocentric normal)
191
198
  refUp.copyFrom(worldPos).normalize();
192
- // east = normalize(worldNorth × up)
193
- // (cross product of Earth rotation axis with up gives east except near poles)
199
+ // east cross product order determines handedness
194
200
  const worldNorth = Vector3.LeftHandedForwardReadOnly; // (0,0,1)
195
- Vector3.CrossToRef(worldNorth, refUp, refEast);
201
+ if (useRightHandedSystem) {
202
+ Vector3.CrossToRef(worldNorth, refUp, refEast);
203
+ }
204
+ else {
205
+ Vector3.CrossToRef(refUp, worldNorth, refEast);
206
+ }
196
207
  // at poles, cross with worldRight instead
197
208
  if (refEast.lengthSquared() < Epsilon) {
198
- Vector3.CrossToRef(Vector3.Right(), refUp, refEast);
209
+ if (useRightHandedSystem) {
210
+ Vector3.CrossToRef(Vector3.Right(), refUp, refEast);
211
+ }
212
+ else {
213
+ Vector3.CrossToRef(refUp, Vector3.Right(), refEast);
214
+ }
199
215
  }
200
216
  refEast.normalize();
201
- // north = up × east (completes right-handed basis)
202
- Vector3.CrossToRef(refUp, refEast, refNorth);
217
+ // north completes the basis (cross order also swapped for handedness)
218
+ if (useRightHandedSystem) {
219
+ Vector3.CrossToRef(refUp, refEast, refNorth);
220
+ }
221
+ else {
222
+ Vector3.CrossToRef(refEast, refUp, refNorth);
223
+ }
203
224
  refNorth.normalize();
204
225
  }
205
226
  //# sourceMappingURL=geospatialCameraMovement.js.map