@onerjs/core 8.36.3 → 8.36.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/Behaviors/Cameras/geospatialClippingBehavior.d.ts +40 -0
  2. package/Behaviors/Cameras/geospatialClippingBehavior.js +80 -0
  3. package/Behaviors/Cameras/geospatialClippingBehavior.js.map +1 -0
  4. package/Behaviors/Cameras/index.d.ts +2 -0
  5. package/Behaviors/Cameras/index.js +2 -0
  6. package/Behaviors/Cameras/index.js.map +1 -1
  7. package/Cameras/Inputs/geospatialCameraPointersInput.js +4 -2
  8. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  9. package/Cameras/Limits/geospatialLimits.d.ts +9 -1
  10. package/Cameras/Limits/geospatialLimits.js +23 -3
  11. package/Cameras/Limits/geospatialLimits.js.map +1 -1
  12. package/Cameras/geospatialCamera.d.ts +23 -0
  13. package/Cameras/geospatialCamera.js +109 -34
  14. package/Cameras/geospatialCamera.js.map +1 -1
  15. package/Cameras/geospatialCameraMovement.js +1 -0
  16. package/Cameras/geospatialCameraMovement.js.map +1 -1
  17. package/Debug/debugLayer.js +11 -3
  18. package/Debug/debugLayer.js.map +1 -1
  19. package/IAssetContainer.d.ts +5 -0
  20. package/IAssetContainer.js.map +1 -1
  21. package/Layers/highlightLayer.d.ts +5 -0
  22. package/Layers/highlightLayer.js +13 -0
  23. package/Layers/highlightLayer.js.map +1 -1
  24. package/Lights/Clustered/clusteredLightContainer.js +1 -1
  25. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  26. package/Loading/Plugins/babylonFileLoader.js +2 -0
  27. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  28. package/Materials/effectRenderer.d.ts +2 -1
  29. package/Materials/effectRenderer.js +2 -12
  30. package/Materials/effectRenderer.js.map +1 -1
  31. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +6 -1
  32. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +21 -17
  33. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  34. package/Particles/solidParticleSystem.d.ts +3 -0
  35. package/Particles/solidParticleSystem.js +7 -4
  36. package/Particles/solidParticleSystem.js.map +1 -1
  37. package/Sprites/spriteManager.d.ts +3 -0
  38. package/Sprites/spriteManager.js +9 -0
  39. package/Sprites/spriteManager.js.map +1 -1
  40. package/assetContainer.d.ts +5 -0
  41. package/assetContainer.js +32 -0
  42. package/assetContainer.js.map +1 -1
  43. package/package.json +1 -1
@@ -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,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,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;AASnF;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,MAAM;IA6BxC,YAAY,IAAY,EAAE,KAAY,EAAE,OAAsB,EAAE,aAA6B;QACzF,KAAK,CAAC,IAAI,EAAE,IAAI,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QArBtC,YAAY;QACJ,kBAAa,G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,CAAC,gBAA0B;QAC7C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAChD,CAAC;IAEQ,aAAa;QAClB,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;IAChC,CAAC;CACJ","sourcesContent":["import { GeospatialCameraInputsManager } from \"./geospatialCameraInputsManager\";\r\nimport { Vector3, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Camera } from \"./camera\";\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\n\r\ntype CameraOptions = {\r\n planetRadius: number; // Radius of the planet\r\n};\r\n\r\n/**\r\n * @experimental\r\n * This camera's movements are limited to a camera orbiting a globe, and as the API evolves it will introduce conversions between cartesian coordinates and true lat/long/alt\r\n *\r\n * Please note this is marked as experimental and the API (including the constructor!) will change until we remove that flag\r\n */\r\nexport class GeospatialCamera extends Camera {\r\n override inputs: GeospatialCameraInputsManager;\r\n\r\n /** If supplied, will be used when picking the globe */\r\n public pickPredicate?: MeshPredicate;\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 public checkCollisions: boolean = false;\r\n\r\n constructor(name: string, scene: Scene, options: CameraOptions, pickPredicate?: MeshPredicate) {\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, pickPredicate, this._flyingBehavior);\r\n\r\n this.pickPredicate = pickPredicate;\r\n this.inputs = new GeospatialCameraInputsManager(this);\r\n this.inputs.addMouse().addMouseWheel().addKeyboard();\r\n }\r\n\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 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 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 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 this._pitch = Clamp(this._pitch, limits.pitchMin, limits.pitchMax);\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 // Trig\r\n const yawScale = this._scene.useRightHandedSystem ? 1 : -1;\r\n const cosYaw = Math.cos(this._yaw * yawScale);\r\n const sinYaw = Math.sin(this._yaw * yawScale);\r\n const sinPitch = Math.sin(this._pitch); // horizontal weight\r\n const cosPitch = Math.cos(this._pitch); // vertical weight (toward center)\r\n\r\n // Temps\r\n const horiz = TmpVectors.Vector3[0];\r\n const t1 = TmpVectors.Vector3[1];\r\n const t2 = TmpVectors.Vector3[2];\r\n const right = TmpVectors.Vector3[3];\r\n\r\n // horizontalDirection = North*cosYaw + East*sinYaw (avoids mutating _temp basis vectors)\r\n horiz.copyFrom(this._tempNorth).scaleInPlace(cosYaw).addInPlace(t1.copyFrom(this._tempEast).scaleInPlace(sinYaw));\r\n\r\n // look = horiz*sinPitch - Up*cosPitch\r\n this._lookAtVector.copyFrom(horiz).scaleInPlace(sinPitch).addInPlace(t2.copyFrom(this._tempUp).scaleInPlace(-cosPitch)).normalize(); // keep it unit\r\n\r\n // Build an orthonormal up aligned with geocentric Up\r\n // right = normalize(cross(upRef, look))\r\n Vector3.CrossToRef(this._tempUp, this._lookAtVector, right);\r\n\r\n // up = normalize(cross(look, right))\r\n Vector3.CrossToRef(this._lookAtVector, right, this.upVector);\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 }\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 if (zoomDelta > 0) {\r\n // Zooming IN - respect radiusMin as distance to surface\r\n if (pickedPoint) {\r\n const pickDistance = Vector3Distance(this._position, pickedPoint);\r\n // Don't zoom past the picked surface point + radiusMin\r\n const maxZoomToSurface = pickDistance - this.limits.radiusMin;\r\n return Math.min(zoomDelta, Math.max(0, maxZoomToSurface));\r\n }\r\n\r\n return zoomDelta;\r\n } else {\r\n // Zooming OUT - respect radiusMax\r\n const maxZoomOut = this.limits.radiusMax - this._radius;\r\n return Math.max(zoomDelta, -Math.max(0, maxZoomOut));\r\n }\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) {\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) {\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 const newRadius = Vector3Distance(this.position, newCenter.pickedPoint);\r\n this._setOrientation(this._yaw, this._pitch, newRadius, newCenter.pickedPoint);\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"]}
1
+ {"version":3,"file":"geospatialCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/geospatialCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,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,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 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\n\r\ntype CameraOptions = {\r\n planetRadius: number; // Radius of the planet\r\n};\r\n\r\n/**\r\n * @experimental\r\n * This camera's movements are limited to a camera orbiting a globe, and as the API evolves it will introduce conversions between cartesian coordinates and true lat/long/alt\r\n *\r\n * Please note this is marked as experimental and the API (including the constructor!) will change until we remove that flag\r\n */\r\nexport class GeospatialCamera extends Camera {\r\n override inputs: GeospatialCameraInputsManager;\r\n\r\n /** If supplied, will be used when picking the globe */\r\n public pickPredicate?: MeshPredicate;\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 public checkCollisions: boolean = false;\r\n\r\n constructor(name: string, scene: Scene, options: CameraOptions, pickPredicate?: MeshPredicate) {\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, pickPredicate, this._flyingBehavior);\r\n\r\n this.pickPredicate = pickPredicate;\r\n this.inputs = new GeospatialCameraInputsManager(this);\r\n this.inputs.addMouse().addMouseWheel().addKeyboard();\r\n }\r\n\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 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 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 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 this._pitch = Clamp(this._pitch, limits.pitchMin, limits.pitchMax);\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 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 }\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) {\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) {\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/**\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 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 // The quaternion rotation produces: horiz = rotate(north, up, angle)\r\n // This is equivalent to: horiz = north*cos(angle) + cross(up, north)*sin(angle) = north*cos(angle) - east*sin(angle)\r\n // (since cross(up, north) = -east in our basis)\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"]}
@@ -39,6 +39,7 @@ export class GeospatialCameraMovement extends CameraMovement {
39
39
  this.rotationInertia = 0;
40
40
  this.rotationXSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel
41
41
  this.rotationYSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel
42
+ this.zoomSpeed = 2; // Base zoom speed; actual speed is scaled based on altitude
42
43
  }
