@onerjs/core 8.27.0 → 8.27.2

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 (59) hide show
  1. package/Animations/runtimeAnimation.js +6 -1
  2. package/Animations/runtimeAnimation.js.map +1 -1
  3. package/Cameras/camera.d.ts +2 -2
  4. package/Cameras/camera.js +2 -2
  5. package/Cameras/camera.js.map +1 -1
  6. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +19 -2
  7. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +72 -4
  8. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  9. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +8 -3
  10. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +34 -12
  11. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  12. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +0 -12
  13. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +0 -45
  14. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -1
  15. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.d.ts +7 -3
  16. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js +18 -32
  17. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js.map +1 -1
  18. package/FrameGraph/Node/nodeRenderGraph.js +2 -1
  19. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  20. package/Layers/layerSceneComponent.js +3 -3
  21. package/Layers/layerSceneComponent.js.map +1 -1
  22. package/Lights/Clustered/clusteredLightContainer.d.ts +4 -1
  23. package/Lights/Clustered/clusteredLightContainer.js +17 -2
  24. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  25. package/Lights/index.d.ts +1 -0
  26. package/Lights/index.js +1 -0
  27. package/Lights/index.js.map +1 -1
  28. package/Materials/PBR/openPbrMaterial.js +7 -6
  29. package/Materials/PBR/openPbrMaterial.js.map +1 -1
  30. package/Materials/Textures/renderTargetTexture.d.ts +2 -0
  31. package/Materials/Textures/renderTargetTexture.js +3 -0
  32. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  33. package/Misc/index.d.ts +1 -0
  34. package/Misc/index.js +1 -0
  35. package/Misc/index.js.map +1 -1
  36. package/Navigation/INavigationEngine.d.ts +17 -5
  37. package/Navigation/INavigationEngine.js.map +1 -1
  38. package/Navigation/Plugins/recastJSPlugin.d.ts +3 -2
  39. package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
  40. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +4 -0
  41. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +10 -1
  42. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  43. package/PostProcesses/motionBlurPostProcess.d.ts +3 -1
  44. package/PostProcesses/motionBlurPostProcess.js +13 -4
  45. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  46. package/Rendering/geometryBufferRenderer.js +58 -0
  47. package/Rendering/geometryBufferRenderer.js.map +1 -1
  48. package/Rendering/objectRenderer.d.ts +2 -0
  49. package/Rendering/objectRenderer.js +13 -0
  50. package/Rendering/objectRenderer.js.map +1 -1
  51. package/Shaders/geometry.fragment.js +14 -0
  52. package/Shaders/geometry.fragment.js.map +1 -1
  53. package/Shaders/geometry.vertex.js +20 -0
  54. package/Shaders/geometry.vertex.js.map +1 -1
  55. package/ShadersWGSL/geometry.fragment.js +14 -0
  56. package/ShadersWGSL/geometry.fragment.js.map +1 -1
  57. package/ShadersWGSL/geometry.vertex.js +20 -0
  58. package/ShadersWGSL/geometry.vertex.js.map +1 -1
  59. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"INavigationEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Navigation/INavigationEngine.ts"],"names":[],"mappings":"","sourcesContent":["import type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Vector3 } from \"../Maths/math\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Scene } from \"../scene\";\r\n\r\n/**\r\n * Navigation plugin interface to add navigation constrained by a navigation mesh\r\n */\r\nexport interface INavigationEnginePlugin {\r\n /**\r\n * plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters): void;\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n isSupported(): boolean;\r\n\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void;\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number): void;\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number;\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are need to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number): void;\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number;\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): IObstacle;\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): IObstacle;\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void;\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Obstacle interface\r\n */\r\nexport interface IObstacle {}\r\n\r\n/**\r\n * Crowd Interface. A Crowd is a collection of moving agents constrained by a navigation mesh\r\n */\r\nexport interface ICrowd {\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number;\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number;\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void;\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[];\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void;\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[];\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Configures an agent\r\n */\r\nexport interface IAgentParameters {\r\n /**\r\n * Agent radius. [Limit: >= 0]\r\n */\r\n radius: number;\r\n\r\n /**\r\n * Agent height. [Limit: > 0]\r\n */\r\n height: number;\r\n\r\n /**\r\n * Maximum allowed acceleration. [Limit: >= 0]\r\n */\r\n maxAcceleration: number;\r\n\r\n /**\r\n * Maximum allowed speed. [Limit: >= 0]\r\n */\r\n maxSpeed: number;\r\n\r\n /**\r\n * Defines how close a collision element must be before it is considered for steering behaviors. [Limits: > 0]\r\n */\r\n collisionQueryRange: number;\r\n\r\n /**\r\n * The path visibility optimization range. [Limit: > 0]\r\n */\r\n pathOptimizationRange: number;\r\n\r\n /**\r\n * How aggressive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0]\r\n */\r\n separationWeight: number;\r\n\r\n /**\r\n * Observers will be notified when agent gets inside the virtual circle with this Radius around destination point.\r\n * Default is agent radius\r\n */\r\n reachRadius?: number;\r\n}\r\n\r\n/**\r\n * Configures the navigation mesh creation\r\n */\r\nexport interface INavMeshParameters {\r\n /**\r\n * The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n cs: number;\r\n\r\n /**\r\n * The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n ch: number;\r\n\r\n /**\r\n * The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]\r\n */\r\n walkableSlopeAngle: number;\r\n\r\n /**\r\n * Minimum floor to 'ceiling' height that will still allow the floor area to\r\n * be considered walkable. [Limit: >= 3] [Units: vx]\r\n */\r\n walkableHeight: number;\r\n\r\n /**\r\n * Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]\r\n */\r\n walkableClimb: number;\r\n\r\n /**\r\n * The distance to erode/shrink the walkable area of the heightfield away from\r\n * obstructions. [Limit: >=0] [Units: vx]\r\n */\r\n walkableRadius: number;\r\n\r\n /**\r\n * The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]\r\n */\r\n maxEdgeLen: number;\r\n\r\n /**\r\n * The maximum distance a simplified contour's border edges should deviate\r\n * the original raw contour. [Limit: >=0] [Units: vx]\r\n */\r\n maxSimplificationError: number;\r\n\r\n /**\r\n * The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]\r\n */\r\n minRegionArea: number;\r\n\r\n /**\r\n * Any regions with a span count smaller than this value will, if possible,\r\n * be merged with larger regions. [Limit: >=0] [Units: vx]\r\n */\r\n mergeRegionArea: number;\r\n\r\n /**\r\n * The maximum number of vertices allowed for polygons generated during the\r\n * contour to polygon conversion process. [Limit: >= 3]\r\n */\r\n maxVertsPerPoly: number;\r\n\r\n /**\r\n * Sets the sampling distance to use when generating the detail mesh.\r\n * (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]\r\n */\r\n detailSampleDist: number;\r\n\r\n /**\r\n * The maximum distance the detail mesh surface should deviate from heightfield\r\n * data. (For height detail only.) [Limit: >=0] [Units: wu]\r\n */\r\n detailSampleMaxError: number;\r\n\r\n /**\r\n * If using obstacles, the navmesh must be subdivided internaly by tiles.\r\n * This member defines the tile cube side length in world units.\r\n * If no obstacles are needed, leave it undefined or 0.\r\n */\r\n tileSize?: number;\r\n\r\n /**\r\n * The size of the non-navigable border around the heightfield.\r\n */\r\n borderSize?: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"INavigationEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Navigation/INavigationEngine.ts"],"names":[],"mappings":"","sourcesContent":["import type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Vector3 } from \"../Maths/math\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\n\r\n/**\r\n * Navigation plugin interface to add navigation constrained by a navigation mesh\r\n */\r\nexport interface INavigationEnginePlugin {\r\n /**\r\n * plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters): void;\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n isSupported(): boolean;\r\n\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void;\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number): void;\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number;\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are need to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number): void;\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number;\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): Nullable<IObstacle>;\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): Nullable<IObstacle>;\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void;\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Obstacle type\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IObstacle =\r\n | {\r\n type: \"box\";\r\n ref: unknown;\r\n position: Vector3;\r\n halfExtents: Vector3;\r\n angle: number;\r\n }\r\n | {\r\n type: \"cylinder\";\r\n ref: unknown;\r\n position: Vector3;\r\n radius: number;\r\n height: number;\r\n };\r\n\r\n/**\r\n * Crowd Interface. A Crowd is a collection of moving agents constrained by a navigation mesh\r\n */\r\nexport interface ICrowd {\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number;\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number;\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void;\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[];\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void;\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[];\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Configures an agent\r\n */\r\nexport interface IAgentParameters {\r\n /**\r\n * Agent radius. [Limit: >= 0]\r\n */\r\n radius: number;\r\n\r\n /**\r\n * Agent height. [Limit: > 0]\r\n */\r\n height: number;\r\n\r\n /**\r\n * Maximum allowed acceleration. [Limit: >= 0]\r\n */\r\n maxAcceleration: number;\r\n\r\n /**\r\n * Maximum allowed speed. [Limit: >= 0]\r\n */\r\n maxSpeed: number;\r\n\r\n /**\r\n * Defines how close a collision element must be before it is considered for steering behaviors. [Limits: > 0]\r\n */\r\n collisionQueryRange: number;\r\n\r\n /**\r\n * The path visibility optimization range. [Limit: > 0]\r\n */\r\n pathOptimizationRange: number;\r\n\r\n /**\r\n * How aggressive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0]\r\n */\r\n separationWeight: number;\r\n\r\n /**\r\n * Observers will be notified when agent gets inside the virtual circle with this Radius around destination point.\r\n * Default is agent radius\r\n */\r\n reachRadius?: number;\r\n}\r\n\r\n/**\r\n * Configures the navigation mesh creation\r\n */\r\nexport interface INavMeshParameters {\r\n /**\r\n * The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n cs: number;\r\n\r\n /**\r\n * The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n ch: number;\r\n\r\n /**\r\n * The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]\r\n */\r\n walkableSlopeAngle: number;\r\n\r\n /**\r\n * Minimum floor to 'ceiling' height that will still allow the floor area to\r\n * be considered walkable. [Limit: >= 3] [Units: vx]\r\n */\r\n walkableHeight: number;\r\n\r\n /**\r\n * Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]\r\n */\r\n walkableClimb: number;\r\n\r\n /**\r\n * The distance to erode/shrink the walkable area of the heightfield away from\r\n * obstructions. [Limit: >=0] [Units: vx]\r\n */\r\n walkableRadius: number;\r\n\r\n /**\r\n * The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]\r\n */\r\n maxEdgeLen: number;\r\n\r\n /**\r\n * The maximum distance a simplified contour's border edges should deviate\r\n * the original raw contour. [Limit: >=0] [Units: vx]\r\n */\r\n maxSimplificationError: number;\r\n\r\n /**\r\n * The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]\r\n */\r\n minRegionArea: number;\r\n\r\n /**\r\n * Any regions with a span count smaller than this value will, if possible,\r\n * be merged with larger regions. [Limit: >=0] [Units: vx]\r\n */\r\n mergeRegionArea: number;\r\n\r\n /**\r\n * The maximum number of vertices allowed for polygons generated during the\r\n * contour to polygon conversion process. [Limit: >= 3]\r\n */\r\n maxVertsPerPoly: number;\r\n\r\n /**\r\n * Sets the sampling distance to use when generating the detail mesh.\r\n * (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]\r\n */\r\n detailSampleDist: number;\r\n\r\n /**\r\n * The maximum distance the detail mesh surface should deviate from heightfield\r\n * data. (For height detail only.) [Limit: >=0] [Units: wu]\r\n */\r\n detailSampleMaxError: number;\r\n\r\n /**\r\n * If using obstacles, the navmesh must be subdivided internaly by tiles.\r\n * This member defines the tile cube side length in world units.\r\n * If no obstacles are needed, leave it undefined or 0.\r\n */\r\n tileSize?: number;\r\n\r\n /**\r\n * The size of the non-navigable border around the heightfield.\r\n */\r\n borderSize?: number;\r\n}\r\n"]}