43
44
  startDrag(pointerX, pointerY) {
44
45
  const pickResult = this._scene.pick(pointerX, pointerY, this.pickPredicate);
@@ -1 +1 @@
1
- {"version":3,"file":"geospatialCameraMovement.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/geospatialCameraMovement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAMvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IAkBxD,YACI,KAAY,EACL,MAAwB,EAC/B,cAAuB,EACf,aAAsB,EACtB,aAAsB,EAC9B,aAA6B,EAC7B,QAAkD;QAElD,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;QAPhC,WAAM,GAAN,MAAM,CAAkB;QAEvB,kBAAa,GAAb,aAAa,CAAS;QACtB,kBAAa,GAAb,aAAa,CAAS;QAhB3B,iBAAY,GAAY,IAAI,CAAC;QAI5B,oBAAe,GAAY,SAAS,CAAC;QACrC,eAAU,GAAU,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1C,qBAAgB,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QAC3C,8BAAyB,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QACpD,4BAAuB,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QAClD,oCAA+B,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QAY9D,IAAI,CAAC,aAAa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CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAChF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAiB,EAAE,OAAgB,EAAE,QAAiB,EAAE,KAAc;IAC1G,+CAA+C;IAC/C,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,CAAC;IAErC,oCAAoC;IACpC,8EAA8E;IAC9E,MAAM,UAAU,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,UAAU;IAChE,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAE/C,0CAA0C;IAC1C,IAAI,OAAO,CAAC,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;QACpC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,CAAC,SAAS,EAAE,CAAC;IAEpB,mDAAmD;IACnD,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,CAAC;AACzB,CAAC","sourcesContent":["import { CameraMovement } from \"./cameraMovement\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport type { GeospatialLimits } from \"./Limits/geospatialLimits\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { MeshPredicate } from \"../Culling/ray.core\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\nimport { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3Distance } from \"../Maths/math.vector.functions\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport type { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { InterpolatingBehavior } from \"../Behaviors/Cameras/interpolatingBehavior\";\r\nimport type { GeospatialCamera } from \"./geospatialCamera\";\r\n\r\n/**\r\n * @experimental\r\n * This class is subject to change as the geospatial camera evolves.\r\n *\r\n * Geospatial-specific camera movement system that extends the base movement with\r\n * raycasting and altitude-aware zoom constraints.\r\n *\r\n * This class encapsulates geospatial camera movement logic:\r\n * - Dragging in a way which keeps cursor anchored to globe\r\n * - Latitude-based pan speed dampening\r\n * - Zoom speed scaling based on distance to center\r\n * - Raycasting to determine zoom constraints based on terrain/globe\r\n * - Altitude-based zoom clamping\r\n * - Zoom direction calculation (towards cursor vs along look vector)\r\n */\r\nexport class GeospatialCameraMovement extends CameraMovement {\r\n /** Predicate function to determine which meshes to pick against (e.g., globe mesh) */\r\n public pickPredicate?: MeshPredicate;\r\n\r\n /** World-space picked point under cursor for zoom-to-cursor behavior (may be undefined) */\r\n public computedPerFrameZoomPickPoint?: Vector3;\r\n\r\n public zoomToCursor: boolean = true;\r\n\r\n private _tempPickingRay: Ray;\r\n\r\n private _hitPointRadius?: number = undefined;\r\n private _dragPlane: Plane = new Plane(0, 0, 0, 0);\r\n private _dragPlaneNormal: Vector3 = Vector3.Zero();\r\n private _dragPlaneOriginPointEcef: Vector3 = Vector3.Zero();\r\n private _dragPlaneHitPointLocal: Vector3 = Vector3.Zero();\r\n private _previousDragPlaneHitPointLocal: Vector3 = Vector3.Zero();\r\n\r\n constructor(\r\n scene: Scene,\r\n public limits: GeospatialLimits,\r\n cameraPosition: Vector3,\r\n private _cameraCenter: Vector3,\r\n private _cameraLookAt: Vector3,\r\n pickPredicate?: MeshPredicate,\r\n behavior?: InterpolatingBehavior<GeospatialCamera>\r\n ) {\r\n super(scene, cameraPosition, behavior);\r\n this.pickPredicate = pickPredicate;\r\n this._tempPickingRay = new Ray(this._cameraPosition, this._cameraLookAt);\r\n this.panInertia = 0;\r\n this.rotationInertia = 0;\r\n this.rotationXSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel\r\n this.rotationYSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel\r\n }\r\n\r\n public startDrag(pointerX: number, pointerY: number) {\r\n const pickResult = this._scene.pick(pointerX, pointerY, this.pickPredicate);\r\n if (pickResult.pickedPoint && pickResult.ray) {\r\n // Store radius from earth center to pickedPoint, used when calculating drag plane\r\n this._hitPointRadius = pickResult.pickedPoint.length();\r\n\r\n this._recalculateDragPlaneHitPoint(this._hitPointRadius, pickResult.ray, TmpVectors.Matrix[0]);\r\n this._previousDragPlaneHitPointLocal.copyFrom(this._dragPlaneHitPointLocal);\r\n } else {\r\n this._hitPointRadius = undefined; // can't drag without a hit on the globe\r\n }\r\n }\r\n\r\n public stopDrag() {\r\n this._hitPointRadius = undefined;\r\n }\r\n\r\n /**\r\n * The previous drag plane hit point in local space is stored to compute the movement delta.\r\n * As the drag movement occurs, we will continuously recalculate this point. The delta between the previous and current hit points is the delta we will apply to the camera's localtranslation\r\n * @param hitPointRadius The distance between the world origin (center of globe) and the initial drag hit point\r\n * @param ray The ray from the camera to the new cursor location\r\n * @param localToEcefResult The matrix to convert from local to ECEF space\r\n */\r\n private _recalculateDragPlaneHitPoint(hitPointRadius: number, ray: Ray, localToEcefResult: Matrix): void {\r\n // Use the camera's geocentric normal to find the dragPlaneOriginPoint which lives at hitPointRadius along the camera's geocentric normal\r\n this._cameraPosition.normalizeToRef(this._dragPlaneNormal);\r\n this._dragPlaneNormal.scaleToRef(hitPointRadius, this._dragPlaneOriginPointEcef);\r\n\r\n // The dragPlaneOffsetVector will later be recalculated when drag occurs, and the delta between the offset vectors will be applied to localTranslation\r\n ComputeLocalBasisToRefs(this._dragPlaneOriginPointEcef, TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]);\r\n const localToEcef = Matrix.FromXYZAxesToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2], localToEcefResult);\r\n localToEcef.setTranslationFromFloats(this._dragPlaneOriginPointEcef.x, this._dragPlaneOriginPointEcef.y, this._dragPlaneOriginPointEcef.z);\r\n const ecefToLocal = localToEcef.invertToRef(TmpVectors.Matrix[1]);\r\n\r\n // Now create a plane at that point, perpendicular to the camera's geocentric normal\r\n Plane.FromPositionAndNormalToRef(this._dragPlaneOriginPointEcef, this._dragPlaneNormal, this._dragPlane);\r\n\r\n // Lastly, find the _dragPlaneHitPoint where the ray intersects the _dragPlane.\r\n if (IntersectRayWithPlaneToRef(ray, this._dragPlane, this._dragPlaneHitPointLocal)) {\r\n // If hit, convert the drag plane hit point into the local space.\r\n Vector3.TransformCoordinatesToRef(this._dragPlaneHitPointLocal, ecefToLocal, this._dragPlaneHitPointLocal);\r\n }\r\n }\r\n\r\n public handleDrag(pointerX: number, pointerY: number) {\r\n if (this._hitPointRadius) {\r\n const pickResult = this._scene.pick(pointerX, pointerY);\r\n if (pickResult.ray) {\r\n const localToEcef = TmpVectors.Matrix[0];\r\n this._recalculateDragPlaneHitPoint(this._hitPointRadius, pickResult.ray, localToEcef);\r\n\r\n const delta = this._dragPlaneHitPointLocal.subtractToRef(this._previousDragPlaneHitPointLocal, TmpVectors.Vector3[6]);\r\n this._previousDragPlaneHitPointLocal.copyFrom(this._dragPlaneHitPointLocal);\r\n\r\n Vector3.TransformNormalToRef(delta, localToEcef, delta);\r\n this._dragPlaneOriginPointEcef.addInPlace(delta);\r\n\r\n this.panAccumulatedPixels.subtractInPlace(delta);\r\n }\r\n }\r\n }\r\n\r\n /** @override */\r\n public override computeCurrentFrameDeltas(): void {\r\n const cameraCenter = this._cameraCenter;\r\n\r\n // Slows down panning near the poles\r\n if (this.panAccumulatedPixels.lengthSquared() > Epsilon) {\r\n const centerRadius = cameraCenter.length(); // distance from planet origin to camera center\r\n const currentRadius = this._cameraPosition.length();\r\n // Dampen the pan speed based on latitude (slower near poles)\r\n const sineOfSphericalLat = centerRadius === 0 ? 0 : cameraCenter.z / centerRadius;\r\n const cosOfSphericalLat = Math.sqrt(1 - Math.min(1, sineOfSphericalLat * sineOfSphericalLat));\r\n const latitudeDampening = Math.sqrt(Math.abs(cosOfSphericalLat)); // sqrt here reduces effect near equator\r\n\r\n // Reduce the dampening effect near surface (so that at ground level, pan speed is not affected by latitude)\r\n const height = Math.max(currentRadius - centerRadius, Epsilon);\r\n const latitudeDampeningScale = Math.max(1, centerRadius / height);\r\n\r\n this._panSpeedMultiplier = Clamp(latitudeDampeningScale * latitudeDampening, 0, 1);\r\n } else {\r\n this._panSpeedMultiplier = 1;\r\n }\r\n\r\n // If a pan drag or rotate is occurring, stop zooming.\r\n let zoomTargetDistance: number | undefined;\r\n if (this.isDragging || this.rotationAccumulatedPixels.lengthSquared() > Epsilon) {\r\n this._zoomSpeedMultiplier = 0;\r\n this._zoomVelocity = 0;\r\n } else {\r\n zoomTargetDistance = this.computedPerFrameZoomPickPoint ? Vector3Distance(this._cameraPosition, this.computedPerFrameZoomPickPoint) : undefined;\r\n\r\n // Scales zoom movement speed based on camera distance to zoom target.\r\n this._zoomSpeedMultiplier = (zoomTargetDistance ?? Vector3Distance(this._cameraPosition, cameraCenter)) * 0.01;\r\n }\r\n\r\n super.computeCurrentFrameDeltas();\r\n }\r\n\r\n public get isDragging() {\r\n return this._hitPointRadius !== undefined;\r\n }\r\n\r\n public handleZoom(zoomDelta: number, toCursor: boolean) {\r\n if (zoomDelta !== 0) {\r\n this.zoomAccumulatedPixels += zoomDelta;\r\n\r\n const pickResult = this._scene.pick(this._scene.pointerX, this._scene.pointerY, this.pickPredicate);\r\n\r\n if (toCursor && pickResult.hit && pickResult.pickedPoint && pickResult.ray && this.zoomToCursor) {\r\n this.computedPerFrameZoomPickPoint = pickResult.pickedPoint;\r\n } else {\r\n // If no hit under cursor or explicitly told not to zoom to cursor, zoom along lookVector instead\r\n const lookPickResult = this.pickAlongVector(this._cameraLookAt);\r\n this.computedPerFrameZoomPickPoint = lookPickResult?.pickedPoint ?? undefined;\r\n }\r\n }\r\n }\r\n\r\n public pickAlongVector(vector: Vector3): Nullable<PickingInfo> {\r\n this._tempPickingRay.origin.copyFrom(this._cameraPosition);\r\n this._tempPickingRay.direction.copyFrom(vector);\r\n return this._scene.pickWithRay(this._tempPickingRay, this.pickPredicate);\r\n }\r\n}\r\n\r\nexport function ClampCenterFromPolesInPlace(center: Vector3) {\r\n const sineOfSphericalLatitudeLimit = 0.998749218; // ~90 degrees\r\n const centerMagnitude = center.length(); // distance from planet origin\r\n if (centerMagnitude > Epsilon) {\r\n const sineSphericalLat = centerMagnitude === 0 ? 0 : center.z / centerMagnitude;\r\n if (Math.abs(sineSphericalLat) > sineOfSphericalLatitudeLimit) {\r\n // Clamp the spherical latitude (and derive longitude)\r\n const sineOfClampedSphericalLat = Clamp(sineSphericalLat, -sineOfSphericalLatitudeLimit, sineOfSphericalLatitudeLimit);\r\n const cosineOfClampedSphericalLat = Math.sqrt(1 - sineOfClampedSphericalLat * sineOfClampedSphericalLat);\r\n const longitude = Math.atan2(center.y, center.x);\r\n\r\n // Spherical to Cartesian\r\n const newX = centerMagnitude * Math.cos(longitude) * cosineOfClampedSphericalLat;\r\n const newY = centerMagnitude * Math.sin(longitude) * cosineOfClampedSphericalLat;\r\n const newZ = centerMagnitude * sineOfClampedSphericalLat;\r\n\r\n center.set(newX, newY, newZ);\r\n }\r\n }\r\n return center;\r\n}\r\n\r\nfunction IntersectRayWithPlaneToRef(ray: Ray, plane: Plane, ref: Vector3): boolean {\r\n // Distance along the ray to the plane; null if no hit\r\n const dist = ray.intersectsPlane(plane);\r\n\r\n if (dist !== null && dist >= 0) {\r\n ray.origin.addToRef(ray.direction.scaleToRef(dist, TmpVectors.Vector3[0]), ref);\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Helper to build east/north/up basis vectors at a world position.\r\n * @internal\r\n */\r\nexport function ComputeLocalBasisToRefs(worldPos: Vector3, refEast: Vector3, refNorth: Vector3, refUp: Vector3) {\r\n // up = normalized position (geocentric normal)\r\n refUp.copyFrom(worldPos).normalize();\r\n\r\n // east = normalize(worldNorth × up)\r\n // (cross product of Earth rotation axis with up gives east except near poles)\r\n const worldNorth = Vector3.LeftHandedForwardReadOnly; // (0,0,1)\r\n Vector3.CrossToRef(worldNorth, refUp, refEast);\r\n\r\n // at poles, cross with worldRight instead\r\n if (refEast.lengthSquared() < Epsilon) {\r\n Vector3.CrossToRef(Vector3.Right(), refUp, refEast);\r\n }\r\n refEast.normalize();\r\n\r\n // north = up × east (completes right-handed basis)\r\n Vector3.CrossToRef(refUp, refEast, refNorth);\r\n refNorth.normalize();\r\n}\r\n"]}
1
+ {"version":3,"file":"geospatialCameraMovement.js","sourceRoot":"","sources":["../../../../dev/core/src/Cameras/geospatialCameraMovement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAMvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IAkBxD,YACI,KAAY,EACL,MAAwB,EAC/B,cAAuB,EACf,aAAsB,EACtB,aAAsB,EAC9B,aAA6B,EAC7B,QAAkD;QAElD,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;QAPhC,WAAM,GAAN,MAAM,CAAkB;QAEvB,kBAAa,GAAb,aAAa,CAAS;QACtB,kBAAa,GAAb,aAAa,CAAS;QAhB3B,iBAAY,GAAY,IAAI,CAAC;QAI5B,oBAAe,GAAY,SAAS,CAAC;QACrC,eAAU,GAAU,IAAI,KAAK,C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its } from \"./Limits/geospatialLimits\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { MeshPredicate } from \"../Culling/ray.core\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\nimport { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Vector3Distance } from \"../Maths/math.vector.functions\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport type { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { InterpolatingBehavior } from \"../Behaviors/Cameras/interpolatingBehavior\";\r\nimport type { GeospatialCamera } from \"./geospatialCamera\";\r\n\r\n/**\r\n * @experimental\r\n * This class is subject to change as the geospatial camera evolves.\r\n *\r\n * Geospatial-specific camera movement system that extends the base movement with\r\n * raycasting and altitude-aware zoom constraints.\r\n *\r\n * This class encapsulates geospatial camera movement logic:\r\n * - Dragging in a way which keeps cursor anchored to globe\r\n * - Latitude-based pan speed dampening\r\n * - Zoom speed scaling based on distance to center\r\n * - Raycasting to determine zoom constraints based on terrain/globe\r\n * - Altitude-based zoom clamping\r\n * - Zoom direction calculation (towards cursor vs along look vector)\r\n */\r\nexport class GeospatialCameraMovement extends CameraMovement {\r\n /** Predicate function to determine which meshes to pick against (e.g., globe mesh) */\r\n public pickPredicate?: MeshPredicate;\r\n\r\n /** World-space picked point under cursor for zoom-to-cursor behavior (may be undefined) */\r\n public computedPerFrameZoomPickPoint?: Vector3;\r\n\r\n public zoomToCursor: boolean = true;\r\n\r\n private _tempPickingRay: Ray;\r\n\r\n private _hitPointRadius?: number = undefined;\r\n private _dragPlane: Plane = new Plane(0, 0, 0, 0);\r\n private _dragPlaneNormal: Vector3 = Vector3.Zero();\r\n private _dragPlaneOriginPointEcef: Vector3 = Vector3.Zero();\r\n private _dragPlaneHitPointLocal: Vector3 = Vector3.Zero();\r\n private _previousDragPlaneHitPointLocal: Vector3 = Vector3.Zero();\r\n\r\n constructor(\r\n scene: Scene,\r\n public limits: GeospatialLimits,\r\n cameraPosition: Vector3,\r\n private _cameraCenter: Vector3,\r\n private _cameraLookAt: Vector3,\r\n pickPredicate?: MeshPredicate,\r\n behavior?: InterpolatingBehavior<GeospatialCamera>\r\n ) {\r\n super(scene, cameraPosition, behavior);\r\n this.pickPredicate = pickPredicate;\r\n this._tempPickingRay = new Ray(this._cameraPosition, this._cameraLookAt);\r\n this.panInertia = 0;\r\n this.rotationInertia = 0;\r\n this.rotationXSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel\r\n this.rotationYSpeed = Math.PI / 500; // Move 1/500th of a half circle per pixel\r\n this.zoomSpeed = 2; // Base zoom speed; actual speed is scaled based on altitude\r\n }\r\n\r\n public startDrag(pointerX: number, pointerY: number) {\r\n const pickResult = this._scene.pick(pointerX, pointerY, this.pickPredicate);\r\n if (pickResult.pickedPoint && pickResult.ray) {\r\n // Store radius from earth center to pickedPoint, used when calculating drag plane\r\n this._hitPointRadius = pickResult.pickedPoint.length();\r\n\r\n this._recalculateDragPlaneHitPoint(this._hitPointRadius, pickResult.ray, TmpVectors.Matrix[0]);\r\n this._previousDragPlaneHitPointLocal.copyFrom(this._dragPlaneHitPointLocal);\r\n } else {\r\n this._hitPointRadius = undefined; // can't drag without a hit on the globe\r\n }\r\n }\r\n\r\n public stopDrag() {\r\n this._hitPointRadius = undefined;\r\n }\r\n\r\n /**\r\n * The previous drag plane hit point in local space is stored to compute the movement delta.\r\n * As the drag movement occurs, we will continuously recalculate this point. The delta between the previous and current hit points is the delta we will apply to the camera's localtranslation\r\n * @param hitPointRadius The distance between the world origin (center of globe) and the initial drag hit point\r\n * @param ray The ray from the camera to the new cursor location\r\n * @param localToEcefResult The matrix to convert from local to ECEF space\r\n */\r\n private _recalculateDragPlaneHitPoint(hitPointRadius: number, ray: Ray, localToEcefResult: Matrix): void {\r\n // Use the camera's geocentric normal to find the dragPlaneOriginPoint which lives at hitPointRadius along the camera's geocentric normal\r\n this._cameraPosition.normalizeToRef(this._dragPlaneNormal);\r\n this._dragPlaneNormal.scaleToRef(hitPointRadius, this._dragPlaneOriginPointEcef);\r\n\r\n // The dragPlaneOffsetVector will later be recalculated when drag occurs, and the delta between the offset vectors will be applied to localTranslation\r\n ComputeLocalBasisToRefs(this._dragPlaneOriginPointEcef, TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]);\r\n const localToEcef = Matrix.FromXYZAxesToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2], localToEcefResult);\r\n localToEcef.setTranslationFromFloats(this._dragPlaneOriginPointEcef.x, this._dragPlaneOriginPointEcef.y, this._dragPlaneOriginPointEcef.z);\r\n const ecefToLocal = localToEcef.invertToRef(TmpVectors.Matrix[1]);\r\n\r\n // Now create a plane at that point, perpendicular to the camera's geocentric normal\r\n Plane.FromPositionAndNormalToRef(this._dragPlaneOriginPointEcef, this._dragPlaneNormal, this._dragPlane);\r\n\r\n // Lastly, find the _dragPlaneHitPoint where the ray intersects the _dragPlane.\r\n if (IntersectRayWithPlaneToRef(ray, this._dragPlane, this._dragPlaneHitPointLocal)) {\r\n // If hit, convert the drag plane hit point into the local space.\r\n Vector3.TransformCoordinatesToRef(this._dragPlaneHitPointLocal, ecefToLocal, this._dragPlaneHitPointLocal);\r\n }\r\n }\r\n\r\n public handleDrag(pointerX: number, pointerY: number) {\r\n if (this._hitPointRadius) {\r\n const pickResult = this._scene.pick(pointerX, pointerY);\r\n if (pickResult.ray) {\r\n const localToEcef = TmpVectors.Matrix[0];\r\n this._recalculateDragPlaneHitPoint(this._hitPointRadius, pickResult.ray, localToEcef);\r\n\r\n const delta = this._dragPlaneHitPointLocal.subtractToRef(this._previousDragPlaneHitPointLocal, TmpVectors.Vector3[6]);\r\n this._previousDragPlaneHitPointLocal.copyFrom(this._dragPlaneHitPointLocal);\r\n\r\n Vector3.TransformNormalToRef(delta, localToEcef, delta);\r\n this._dragPlaneOriginPointEcef.addInPlace(delta);\r\n\r\n this.panAccumulatedPixels.subtractInPlace(delta);\r\n }\r\n }\r\n }\r\n\r\n /** @override */\r\n public override computeCurrentFrameDeltas(): void {\r\n const cameraCenter = this._cameraCenter;\r\n\r\n // Slows down panning near the poles\r\n if (this.panAccumulatedPixels.lengthSquared() > Epsilon) {\r\n const centerRadius = cameraCenter.length(); // distance from planet origin to camera center\r\n const currentRadius = this._cameraPosition.length();\r\n // Dampen the pan speed based on latitude (slower near poles)\r\n const sineOfSphericalLat = centerRadius === 0 ? 0 : cameraCenter.z / centerRadius;\r\n const cosOfSphericalLat = Math.sqrt(1 - Math.min(1, sineOfSphericalLat * sineOfSphericalLat));\r\n const latitudeDampening = Math.sqrt(Math.abs(cosOfSphericalLat)); // sqrt here reduces effect near equator\r\n\r\n // Reduce the dampening effect near surface (so that at ground level, pan speed is not affected by latitude)\r\n const height = Math.max(currentRadius - centerRadius, Epsilon);\r\n const latitudeDampeningScale = Math.max(1, centerRadius / height);\r\n\r\n this._panSpeedMultiplier = Clamp(latitudeDampeningScale * latitudeDampening, 0, 1);\r\n } else {\r\n this._panSpeedMultiplier = 1;\r\n }\r\n\r\n // If a pan drag or rotate is occurring, stop zooming.\r\n let zoomTargetDistance: number | undefined;\r\n if (this.isDragging || this.rotationAccumulatedPixels.lengthSquared() > Epsilon) {\r\n this._zoomSpeedMultiplier = 0;\r\n this._zoomVelocity = 0;\r\n } else {\r\n zoomTargetDistance = this.computedPerFrameZoomPickPoint ? Vector3Distance(this._cameraPosition, this.computedPerFrameZoomPickPoint) : undefined;\r\n\r\n // Scales zoom movement speed based on camera distance to zoom target.\r\n this._zoomSpeedMultiplier = (zoomTargetDistance ?? Vector3Distance(this._cameraPosition, cameraCenter)) * 0.01;\r\n }\r\n\r\n super.computeCurrentFrameDeltas();\r\n }\r\n\r\n public get isDragging() {\r\n return this._hitPointRadius !== undefined;\r\n }\r\n\r\n public handleZoom(zoomDelta: number, toCursor: boolean) {\r\n if (zoomDelta !== 0) {\r\n this.zoomAccumulatedPixels += zoomDelta;\r\n\r\n const pickResult = this._scene.pick(this._scene.pointerX, this._scene.pointerY, this.pickPredicate);\r\n\r\n if (toCursor && pickResult.hit && pickResult.pickedPoint && pickResult.ray && this.zoomToCursor) {\r\n this.computedPerFrameZoomPickPoint = pickResult.pickedPoint;\r\n } else {\r\n // If no hit under cursor or explicitly told not to zoom to cursor, zoom along lookVector instead\r\n const lookPickResult = this.pickAlongVector(this._cameraLookAt);\r\n this.computedPerFrameZoomPickPoint = lookPickResult?.pickedPoint ?? undefined;\r\n }\r\n }\r\n }\r\n\r\n public pickAlongVector(vector: Vector3): Nullable<PickingInfo> {\r\n this._tempPickingRay.origin.copyFrom(this._cameraPosition);\r\n this._tempPickingRay.direction.copyFrom(vector);\r\n return this._scene.pickWithRay(this._tempPickingRay, this.pickPredicate);\r\n }\r\n}\r\n\r\nexport function ClampCenterFromPolesInPlace(center: Vector3) {\r\n const sineOfSphericalLatitudeLimit = 0.998749218; // ~90 degrees\r\n const centerMagnitude = center.length(); // distance from planet origin\r\n if (centerMagnitude > Epsilon) {\r\n const sineSphericalLat = centerMagnitude === 0 ? 0 : center.z / centerMagnitude;\r\n if (Math.abs(sineSphericalLat) > sineOfSphericalLatitudeLimit) {\r\n // Clamp the spherical latitude (and derive longitude)\r\n const sineOfClampedSphericalLat = Clamp(sineSphericalLat, -sineOfSphericalLatitudeLimit, sineOfSphericalLatitudeLimit);\r\n const cosineOfClampedSphericalLat = Math.sqrt(1 - sineOfClampedSphericalLat * sineOfClampedSphericalLat);\r\n const longitude = Math.atan2(center.y, center.x);\r\n\r\n // Spherical to Cartesian\r\n const newX = centerMagnitude * Math.cos(longitude) * cosineOfClampedSphericalLat;\r\n const newY = centerMagnitude * Math.sin(longitude) * cosineOfClampedSphericalLat;\r\n const newZ = centerMagnitude * sineOfClampedSphericalLat;\r\n\r\n center.set(newX, newY, newZ);\r\n }\r\n }\r\n return center;\r\n}\r\n\r\nfunction IntersectRayWithPlaneToRef(ray: Ray, plane: Plane, ref: Vector3): boolean {\r\n // Distance along the ray to the plane; null if no hit\r\n const dist = ray.intersectsPlane(plane);\r\n\r\n if (dist !== null && dist >= 0) {\r\n ray.origin.addToRef(ray.direction.scaleToRef(dist, TmpVectors.Vector3[0]), ref);\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Helper to build east/north/up basis vectors at a world position.\r\n * @internal\r\n */\r\nexport function ComputeLocalBasisToRefs(worldPos: Vector3, refEast: Vector3, refNorth: Vector3, refUp: Vector3) {\r\n // up = normalized position (geocentric normal)\r\n refUp.copyFrom(worldPos).normalize();\r\n\r\n // east = normalize(worldNorth × up)\r\n // (cross product of Earth rotation axis with up gives east except near poles)\r\n const worldNorth = Vector3.LeftHandedForwardReadOnly; // (0,0,1)\r\n Vector3.CrossToRef(worldNorth, refUp, refEast);\r\n\r\n // at poles, cross with worldRight instead\r\n if (refEast.lengthSquared() < Epsilon) {\r\n Vector3.CrossToRef(Vector3.Right(), refUp, refEast);\r\n }\r\n refEast.normalize();\r\n\r\n // north = up × east (completes right-handed basis)\r\n Vector3.CrossToRef(refUp, refEast, refNorth);\r\n refNorth.normalize();\r\n}\r\n"]}
@@ -135,9 +135,17 @@ export class DebugLayer {
135
135
  }
136
136
  }