@@ -4,6 +4,7 @@ import type { Scene } from "../../scene.js";
4
4
  import { Vector3 } from "../../Maths/math.js";
5
5
  import type { TransformNode } from "../../Meshes/transformNode.js";
6
6
  import { Observable } from "../../Misc/observable.js";
7
+ import type { Nullable } from "../../types.js";
7
8
  /**
8
9
  * RecastJS navigation plugin
9
10
  */
@@ -188,7 +189,7 @@ export declare class RecastJSPlugin implements INavigationEnginePlugin {
188
189
  * @param height cylinder height
189
190
  * @returns the obstacle freshly created
190
191
  */
191
- addCylinderObstacle(position: Vector3, radius: number, height: number): IObstacle;
192
+ addCylinderObstacle(position: Vector3, radius: number, height: number): Nullable<IObstacle>;
192
193
  /**
193
194
  * Creates an oriented box obstacle and add it to the navigation
194
195
  * @param position world position
@@ -196,7 +197,7 @@ export declare class RecastJSPlugin implements INavigationEnginePlugin {
196
197
  * @param angle angle in radians of the box orientation on Y axis
197
198
  * @returns the obstacle freshly created
198
199
  */
199
- addBoxObstacle(position: Vector3, extent: Vector3, angle: number): IObstacle;
200
+ addBoxObstacle(position: Vector3, extent: Vector3, angle: number): Nullable<IObstacle>;
200
201
  /**
201
202
  * Removes an obstacle created by addCylinderObstacle or addBoxObstacle
202
203
  * @param obstacle obstacle to remove from the navigation
@@ -1 +1 @@
1
- {"version":3,"file":"recastJSPlugin.js","sourceRoot":"","sources":["../../../../../dev/core/src/Navigation/Plugins/recastJSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAA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AAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACnD,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC;YACjC,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC/B,SAAS,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,OAAO;QACH,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAClF,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { INavigationEnginePlugin, ICrowd, IAgentParameters, INavMeshParameters, IObstacle } from \"../../Navigation/INavigationEngine\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { VertexData } from \"../../Meshes/mesh.vertexData\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Epsilon, Vector3, Matrix } from \"../../Maths/math\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let Recast: any;\r\n\r\n/**\r\n * RecastJS navigation plugin\r\n */\r\nexport class RecastJSPlugin implements INavigationEnginePlugin {\r\n /**\r\n * Reference to the Recast library\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public bjsRECAST: any = {};\r\n\r\n /**\r\n * plugin name\r\n */\r\n public name: string = \"RecastJSPlugin\";\r\n\r\n /**\r\n * the first navmesh created. We might extend this to support multiple navmeshes\r\n */\r\n public navMesh: any;\r\n\r\n private _maximumSubStepCount: number = 10;\r\n private _timeStep: number = 1 / 60;\r\n private _timeFactor: number = 1;\r\n\r\n private _tempVec1: any;\r\n private _tempVec2: any;\r\n\r\n private _worker: Nullable<Worker> = null;\r\n\r\n /**\r\n * Initializes the recastJS plugin\r\n * @param recastInjection can be used to inject your own recast reference\r\n */\r\n public constructor(recastInjection: any = Recast) {\r\n if (typeof recastInjection === \"function\") {\r\n Logger.Error(\"RecastJS is not ready. Please make sure you await Recast() before using the plugin.\");\r\n } else {\r\n this.bjsRECAST = recastInjection;\r\n }\r\n\r\n if (!this.isSupported()) {\r\n Logger.Error(\"RecastJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n this.setTimeStep();\r\n\r\n this._tempVec1 = new this.bjsRECAST.Vec3();\r\n this._tempVec2 = new this.bjsRECAST.Vec3();\r\n }\r\n\r\n /**\r\n * Set worker URL to be used when generating a new navmesh\r\n * @param workerURL url string\r\n * @returns boolean indicating if worker is created\r\n */\r\n public setWorkerURL(workerURL: string | URL): boolean {\r\n if (window && window.Worker) {\r\n this._worker = new Worker(workerURL);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number = 1 / 60): void {\r\n this._timeStep = newTimeStep;\r\n }\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number {\r\n return this._timeStep;\r\n }\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are need to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number = 10): void {\r\n this._maximumSubStepCount = newStepCount;\r\n }\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number {\r\n return this._maximumSubStepCount;\r\n }\r\n\r\n /**\r\n * Time factor applied when updating crowd agents (default 1). A value of 0 will pause crowd updates.\r\n * @param value the time factor applied at update\r\n */\r\n public set timeFactor(value: number) {\r\n this._timeFactor = Math.max(value, 0);\r\n }\r\n\r\n /**\r\n * Get the time factor used for crowd agent update\r\n * @returns the time factor\r\n */\r\n public get timeFactor(): number {\r\n return this._timeFactor;\r\n }\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n * @param completion callback when data is available from the worker. Not used without a worker\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters, completion?: (navmeshData: Uint8Array) => void): void {\r\n if (this._worker && !completion) {\r\n Logger.Warn(\"A worker is avaible but no completion callback. Defaulting to blocking navmesh creation\");\r\n } else if (!this._worker && completion) {\r\n Logger.Warn(\"A completion callback is avaible but no worker. Defaulting to blocking navmesh creation\");\r\n }\r\n\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n\r\n let index: number;\r\n let tri: number;\r\n let pt: number;\r\n\r\n const indices = [];\r\n const positions = [];\r\n let offset = 0;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n const mesh = meshes[index];\r\n\r\n const meshIndices = mesh.getIndices();\r\n if (!meshIndices) {\r\n continue;\r\n }\r\n const meshPositions = mesh.getVerticesData(VertexBuffer.PositionKind, false, false);\r\n if (!meshPositions) {\r\n continue;\r\n }\r\n\r\n const worldMatrices = [];\r\n const worldMatrix = mesh.computeWorldMatrix(true);\r\n\r\n if (mesh.hasThinInstances) {\r\n const thinMatrices = mesh.thinInstanceGetWorldMatrices();\r\n for (let instanceIndex = 0; instanceIndex < thinMatrices.length; instanceIndex++) {\r\n const tmpMatrix = new Matrix();\r\n const thinMatrix = thinMatrices[instanceIndex];\r\n thinMatrix.multiplyToRef(worldMatrix, tmpMatrix);\r\n worldMatrices.push(tmpMatrix);\r\n }\r\n } else {\r\n worldMatrices.push(worldMatrix);\r\n }\r\n\r\n for (let matrixIndex = 0; matrixIndex < worldMatrices.length; matrixIndex++) {\r\n const wm = worldMatrices[matrixIndex];\r\n for (tri = 0; tri < meshIndices.length; tri++) {\r\n indices.push(meshIndices[tri] + offset);\r\n }\r\n\r\n const transformed = Vector3.Zero();\r\n const position = Vector3.Zero();\r\n for (pt = 0; pt < meshPositions.length; pt += 3) {\r\n Vector3.FromArrayToRef(meshPositions, pt, position);\r\n Vector3.TransformCoordinatesToRef(position, wm, transformed);\r\n positions.push(transformed.x, transformed.y, transformed.z);\r\n }\r\n\r\n offset += meshPositions.length / 3;\r\n }\r\n }\r\n }\r\n\r\n if (this._worker && completion) {\r\n // spawn worker and send message\r\n this._worker.postMessage([positions, offset, indices, indices.length, parameters]);\r\n this._worker.onmessage = function (e) {\r\n completion(e.data);\r\n };\r\n } else {\r\n // blocking calls\r\n const rc = new this.bjsRECAST.rcConfig();\r\n rc.cs = parameters.cs;\r\n rc.ch = parameters.ch;\r\n rc.borderSize = parameters.borderSize ? parameters.borderSize : 0;\r\n rc.tileSize = parameters.tileSize ? parameters.tileSize : 0;\r\n rc.walkableSlopeAngle = parameters.walkableSlopeAngle;\r\n rc.walkableHeight = parameters.walkableHeight;\r\n rc.walkableClimb = parameters.walkableClimb;\r\n rc.walkableRadius = parameters.walkableRadius;\r\n rc.maxEdgeLen = parameters.maxEdgeLen;\r\n rc.maxSimplificationError = parameters.maxSimplificationError;\r\n rc.minRegionArea = parameters.minRegionArea;\r\n rc.mergeRegionArea = parameters.mergeRegionArea;\r\n rc.maxVertsPerPoly = parameters.maxVertsPerPoly;\r\n rc.detailSampleDist = parameters.detailSampleDist;\r\n rc.detailSampleMaxError = parameters.detailSampleMaxError;\r\n\r\n this.navMesh.build(positions, offset, indices, indices.length, rc);\r\n }\r\n }\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh {\r\n let tri: number;\r\n let pt: number;\r\n const debugNavMesh = this.navMesh.getDebugNavMesh();\r\n const triangleCount = debugNavMesh.getTriangleCount();\r\n\r\n const indices = [];\r\n const positions = [];\r\n for (tri = 0; tri < triangleCount * 3; tri++) {\r\n indices.push(tri);\r\n }\r\n for (tri = 0; tri < triangleCount; tri++) {\r\n for (pt = 0; pt < 3; pt++) {\r\n const point = debugNavMesh.getTriangle(tri).getPoint(pt);\r\n positions.push(point.x, point.y, point.z);\r\n }\r\n }\r\n\r\n const mesh = new Mesh(\"NavMeshDebug\", scene);\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.applyToMesh(mesh, false);\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getClosestPoint(this._tempVec1);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getClosestPoint(this._tempVec1);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getRandomPointAround(this._tempVec1, maxRadius);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getRandomPointAround(this._tempVec1, maxRadius);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = destination.x;\r\n this._tempVec2.y = destination.y;\r\n this._tempVec2.z = destination.z;\r\n const ret = this.navMesh.moveAlong(this._tempVec1, this._tempVec2);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = destination.x;\r\n this._tempVec2.y = destination.y;\r\n this._tempVec2.z = destination.z;\r\n const ret = this.navMesh.moveAlong(this._tempVec1, this._tempVec2);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n private _convertNavPathPoints(navPath: any): Vector3[] {\r\n let pt: number;\r\n const pointCount = navPath.getPointCount();\r\n const positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n const p = navPath.getPoint(pt);\r\n positions.push(new Vector3(p.x, p.y, p.z));\r\n }\r\n return positions;\r\n }\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[] {\r\n this._tempVec1.x = start.x;\r\n this._tempVec1.y = start.y;\r\n this._tempVec1.z = start.z;\r\n this._tempVec2.x = end.x;\r\n this._tempVec2.y = end.y;\r\n this._tempVec2.z = end.z;\r\n const navPath = this.navMesh.computePath(this._tempVec1, this._tempVec2);\r\n return this._convertNavPathPoints(navPath);\r\n }\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[] {\r\n this._tempVec1.x = start.x;\r\n this._tempVec1.y = start.y;\r\n this._tempVec1.z = start.z;\r\n this._tempVec2.x = end.x;\r\n this._tempVec2.y = end.y;\r\n this._tempVec2.z = end.z;\r\n const navPath = this.navMesh.computePathSmooth(this._tempVec1, this._tempVec2);\r\n return this._convertNavPathPoints(navPath);\r\n }\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd {\r\n const crowd = new RecastJSCrowd(this, maxAgents, maxAgentRadius, scene);\r\n return crowd;\r\n }\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void {\r\n this._tempVec1.x = extent.x;\r\n this._tempVec1.y = extent.y;\r\n this._tempVec1.z = extent.z;\r\n this.navMesh.setDefaultQueryExtent(this._tempVec1);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3 {\r\n const p = this.navMesh.getDefaultQueryExtent();\r\n return new Vector3(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void {\r\n const nDataBytes = data.length * data.BYTES_PER_ELEMENT;\r\n const dataPtr = this.bjsRECAST._malloc(nDataBytes);\r\n\r\n const dataHeap = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, dataPtr, nDataBytes);\r\n dataHeap.set(data);\r\n\r\n const buf = new this.bjsRECAST.NavmeshData();\r\n buf.dataPointer = dataHeap.byteOffset;\r\n buf.size = data.length;\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n this.navMesh.buildFromNavmeshData(buf);\r\n\r\n // Free memory\r\n this.bjsRECAST._free(dataHeap.byteOffset);\r\n }\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array {\r\n const navmeshData = this.navMesh.getNavmeshData();\r\n const arrView = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);\r\n const ret = new Uint8Array(navmeshData.size);\r\n ret.set(arrView);\r\n this.navMesh.freeNavmeshData(navmeshData);\r\n return ret;\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void {\r\n const p = this.navMesh.getDefaultQueryExtent();\r\n result.set(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Disposes\r\n */\r\n public dispose() {}\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): IObstacle {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n return this.navMesh.addCylinderObstacle(this._tempVec1, radius, height);\r\n }\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): IObstacle {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = extent.x;\r\n this._tempVec2.y = extent.y;\r\n this._tempVec2.z = extent.z;\r\n return this.navMesh.addBoxObstacle(this._tempVec1, this._tempVec2, angle);\r\n }\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void {\r\n this.navMesh.removeObstacle(obstacle);\r\n }\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n public isSupported(): boolean {\r\n return this.bjsRECAST !== undefined;\r\n }\r\n\r\n /**\r\n * Returns the seed used for randomized functions like `getRandomPointAround`\r\n * @returns seed number\r\n */\r\n public getRandomSeed(): number {\r\n return this.bjsRECAST._getRandomSeed();\r\n }\r\n\r\n /**\r\n * Set the seed used for randomized functions like `getRandomPointAround`\r\n * @param seed number used as seed for random functions\r\n */\r\n public setRandomSeed(seed: number): void {\r\n this.bjsRECAST._setRandomSeed(seed);\r\n }\r\n}\r\n\r\n/**\r\n * Recast detour crowd implementation\r\n */\r\nexport class RecastJSCrowd implements ICrowd {\r\n /**\r\n * Recast/detour plugin\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public bjsRECASTPlugin: RecastJSPlugin;\r\n /**\r\n * Link to the detour crowd\r\n */\r\n public recastCrowd: any = {};\r\n /**\r\n * One transform per agent\r\n */\r\n public transforms: TransformNode[] = new Array<TransformNode>();\r\n /**\r\n * All agents created\r\n */\r\n public agents: number[] = new Array<number>();\r\n /**\r\n * agents reach radius\r\n */\r\n public reachRadii: number[] = new Array<number>();\r\n /**\r\n * true when a destination is active for an agent and notifier hasn't been notified of reach\r\n */\r\n private _agentDestinationArmed: boolean[] = new Array<boolean>();\r\n /**\r\n * agent current target\r\n */\r\n private _agentDestination: Vector3[] = new Array<Vector3>();\r\n /**\r\n * Link to the scene is kept to unregister the crowd from the scene\r\n */\r\n private _scene: Scene;\r\n\r\n /**\r\n * Observer for crowd updates\r\n */\r\n private _onBeforeAnimationsObserver: Nullable<Observer<Scene>> = null;\r\n\r\n /**\r\n * Fires each time an agent is in reach radius of its destination\r\n */\r\n public onReachTargetObservable = new Observable<{ agentIndex: number; destination: Vector3 }>();\r\n\r\n /**\r\n * Constructor\r\n * @param plugin recastJS plugin\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n public constructor(plugin: RecastJSPlugin, maxAgents: number, maxAgentRadius: number, scene: Scene) {\r\n this.bjsRECASTPlugin = plugin;\r\n this.recastCrowd = new this.bjsRECASTPlugin.bjsRECAST.Crowd(maxAgents, maxAgentRadius, this.bjsRECASTPlugin.navMesh.getNavMesh());\r\n this._scene = scene;\r\n\r\n this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(() => {\r\n this.update(scene.getEngine().getDeltaTime() * 0.001 * plugin.timeFactor);\r\n });\r\n }\r\n\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number {\r\n const agentParams = new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParams();\r\n agentParams.radius = parameters.radius;\r\n agentParams.height = parameters.height;\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n agentParams.separationWeight = parameters.separationWeight;\r\n agentParams.updateFlags = 7;\r\n agentParams.obstacleAvoidanceType = 0;\r\n agentParams.queryFilterType = 0;\r\n agentParams.userData = 0;\r\n\r\n const agentIndex = this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(pos.x, pos.y, pos.z), agentParams);\r\n this.transforms.push(transform);\r\n this.agents.push(agentIndex);\r\n this.reachRadii.push(parameters.reachRadius ? parameters.reachRadius : parameters.radius);\r\n this._agentDestinationArmed.push(false);\r\n this._agentDestination.push(new Vector3(0, 0, 0));\r\n return agentIndex;\r\n }\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3 {\r\n const agentPos = this.recastCrowd.getAgentPosition(index);\r\n return new Vector3(agentPos.x, agentPos.y, agentPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void {\r\n const agentPos = this.recastCrowd.getAgentPosition(index);\r\n result.set(agentPos.x, agentPos.y, agentPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3 {\r\n const agentVel = this.recastCrowd.getAgentVelocity(index);\r\n return new Vector3(agentVel.x, agentVel.y, agentVel.z);\r\n }\r\n\r\n /**\r\n * Returns the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void {\r\n const agentVel = this.recastCrowd.getAgentVelocity(index);\r\n result.set(agentVel.x, agentVel.y, agentVel.z);\r\n }\r\n\r\n /**\r\n * Returns the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3 {\r\n const pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);\r\n return new Vector3(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void {\r\n const pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);\r\n result.set(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);\r\n }\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number {\r\n return this.recastCrowd.getAgentState(index);\r\n }\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean {\r\n return this.recastCrowd.overOffmeshConnection(index);\r\n }\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void {\r\n this.recastCrowd.agentGoto(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n\r\n // arm observer\r\n const item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this._agentDestinationArmed[item] = true;\r\n this._agentDestination[item].set(destination.x, destination.y, destination.z);\r\n }\r\n }\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void {\r\n this.recastCrowd.agentTeleport(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n }\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void {\r\n const agentParams = this.recastCrowd.getAgentParameters(index);\r\n\r\n if (parameters.radius !== undefined) {\r\n agentParams.radius = parameters.radius;\r\n }\r\n if (parameters.height !== undefined) {\r\n agentParams.height = parameters.height;\r\n }\r\n if (parameters.maxAcceleration !== undefined) {\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n }\r\n if (parameters.maxSpeed !== undefined) {\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n }\r\n if (parameters.collisionQueryRange !== undefined) {\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n }\r\n if (parameters.pathOptimizationRange !== undefined) {\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n }\r\n if (parameters.separationWeight !== undefined) {\r\n agentParams.separationWeight = parameters.separationWeight;\r\n }\r\n\r\n this.recastCrowd.setAgentParameters(index, agentParams);\r\n }\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void {\r\n this.recastCrowd.removeAgent(index);\r\n\r\n const item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this.agents.splice(item, 1);\r\n this.transforms.splice(item, 1);\r\n this.reachRadii.splice(item, 1);\r\n this._agentDestinationArmed.splice(item, 1);\r\n this._agentDestination.splice(item, 1);\r\n }\r\n }\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[] {\r\n return this.agents;\r\n }\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void {\r\n // update obstacles\r\n this.bjsRECASTPlugin.navMesh.update();\r\n\r\n if (deltaTime <= Epsilon) {\r\n return;\r\n }\r\n // update crowd\r\n const timeStep = this.bjsRECASTPlugin.getTimeStep();\r\n const maxStepCount = this.bjsRECASTPlugin.getMaximumSubStepCount();\r\n if (timeStep <= Epsilon) {\r\n this.recastCrowd.update(deltaTime);\r\n } else {\r\n let iterationCount = Math.floor(deltaTime / timeStep);\r\n if (maxStepCount && iterationCount > maxStepCount) {\r\n iterationCount = maxStepCount;\r\n }\r\n if (iterationCount < 1) {\r\n iterationCount = 1;\r\n }\r\n\r\n const step = deltaTime / iterationCount;\r\n for (let i = 0; i < iterationCount; i++) {\r\n this.recastCrowd.update(step);\r\n }\r\n }\r\n\r\n // update transforms\r\n for (let index = 0; index < this.agents.length; index++) {\r\n // update transform position\r\n const agentIndex = this.agents[index];\r\n const agentPosition = this.getAgentPosition(agentIndex);\r\n this.transforms[index].position = agentPosition;\r\n // check agent reach destination\r\n if (this._agentDestinationArmed[index]) {\r\n const dx = agentPosition.x - this._agentDestination[index].x;\r\n const dz = agentPosition.z - this._agentDestination[index].z;\r\n const radius = this.reachRadii[index];\r\n const groundY = this._agentDestination[index].y - this.reachRadii[index];\r\n const ceilingY = this._agentDestination[index].y + this.reachRadii[index];\r\n const distanceXZSquared = dx * dx + dz * dz;\r\n if (agentPosition.y > groundY && agentPosition.y < ceilingY && distanceXZSquared < radius * radius) {\r\n this._agentDestinationArmed[index] = false;\r\n this.onReachTargetObservable.notifyObservers({ agentIndex: agentIndex, destination: this._agentDestination[index] });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void {\r\n const ext = new this.bjsRECASTPlugin.bjsRECAST.Vec3(extent.x, extent.y, extent.z);\r\n this.recastCrowd.setDefaultQueryExtent(ext);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3 {\r\n const p = this.recastCrowd.getDefaultQueryExtent();\r\n return new Vector3(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void {\r\n const p = this.recastCrowd.getDefaultQueryExtent();\r\n result.set(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[] {\r\n let pt: number;\r\n const navPath = this.recastCrowd.getCorners(index);\r\n const pointCount = navPath.getPointCount();\r\n const positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n const p = navPath.getPoint(pt);\r\n positions.push(new Vector3(p.x, p.y, p.z));\r\n }\r\n return positions;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void {\r\n this.recastCrowd.destroy();\r\n this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver);\r\n this._onBeforeAnimationsObserver = null;\r\n this.onReachTargetObservable.clear();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"recastJSPlugin.js","sourceRoot":"","sources":["../../../../../dev/core/src/Navigation/Plugins/recastJSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD;;GAEG;AACH,MAAM,OAAO,cAAc;IA0BvB;;;OAGG;IACH,YAAmB,kBAAuB,MAAM;QA7BhD;;WAEG;QACH,gEAAgE;QACzD,cAAS,GAAQ,EAAE,CAAC;QAE3B;;WAEG;QACI,SAAI,GAAW,gBAAgB,CAAC;QAO/B,yBAAoB,GAAW,EAAE,CAAC;QAClC,cAAS,GAAW,CAAC,GAAG,EAAE,CAAC;QAC3B,gBAAW,GAAW,CAAC,CAAC;QAKxB,YAAO,GAAqB,IAAI,CAAC;QAOrC,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE,CAAC;YACxC,MAAM,CAAC,KAAK,CAAC,qFAAqF,CAAC,CAAC;QACxG,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;YACtF,OAAO;QACX,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,SAAS,GAAG,IAAI,IAA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AgentParameters, INavMeshParameters, IObstacle } from \"../../Navigation/INavigationEngine\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { VertexData } from \"../../Meshes/mesh.vertexData\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Epsilon, Vector3, Matrix } from \"../../Maths/math\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let Recast: any;\r\n\r\n/**\r\n * RecastJS navigation plugin\r\n */\r\nexport class RecastJSPlugin implements INavigationEnginePlugin {\r\n /**\r\n * Reference to the Recast library\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public bjsRECAST: any = {};\r\n\r\n /**\r\n * plugin name\r\n */\r\n public name: string = \"RecastJSPlugin\";\r\n\r\n /**\r\n * the first navmesh created. We might extend this to support multiple navmeshes\r\n */\r\n public navMesh: any;\r\n\r\n private _maximumSubStepCount: number = 10;\r\n private _timeStep: number = 1 / 60;\r\n private _timeFactor: number = 1;\r\n\r\n private _tempVec1: any;\r\n private _tempVec2: any;\r\n\r\n private _worker: Nullable<Worker> = null;\r\n\r\n /**\r\n * Initializes the recastJS plugin\r\n * @param recastInjection can be used to inject your own recast reference\r\n */\r\n public constructor(recastInjection: any = Recast) {\r\n if (typeof recastInjection === \"function\") {\r\n Logger.Error(\"RecastJS is not ready. Please make sure you await Recast() before using the plugin.\");\r\n } else {\r\n this.bjsRECAST = recastInjection;\r\n }\r\n\r\n if (!this.isSupported()) {\r\n Logger.Error(\"RecastJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n this.setTimeStep();\r\n\r\n this._tempVec1 = new this.bjsRECAST.Vec3();\r\n this._tempVec2 = new this.bjsRECAST.Vec3();\r\n }\r\n\r\n /**\r\n * Set worker URL to be used when generating a new navmesh\r\n * @param workerURL url string\r\n * @returns boolean indicating if worker is created\r\n */\r\n public setWorkerURL(workerURL: string | URL): boolean {\r\n if (window && window.Worker) {\r\n this._worker = new Worker(workerURL);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number = 1 / 60): void {\r\n this._timeStep = newTimeStep;\r\n }\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number {\r\n return this._timeStep;\r\n }\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are need to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number = 10): void {\r\n this._maximumSubStepCount = newStepCount;\r\n }\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number {\r\n return this._maximumSubStepCount;\r\n }\r\n\r\n /**\r\n * Time factor applied when updating crowd agents (default 1). A value of 0 will pause crowd updates.\r\n * @param value the time factor applied at update\r\n */\r\n public set timeFactor(value: number) {\r\n this._timeFactor = Math.max(value, 0);\r\n }\r\n\r\n /**\r\n * Get the time factor used for crowd agent update\r\n * @returns the time factor\r\n */\r\n public get timeFactor(): number {\r\n return this._timeFactor;\r\n }\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n * @param completion callback when data is available from the worker. Not used without a worker\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters, completion?: (navmeshData: Uint8Array) => void): void {\r\n if (this._worker && !completion) {\r\n Logger.Warn(\"A worker is avaible but no completion callback. Defaulting to blocking navmesh creation\");\r\n } else if (!this._worker && completion) {\r\n Logger.Warn(\"A completion callback is avaible but no worker. Defaulting to blocking navmesh creation\");\r\n }\r\n\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n\r\n let index: number;\r\n let tri: number;\r\n let pt: number;\r\n\r\n const indices = [];\r\n const positions = [];\r\n let offset = 0;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n const mesh = meshes[index];\r\n\r\n const meshIndices = mesh.getIndices();\r\n if (!meshIndices) {\r\n continue;\r\n }\r\n const meshPositions = mesh.getVerticesData(VertexBuffer.PositionKind, false, false);\r\n if (!meshPositions) {\r\n continue;\r\n }\r\n\r\n const worldMatrices = [];\r\n const worldMatrix = mesh.computeWorldMatrix(true);\r\n\r\n if (mesh.hasThinInstances) {\r\n const thinMatrices = mesh.thinInstanceGetWorldMatrices();\r\n for (let instanceIndex = 0; instanceIndex < thinMatrices.length; instanceIndex++) {\r\n const tmpMatrix = new Matrix();\r\n const thinMatrix = thinMatrices[instanceIndex];\r\n thinMatrix.multiplyToRef(worldMatrix, tmpMatrix);\r\n worldMatrices.push(tmpMatrix);\r\n }\r\n } else {\r\n worldMatrices.push(worldMatrix);\r\n }\r\n\r\n for (let matrixIndex = 0; matrixIndex < worldMatrices.length; matrixIndex++) {\r\n const wm = worldMatrices[matrixIndex];\r\n for (tri = 0; tri < meshIndices.length; tri++) {\r\n indices.push(meshIndices[tri] + offset);\r\n }\r\n\r\n const transformed = Vector3.Zero();\r\n const position = Vector3.Zero();\r\n for (pt = 0; pt < meshPositions.length; pt += 3) {\r\n Vector3.FromArrayToRef(meshPositions, pt, position);\r\n Vector3.TransformCoordinatesToRef(position, wm, transformed);\r\n positions.push(transformed.x, transformed.y, transformed.z);\r\n }\r\n\r\n offset += meshPositions.length / 3;\r\n }\r\n }\r\n }\r\n\r\n if (this._worker && completion) {\r\n // spawn worker and send message\r\n this._worker.postMessage([positions, offset, indices, indices.length, parameters]);\r\n this._worker.onmessage = function (e) {\r\n completion(e.data);\r\n };\r\n } else {\r\n // blocking calls\r\n const rc = new this.bjsRECAST.rcConfig();\r\n rc.cs = parameters.cs;\r\n rc.ch = parameters.ch;\r\n rc.borderSize = parameters.borderSize ? parameters.borderSize : 0;\r\n rc.tileSize = parameters.tileSize ? parameters.tileSize : 0;\r\n rc.walkableSlopeAngle = parameters.walkableSlopeAngle;\r\n rc.walkableHeight = parameters.walkableHeight;\r\n rc.walkableClimb = parameters.walkableClimb;\r\n rc.walkableRadius = parameters.walkableRadius;\r\n rc.maxEdgeLen = parameters.maxEdgeLen;\r\n rc.maxSimplificationError = parameters.maxSimplificationError;\r\n rc.minRegionArea = parameters.minRegionArea;\r\n rc.mergeRegionArea = parameters.mergeRegionArea;\r\n rc.maxVertsPerPoly = parameters.maxVertsPerPoly;\r\n rc.detailSampleDist = parameters.detailSampleDist;\r\n rc.detailSampleMaxError = parameters.detailSampleMaxError;\r\n\r\n this.navMesh.build(positions, offset, indices, indices.length, rc);\r\n }\r\n }\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh {\r\n let tri: number;\r\n let pt: number;\r\n const debugNavMesh = this.navMesh.getDebugNavMesh();\r\n const triangleCount = debugNavMesh.getTriangleCount();\r\n\r\n const indices = [];\r\n const positions = [];\r\n for (tri = 0; tri < triangleCount * 3; tri++) {\r\n indices.push(tri);\r\n }\r\n for (tri = 0; tri < triangleCount; tri++) {\r\n for (pt = 0; pt < 3; pt++) {\r\n const point = debugNavMesh.getTriangle(tri).getPoint(pt);\r\n positions.push(point.x, point.y, point.z);\r\n }\r\n }\r\n\r\n const mesh = new Mesh(\"NavMeshDebug\", scene);\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.applyToMesh(mesh, false);\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getClosestPoint(this._tempVec1);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getClosestPoint(this._tempVec1);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getRandomPointAround(this._tempVec1, maxRadius);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getRandomPointAround(this._tempVec1, maxRadius);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = destination.x;\r\n this._tempVec2.y = destination.y;\r\n this._tempVec2.z = destination.z;\r\n const ret = this.navMesh.moveAlong(this._tempVec1, this._tempVec2);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = destination.x;\r\n this._tempVec2.y = destination.y;\r\n this._tempVec2.z = destination.z;\r\n const ret = this.navMesh.moveAlong(this._tempVec1, this._tempVec2);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n private _convertNavPathPoints(navPath: any): Vector3[] {\r\n let pt: number;\r\n const pointCount = navPath.getPointCount();\r\n const positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n const p = navPath.getPoint(pt);\r\n positions.push(new Vector3(p.x, p.y, p.z));\r\n }\r\n return positions;\r\n }\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[] {\r\n this._tempVec1.x = start.x;\r\n this._tempVec1.y = start.y;\r\n this._tempVec1.z = start.z;\r\n this._tempVec2.x = end.x;\r\n this._tempVec2.y = end.y;\r\n this._tempVec2.z = end.z;\r\n const navPath = this.navMesh.computePath(this._tempVec1, this._tempVec2);\r\n return this._convertNavPathPoints(navPath);\r\n }\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[] {\r\n this._tempVec1.x = start.x;\r\n this._tempVec1.y = start.y;\r\n this._tempVec1.z = start.z;\r\n this._tempVec2.x = end.x;\r\n this._tempVec2.y = end.y;\r\n this._tempVec2.z = end.z;\r\n const navPath = this.navMesh.computePathSmooth(this._tempVec1, this._tempVec2);\r\n return this._convertNavPathPoints(navPath);\r\n }\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd {\r\n const crowd = new RecastJSCrowd(this, maxAgents, maxAgentRadius, scene);\r\n return crowd;\r\n }\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void {\r\n this._tempVec1.x = extent.x;\r\n this._tempVec1.y = extent.y;\r\n this._tempVec1.z = extent.z;\r\n this.navMesh.setDefaultQueryExtent(this._tempVec1);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3 {\r\n const p = this.navMesh.getDefaultQueryExtent();\r\n return new Vector3(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void {\r\n const nDataBytes = data.length * data.BYTES_PER_ELEMENT;\r\n const dataPtr = this.bjsRECAST._malloc(nDataBytes);\r\n\r\n const dataHeap = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, dataPtr, nDataBytes);\r\n dataHeap.set(data);\r\n\r\n const buf = new this.bjsRECAST.NavmeshData();\r\n buf.dataPointer = dataHeap.byteOffset;\r\n buf.size = data.length;\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n this.navMesh.buildFromNavmeshData(buf);\r\n\r\n // Free memory\r\n this.bjsRECAST._free(dataHeap.byteOffset);\r\n }\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array {\r\n const navmeshData = this.navMesh.getNavmeshData();\r\n const arrView = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);\r\n const ret = new Uint8Array(navmeshData.size);\r\n ret.set(arrView);\r\n this.navMesh.freeNavmeshData(navmeshData);\r\n return ret;\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void {\r\n const p = this.navMesh.getDefaultQueryExtent();\r\n result.set(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Disposes\r\n */\r\n public dispose() {}\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): Nullable<IObstacle> {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n return this.navMesh.addCylinderObstacle(this._tempVec1, radius, height);\r\n }\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): Nullable<IObstacle> {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = extent.x;\r\n this._tempVec2.y = extent.y;\r\n this._tempVec2.z = extent.z;\r\n return this.navMesh.addBoxObstacle(this._tempVec1, this._tempVec2, angle);\r\n }\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void {\r\n this.navMesh.removeObstacle(obstacle);\r\n }\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n public isSupported(): boolean {\r\n return this.bjsRECAST !== undefined;\r\n }\r\n\r\n /**\r\n * Returns the seed used for randomized functions like `getRandomPointAround`\r\n * @returns seed number\r\n */\r\n public getRandomSeed(): number {\r\n return this.bjsRECAST._getRandomSeed();\r\n }\r\n\r\n /**\r\n * Set the seed used for randomized functions like `getRandomPointAround`\r\n * @param seed number used as seed for random functions\r\n */\r\n public setRandomSeed(seed: number): void {\r\n this.bjsRECAST._setRandomSeed(seed);\r\n }\r\n}\r\n\r\n/**\r\n * Recast detour crowd implementation\r\n */\r\nexport class RecastJSCrowd implements ICrowd {\r\n /**\r\n * Recast/detour plugin\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public bjsRECASTPlugin: RecastJSPlugin;\r\n /**\r\n * Link to the detour crowd\r\n */\r\n public recastCrowd: any = {};\r\n /**\r\n * One transform per agent\r\n */\r\n public transforms: TransformNode[] = new Array<TransformNode>();\r\n /**\r\n * All agents created\r\n */\r\n public agents: number[] = new Array<number>();\r\n /**\r\n * agents reach radius\r\n */\r\n public reachRadii: number[] = new Array<number>();\r\n /**\r\n * true when a destination is active for an agent and notifier hasn't been notified of reach\r\n */\r\n private _agentDestinationArmed: boolean[] = new Array<boolean>();\r\n /**\r\n * agent current target\r\n */\r\n private _agentDestination: Vector3[] = new Array<Vector3>();\r\n /**\r\n * Link to the scene is kept to unregister the crowd from the scene\r\n */\r\n private _scene: Scene;\r\n\r\n /**\r\n * Observer for crowd updates\r\n */\r\n private _onBeforeAnimationsObserver: Nullable<Observer<Scene>> = null;\r\n\r\n /**\r\n * Fires each time an agent is in reach radius of its destination\r\n */\r\n public onReachTargetObservable = new Observable<{ agentIndex: number; destination: Vector3 }>();\r\n\r\n /**\r\n * Constructor\r\n * @param plugin recastJS plugin\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n public constructor(plugin: RecastJSPlugin, maxAgents: number, maxAgentRadius: number, scene: Scene) {\r\n this.bjsRECASTPlugin = plugin;\r\n this.recastCrowd = new this.bjsRECASTPlugin.bjsRECAST.Crowd(maxAgents, maxAgentRadius, this.bjsRECASTPlugin.navMesh.getNavMesh());\r\n this._scene = scene;\r\n\r\n this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(() => {\r\n this.update(scene.getEngine().getDeltaTime() * 0.001 * plugin.timeFactor);\r\n });\r\n }\r\n\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number {\r\n const agentParams = new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParams();\r\n agentParams.radius = parameters.radius;\r\n agentParams.height = parameters.height;\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n agentParams.separationWeight = parameters.separationWeight;\r\n agentParams.updateFlags = 7;\r\n agentParams.obstacleAvoidanceType = 0;\r\n agentParams.queryFilterType = 0;\r\n agentParams.userData = 0;\r\n\r\n const agentIndex = this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(pos.x, pos.y, pos.z), agentParams);\r\n this.transforms.push(transform);\r\n this.agents.push(agentIndex);\r\n this.reachRadii.push(parameters.reachRadius ? parameters.reachRadius : parameters.radius);\r\n this._agentDestinationArmed.push(false);\r\n this._agentDestination.push(new Vector3(0, 0, 0));\r\n return agentIndex;\r\n }\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3 {\r\n const agentPos = this.recastCrowd.getAgentPosition(index);\r\n return new Vector3(agentPos.x, agentPos.y, agentPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void {\r\n const agentPos = this.recastCrowd.getAgentPosition(index);\r\n result.set(agentPos.x, agentPos.y, agentPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3 {\r\n const agentVel = this.recastCrowd.getAgentVelocity(index);\r\n return new Vector3(agentVel.x, agentVel.y, agentVel.z);\r\n }\r\n\r\n /**\r\n * Returns the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void {\r\n const agentVel = this.recastCrowd.getAgentVelocity(index);\r\n result.set(agentVel.x, agentVel.y, agentVel.z);\r\n }\r\n\r\n /**\r\n * Returns the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3 {\r\n const pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);\r\n return new Vector3(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void {\r\n const pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);\r\n result.set(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);\r\n }\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number {\r\n return this.recastCrowd.getAgentState(index);\r\n }\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean {\r\n return this.recastCrowd.overOffmeshConnection(index);\r\n }\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void {\r\n this.recastCrowd.agentGoto(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n\r\n // arm observer\r\n const item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this._agentDestinationArmed[item] = true;\r\n this._agentDestination[item].set(destination.x, destination.y, destination.z);\r\n }\r\n }\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void {\r\n this.recastCrowd.agentTeleport(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n }\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void {\r\n const agentParams = this.recastCrowd.getAgentParameters(index);\r\n\r\n if (parameters.radius !== undefined) {\r\n agentParams.radius = parameters.radius;\r\n }\r\n if (parameters.height !== undefined) {\r\n agentParams.height = parameters.height;\r\n }\r\n if (parameters.maxAcceleration !== undefined) {\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n }\r\n if (parameters.maxSpeed !== undefined) {\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n }\r\n if (parameters.collisionQueryRange !== undefined) {\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n }\r\n if (parameters.pathOptimizationRange !== undefined) {\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n }\r\n if (parameters.separationWeight !== undefined) {\r\n agentParams.separationWeight = parameters.separationWeight;\r\n }\r\n\r\n this.recastCrowd.setAgentParameters(index, agentParams);\r\n }\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void {\r\n this.recastCrowd.removeAgent(index);\r\n\r\n const item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this.agents.splice(item, 1);\r\n this.transforms.splice(item, 1);\r\n this.reachRadii.splice(item, 1);\r\n this._agentDestinationArmed.splice(item, 1);\r\n this._agentDestination.splice(item, 1);\r\n }\r\n }\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[] {\r\n return this.agents;\r\n }\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void {\r\n // update obstacles\r\n this.bjsRECASTPlugin.navMesh.update();\r\n\r\n if (deltaTime <= Epsilon) {\r\n return;\r\n }\r\n // update crowd\r\n const timeStep = this.bjsRECASTPlugin.getTimeStep();\r\n const maxStepCount = this.bjsRECASTPlugin.getMaximumSubStepCount();\r\n if (timeStep <= Epsilon) {\r\n this.recastCrowd.update(deltaTime);\r\n } else {\r\n let iterationCount = Math.floor(deltaTime / timeStep);\r\n if (maxStepCount && iterationCount > maxStepCount) {\r\n iterationCount = maxStepCount;\r\n }\r\n if (iterationCount < 1) {\r\n iterationCount = 1;\r\n }\r\n\r\n const step = deltaTime / iterationCount;\r\n for (let i = 0; i < iterationCount; i++) {\r\n this.recastCrowd.update(step);\r\n }\r\n }\r\n\r\n // update transforms\r\n for (let index = 0; index < this.agents.length; index++) {\r\n // update transform position\r\n const agentIndex = this.agents[index];\r\n const agentPosition = this.getAgentPosition(agentIndex);\r\n this.transforms[index].position = agentPosition;\r\n // check agent reach destination\r\n if (this._agentDestinationArmed[index]) {\r\n const dx = agentPosition.x - this._agentDestination[index].x;\r\n const dz = agentPosition.z - this._agentDestination[index].z;\r\n const radius = this.reachRadii[index];\r\n const groundY = this._agentDestination[index].y - this.reachRadii[index];\r\n const ceilingY = this._agentDestination[index].y + this.reachRadii[index];\r\n const distanceXZSquared = dx * dx + dz * dz;\r\n if (agentPosition.y > groundY && agentPosition.y < ceilingY && distanceXZSquared < radius * radius) {\r\n this._agentDestinationArmed[index] = false;\r\n this.onReachTargetObservable.notifyObservers({ agentIndex: agentIndex, destination: this._agentDestination[index] });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void {\r\n const ext = new this.bjsRECASTPlugin.bjsRECAST.Vec3(extent.x, extent.y, extent.z);\r\n this.recastCrowd.setDefaultQueryExtent(ext);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3 {\r\n const p = this.recastCrowd.getDefaultQueryExtent();\r\n return new Vector3(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void {\r\n const p = this.recastCrowd.getDefaultQueryExtent();\r\n result.set(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[] {\r\n let pt: number;\r\n const navPath = this.recastCrowd.getCorners(index);\r\n const pointCount = navPath.getPointCount();\r\n const positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n const p = navPath.getPoint(pt);\r\n positions.push(new Vector3(p.x, p.y, p.z));\r\n }\r\n return positions;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void {\r\n this.recastCrowd.destroy();\r\n this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver);\r\n this._onBeforeAnimationsObserver = null;\r\n this.onReachTargetObservable.clear();\r\n }\r\n}\r\n"]}
@@ -137,6 +137,10 @@ export declare class SSAO2RenderingPipeline extends PostProcessRenderPipeline {
137
137
  * Support test.
138
138
  */
139
139
  static get IsSupported(): boolean;
140
+ /**
141
+ * Indicates that the combine stage should use the current camera viewport to render the SSAO result on only a portion of the output texture (default: true).
142
+ */
143
+ useViewportInCombineStage: boolean;
140
144
  private _scene;
141
145
  private _randomTexture;
142
146
  private _originalColorPostProcess;
@@ -213,6 +213,10 @@ export class SSAO2RenderingPipeline extends PostProcessRenderPipeline {
213
213
  * Useful value range is normally [0..1], but higher values are allowed.
214
214
  */
215
215
  this.bilateralTolerance = 0;
216
+ /**
217
+ * Indicates that the combine stage should use the current camera viewport to render the SSAO result on only a portion of the output texture (default: true).
218
+ */
219
+ this.useViewportInCombineStage = true;
216
220
  this._bits = new Uint32Array(1);
217
221
  this._scene = scene;
218
222
  this._ratio = ratio;
@@ -488,7 +492,12 @@ export class SSAO2RenderingPipeline extends PostProcessRenderPipeline {
488
492
  });
489
493
  this._ssaoCombinePostProcess.onApply = (effect) => {
490
494
  const viewport = this._scene.activeCamera.viewport;
491
- effect.setVector4("viewport", TmpVectors.Vector4[0].copyFromFloats(viewport.x, viewport.y, viewport.width, viewport.height));
495
+ if (this.useViewportInCombineStage) {
496
+ effect.setVector4("viewport", TmpVectors.Vector4[0].copyFromFloats(viewport.x, viewport.y, viewport.width, viewport.height));
497
+ }
498
+ else {
499
+ effect.setVector4("viewport", TmpVectors.Vector4[0].copyFromFloats(0, 0, 1, 1));
500
+ }
492
501
  effect.setTextureFromPostProcessOutput("originalColor", this._originalColorPostProcess);
493
502
  };
494
503
  this._ssaoCombinePostProcess.autoClear = false;