137
137
  if (!this.BJSINSPECTOR.Inspector.IsVisible) {
138
- setTimeout(() => {
139
- this.select(entity, lineContainerTitles);
140
- }, 100);
138
+ const waitAndCheck = () => {
139
+ setTimeout(() => {
140
+ if (this.BJSINSPECTOR.Inspector.IsVisible) {
141
+ this.select(entity, lineContainerTitles);
142
+ }
143
+ else {
144
+ waitAndCheck();
145
+ }
146
+ }, 100);
147
+ };
148
+ waitAndCheck();
141
149
  }
142
150
  else {
143
151
  this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);
@@ -1 +1 @@
1
- {"version":3,"file":"debugLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Debug/debugLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAA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AI;IAClB,WAAW,EAAE,IAAI;CACpB,AAPmB,CAOlB","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { IInspectable } from \"../Misc/iInspectable\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare INSPECTOR namespace for compilation issue\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let INSPECTOR: any;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let BABYLON: any;\r\n// load the inspector using require, if not present in the global namespace.\r\n\r\n/**\r\n * Interface used to define scene explorer extensibility option\r\n */\r\nexport interface IExplorerExtensibilityOption {\r\n /**\r\n * Define the option label\r\n */\r\n label: string;\r\n /**\r\n * Defines the action to execute on click\r\n */\r\n action: (entity: any) => void;\r\n /**\r\n * Keep popup open after click\r\n */\r\n keepOpenAfterClick?: boolean;\r\n}\r\n\r\n/**\r\n * Defines a group of actions associated with a predicate to use when extending the Inspector scene explorer\r\n */\r\nexport interface IExplorerExtensibilityGroup {\r\n /**\r\n * Defines a predicate to test if a given type mut be extended\r\n */\r\n predicate: (entity: any) => boolean;\r\n /**\r\n * Gets the list of options added to a type\r\n */\r\n entries: IExplorerExtensibilityOption[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalChild {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the class name of the child node\r\n */\r\n getClassName(): string;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n inspectableCustomProperties: IInspectable[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalNode {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the list of child entries\r\n */\r\n getContent(): IExplorerAdditionalChild[];\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IInspectorContextMenuType = \"pipeline\" | \"node\" | \"materials\" | \"spriteManagers\" | \"particleSystems\" | \"frameGraphs\";\r\n\r\n/**\r\n * Context menu item\r\n */\r\nexport interface IInspectorContextMenuItem {\r\n /**\r\n * Display label - menu item\r\n */\r\n label: string;\r\n /**\r\n * Callback function that will be called when the menu item is selected\r\n * @param entity the entity that is currently selected in the scene explorer\r\n */\r\n action: (entity?: unknown) => void;\r\n}\r\n\r\n/**\r\n * Interface used to define the options to use to create the Inspector\r\n */\r\nexport interface IInspectorOptions {\r\n /**\r\n * Display in overlay mode (default: false)\r\n */\r\n overlay?: boolean;\r\n /**\r\n * HTML element to use as root (the parent of the rendering canvas will be used as default value)\r\n */\r\n globalRoot?: HTMLElement;\r\n /**\r\n * Display the Scene explorer\r\n */\r\n showExplorer?: boolean;\r\n /**\r\n * Display the property inspector\r\n */\r\n showInspector?: boolean;\r\n /**\r\n * Display in embed mode (both panes on the right)\r\n */\r\n embedMode?: boolean;\r\n /**\r\n * let the Inspector handles resize of the canvas when panes are resized (default to true)\r\n */\r\n handleResize?: boolean;\r\n /**\r\n * Allow the panes to popup (default: true)\r\n */\r\n enablePopup?: boolean;\r\n /**\r\n * Allow the panes to be closed by users (default: true)\r\n */\r\n enableClose?: boolean;\r\n /**\r\n * Optional list of extensibility entries\r\n */\r\n explorerExtensibility?: IExplorerExtensibilityGroup[];\r\n /**\r\n * Optional list of additional top level nodes\r\n */\r\n additionalNodes?: IExplorerAdditionalNode[];\r\n /**\r\n * Optional URL to get the inspector script from (by default it uses the babylonjs CDN).\r\n */\r\n inspectorURL?: string;\r\n /**\r\n * Optional initial tab (default to DebugLayerTab.Properties)\r\n */\r\n initialTab?: DebugLayerTab;\r\n /**\r\n * Optional camera to use to render the gizmos from the inspector (default to the scene.activeCamera or the latest from scene.activeCameras)\r\n */\r\n gizmoCamera?: Camera;\r\n /**\r\n * Context menu for inspector tools such as \"Post Process\", \"Nodes\", \"Materials\", etc.\r\n */\r\n contextMenu?: Partial<Record<IInspectorContextMenuType, IInspectorContextMenuItem[]>>;\r\n /**\r\n * List of context menu items that should be completely overridden by custom items from the contextMenu property.\r\n */\r\n contextMenuOverride?: IInspectorContextMenuType[];\r\n\r\n /**\r\n * Should the default font loading be skipped\r\n */\r\n skipDefaultFontLoading?: boolean;\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /**\r\n * @internal\r\n * Backing field\r\n */\r\n _debugLayer?: DebugLayer;\r\n\r\n /**\r\n * Gets the debug layer (aka Inspector) associated with the scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\n debugLayer: DebugLayer;\r\n }\r\n}\r\nObject.defineProperty(Scene.prototype, \"debugLayer\", {\r\n get: function (this: Scene) {\r\n if (!this._debugLayer) {\r\n this._debugLayer = new DebugLayer(this);\r\n }\r\n return this._debugLayer;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Enum of inspector action tab\r\n */\r\nexport const enum DebugLayerTab {\r\n /**\r\n * Properties tag (default)\r\n */\r\n Properties = 0,\r\n /**\r\n * Debug tab\r\n */\r\n Debug = 1,\r\n /**\r\n * Statistics tab\r\n */\r\n Statistics = 2,\r\n /**\r\n * Tools tab\r\n */\r\n Tools = 3,\r\n /**\r\n * Settings tab\r\n */\r\n Settings = 4,\r\n}\r\n\r\n/**\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\nexport class DebugLayer {\r\n /**\r\n * Define the url to get the inspector script from.\r\n * By default it uses the babylonjs CDN.\r\n * @ignoreNaming\r\n */\r\n public static InspectorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/inspector/babylon.inspector.bundle.js`;\r\n\r\n /**\r\n * The default configuration of the inspector\r\n */\r\n public static Config: IInspectorOptions = {\r\n overlay: false,\r\n showExplorer: true,\r\n showInspector: true,\r\n embedMode: false,\r\n handleResize: true,\r\n enablePopup: true,\r\n };\r\n\r\n private _scene: Scene;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected BJSINSPECTOR = this._getGlobalInspector();\r\n\r\n private _onPropertyChangedObservable?: Observable<{ object: any; property: string; value: any; initialValue: any }>;\r\n /**\r\n * Observable triggered when a property is changed through the inspector.\r\n */\r\n public get onPropertyChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable;\r\n }\r\n\r\n if (!this._onPropertyChangedObservable) {\r\n this._onPropertyChangedObservable = new Observable<{ object: any; property: string; value: any; initialValue: any }>();\r\n }\r\n\r\n return this._onPropertyChangedObservable;\r\n }\r\n\r\n private _onSelectionChangedObservable?: Observable<any>;\r\n /**\r\n * Observable triggered when the selection is changed through the inspector.\r\n */\r\n public get onSelectionChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable;\r\n }\r\n\r\n if (!this._onSelectionChangedObservable) {\r\n this._onSelectionChangedObservable = new Observable<any>();\r\n }\r\n\r\n return this._onSelectionChangedObservable;\r\n }\r\n\r\n /**\r\n * Instantiates a new debug layer.\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n * @param scene Defines the scene to inspect\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this._scene.onDisposeObservable.add(() => {\r\n // Debug layer\r\n if (this._scene._debugLayer) {\r\n this._scene._debugLayer.hide();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the inspector window.\r\n * @param config\r\n */\r\n private _createInspector(config?: Partial<IInspectorOptions>) {\r\n if (this.isVisible()) {\r\n return;\r\n }\r\n\r\n if (this._onPropertyChangedObservable) {\r\n for (const observer of this._onPropertyChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(observer);\r\n }\r\n this._onPropertyChangedObservable.clear();\r\n this._onPropertyChangedObservable = undefined;\r\n }\r\n\r\n if (this._onSelectionChangedObservable) {\r\n for (const observer of this._onSelectionChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangedObservable.add(observer);\r\n }\r\n this._onSelectionChangedObservable.clear();\r\n this._onSelectionChangedObservable = undefined;\r\n }\r\n\r\n const userOptions: IInspectorOptions = {\r\n ...DebugLayer.Config,\r\n ...config,\r\n };\r\n\r\n this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();\r\n\r\n this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);\r\n }\r\n\r\n /**\r\n * Select a specific entity in the scene explorer and highlight a specific block in that entity property grid\r\n * @param entity defines the entity to select\r\n * @param lineContainerTitles defines the specific blocks to highlight (could be a string or an array of strings)\r\n */\r\n public select(entity: any, lineContainerTitles?: string | string[]) {\r\n if (this.BJSINSPECTOR) {\r\n if (lineContainerTitles) {\r\n if (Object.prototype.toString.call(lineContainerTitles) == \"[object String]\") {\r\n this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(lineContainerTitles);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(lineContainerTitles);\r\n }\r\n }\r\n if (!this.BJSINSPECTOR.Inspector.IsVisible) {\r\n setTimeout(() => {\r\n this.select(entity, lineContainerTitles);\r\n }, 100);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get the inspector from bundle or global\r\n * @returns the inspector instance if found otherwise, null\r\n */\r\n private _getGlobalInspector(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof INSPECTOR !== \"undefined\") {\r\n return INSPECTOR;\r\n }\r\n\r\n // In case of module let s check the global emitted from the Inspector entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.Inspector !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Get if the inspector is visible or not.\r\n * @returns true if visible otherwise, false\r\n */\r\n public isVisible(): boolean {\r\n return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;\r\n }\r\n\r\n /**\r\n * Hide the inspector and close its window.\r\n */\r\n public hide() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.Hide();\r\n }\r\n }\r\n\r\n /**\r\n * Get the number of opened panes in the inspector\r\n */\r\n public get openedPanes() {\r\n if (this.BJSINSPECTOR) {\r\n return this.BJSINSPECTOR.Inspector._OpenedPane;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Update the scene in the inspector\r\n */\r\n public setAsActiveScene() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector._SetNewScene(this._scene);\r\n }\r\n }\r\n\r\n public popupSceneExplorer() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupSceneExplorer();\r\n }\r\n }\r\n\r\n public popupInspector() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupInspector();\r\n }\r\n }\r\n\r\n public popupEmbed() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupEmbed();\r\n }\r\n }\r\n\r\n /**\r\n * Launch the debugLayer.\r\n * @param config Define the configuration of the inspector\r\n * @returns a promise fulfilled when the debug layer is visible\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async show(config?: IInspectorOptions): Promise<DebugLayer> {\r\n return await new Promise((resolve) => {\r\n if (typeof this.BJSINSPECTOR == \"undefined\") {\r\n const inspectorUrl = config && config.inspectorURL ? config.inspectorURL : DebugLayer.InspectorURL;\r\n\r\n // Load inspector and add it to the DOM\r\n Tools.LoadBabylonScript(inspectorUrl, () => {\r\n this._createInspector(config);\r\n resolve(this);\r\n });\r\n } else {\r\n // Otherwise creates the inspector\r\n this._createInspector(config);\r\n resolve(this);\r\n }\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"debugLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Debug/debugLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,qCAAoC;AAmL7D,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE;IACjD,GAAG,EAAE;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IACD,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;CACrB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAN,IAAkB,aAqBjB;AArBD,WAAkB,aAAa;IAC3B;;OAEG;IACH,6DAAc,CAAA;IACd;;OAEG;IACH,mDAAS,CAAA;IACT;;OAEG;IACH,6DAAc,CAAA;IACd;;OAEG;IACH,mDAAS,CAAA;IACT;;OAEG;IACH,yDAAY,CAAA;AAChB,CAAC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AAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC;gBAEnG,uCAAuC;gBACvC,KAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,GAAG,EAAE;oBACvC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,kCAAkC;gBAClC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;;AA7OD;;;;GAIG;AACW,uBAAY,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,wCAAwC,AAA7F,CAA8F;AAExH;;GAEG;AACW,iBAAM,GAAsB;IACtC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;CACpB,AAPmB,CAOlB","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { IInspectable } from \"../Misc/iInspectable\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare INSPECTOR namespace for compilation issue\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let INSPECTOR: any;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let BABYLON: any;\r\n// load the inspector using require, if not present in the global namespace.\r\n\r\n/**\r\n * Interface used to define scene explorer extensibility option\r\n */\r\nexport interface IExplorerExtensibilityOption {\r\n /**\r\n * Define the option label\r\n */\r\n label: string;\r\n /**\r\n * Defines the action to execute on click\r\n */\r\n action: (entity: any) => void;\r\n /**\r\n * Keep popup open after click\r\n */\r\n keepOpenAfterClick?: boolean;\r\n}\r\n\r\n/**\r\n * Defines a group of actions associated with a predicate to use when extending the Inspector scene explorer\r\n */\r\nexport interface IExplorerExtensibilityGroup {\r\n /**\r\n * Defines a predicate to test if a given type mut be extended\r\n */\r\n predicate: (entity: any) => boolean;\r\n /**\r\n * Gets the list of options added to a type\r\n */\r\n entries: IExplorerExtensibilityOption[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalChild {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the class name of the child node\r\n */\r\n getClassName(): string;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n inspectableCustomProperties: IInspectable[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalNode {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the list of child entries\r\n */\r\n getContent(): IExplorerAdditionalChild[];\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IInspectorContextMenuType = \"pipeline\" | \"node\" | \"materials\" | \"spriteManagers\" | \"particleSystems\" | \"frameGraphs\";\r\n\r\n/**\r\n * Context menu item\r\n */\r\nexport interface IInspectorContextMenuItem {\r\n /**\r\n * Display label - menu item\r\n */\r\n label: string;\r\n /**\r\n * Callback function that will be called when the menu item is selected\r\n * @param entity the entity that is currently selected in the scene explorer\r\n */\r\n action: (entity?: unknown) => void;\r\n}\r\n\r\n/**\r\n * Interface used to define the options to use to create the Inspector\r\n */\r\nexport interface IInspectorOptions {\r\n /**\r\n * Display in overlay mode (default: false)\r\n */\r\n overlay?: boolean;\r\n /**\r\n * HTML element to use as root (the parent of the rendering canvas will be used as default value)\r\n */\r\n globalRoot?: HTMLElement;\r\n /**\r\n * Display the Scene explorer\r\n */\r\n showExplorer?: boolean;\r\n /**\r\n * Display the property inspector\r\n */\r\n showInspector?: boolean;\r\n /**\r\n * Display in embed mode (both panes on the right)\r\n */\r\n embedMode?: boolean;\r\n /**\r\n * let the Inspector handles resize of the canvas when panes are resized (default to true)\r\n */\r\n handleResize?: boolean;\r\n /**\r\n * Allow the panes to popup (default: true)\r\n */\r\n enablePopup?: boolean;\r\n /**\r\n * Allow the panes to be closed by users (default: true)\r\n */\r\n enableClose?: boolean;\r\n /**\r\n * Optional list of extensibility entries\r\n */\r\n explorerExtensibility?: IExplorerExtensibilityGroup[];\r\n /**\r\n * Optional list of additional top level nodes\r\n */\r\n additionalNodes?: IExplorerAdditionalNode[];\r\n /**\r\n * Optional URL to get the inspector script from (by default it uses the babylonjs CDN).\r\n */\r\n inspectorURL?: string;\r\n /**\r\n * Optional initial tab (default to DebugLayerTab.Properties)\r\n */\r\n initialTab?: DebugLayerTab;\r\n /**\r\n * Optional camera to use to render the gizmos from the inspector (default to the scene.activeCamera or the latest from scene.activeCameras)\r\n */\r\n gizmoCamera?: Camera;\r\n /**\r\n * Context menu for inspector tools such as \"Post Process\", \"Nodes\", \"Materials\", etc.\r\n */\r\n contextMenu?: Partial<Record<IInspectorContextMenuType, IInspectorContextMenuItem[]>>;\r\n /**\r\n * List of context menu items that should be completely overridden by custom items from the contextMenu property.\r\n */\r\n contextMenuOverride?: IInspectorContextMenuType[];\r\n\r\n /**\r\n * Should the default font loading be skipped\r\n */\r\n skipDefaultFontLoading?: boolean;\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /**\r\n * @internal\r\n * Backing field\r\n */\r\n _debugLayer?: DebugLayer;\r\n\r\n /**\r\n * Gets the debug layer (aka Inspector) associated with the scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\n debugLayer: DebugLayer;\r\n }\r\n}\r\nObject.defineProperty(Scene.prototype, \"debugLayer\", {\r\n get: function (this: Scene) {\r\n if (!this._debugLayer) {\r\n this._debugLayer = new DebugLayer(this);\r\n }\r\n return this._debugLayer;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Enum of inspector action tab\r\n */\r\nexport const enum DebugLayerTab {\r\n /**\r\n * Properties tag (default)\r\n */\r\n Properties = 0,\r\n /**\r\n * Debug tab\r\n */\r\n Debug = 1,\r\n /**\r\n * Statistics tab\r\n */\r\n Statistics = 2,\r\n /**\r\n * Tools tab\r\n */\r\n Tools = 3,\r\n /**\r\n * Settings tab\r\n */\r\n Settings = 4,\r\n}\r\n\r\n/**\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\nexport class DebugLayer {\r\n /**\r\n * Define the url to get the inspector script from.\r\n * By default it uses the babylonjs CDN.\r\n * @ignoreNaming\r\n */\r\n public static InspectorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/inspector/babylon.inspector.bundle.js`;\r\n\r\n /**\r\n * The default configuration of the inspector\r\n */\r\n public static Config: IInspectorOptions = {\r\n overlay: false,\r\n showExplorer: true,\r\n showInspector: true,\r\n embedMode: false,\r\n handleResize: true,\r\n enablePopup: true,\r\n };\r\n\r\n private _scene: Scene;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected BJSINSPECTOR = this._getGlobalInspector();\r\n\r\n private _onPropertyChangedObservable?: Observable<{ object: any; property: string; value: any; initialValue: any }>;\r\n /**\r\n * Observable triggered when a property is changed through the inspector.\r\n */\r\n public get onPropertyChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable;\r\n }\r\n\r\n if (!this._onPropertyChangedObservable) {\r\n this._onPropertyChangedObservable = new Observable<{ object: any; property: string; value: any; initialValue: any }>();\r\n }\r\n\r\n return this._onPropertyChangedObservable;\r\n }\r\n\r\n private _onSelectionChangedObservable?: Observable<any>;\r\n /**\r\n * Observable triggered when the selection is changed through the inspector.\r\n */\r\n public get onSelectionChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable;\r\n }\r\n\r\n if (!this._onSelectionChangedObservable) {\r\n this._onSelectionChangedObservable = new Observable<any>();\r\n }\r\n\r\n return this._onSelectionChangedObservable;\r\n }\r\n\r\n /**\r\n * Instantiates a new debug layer.\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n * @param scene Defines the scene to inspect\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this._scene.onDisposeObservable.add(() => {\r\n // Debug layer\r\n if (this._scene._debugLayer) {\r\n this._scene._debugLayer.hide();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the inspector window.\r\n * @param config\r\n */\r\n private _createInspector(config?: Partial<IInspectorOptions>) {\r\n if (this.isVisible()) {\r\n return;\r\n }\r\n\r\n if (this._onPropertyChangedObservable) {\r\n for (const observer of this._onPropertyChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(observer);\r\n }\r\n this._onPropertyChangedObservable.clear();\r\n this._onPropertyChangedObservable = undefined;\r\n }\r\n\r\n if (this._onSelectionChangedObservable) {\r\n for (const observer of this._onSelectionChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangedObservable.add(observer);\r\n }\r\n this._onSelectionChangedObservable.clear();\r\n this._onSelectionChangedObservable = undefined;\r\n }\r\n\r\n const userOptions: IInspectorOptions = {\r\n ...DebugLayer.Config,\r\n ...config,\r\n };\r\n\r\n this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();\r\n\r\n this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);\r\n }\r\n\r\n /**\r\n * Select a specific entity in the scene explorer and highlight a specific block in that entity property grid\r\n * @param entity defines the entity to select\r\n * @param lineContainerTitles defines the specific blocks to highlight (could be a string or an array of strings)\r\n */\r\n public select(entity: any, lineContainerTitles?: string | string[]) {\r\n if (this.BJSINSPECTOR) {\r\n if (lineContainerTitles) {\r\n if (Object.prototype.toString.call(lineContainerTitles) == \"[object String]\") {\r\n this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(lineContainerTitles);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(lineContainerTitles);\r\n }\r\n }\r\n if (!this.BJSINSPECTOR.Inspector.IsVisible) {\r\n const waitAndCheck = () => {\r\n setTimeout(() => {\r\n if (this.BJSINSPECTOR.Inspector.IsVisible) {\r\n this.select(entity, lineContainerTitles);\r\n } else {\r\n waitAndCheck();\r\n }\r\n }, 100);\r\n };\r\n waitAndCheck();\r\n } else {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get the inspector from bundle or global\r\n * @returns the inspector instance if found otherwise, null\r\n */\r\n private _getGlobalInspector(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof INSPECTOR !== \"undefined\") {\r\n return INSPECTOR;\r\n }\r\n\r\n // In case of module let s check the global emitted from the Inspector entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.Inspector !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Get if the inspector is visible or not.\r\n * @returns true if visible otherwise, false\r\n */\r\n public isVisible(): boolean {\r\n return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;\r\n }\r\n\r\n /**\r\n * Hide the inspector and close its window.\r\n */\r\n public hide() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.Hide();\r\n }\r\n }\r\n\r\n /**\r\n * Get the number of opened panes in the inspector\r\n */\r\n public get openedPanes() {\r\n if (this.BJSINSPECTOR) {\r\n return this.BJSINSPECTOR.Inspector._OpenedPane;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Update the scene in the inspector\r\n */\r\n public setAsActiveScene() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector._SetNewScene(this._scene);\r\n }\r\n }\r\n\r\n public popupSceneExplorer() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupSceneExplorer();\r\n }\r\n }\r\n\r\n public popupInspector() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupInspector();\r\n }\r\n }\r\n\r\n public popupEmbed() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupEmbed();\r\n }\r\n }\r\n\r\n /**\r\n * Launch the debugLayer.\r\n * @param config Define the configuration of the inspector\r\n * @returns a promise fulfilled when the debug layer is visible\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async show(config?: IInspectorOptions): Promise<DebugLayer> {\r\n return await new Promise((resolve) => {\r\n if (typeof this.BJSINSPECTOR == \"undefined\") {\r\n const inspectorUrl = config && config.inspectorURL ? config.inspectorURL : DebugLayer.InspectorURL;\r\n\r\n // Load inspector and add it to the DOM\r\n Tools.LoadBabylonScript(inspectorUrl, () => {\r\n this._createInspector(config);\r\n resolve(this);\r\n });\r\n } else {\r\n // Otherwise creates the inspector\r\n this._createInspector(config);\r\n resolve(this);\r\n }\r\n });\r\n }\r\n}\r\n"]}
@@ -21,6 +21,7 @@ import type { EffectLayer } from "./Layers/effectLayer.js";
21
21
  import type { ReflectionProbe } from "./Probes/reflectionProbe.js";
22
22
  import type { LensFlareSystem } from "./LensFlares/lensFlareSystem.js";
23
23
  import type { ProceduralTexture } from "./Materials/Textures/Procedurals/proceduralTexture.js";
24
+ import type { ISpriteManager } from "./Sprites/spriteManager.js";
24
25
  /**
25
26
  * Interface defining container for the different elements composing a scene.
26
27
  * This class is dynamically extended by the different components of the scene increasing
@@ -136,6 +137,10 @@ export interface IAssetContainer {
136
137
  * The list of procedural textures added to the scene
137
138
  */
138
139
  proceduralTextures: ProceduralTexture[];
140
+ /**
141
+ * The list of sprite managers added to the scene
142
+ */
143
+ spriteManagers?: ISpriteManager[];
139
144
  /**
140
145
  * @returns all meshes, lights, cameras, transformNodes and bones
141
146
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IAssetContainer.js","sourceRoot":"","sources":["../../../dev/core/src/IAssetContainer.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"./types\";\r\nimport type { AbstractMesh } from \"./Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"./Meshes/transformNode\";\r\nimport type { Geometry } from \"./Meshes/geometry\";\r\nimport type { Skeleton } from \"./Bones/skeleton\";\r\nimport type { MorphTargetManager } from \"./Morph/morphTargetManager\";\r\nimport type { IParticleSystem } from \"./Particles/IParticleSystem\";\r\nimport type { AnimationGroup } from \"./Animations/animationGroup\";\r\nimport type { BaseTexture } from \"./Materials/Textures/baseTexture\";\r\nimport type { Material } from \"./Materials/material\";\r\nimport type { MultiMaterial } from \"./Materials/multiMaterial\";\r\nimport type { AbstractActionManager } from \"./Actions/abstractActionManager\";\r\nimport type { Camera } from \"./Cameras/camera\";\r\nimport type { Light } from \"./Lights/light\";\r\nimport type { Node } from \"./node\";\r\nimport type { PostProcess } from \"./PostProcesses/postProcess\";\r\nimport type { Animation } from \"./Animations/animation\";\r\nimport type { Sound } from \"./Audio/sound\";\r\nimport type { Layer } from \"./Layers/layer\";\r\nimport type { EffectLayer } from \"./Layers/effectLayer\";\r\nimport type { ReflectionProbe } from \"./Probes/reflectionProbe\";\r\nimport type { LensFlareSystem } from \"./LensFlares/lensFlareSystem\";\r\nimport type { ProceduralTexture } from \"./Materials/Textures/Procedurals/proceduralTexture\";\r\n/**\r\n * Interface defining container for the different elements composing a scene.\r\n * This class is dynamically extended by the different components of the scene increasing\r\n * flexibility and reducing coupling\r\n */\r\nexport interface IAssetContainer {\r\n /**\r\n * Gets the list of root nodes (ie. nodes with no parent)\r\n */\r\n rootNodes: Node[];\r\n\r\n /** All of the cameras added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\r\n */\r\n cameras: Camera[];\r\n\r\n /**\r\n * All of the lights added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\n lights: Light[];\r\n\r\n /**\r\n * All of the (abstract) meshes added to this scene\r\n */\r\n meshes: AbstractMesh[];\r\n\r\n /**\r\n * The list of skeletons added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\r\n */\r\n skeletons: Skeleton[];\r\n\r\n /**\r\n * All of the particle systems added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\r\n */\r\n particleSystems: IParticleSystem[];\r\n\r\n /**\r\n * Gets a list of Animations associated with the scene\r\n */\r\n animations: Animation[];\r\n\r\n /**\r\n * All of the animation groups added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\r\n */\r\n animationGroups: AnimationGroup[];\r\n\r\n /**\r\n * All of the multi-materials added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\r\n */\r\n multiMaterials: MultiMaterial[];\r\n\r\n /**\r\n * All of the materials added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\r\n * Note also that the order of the Material within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\r\n */\r\n materials: Material[];\r\n\r\n /**\r\n * The list of morph target managers added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\r\n */\r\n morphTargetManagers: MorphTargetManager[];\r\n\r\n /**\r\n * The list of geometries used in the scene.\r\n */\r\n geometries: Geometry[];\r\n\r\n /**\r\n * All of the transform nodes added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\r\n * Note also that the order of the TransformNode within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\r\n */\r\n transformNodes: TransformNode[];\r\n\r\n /**\r\n * ActionManagers available on the scene.\r\n * @deprecated\r\n */\r\n actionManagers: AbstractActionManager[];\r\n\r\n /**\r\n * Textures to keep.\r\n */\r\n textures: BaseTexture[];\r\n\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n environmentTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * The list of postprocesses added to the scene\r\n */\r\n postProcesses: PostProcess[];\r\n\r\n /**\r\n * The list of sound added to the scene\r\n */\r\n sounds: Nullable<Sound[]>;\r\n\r\n /**\r\n * The list of effect layers added to the scene\r\n */\r\n effectLayers: EffectLayer[];\r\n\r\n /**\r\n * The list of layers added to the scene\r\n */\r\n layers: Layer[];\r\n\r\n /**\r\n * The list of reflection probes added to the scene\r\n */\r\n reflectionProbes: ReflectionProbe[];\r\n\r\n /**\r\n * The list of lens flare system added to the scene\r\n */\r\n lensFlareSystems: LensFlareSystem[];\r\n\r\n /**\r\n * The list of procedural textures added to the scene\r\n */\r\n proceduralTextures: ProceduralTexture[];\r\n\r\n /**\r\n * @returns all meshes, lights, cameras, transformNodes and bones\r\n */\r\n getNodes(): Array<Node>;\r\n}\r\n"]}
1
+ {"version":3,"file":"IAssetContainer.js","sourceRoot":"","sources":["../../../dev/core/src/IAssetContainer.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"./types\";\r\nimport type { AbstractMesh } from \"./Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"./Meshes/transformNode\";\r\nimport type { Geometry } from \"./Meshes/geometry\";\r\nimport type { Skeleton } from \"./Bones/skeleton\";\r\nimport type { MorphTargetManager } from \"./Morph/morphTargetManager\";\r\nimport type { IParticleSystem } from \"./Particles/IParticleSystem\";\r\nimport type { AnimationGroup } from \"./Animations/animationGroup\";\r\nimport type { BaseTexture } from \"./Materials/Textures/baseTexture\";\r\nimport type { Material } from \"./Materials/material\";\r\nimport type { MultiMaterial } from \"./Materials/multiMaterial\";\r\nimport type { AbstractActionManager } from \"./Actions/abstractActionManager\";\r\nimport type { Camera } from \"./Cameras/camera\";\r\nimport type { Light } from \"./Lights/light\";\r\nimport type { Node } from \"./node\";\r\nimport type { PostProcess } from \"./PostProcesses/postProcess\";\r\nimport type { Animation } from \"./Animations/animation\";\r\nimport type { Sound } from \"./Audio/sound\";\r\nimport type { Layer } from \"./Layers/layer\";\r\nimport type { EffectLayer } from \"./Layers/effectLayer\";\r\nimport type { ReflectionProbe } from \"./Probes/reflectionProbe\";\r\nimport type { LensFlareSystem } from \"./LensFlares/lensFlareSystem\";\r\nimport type { ProceduralTexture } from \"./Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { ISpriteManager } from \"./Sprites/spriteManager\";\r\n/**\r\n * Interface defining container for the different elements composing a scene.\r\n * This class is dynamically extended by the different components of the scene increasing\r\n * flexibility and reducing coupling\r\n */\r\nexport interface IAssetContainer {\r\n /**\r\n * Gets the list of root nodes (ie. nodes with no parent)\r\n */\r\n rootNodes: Node[];\r\n\r\n /** All of the cameras added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\r\n */\r\n cameras: Camera[];\r\n\r\n /**\r\n * All of the lights added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\n lights: Light[];\r\n\r\n /**\r\n * All of the (abstract) meshes added to this scene\r\n */\r\n meshes: AbstractMesh[];\r\n\r\n /**\r\n * The list of skeletons added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\r\n */\r\n skeletons: Skeleton[];\r\n\r\n /**\r\n * All of the particle systems added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\r\n */\r\n particleSystems: IParticleSystem[];\r\n\r\n /**\r\n * Gets a list of Animations associated with the scene\r\n */\r\n animations: Animation[];\r\n\r\n /**\r\n * All of the animation groups added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\r\n */\r\n animationGroups: AnimationGroup[];\r\n\r\n /**\r\n * All of the multi-materials added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\r\n */\r\n multiMaterials: MultiMaterial[];\r\n\r\n /**\r\n * All of the materials added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\r\n * Note also that the order of the Material within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\r\n */\r\n materials: Material[];\r\n\r\n /**\r\n * The list of morph target managers added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\r\n */\r\n morphTargetManagers: MorphTargetManager[];\r\n\r\n /**\r\n * The list of geometries used in the scene.\r\n */\r\n geometries: Geometry[];\r\n\r\n /**\r\n * All of the transform nodes added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\r\n * Note also that the order of the TransformNode within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\r\n */\r\n transformNodes: TransformNode[];\r\n\r\n /**\r\n * ActionManagers available on the scene.\r\n * @deprecated\r\n */\r\n actionManagers: AbstractActionManager[];\r\n\r\n /**\r\n * Textures to keep.\r\n */\r\n textures: BaseTexture[];\r\n\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n environmentTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * The list of postprocesses added to the scene\r\n */\r\n postProcesses: PostProcess[];\r\n\r\n /**\r\n * The list of sound added to the scene\r\n */\r\n sounds: Nullable<Sound[]>;\r\n\r\n /**\r\n * The list of effect layers added to the scene\r\n */\r\n effectLayers: EffectLayer[];\r\n\r\n /**\r\n * The list of layers added to the scene\r\n */\r\n layers: Layer[];\r\n\r\n /**\r\n * The list of reflection probes added to the scene\r\n */\r\n reflectionProbes: ReflectionProbe[];\r\n\r\n /**\r\n * The list of lens flare system added to the scene\r\n */\r\n lensFlareSystems: LensFlareSystem[];\r\n\r\n /**\r\n * The list of procedural textures added to the scene\r\n */\r\n proceduralTextures: ProceduralTexture[];\r\n\r\n /**\r\n * The list of sprite managers added to the scene\r\n */\r\n spriteManagers?: ISpriteManager[];\r\n\r\n /**\r\n * @returns all meshes, lights, cameras, transformNodes and bones\r\n */\r\n getNodes(): Array<Node>;\r\n}\r\n"]}
@@ -178,6 +178,11 @@ export declare class HighlightLayer extends EffectLayer {
178
178
  * @param glowEmissiveOnly Extract the glow from the emissive texture
179
179
  */
180
180
  addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
181
+ /**
182
+ * Get all meshes from the highlight layer
183
+ * @returns Mesh[]
184
+ */
185
+ getAllMeshes(): Mesh[];
181
186
  /**
182
187
  * Remove a mesh from the highlight layer in order to make it stop glowing.
183
188
  * @param mesh The mesh to highlight
@@ -378,6 +378,19 @@ export class HighlightLayer extends EffectLayer {
378
378
  addMesh(mesh, color, glowEmissiveOnly = false) {
379
379
  this._thinEffectLayer.addMesh(mesh, color, glowEmissiveOnly);
380
380
  }
381
+ /**
382
+ * Get all meshes from the highlight layer
383
+ * @returns Mesh[]
384
+ */
385
+ getAllMeshes() {
386
+ return this._thinEffectLayer._meshes
387
+ ? Object.values(this._thinEffectLayer._meshes)
388
+ .map((mesh) => {
389
+ return mesh?.mesh;
390
+ })
391
+ .filter(Boolean)
392
+ : [];
393
+ }
381
394
  /**
382
395
  * Remove a mesh from the highlight layer in order to make it stop glowing.
383
396
  * @param mesh The mesh to highlight