@onerjs/addons 8.27.1 → 8.27.3

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 (83) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +1 -0
  3. package/index.js.map +1 -1
  4. package/msdfText/paragraphOptions.d.ts +15 -0
  5. package/msdfText/paragraphOptions.js.map +1 -1
  6. package/msdfText/sdf/paragraph.js +1 -1
  7. package/msdfText/sdf/paragraph.js.map +1 -1
  8. package/navigation/common/config.d.ts +35 -0
  9. package/navigation/common/config.js +61 -0
  10. package/navigation/common/config.js.map +1 -0
  11. package/navigation/common/convert.d.ts +8 -0
  12. package/navigation/common/convert.js +22 -0
  13. package/navigation/common/convert.js.map +1 -0
  14. package/navigation/common/getters.d.ts +15 -0
  15. package/navigation/common/getters.js +76 -0
  16. package/navigation/common/getters.js.map +1 -0
  17. package/navigation/common/index.d.ts +6 -0
  18. package/navigation/common/index.js +7 -0
  19. package/navigation/common/index.js.map +1 -0
  20. package/navigation/common/smooth-path.d.ts +32 -0
  21. package/navigation/common/smooth-path.js +340 -0
  22. package/navigation/common/smooth-path.js.map +1 -0
  23. package/navigation/common/tile-cache.d.ts +15 -0
  24. package/navigation/common/tile-cache.js +32 -0
  25. package/navigation/common/tile-cache.js.map +1 -0
  26. package/navigation/common/utils.d.ts +17 -0
  27. package/navigation/common/utils.js +66 -0
  28. package/navigation/common/utils.js.map +1 -0
  29. package/navigation/debug/NavigationDebugger.d.ts +248 -0
  30. package/navigation/debug/NavigationDebugger.js +587 -0
  31. package/navigation/debug/NavigationDebugger.js.map +1 -0
  32. package/navigation/debug/index.d.ts +2 -0
  33. package/navigation/debug/index.js +3 -0
  34. package/navigation/debug/index.js.map +1 -0
  35. package/navigation/debug/simple-debug.d.ts +13 -0
  36. package/navigation/debug/simple-debug.js +23 -0
  37. package/navigation/debug/simple-debug.js.map +1 -0
  38. package/navigation/factory/common.d.ts +20 -0
  39. package/navigation/factory/common.js +80 -0
  40. package/navigation/factory/common.js.map +1 -0
  41. package/navigation/factory/factory.single-thread.d.ts +7 -0
  42. package/navigation/factory/factory.single-thread.js +15 -0
  43. package/navigation/factory/factory.single-thread.js.map +1 -0
  44. package/navigation/factory/factory.worker.d.ts +9 -0
  45. package/navigation/factory/factory.worker.js +40 -0
  46. package/navigation/factory/factory.worker.js.map +1 -0
  47. package/navigation/factory/index.d.ts +1 -0
  48. package/navigation/factory/index.js +3 -0
  49. package/navigation/factory/index.js.map +1 -0
  50. package/navigation/generator/generator.common.d.ts +25 -0
  51. package/navigation/generator/generator.common.js +40 -0
  52. package/navigation/generator/generator.common.js.map +1 -0
  53. package/navigation/generator/generator.single-thread.d.ts +20 -0
  54. package/navigation/generator/generator.single-thread.js +57 -0
  55. package/navigation/generator/generator.single-thread.js.map +1 -0
  56. package/navigation/generator/generator.worker.d.ts +29 -0
  57. package/navigation/generator/generator.worker.js +47 -0
  58. package/navigation/generator/generator.worker.js.map +1 -0
  59. package/navigation/generator/index.d.ts +3 -0
  60. package/navigation/generator/index.js +5 -0
  61. package/navigation/generator/index.js.map +1 -0
  62. package/navigation/generator/injection.d.ts +6 -0
  63. package/navigation/generator/injection.js +16 -0
  64. package/navigation/generator/injection.js.map +1 -0
  65. package/navigation/index.d.ts +5 -0
  66. package/navigation/index.js +7 -0
  67. package/navigation/index.js.map +1 -0
  68. package/navigation/plugin/RecastJSCrowd.d.ts +198 -0
  69. package/navigation/plugin/RecastJSCrowd.js +359 -0
  70. package/navigation/plugin/RecastJSCrowd.js.map +1 -0
  71. package/navigation/plugin/RecastNavigationJSPlugin.d.ts +419 -0
  72. package/navigation/plugin/RecastNavigationJSPlugin.js +482 -0
  73. package/navigation/plugin/RecastNavigationJSPlugin.js.map +1 -0
  74. package/navigation/plugin/index.d.ts +1 -0
  75. package/navigation/plugin/index.js +2 -0
  76. package/navigation/plugin/index.js.map +1 -0
  77. package/navigation/types.d.ts +199 -0
  78. package/navigation/types.js +11 -0
  79. package/navigation/types.js.map +1 -0
  80. package/navigation/worker/navmesh-worker.d.ts +4 -0
  81. package/navigation/worker/navmesh-worker.js +63 -0
  82. package/navigation/worker/navmesh-worker.js.map +1 -0
  83. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationDebugger.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/debug/NavigationDebugger.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,mDAAwC;AACnE,OAAO,EAAE,MAAM,EAAE,yCAA8B;AAC/C,OAAO,EAAE,MAAM,EAAE,0CAA+B;AAChD,OAAO,EAAE,iBAAiB,EAAE,2DAAgD;AAE5E,OAAO,EAAE,IAAI,EAAE,oCAAyB;AACxC,OAAO,EAAE,UAAU,EAAE,+CAAoC;AACzD,OAAO,EAAE,aAAa,EAAE,6CAAkC;AAG1D,OAAO,EAAE,SAAS,EAAE,mDAAwC;AAC5D,OAAO,EAAE,MAAM,EAAE,oCAAyB;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,cAAc;AACd,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,oBAAoB,EAAE,sBAAsB;IAC5C,yBAAyB,EAAE,2BAA2B;IACtD,2BAA2B,EAAE,6BAA6B;IAC1D,4BAA4B,EAAE,8BAA8B;IAC5D,YAAY,EAAE,cAAc;IAC5B,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,kBAAkB;IACpC,OAAO,EAAE,SAAS;IAClB,eAAe,EAAE,iBAAiB;CACrC,CAAC;AAIF;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IA8C3B;;;;;;OAMG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAW,cAAc,CAAC,KAAiC;QACvD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAA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;;GAEG;AACW,4CAAyB,GAAG,sBAAsB,AAAzB,CAA0B;AAEjE;;GAEG;AACW,4CAAyB,GAAG,sBAAsB,AAAzB,CAA0B","sourcesContent":["import type {\n DebugDrawerPrimitive,\n DebugDrawerPrimitiveType,\n NavMesh,\n NavMeshQuery,\n RecastCompactHeightfield,\n RecastContourSet,\n RecastHeightfield,\n RecastHeightfieldLayer,\n RecastHeightfieldLayerSet,\n RecastPolyMesh,\n RecastPolyMeshDetail,\n DebugDrawerUtils,\n} from \"@recast-navigation/core\";\n\nimport type { GreasedLineMaterialOptions } from \"core/Materials/GreasedLine/greasedLineMaterialInterfaces\";\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\nimport { Color3 } from \"core/Maths/math.color\";\nimport { Matrix } from \"core/Maths/math.vector\";\nimport { CreateGreasedLine } from \"core/Meshes/Builders/greasedLineBuilder\";\nimport type { GreasedLineBaseMesh, GreasedLineMeshOptions } from \"core/Meshes/GreasedLine/greasedLineBaseMesh\";\nimport { Mesh } from \"core/Meshes/mesh\";\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\nimport { TransformNode } from \"core/Meshes/transformNode\";\nimport type { Scene } from \"core/scene\";\nimport type { Nullable } from \"core/types\";\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\nimport { Logger } from \"core/Misc/logger\";\n\nimport type { GeneratorIntermediates } from \"../types\";\nimport { GetRecast } from \"../factory/common\";\n\n// TODO: Enum?\nexport const DebugLayerOption = {\n HEIGHTFIELD_SOLID: \"heightfield solid\",\n HEIGHTFIELD_WALKABLE: \"heightfield walkable\",\n COMPACT_HEIGHTFIELD_SOLID: \"compact heightfield solid\",\n COMPACT_HEIGHTFIELD_REGIONS: \"compact heightfield regions\",\n COMPACT_HEIGHTFIELD_DISTANCE: \"compact heightfield distance\",\n RAW_CONTOURS: \"raw contours\",\n CONTOURS: \"contours\",\n POLY_MESH: \"poly mesh\",\n POLY_MESH_DETAIL: \"poly mesh detail\",\n NAVMESH: \"navmesh\",\n NAVMESH_BV_TREE: \"navmesh bv tree\",\n};\n\nexport type DebugLayerOptions = (typeof DebugLayerOption)[keyof typeof DebugLayerOption];\n\n/**\n * NavigationDebugger is a utility class for visualizing navigation meshes and related data in a Babylon.js scene.\n * It provides methods to draw various navigation-related primitives such as points, lines, triangles, and quads.\n * It also supports drawing heightfields, compact heightfields, contours, poly meshes, and nav meshes.\n */\nexport class NavigationDebugger {\n /**\n * The name of the debug mesh used for navigation debugging.\n * This is used to group all navigation debug meshes under a single name for easier management\n */\n public static NAV_MESH_DEBUG_NAME = \"nav-mesh-debug\";\n\n /**\n * The name of the debug mesh used for visualization of the navigation mesh using points.\n */\n public static NAV_MESH_DEBUG_NAME_POINTS = \"nav-mesh-debug-points\";\n\n /**\n * The name of the debug mesh used for visualization of the navigation mesh using triangles.\n */\n public static NAV_MESH_DEBUG_NAME_TRIS = \"nav-mesh-debug-tris\";\n\n /**\n * The name of the debug mesh used for visualization of the navigation mesh using quads.\n */\n public static NAV_MESH_DEBUG_NAME_QUADS = \"nav-mesh-debug-quads\";\n\n /**\n * The name of the debug mesh used for visualization of the navigation mesh using lines.\n */\n public static NAV_MESH_DEBUG_NAME_LINES = \"nav-mesh-debug-lines\";\n\n /**\n * The material used for rendering triangles in the navigation debug visualization.\n */\n public triMaterial: StandardMaterial;\n /**\n * The material used for rendering points in the navigation debug visualization.\n */\n public pointMaterial: StandardMaterial;\n\n /**\n * The list of line materials used in the navigation debug visualization.\n */\n public lineMaterials: StandardMaterial[] = [];\n\n /**\n * The parent node for the debug drawer.\n */\n public debugDrawerParentNode: TransformNode;\n\n /**\n * * Gets or sets the primitive types to be drawn by the debug drawer.\n * * This allows you to control which types of primitives (points, lines, tris, quads) are rendered in the navigation debug visualization.\n * * The default value is `[\"points\", \"lines\", \"tris\", \"quads\"]`.\n * * You can modify this property to include or exclude specific primitive types based on your debugging needs.\n * @returns An array of primitive types that the debug drawer will render.\n */\n public get primitiveTypes(): DebugDrawerPrimitiveType[] {\n return this._primitiveTypes;\n }\n\n public set primitiveTypes(value: DebugDrawerPrimitiveType[]) {\n this._primitiveTypes = value;\n }\n\n private _lineMaterialOptions: {\n greasedLineMaterialOptions: Partial<GreasedLineMaterialOptions>;\n greasedLineMeshOptions: Partial<GreasedLineMeshOptions>;\n };\n private _pointMesh: Mesh;\n private _debugDrawerUtils: DebugDrawerUtils;\n private _primitiveTypes: DebugDrawerPrimitiveType[];\n\n constructor(\n private _scene: Scene,\n options?: {\n parent?: {\n node?: TransformNode | string;\n };\n primitiveTypes?: DebugDrawerPrimitiveType[];\n materials?: {\n triMaterial?: StandardMaterial;\n pointMaterial?: StandardMaterial;\n lineMaterialOptions: {\n greasedLineMaterialOptions: Partial<GreasedLineMaterialOptions>;\n greasedLineMeshOptions: Partial<GreasedLineMeshOptions>;\n };\n };\n }\n ) {\n this._debugDrawerUtils = new (GetRecast().DebugDrawerUtils)();\n\n this._primitiveTypes = options?.primitiveTypes ?? [\"points\", \"lines\", \"tris\", \"quads\"];\n\n this.debugDrawerParentNode =\n options?.parent?.node instanceof TransformNode ? options.parent.node : new TransformNode((options?.parent?.node as string) ?? \"nav-mesh-debug-parent\", this._scene);\n\n const materials = options?.materials;\n if (materials?.triMaterial) {\n this.triMaterial = materials.triMaterial;\n } else {\n this.triMaterial = new StandardMaterial(\"nav-debug-tris-material\");\n this.triMaterial.backFaceCulling = false;\n this.triMaterial.specularColor = Color3.Black();\n this.triMaterial.alpha = 0.5;\n }\n\n if (materials?.pointMaterial) {\n this.pointMaterial = materials.pointMaterial;\n } else {\n this.pointMaterial = new StandardMaterial(\"nav-debug-points-material\");\n this.pointMaterial.backFaceCulling = false;\n this.pointMaterial.specularColor = Color3.Black();\n }\n\n if (materials?.lineMaterialOptions) {\n this._lineMaterialOptions = materials.lineMaterialOptions;\n } else {\n this._lineMaterialOptions = {\n greasedLineMaterialOptions: {\n width: 2,\n sizeAttenuation: true,\n },\n greasedLineMeshOptions: {},\n };\n }\n\n this._pointMesh = CreateBox(NavigationDebugger.NAV_MESH_DEBUG_NAME_POINTS, { size: 0.02 });\n }\n\n /**\n * Resets the debug drawer by disposing of all child meshes in the debug drawer parent node.\n * This is useful for clearing the debug visualization before drawing new primitives.\n */\n public clear() {\n for (const child of this.debugDrawerParentNode.getChildMeshes()) {\n child.dispose();\n }\n }\n\n /**\n * Disposes of the debug drawer, including all meshes and materials used for rendering.\n * This method should be called when the debug drawer is no longer needed to free up resources.\n */\n public dispose() {\n this.clear();\n this._debugDrawerUtils.dispose();\n this._pointMesh.dispose();\n this.triMaterial.dispose();\n this.pointMaterial.dispose();\n }\n\n /**\n * This method iterates through the provided primitives and draws them based on their type.\n * It supports drawing points, lines, triangles, and quads, depending on the primitive type.\n * @param primitives An array of debug drawer primitives to be drawn.\n * @param options Optional parameters to control the drawing behavior, such as whether to join meshes.\n */\n public drawPrimitives(primitives: DebugDrawerPrimitive[], options?: { joinMeshes?: boolean }) {\n let linesInstance = null;\n\n for (const primitive of primitives) {\n // draw only the primitives that are in the primitiveTypes array\n if (!this._primitiveTypes.includes(primitive.type)) {\n continue;\n }\n\n switch (primitive.type) {\n case \"points\":\n this._drawPoints(primitive);\n break;\n case \"lines\": {\n const line = this._drawLines(primitive, linesInstance);\n if (!linesInstance) {\n linesInstance = line;\n }\n break;\n }\n case \"tris\":\n this._drawTris(primitive);\n break;\n case \"quads\":\n this._drawQuads(primitive);\n break;\n }\n }\n\n linesInstance?.updateLazy();\n\n if (options?.joinMeshes ?? true) {\n // Join the debug meshes into a single mesh for better performance\n this._joinDebugMeshes();\n }\n }\n\n /**\n * Draws a heightfield as solid using the debug drawer utilities.\n * @param hf The heightfield to draw as solid.\n */\n public drawHeightfieldSolid(hf: RecastHeightfield): void {\n const primitives = this._debugDrawerUtils.drawHeightfieldSolid(hf);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws a heightfield as walkable using the debug drawer utilities.\n * @param hf The heightfield to draw as walkable.\n */\n public drawHeightfieldWalkable(hf: RecastHeightfield): void {\n const primitives = this._debugDrawerUtils.drawHeightfieldWalkable(hf);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws a compact heightfield as solid using the debug drawer utilities.\n * @param chf The compact heightfield to draw as solid.\n */\n public drawCompactHeightfieldSolid(chf: RecastCompactHeightfield): void {\n const primitives = this._debugDrawerUtils.drawCompactHeightfieldSolid(chf);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws the regions of a compact heightfield using the debug drawer utilities.\n * @param chf The compact heightfield to draw regions for.\n */\n public drawCompactHeightfieldRegions(chf: RecastCompactHeightfield): void {\n const primitives = this._debugDrawerUtils.drawCompactHeightfieldRegions(chf);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws the distance field of a compact heightfield using the debug drawer utilities.\n * @param chf The compact heightfield to draw the distance for.\n */\n public drawCompactHeightfieldDistance(chf: RecastCompactHeightfield): void {\n const primitives = this._debugDrawerUtils.drawCompactHeightfieldDistance(chf);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws a heightfield layer using the debug drawer utilities.\n * @param layer The heightfield layer to draw.\n * @param idx The index of the layer to draw.\n */\n public drawHeightfieldLayer(layer: RecastHeightfieldLayer, idx: number): void {\n const primitives = this._debugDrawerUtils.drawHeightfieldLayer(layer, idx);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws the layers of a heightfield using the debug drawer utilities.\n * @param lset The heightfield layer set containing the layers to draw.\n */\n public drawHeightfieldLayers(lset: RecastHeightfieldLayerSet): void {\n const primitives = this._debugDrawerUtils.drawHeightfieldLayers(lset);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws the region connections of a RecastContourSet using the debug drawer utilities.\n * @param cset RecastContourSet to draw\n * @param alpha The alpha value for the drawn contours, default is 1.\n */\n public drawRegionConnections(cset: RecastContourSet, alpha: number = 1): void {\n const primitives = this._debugDrawerUtils.drawRegionConnections(cset, alpha);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws raw contours from a RecastContourSet using the debug drawer utilities.\n * @param cset RecastContourSet to draw\n * @param alpha The alpha value for the drawn contours, default is 1.\n */\n public drawRawContours(cset: RecastContourSet, alpha: number = 1): void {\n const primitives = this._debugDrawerUtils.drawRawContours(cset, alpha);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws contours from a RecastContourSet using the debug drawer utilities.\n * @param cset RecastContourSet to draw\n * @param alpha The alpha value for the drawn contours, default is 1.\n */\n public drawContours(cset: RecastContourSet, alpha: number = 1): void {\n const primitives = this._debugDrawerUtils.drawContours(cset, alpha);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws a poly mesh using the debug drawer utilities.\n * @param mesh RecastPolyMesh to draw\n */\n public drawPolyMesh(mesh: RecastPolyMesh): void {\n const primitives = this._debugDrawerUtils.drawPolyMesh(mesh);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws a poly mesh detail using the debug drawer utilities.\n * @param dmesh RecastPolyMeshDetail to draw\n */\n public drawPolyMeshDetail(dmesh: RecastPolyMeshDetail): void {\n const primitives = this._debugDrawerUtils.drawPolyMeshDetail(dmesh);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws a NavMesh using the debug drawer utilities.\n * @param mesh NavMesh to draw\n * @param flags Flags to control the drawing behavior, default is 0.\n */\n public drawNavMesh(mesh: NavMesh, flags: number = 0): void {\n const primitives = this._debugDrawerUtils.drawNavMesh(mesh, flags);\n this.drawPrimitives(primitives);\n }\n\n // todo:\n // - drawTileCacheLayerAreas\n // - drawTileCacheLayerRegions\n // - drawTileCacheContours\n // - drawTileCachePolyMesh\n\n /**\n * Draws a NavMesh with closed list using the debug drawer utilities.\n * @param mesh NavMesh to draw\n * @param query NavMeshQuery to use for drawing the closed list.\n * @param flags Flags to control the drawing behavior, default is 0.\n */\n public drawNavMeshWithClosedList(mesh: NavMesh, query: NavMeshQuery, flags: number = 0): void {\n const primitives = this._debugDrawerUtils.drawNavMeshWithClosedList(mesh, query, flags);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws the nodes of a NavMesh using the debug drawer utilities.\n * @param query NavMeshQuery to use for drawing the nodes.\n */\n public drawNavMeshNodes(query: NavMeshQuery): void {\n const primitives = this._debugDrawerUtils.drawNavMeshNodes(query);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws the bounding volume tree of a NavMesh using the debug drawer utilities.\n * @param mesh NavMesh to draw the bounding volume tree for.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public drawNavMeshBVTree(mesh: NavMesh): void {\n const primitives = this._debugDrawerUtils.drawNavMeshBVTree(mesh);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws the portals of a NavMesh using the debug drawer utilities.\n * @param mesh NavMesh to draw the portals for.\n */\n public drawNavMeshPortals(mesh: NavMesh): void {\n const primitives = this._debugDrawerUtils.drawNavMeshPortals(mesh);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws polygons of a NavMesh with specific flags using the debug drawer utilities.\n * @param mesh NavMesh to draw the polygons with specific flags.\n * @param flags The flags to filter the polygons to be drawn.\n * @param col The color to use for the drawn polygons, represented as a number.\n */\n public drawNavMeshPolysWithFlags(mesh: NavMesh, flags: number, col: number): void {\n const primitives = this._debugDrawerUtils.drawNavMeshPolysWithFlags(mesh, flags, col);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Draws polygons of a NavMesh with specific reference and color using the debug drawer utilities.\n * @param mesh NavMesh to draw the polygons with specific reference and color.\n * @param ref The reference number of the polygons to be drawn.\n * @param col The color to use for the drawn polygons, represented as a number.\n */\n public drawNavMeshPoly(mesh: NavMesh, ref: number, col: number): void {\n const primitives = this._debugDrawerUtils.drawNavMeshPoly(mesh, ref, col);\n this.drawPrimitives(primitives);\n }\n\n /**\n * Get the intermediates from the generator\n * @param intermediates - The generator intermediates\n * @returns An object containing lists of heightfields, compact heightfields, contour sets\n */\n public getIntermediates = (intermediates: GeneratorIntermediates) => {\n const heightfieldList: RecastHeightfield[] = [];\n const compactHeightfieldList: RecastCompactHeightfield[] = [];\n const contourSetList: RecastContourSet[] = [];\n const polyMeshList: RecastPolyMesh[] = [];\n const polyMeshDetailList: RecastPolyMeshDetail[] = [];\n\n if (intermediates) {\n if (intermediates.type === \"solo\") {\n if (intermediates.heightfield) {\n heightfieldList.push(intermediates.heightfield);\n }\n\n if (intermediates.compactHeightfield) {\n compactHeightfieldList.push(intermediates.compactHeightfield);\n }\n\n if (intermediates.contourSet) {\n contourSetList.push(intermediates.contourSet);\n }\n\n if (intermediates.polyMesh) {\n polyMeshList.push(intermediates.polyMesh);\n }\n\n if (intermediates.polyMeshDetail) {\n polyMeshDetailList.push(intermediates.polyMeshDetail);\n }\n } else if (intermediates.type === \"tiled\") {\n for (const tile of intermediates.tileIntermediates) {\n if (tile.heightfield) {\n heightfieldList.push(tile.heightfield);\n }\n\n if (tile.compactHeightfield) {\n compactHeightfieldList.push(tile.compactHeightfield);\n }\n\n if (tile.contourSet) {\n contourSetList.push(tile.contourSet);\n }\n\n if (tile.polyMesh) {\n polyMeshList.push(tile.polyMesh);\n }\n\n if (tile.polyMeshDetail) {\n polyMeshDetailList.push(tile.polyMeshDetail);\n }\n }\n } else if (intermediates.type === \"tilecache\") {\n for (const tile of intermediates.tileIntermediates) {\n if (tile.heightfield) {\n heightfieldList.push(tile.heightfield);\n }\n\n if (tile.compactHeightfield) {\n compactHeightfieldList.push(tile.compactHeightfield);\n }\n }\n }\n }\n\n return {\n heightfieldList,\n compactHeightfieldList,\n contourSetList,\n polyMeshList,\n polyMeshDetailList,\n };\n };\n\n /**\n * Draw debug information based on the selected option\n * @param navMesh - The navigation mesh to draw\n * @param intermediates - The generator intermediates containing the data to draw\n * @param scene - The scene to draw in\n * @param option - The debug drawer option to use\n * @remarks This method will reset the debug drawer before drawing.\n */\n public draw(navMesh: NavMesh, intermediates: GeneratorIntermediates, scene: Scene, option: DebugLayerOptions) {\n this.clear();\n\n const { heightfieldList, compactHeightfieldList, contourSetList, polyMeshList, polyMeshDetailList } = this.getIntermediates(intermediates);\n\n if (option === DebugLayerOption.HEIGHTFIELD_SOLID) {\n for (const heightfield of heightfieldList) {\n this.drawHeightfieldSolid(heightfield);\n }\n } else if (option === DebugLayerOption.HEIGHTFIELD_WALKABLE) {\n for (const heightfield of heightfieldList) {\n this.drawHeightfieldWalkable(heightfield);\n }\n } else if (option === DebugLayerOption.COMPACT_HEIGHTFIELD_SOLID) {\n for (const compactHeightfield of compactHeightfieldList) {\n this.drawCompactHeightfieldSolid(compactHeightfield);\n }\n } else if (option === DebugLayerOption.COMPACT_HEIGHTFIELD_REGIONS) {\n for (const compactHeightfield of compactHeightfieldList) {\n this.drawCompactHeightfieldRegions(compactHeightfield);\n }\n } else if (option === DebugLayerOption.COMPACT_HEIGHTFIELD_DISTANCE) {\n for (const compactHeightfield of compactHeightfieldList) {\n this.drawCompactHeightfieldDistance(compactHeightfield);\n }\n } else if (option === DebugLayerOption.RAW_CONTOURS) {\n for (const contourSet of contourSetList) {\n this.drawRawContours(contourSet);\n }\n } else if (option === DebugLayerOption.CONTOURS) {\n for (const contourSet of contourSetList) {\n this.drawContours(contourSet);\n }\n } else if (option === DebugLayerOption.POLY_MESH) {\n for (const polyMesh of polyMeshList) {\n this.drawPolyMesh(polyMesh);\n }\n } else if (option === DebugLayerOption.POLY_MESH_DETAIL) {\n for (const polyMeshDetail of polyMeshDetailList) {\n this.drawPolyMeshDetail(polyMeshDetail);\n }\n } else if (option === DebugLayerOption.NAVMESH) {\n this.drawNavMesh(navMesh);\n } else if (option === DebugLayerOption.NAVMESH_BV_TREE) {\n this.drawNavMeshBVTree(navMesh);\n }\n }\n\n private _drawPoints(primitive: DebugDrawerPrimitive): void {\n if (primitive.vertices.length === 0) {\n return;\n }\n\n const matricesData = new Float32Array(16 * primitive.vertices.length);\n const colorData = new Float32Array(4 * primitive.vertices.length);\n\n for (let i = 0; i < primitive.vertices.length; i++) {\n const [x, y, z, r, g, b, a] = primitive.vertices[i];\n\n colorData[i * 4] = r;\n colorData[i * 4 + 1] = g;\n colorData[i * 4 + 2] = b;\n colorData[i * 4 + 3] = a;\n\n const matrix = Matrix.Translation(x, y, z);\n matrix.copyToArray(matricesData, i * 16);\n }\n\n this._pointMesh.thinInstanceSetBuffer(\"matrix\", matricesData, 16);\n this._pointMesh.thinInstanceSetBuffer(\"color\", colorData, 4);\n\n this._pointMesh.parent = this.debugDrawerParentNode;\n }\n\n private _drawLines(primitive: DebugDrawerPrimitive, instance: Nullable<GreasedLineBaseMesh>): Nullable<GreasedLineBaseMesh> {\n if (primitive.vertices.length === 0) {\n return null;\n }\n\n const points: number[][] = [];\n const colors: Color3[] = [];\n\n for (let i = 0; i < primitive.vertices.length; i += 2) {\n const [x1, y1, z1, r1, g1, b1] = primitive.vertices[i];\n const [x2, y2, z2, r2, g2, b2] = primitive.vertices[i + 1];\n\n points.push([x1, y1, z1, x2, y2, z2]);\n\n colors.push(new Color3(r1, g1, b1));\n colors.push(new Color3(r2, g2, b2));\n }\n\n const options = { ...this._lineMaterialOptions.greasedLineMeshOptions, points, instance: instance ?? undefined };\n const materialOptions = { ...this._lineMaterialOptions.greasedLineMaterialOptions, colors };\n\n const lines = CreateGreasedLine(NavigationDebugger.NAV_MESH_DEBUG_NAME_LINES, options, materialOptions);\n\n lines.parent = this.debugDrawerParentNode;\n this.lineMaterials.push(lines.material as StandardMaterial);\n\n return lines;\n }\n\n private _drawTris(primitive: DebugDrawerPrimitive): void {\n if (primitive.vertices.length === 0) {\n return;\n }\n\n const positions = new Float32Array(primitive.vertices.length * 3);\n const colors = new Float32Array(primitive.vertices.length * 4);\n\n for (let i = 0; i < primitive.vertices.length; i++) {\n const [x, y, z, r, g, b] = primitive.vertices[i];\n positions[i * 3 + 0] = x;\n positions[i * 3 + 1] = y;\n positions[i * 3 + 2] = z;\n\n colors[i * 4 + 0] = r;\n colors[i * 4 + 1] = g;\n colors[i * 4 + 2] = b;\n colors[i * 4 + 3] = 1;\n }\n\n const vertexData = new VertexData();\n\n vertexData.positions = positions;\n vertexData.colors = colors;\n\n const customMesh = new Mesh(NavigationDebugger.NAV_MESH_DEBUG_NAME_TRIS);\n customMesh.isUnIndexed = true;\n vertexData.applyToMesh(customMesh);\n\n customMesh.material = this.triMaterial;\n customMesh.parent = this.debugDrawerParentNode;\n }\n\n private _drawQuads(primitive: DebugDrawerPrimitive): void {\n if (primitive.vertices.length === 0) {\n return;\n }\n\n const positions: number[] = [];\n const colors: number[] = [];\n for (let i = 0; i < primitive.vertices.length; i += 4) {\n const vertices = [\n primitive.vertices[i],\n primitive.vertices[i + 1],\n primitive.vertices[i + 2],\n primitive.vertices[i],\n primitive.vertices[i + 2],\n primitive.vertices[i + 3],\n ];\n for (const [x, y, z, r, g, b] of vertices) {\n positions.push(x, y, z);\n colors.push(r, g, b, 1);\n }\n }\n\n const vertexData = new VertexData();\n\n vertexData.positions = positions;\n vertexData.colors = colors;\n\n const customMesh = new Mesh(NavigationDebugger.NAV_MESH_DEBUG_NAME_QUADS);\n customMesh.isUnIndexed = true;\n vertexData.applyToMesh(customMesh);\n\n customMesh.material = this.triMaterial;\n customMesh.parent = this.debugDrawerParentNode;\n }\n\n /**\n * Merge the debug meshes for better performance\n */\n private _joinDebugMeshes() {\n const debugMeshes = this._scene.meshes.filter((m) => m.name === NavigationDebugger.NAV_MESH_DEBUG_NAME) as Mesh[];\n\n // only indexed meshes can be merged\n debugMeshes.forEach((m) => {\n this._convertUnindexedToIndexed(m);\n });\n\n const merged = Mesh.MergeMeshes(debugMeshes, true);\n if (merged) {\n merged.name = NavigationDebugger.NAV_MESH_DEBUG_NAME;\n merged.parent = this.debugDrawerParentNode;\n }\n }\n\n private _convertUnindexedToIndexed(mesh: Mesh): void {\n const vertexData = VertexData.ExtractFromMesh(mesh);\n const positions = vertexData.positions;\n\n if (!positions || positions.length % 9 !== 0) {\n Logger.Warn(\"Mesh must be fully unindexed with triangles.\");\n return;\n }\n\n const vertexCount = positions.length / 3;\n const indices = Array.from({ length: vertexCount }, (_, i) => i);\n\n const newVertexData = new VertexData();\n newVertexData.positions = positions;\n newVertexData.indices = indices;\n\n newVertexData.applyToMesh(mesh, true);\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./NavigationDebugger.js";
2
+ export * from "./simple-debug.js";
@@ -0,0 +1,3 @@
1
+ export * from "./NavigationDebugger.js";
2
+ export * from "./simple-debug.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/debug/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./NavigationDebugger\";\nexport * from \"./simple-debug\";\n"]}
@@ -0,0 +1,13 @@
1
+ import type { NavMesh } from "@recast-navigation/core";
2
+ import type { Scene } from "@onerjs/core/scene.js";
3
+ import type { Node } from "@onerjs/core/node.js";
4
+ import { Mesh } from "@onerjs/core/Meshes/mesh.js";
5
+ /**
6
+ * Creates a debug mesh for visualizing a NavMesh in the scene.
7
+ * @param navMesh The NavMesh to visualize.
8
+ * @param scene The scene in which to create the debug mesh.
9
+ * @param parent Optional parent node for the debug mesh.
10
+ * @param flags Poly flags to filter by, defaults to undefined to include all polys
11
+ * @returns The created debug mesh.
12
+ */
13
+ export declare function CreateDebugNavMesh(navMesh: NavMesh, scene: Scene, parent?: Node, flags?: number): Mesh;
@@ -0,0 +1,23 @@
1
+ import { Mesh } from "@onerjs/core/Meshes/mesh.js";
2
+ import { VertexData } from "@onerjs/core/Meshes/mesh.vertexData.js";
3
+ import { GetReversedIndices } from "../common/getters.js";
4
+ import { GetRecast } from "../factory/common.js";
5
+ /**
6
+ * Creates a debug mesh for visualizing a NavMesh in the scene.
7
+ * @param navMesh The NavMesh to visualize.
8
+ * @param scene The scene in which to create the debug mesh.
9
+ * @param parent Optional parent node for the debug mesh.
10
+ * @param flags Poly flags to filter by, defaults to undefined to include all polys
11
+ * @returns The created debug mesh.
12
+ */
13
+ export function CreateDebugNavMesh(navMesh, scene, parent, flags) {
14
+ const [positions, indices] = GetRecast().getNavMeshPositionsAndIndices(navMesh, flags);
15
+ const mesh = new Mesh("NavMeshDebug", scene);
16
+ const vertexData = new VertexData();
17
+ vertexData.indices = GetReversedIndices(indices);
18
+ vertexData.positions = positions;
19
+ vertexData.applyToMesh(mesh, false);
20
+ parent && (mesh.parent = parent);
21
+ return mesh;
22
+ }
23
+ //# sourceMappingURL=simple-debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-debug.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/debug/simple-debug.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,oCAAyB;AACxC,OAAO,EAAE,UAAU,EAAE,+CAAoC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgB,EAAE,KAAY,EAAE,MAAa,EAAE,KAAc;IAC5F,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,CAAC,6BAA6B,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAEvF,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,UAAU,CAAC,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACjD,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEpC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEjC,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import type { NavMesh } from \"@recast-navigation/core\";\n\nimport type { Scene } from \"core/scene\";\nimport type { Node } from \"core/node\";\nimport { Mesh } from \"core/Meshes/mesh\";\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\n\nimport { GetReversedIndices } from \"../common/getters\";\nimport { GetRecast } from \"../factory/common\";\n\n/**\n * Creates a debug mesh for visualizing a NavMesh in the scene.\n * @param navMesh The NavMesh to visualize.\n * @param scene The scene in which to create the debug mesh.\n * @param parent Optional parent node for the debug mesh.\n * @param flags Poly flags to filter by, defaults to undefined to include all polys\n * @returns The created debug mesh.\n */\nexport function CreateDebugNavMesh(navMesh: NavMesh, scene: Scene, parent?: Node, flags?: number) {\n const [positions, indices] = GetRecast().getNavMeshPositionsAndIndices(navMesh, flags);\n\n const mesh = new Mesh(\"NavMeshDebug\", scene);\n const vertexData = new VertexData();\n\n vertexData.indices = GetReversedIndices(indices);\n vertexData.positions = positions;\n vertexData.applyToMesh(mesh, false);\n\n parent && (mesh.parent = parent);\n\n return mesh;\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { RecastInjection } from "../types.js";
2
+ /**
3
+ * Gets the RecastInjection instance (reference to the recast-navigation-js library).
4
+ * @returns The RecastInjection instance
5
+ * @throws Error if Recast is not initialized
6
+ */
7
+ export declare function GetRecast(): RecastInjection;
8
+ /**
9
+ * Sets the RecastInjection instance (reference to the recast-navigation-js library).
10
+ * @param recast The RecastInjection instance to set
11
+ */
12
+ export declare function SetRecast(recast: RecastInjection): void;
13
+ /**
14
+ * Initialize the Manifold library
15
+ * @param version defines the version of the library to use, default is "0.43.0"
16
+ * @param options defines the options to use to initialize the library
17
+ */
18
+ export declare function InitRecast(version?: string, options?: {
19
+ instance: RecastInjection;
20
+ }): Promise<void>;
@@ -0,0 +1,80 @@
1
+ import { _LoadScriptModuleAsync } from "@onerjs/core/Misc/tools.internals.js";
2
+ /**
3
+ * Gets the RecastInjection instance (reference to the recast-navigation-js library).
4
+ * @returns The RecastInjection instance
5
+ * @throws Error if Recast is not initialized
6
+ */
7
+ export function GetRecast() {
8
+ if (!_Recast) {
9
+ throw new Error("Recast is not initialized. Please call InitRecast first.");
10
+ }
11
+ return _Recast;
12
+ }
13
+ /**
14
+ * Sets the RecastInjection instance (reference to the recast-navigation-js library).
15
+ * @param recast The RecastInjection instance to set
16
+ */
17
+ export function SetRecast(recast) {
18
+ _Recast = recast;
19
+ }
20
+ /**
21
+ * Reference to the recast-navigation-js library
22
+ */
23
+ let _Recast;
24
+ /**
25
+ * Promise to wait for the recast-navigation-js library to be ready
26
+ */
27
+ // eslint-disable-next-line @typescript-eslint/naming-convention
28
+ let _InitPromise = null;
29
+ /**
30
+ * Initialize the Manifold library
31
+ * @param version defines the version of the library to use, default is "0.43.0"
32
+ * @param options defines the options to use to initialize the library
33
+ */
34
+ export async function InitRecast(version = "0.43.0", options) {
35
+ const localOptions = {
36
+ url: "https://unpkg.com/@recast-navigation",
37
+ version,
38
+ ...options,
39
+ };
40
+ if (_Recast) {
41
+ return; // Already initialized
42
+ }
43
+ if (_InitPromise) {
44
+ await _InitPromise;
45
+ return;
46
+ }
47
+ if (localOptions.instance) {
48
+ _Recast = localOptions.instance;
49
+ }
50
+ else {
51
+ _InitPromise = ImportRecast(localOptions.url, localOptions.version);
52
+ const result = await _InitPromise;
53
+ // eslint-disable-next-line require-atomic-updates
54
+ _Recast = { ...result.core, ...result.generators };
55
+ await _Recast.init();
56
+ }
57
+ }
58
+ async function ImportRecast(baseUrl, version) {
59
+ const importMap = {
60
+ imports: {
61
+ // eslint-disable-next-line @typescript-eslint/naming-convention
62
+ "@recast-navigation/core": `${baseUrl}/core@${version}/dist/index.mjs`,
63
+ // eslint-disable-next-line @typescript-eslint/naming-convention
64
+ "@recast-navigation/wasm": `${baseUrl}/wasm@${version}/dist/recast-navigation.wasm-compat.js`,
65
+ // eslint-disable-next-line @typescript-eslint/naming-convention
66
+ "@recast-navigation/generators": `${baseUrl}/generators@${version}/dist/index.mjs`,
67
+ },
68
+ };
69
+ const script = document.createElement("script");
70
+ script.type = "importmap";
71
+ script.textContent = JSON.stringify(importMap);
72
+ document.body.appendChild(script);
73
+ const result = await _LoadScriptModuleAsync(`
74
+ import * as CoreModule from '${baseUrl}/core@${version}/dist/index.mjs';
75
+ import * as GeneratorsModule from '${baseUrl}/generators@${version}/dist/index.mjs';
76
+ const returnedValue = {core: CoreModule, generators: GeneratorsModule};
77
+ `);
78
+ return result;
79
+ }
80
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/factory/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,6CAAkC;AAKnE;;;;GAIG;AACH,MAAM,UAAU,SAAS;IACrB,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,MAAuB;IAC7C,OAAO,GAAG,MAAM,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,IAAI,OAAwB,CAAC;AAE7B;;GAEG;AACH,gEAAgE;AAChE,IAAI,YAAY,GAAsD,IAAI,CAAC;AAE3E;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC5B,OAAO,GAAG,QAAQ,EAClB,OAEC;IAED,MAAM,YAAY,GAAG;QACjB,GAAG,EAAE,sCAAsC;QAC3C,OAAO;QACP,GAAG,OAAO;KACb,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACV,OAAO,CAAC,sBAAsB;IAClC,CAAC;IAED,IAAI,YAAY,EAAE,CAAC;QACf,MAAM,YAAY,CAAC;QACnB,OAAO;IACX,CAAC;IAED,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;QACxB,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC;IACpC,CAAC;SAAM,CAAC;QACJ,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;QAEpE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;QAClC,kDAAkD;QAClD,OAAO,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAEnD,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;AACL,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,OAAe,EAAE,OAAe;IACxD,MAAM,SAAS,GAAG;QACd,OAAO,EAAE;YACL,gEAAgE;YAChE,yBAAyB,EAAE,GAAG,OAAO,SAAS,OAAO,iBAAiB;YACtE,gEAAgE;YAChE,yBAAyB,EAAE,GAAG,OAAO,SAAS,OAAO,wCAAwC;YAC7F,gEAAgE;YAChE,+BAA+B,EAAE,GAAG,OAAO,eAAe,OAAO,iBAAiB;SACrF;KACJ,CAAC;IAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAElC,MAAM,MAAM,GAAG,MAAM,sBAAsB,CACvC;+CACuC,OAAO,SAAS,OAAO;qDACjB,OAAO,eAAe,OAAO;;aAErE,CACR,CAAC;IACF,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { _LoadScriptModuleAsync } from \"core/Misc/tools.internals\";\nimport type { Nullable } from \"core/types\";\n\nimport type { RecastInjection } from \"../types\";\n\n/**\n * Gets the RecastInjection instance (reference to the recast-navigation-js library).\n * @returns The RecastInjection instance\n * @throws Error if Recast is not initialized\n */\nexport function GetRecast(): RecastInjection {\n if (!_Recast) {\n throw new Error(\"Recast is not initialized. Please call InitRecast first.\");\n }\n return _Recast;\n}\n\n/**\n * Sets the RecastInjection instance (reference to the recast-navigation-js library).\n * @param recast The RecastInjection instance to set\n */\nexport function SetRecast(recast: RecastInjection) {\n _Recast = recast;\n}\n\n/**\n * Reference to the recast-navigation-js library\n */\nlet _Recast: RecastInjection;\n\n/**\n * Promise to wait for the recast-navigation-js library to be ready\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nlet _InitPromise: Nullable<Promise<{ core: any; generators: any }>> = null;\n\n/**\n * Initialize the Manifold library\n * @param version defines the version of the library to use, default is \"0.43.0\"\n * @param options defines the options to use to initialize the library\n */\nexport async function InitRecast(\n version = \"0.43.0\",\n options?: {\n instance: RecastInjection;\n }\n) {\n const localOptions = {\n url: \"https://unpkg.com/@recast-navigation\",\n version,\n ...options,\n };\n\n if (_Recast) {\n return; // Already initialized\n }\n\n if (_InitPromise) {\n await _InitPromise;\n return;\n }\n\n if (localOptions.instance) {\n _Recast = localOptions.instance;\n } else {\n _InitPromise = ImportRecast(localOptions.url, localOptions.version);\n\n const result = await _InitPromise;\n // eslint-disable-next-line require-atomic-updates\n _Recast = { ...result.core, ...result.generators };\n\n await _Recast.init();\n }\n}\n\nasync function ImportRecast(baseUrl: string, version: string) {\n const importMap = {\n imports: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \"@recast-navigation/core\": `${baseUrl}/core@${version}/dist/index.mjs`,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \"@recast-navigation/wasm\": `${baseUrl}/wasm@${version}/dist/recast-navigation.wasm-compat.js`,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \"@recast-navigation/generators\": `${baseUrl}/generators@${version}/dist/index.mjs`,\n },\n };\n\n const script = document.createElement(\"script\");\n script.type = \"importmap\";\n script.textContent = JSON.stringify(importMap);\n document.body.appendChild(script);\n\n const result = await _LoadScriptModuleAsync(\n `\n import * as CoreModule from '${baseUrl}/core@${version}/dist/index.mjs';\n import * as GeneratorsModule from '${baseUrl}/generators@${version}/dist/index.mjs';\n const returnedValue = {core: CoreModule, generators: GeneratorsModule};\n `\n );\n return result;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { RecastNavigationJSPluginV2 } from "../plugin/RecastNavigationJSPlugin.js";
2
+ /**
3
+ * Creates a navigation plugin for the given scene.
4
+ * @returns A promise that resolves to the created navigation plugin.
5
+ * @remarks This function initializes the Recast module and sets up the navigation plugin.
6
+ */
7
+ export declare function CreateNavigationPluginAsync(): Promise<RecastNavigationJSPluginV2>;
@@ -0,0 +1,15 @@
1
+ import { InjectGenerators } from "../generator/injection.js";
2
+ import { RecastNavigationJSPluginV2 } from "../plugin/RecastNavigationJSPlugin.js";
3
+ import { GetRecast, InitRecast } from "./common.js";
4
+ /**
5
+ * Creates a navigation plugin for the given scene.
6
+ * @returns A promise that resolves to the created navigation plugin.
7
+ * @remarks This function initializes the Recast module and sets up the navigation plugin.
8
+ */
9
+ export async function CreateNavigationPluginAsync() {
10
+ await InitRecast();
11
+ const navigationPlugin = new RecastNavigationJSPluginV2(GetRecast());
12
+ InjectGenerators(navigationPlugin);
13
+ return navigationPlugin;
14
+ }
15
+ //# sourceMappingURL=factory.single-thread.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.single-thread.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/factory/factory.single-thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B;IAC7C,MAAM,UAAU,EAAE,CAAC;IAEnB,MAAM,gBAAgB,GAAG,IAAI,0BAA0B,CAAC,SAAS,EAAE,CAAC,CAAC;IACrE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAEnC,OAAO,gBAAgB,CAAC;AAC5B,CAAC","sourcesContent":["import { InjectGenerators } from \"../generator/injection\";\nimport { RecastNavigationJSPluginV2 } from \"../plugin/RecastNavigationJSPlugin\";\nimport { GetRecast, InitRecast } from \"./common\";\n\n/**\n * Creates a navigation plugin for the given scene.\n * @returns A promise that resolves to the created navigation plugin.\n * @remarks This function initializes the Recast module and sets up the navigation plugin.\n */\nexport async function CreateNavigationPluginAsync() {\n await InitRecast();\n\n const navigationPlugin = new RecastNavigationJSPluginV2(GetRecast());\n InjectGenerators(navigationPlugin);\n\n return navigationPlugin;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { RecastNavigationJSPluginV2 } from "../plugin/RecastNavigationJSPlugin.js";
2
+ /**
3
+ * Creates a navigation plugin for the given scene using a worker.
4
+ * @returns A promise that resolves to the created navigation plugin.
5
+ * @remarks This function initializes the Recast module and sets up the navigation plugin to use a worker.
6
+ * The worker is used to handle the creation of the navigation mesh asynchronously.
7
+ * The `createNavMesh` method is not supported in worker mode, use `createNavMeshAsync` instead.
8
+ */
9
+ export declare function CreateNavigationPluginWorkerAsync(): Promise<RecastNavigationJSPluginV2>;
@@ -0,0 +1,40 @@
1
+ import { init as initRecast } from "@recast-navigation/core";
2
+ import { Logger } from "@onerjs/core/Misc/logger.js";
3
+ import { RecastNavigationJSPluginV2 } from "../plugin/RecastNavigationJSPlugin.js";
4
+ import { GenerateNavMeshWithWorker } from "../generator/generator.worker.js";
5
+ import { CreateNavigationPluginAsync } from "./factory.single-thread.js";
6
+ import { GenerateNavMeshWorker } from "../worker/navmesh-worker.js";
7
+ /**
8
+ * Creates a navigation plugin for the given scene using a worker.
9
+ * @returns A promise that resolves to the created navigation plugin.
10
+ * @remarks This function initializes the Recast module and sets up the navigation plugin to use a worker.
11
+ * The worker is used to handle the creation of the navigation mesh asynchronously.
12
+ * The `createNavMesh` method is not supported in worker mode, use `createNavMeshAsync` instead.
13
+ */
14
+ export async function CreateNavigationPluginWorkerAsync() {
15
+ if (window && !window.Worker) {
16
+ Logger.Error("Web Workers are not supported in this environment. Please ensure your environment supports Web Workers.");
17
+ return await CreateNavigationPluginAsync(); // Fallback to single-threaded version
18
+ }
19
+ await initRecast();
20
+ const plugin = new RecastNavigationJSPluginV2();
21
+ // Convert the worker function to a blob
22
+ const workerBlob = new Blob([`(${GenerateNavMeshWorker.toString()})()`], { type: "application/javascript" });
23
+ const worker = new Worker(URL.createObjectURL(workerBlob));
24
+ plugin.createNavMesh = () => {
25
+ Logger.Warn("createNavMesh is not supported in worker mode, use createNavMeshAsync instead.");
26
+ return null;
27
+ };
28
+ plugin.createNavMeshAsync = async (meshes, parameters) => {
29
+ return await new Promise((resolve, _reject) => {
30
+ GenerateNavMeshWithWorker(meshes, parameters, {
31
+ worker,
32
+ completion: (navMesh, navMeshQuery, tileCache) => {
33
+ resolve({ navMesh, navMeshQuery, tileCache });
34
+ },
35
+ });
36
+ });
37
+ };
38
+ return plugin;
39
+ }
40
+ //# sourceMappingURL=factory.worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.worker.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/factory/factory.worker.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,oCAAyB;AAG1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC;IACnD,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,KAAK,CAAC,yGAAyG,CAAC,CAAC;QACxH,OAAO,MAAM,2BAA2B,EAAE,CAAC,CAAC,sCAAsC;IACtF,CAAC;IAED,MAAM,UAAU,EAAE,CAAC;IAEnB,MAAM,MAAM,GAAG,IAAI,0BAA0B,EAAE,CAAC;IAEhD,wCAAwC;IACxC,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,qBAAqB,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAC7G,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IAE3D,MAAM,CAAC,aAAa,GAAG,GAAG,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;QAC9F,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;IAEF,MAAM,CAAC,kBAAkB,GAAG,KAAK,EAAE,MAAc,EAAE,UAAgC,EAAE,EAAE;QACnF,OAAO,MAAM,IAAI,OAAO,CAIrB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;YACpB,yBAAyB,CAAC,MAAM,EAAE,UAAU,EAAE;gBAC1C,MAAM;gBACN,UAAU,EAAE,CAAC,OAAgB,EAAE,YAA0B,EAAE,SAAqB,EAAE,EAAE;oBAChF,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;gBAClD,CAAC;aACJ,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["/**\n * IMPORTANT!\n * This file is still under construction and will change in the future.\n * Workers are not yet supported.\n * For more info visit: https://forum.babylonjs.com/t/replacing-recastjs-with-recast-navigation-js/56003/46\n */\nimport type { NavMesh, NavMeshQuery, TileCache } from \"@recast-navigation/core\";\nimport { init as initRecast } from \"@recast-navigation/core\";\n\nimport { Logger } from \"core/Misc/logger\";\nimport type { Mesh } from \"core/Meshes/mesh\";\n\nimport { RecastNavigationJSPluginV2 } from \"../plugin/RecastNavigationJSPlugin\";\nimport type { INavMeshParametersV2 } from \"../types\";\nimport { GenerateNavMeshWithWorker } from \"../generator/generator.worker\";\nimport { CreateNavigationPluginAsync } from \"./factory.single-thread\";\nimport { GenerateNavMeshWorker } from \"../worker/navmesh-worker\";\n\n/**\n * Creates a navigation plugin for the given scene using a worker.\n * @returns A promise that resolves to the created navigation plugin.\n * @remarks This function initializes the Recast module and sets up the navigation plugin to use a worker.\n * The worker is used to handle the creation of the navigation mesh asynchronously.\n * The `createNavMesh` method is not supported in worker mode, use `createNavMeshAsync` instead.\n */\nexport async function CreateNavigationPluginWorkerAsync() {\n if (window && !window.Worker) {\n Logger.Error(\"Web Workers are not supported in this environment. Please ensure your environment supports Web Workers.\");\n return await CreateNavigationPluginAsync(); // Fallback to single-threaded version\n }\n\n await initRecast();\n\n const plugin = new RecastNavigationJSPluginV2();\n\n // Convert the worker function to a blob\n const workerBlob = new Blob([`(${GenerateNavMeshWorker.toString()})()`], { type: \"application/javascript\" });\n const worker = new Worker(URL.createObjectURL(workerBlob));\n\n plugin.createNavMesh = () => {\n Logger.Warn(\"createNavMesh is not supported in worker mode, use createNavMeshAsync instead.\");\n return null;\n };\n\n plugin.createNavMeshAsync = async (meshes: Mesh[], parameters: INavMeshParametersV2) => {\n return await new Promise<{\n navMesh: NavMesh;\n navMeshQuery: NavMeshQuery;\n tileCache?: TileCache;\n }>((resolve, _reject) => {\n GenerateNavMeshWithWorker(meshes, parameters, {\n worker,\n completion: (navMesh: NavMesh, navMeshQuery: NavMeshQuery, tileCache?: TileCache) => {\n resolve({ navMesh, navMeshQuery, tileCache });\n },\n });\n });\n };\n\n return plugin;\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from "./factory.single-thread.js";
@@ -0,0 +1,3 @@
1
+ // export * from "./factory.worker.js";
2
+ export * from "./factory.single-thread.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/factory/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,cAAc,yBAAyB,CAAC","sourcesContent":["// export * from \"./factory.worker\";\nexport * from \"./factory.single-thread\";\n"]}
@@ -0,0 +1,25 @@
1
+ import type { TileCacheMeshProcess } from "@recast-navigation/core";
2
+ /**
3
+ * Builds a NavMesh and NavMeshQuery from serialized data.
4
+ * @param data The serialized NavMesh data.
5
+ * @returns An object containing the NavMesh and NavMeshQuery.
6
+ * @remarks This function deserializes the NavMesh data and creates a NavMeshQuery
7
+ * instance for querying the NavMesh.
8
+ * @throws Error if the NavMesh data is invalid or cannot be deserialized.
9
+ */
10
+ export declare function BuildFromNavmeshData(data: Uint8Array): {
11
+ navMesh: any;
12
+ navMeshQuery: any;
13
+ tileCache: undefined;
14
+ };
15
+ /**
16
+ * Builds a TileCache and NavMeshQuery from serialized data.
17
+ * @param data The serialized TileCache data.
18
+ * @param tileCacheMeshProcess Optional function to process the TileCache mesh.
19
+ * @returns An object containing the TileCache, NavMesh, and NavMeshQuery.
20
+ */
21
+ export declare function BuildFromTileCacheData(data: Uint8Array, tileCacheMeshProcess: TileCacheMeshProcess): {
22
+ navMesh: any;
23
+ navMeshQuery: any;
24
+ tileCache: any;
25
+ };
@@ -0,0 +1,40 @@
1
+ import { GetRecast } from "../factory/common.js";
2
+ /**
3
+ * Builds a NavMesh and NavMeshQuery from serialized data.
4
+ * @param data The serialized NavMesh data.
5
+ * @returns An object containing the NavMesh and NavMeshQuery.
6
+ * @remarks This function deserializes the NavMesh data and creates a NavMeshQuery
7
+ * instance for querying the NavMesh.
8
+ * @throws Error if the NavMesh data is invalid or cannot be deserialized.
9
+ */
10
+ export function BuildFromNavmeshData(data) {
11
+ const recast = GetRecast();
12
+ const result = recast.importNavMesh(data);
13
+ if (!result.navMesh) {
14
+ throw new Error(`Unable to deserialize NavMesh.`);
15
+ }
16
+ return {
17
+ navMesh: result.navMesh,
18
+ navMeshQuery: new recast.NavMeshQuery(result.navMesh),
19
+ tileCache: undefined,
20
+ };
21
+ }
22
+ /**
23
+ * Builds a TileCache and NavMeshQuery from serialized data.
24
+ * @param data The serialized TileCache data.
25
+ * @param tileCacheMeshProcess Optional function to process the TileCache mesh.
26
+ * @returns An object containing the TileCache, NavMesh, and NavMeshQuery.
27
+ */
28
+ export function BuildFromTileCacheData(data, tileCacheMeshProcess) {
29
+ const recast = GetRecast();
30
+ const result = recast.importTileCache(data, tileCacheMeshProcess);
31
+ if (!result.tileCache) {
32
+ throw new Error(`Unable to deserialize TileCache.`);
33
+ }
34
+ return {
35
+ navMesh: result.navMesh,
36
+ navMeshQuery: new recast.NavMeshQuery(result.navMesh),
37
+ tileCache: result.tileCache,
38
+ };
39
+ }
40
+ //# sourceMappingURL=generator.common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.common.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/generator/generator.common.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAgB;IACjD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAE1C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACH,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,YAAY,EAAE,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC;QACrD,SAAS,EAAE,SAAS;KACvB,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAgB,EAAE,oBAA0C;IAC/F,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAElE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO;QACH,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,YAAY,EAAE,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC;QACrD,SAAS,EAAE,MAAM,CAAC,SAAS;KAC9B,CAAC;AACN,CAAC","sourcesContent":["import type { TileCacheMeshProcess } from \"@recast-navigation/core\";\n\nimport { GetRecast } from \"../factory/common\";\n\n/**\n * Builds a NavMesh and NavMeshQuery from serialized data.\n * @param data The serialized NavMesh data.\n * @returns An object containing the NavMesh and NavMeshQuery.\n * @remarks This function deserializes the NavMesh data and creates a NavMeshQuery\n * instance for querying the NavMesh.\n * @throws Error if the NavMesh data is invalid or cannot be deserialized.\n */\nexport function BuildFromNavmeshData(data: Uint8Array) {\n const recast = GetRecast();\n const result = recast.importNavMesh(data);\n\n if (!result.navMesh) {\n throw new Error(`Unable to deserialize NavMesh.`);\n }\n\n return {\n navMesh: result.navMesh,\n navMeshQuery: new recast.NavMeshQuery(result.navMesh),\n tileCache: undefined,\n };\n}\n\n/**\n * Builds a TileCache and NavMeshQuery from serialized data.\n * @param data The serialized TileCache data.\n * @param tileCacheMeshProcess Optional function to process the TileCache mesh.\n * @returns An object containing the TileCache, NavMesh, and NavMeshQuery.\n */\nexport function BuildFromTileCacheData(data: Uint8Array, tileCacheMeshProcess: TileCacheMeshProcess) {\n const recast = GetRecast();\n const result = recast.importTileCache(data, tileCacheMeshProcess);\n\n if (!result.tileCache) {\n throw new Error(`Unable to deserialize TileCache.`);\n }\n\n return {\n navMesh: result.navMesh,\n navMeshQuery: new recast.NavMeshQuery(result.navMesh),\n tileCache: result.tileCache,\n };\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { Mesh } from "@onerjs/core/Meshes/mesh.js";
2
+ import type { INavMeshParametersV2 } from "../types.js";
3
+ /**
4
+ * Builds a NavMesh and NavMeshQuery from meshes using provided parameters.
5
+ * @param meshes The array of meshes used to create the NavMesh.
6
+ * @param parameters The parameters used to configure the NavMesh generation.
7
+ * @returns An object containing the NavMesh and NavMeshQuery.
8
+ * @remarks This function generates a NavMesh based on the provided meshes and parameters.
9
+ * It supports different configurations such as solo, tiled, and tile cache nav meshes.
10
+ * If you need obstacles, ensure that `maxObstacles` is set to a value greater than 0.
11
+ * Recommended values for `tileSize` are between 32 and 64 when using obstacles/tile cache.
12
+ * If you need a tiled nav mesh, ensure that `tileSize` is set to a value greater than 0.
13
+ * @throws Error if the NavMesh data is invalid or cannot be deserialized.
14
+ */
15
+ export declare function GenerateNavMesh(meshes: Array<Mesh>, parameters: INavMeshParametersV2): {
16
+ navMesh: any;
17
+ intermediates: any;
18
+ navMeshQuery: any;
19
+ tileCache: any;
20
+ };
@@ -0,0 +1,57 @@
1
+ import { Logger } from "@onerjs/core/Misc/logger.js";
2
+ import { GetPositionsAndIndices } from "../common/getters.js";
3
+ import { CreateSoloNavMeshConfig, CreateTileCacheNavMeshConfig, CreateTiledNavMeshConfig } from "../common/config.js";
4
+ import { GetRecast } from "../factory/common.js";
5
+ /**
6
+ * Builds a NavMesh and NavMeshQuery from meshes using provided parameters.
7
+ * @param meshes The array of meshes used to create the NavMesh.
8
+ * @param parameters The parameters used to configure the NavMesh generation.
9
+ * @returns An object containing the NavMesh and NavMeshQuery.
10
+ * @remarks This function generates a NavMesh based on the provided meshes and parameters.
11
+ * It supports different configurations such as solo, tiled, and tile cache nav meshes.
12
+ * If you need obstacles, ensure that `maxObstacles` is set to a value greater than 0.
13
+ * Recommended values for `tileSize` are between 32 and 64 when using obstacles/tile cache.
14
+ * If you need a tiled nav mesh, ensure that `tileSize` is set to a value greater than 0.
15
+ * @throws Error if the NavMesh data is invalid or cannot be deserialized.
16
+ */
17
+ export function GenerateNavMesh(meshes, parameters) {
18
+ const recast = GetRecast();
19
+ if (meshes.length === 0) {
20
+ throw new Error("At least one mesh is needed to create the nav mesh.");
21
+ }
22
+ const [positions, indices] = GetPositionsAndIndices(meshes);
23
+ if (!positions || !indices) {
24
+ throw new Error("Unable to get nav mesh. No vertices or indices.");
25
+ }
26
+ // Decide on the type of nav mesh to generate based on parameters
27
+ // If tileSize is set, we will generate a tiled nav mesh
28
+ // If maxObstacles is set, we will generate a tile cache nav mesh
29
+ // Otherwise, we will generate a solo nav mesh
30
+ // Note: tileSize is only used for tiled nav meshes, not tile cache nav meshes
31
+ // If both tileSize and maxObstacles are set, we will generate a tile cache
32
+ const tileSize = parameters.tileSize ?? 0;
33
+ const needsTileCache = (parameters.maxObstacles ?? 0) > 0;
34
+ const needsTiledNavMesh = tileSize > 0;
35
+ if (needsTileCache) {
36
+ if (tileSize < 32 || tileSize > 64) {
37
+ Logger.Warn("NavigationPlugin: Tile cache is enabled. Recommended tileSize is 32 to 64. Other values may lead to unexpected behavior.");
38
+ }
39
+ }
40
+ // Create the appropriate configuration based on the parameters
41
+ const config = needsTileCache ? CreateTileCacheNavMeshConfig(parameters) : needsTiledNavMesh ? CreateTiledNavMeshConfig(parameters) : CreateSoloNavMeshConfig(parameters);
42
+ const result = needsTileCache
43
+ ? recast.generateTileCache(positions, indices, config, parameters.keepIntermediates)
44
+ : needsTiledNavMesh
45
+ ? recast.generateTiledNavMesh(positions, indices, config, parameters.keepIntermediates)
46
+ : recast.generateSoloNavMesh(positions, indices, config, parameters.keepIntermediates);
47
+ if (!result.success) {
48
+ throw new Error(`Unable to generateSoloNavMesh: ${result.error}`);
49
+ }
50
+ return {
51
+ navMesh: result.navMesh,
52
+ intermediates: result.intermediates,
53
+ navMeshQuery: new recast.NavMeshQuery(result.navMesh),
54
+ tileCache: "tileCache" in result ? result.tileCache : undefined,
55
+ };
56
+ }
57
+ //# sourceMappingURL=generator.single-thread.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.single-thread.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/generator/generator.single-thread.ts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,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC1K,MAAM,MAAM,GAAG,cAAc;QACzB,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,MAAkC,EAAE,UAAU,CAAC,iBAAiB,CAAC;QAChH,CAAC,CAAC,iBAAiB;YACjB,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,MAAqC,EAAE,UAAU,CAAC,iBAAiB,CAAC;YACtH,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,EAAE,MAAoC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAE3H,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACH,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,YAAY,EAAE,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC;QACrD,SAAS,EAAE,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;KAClE,CAAC;AACN,CAAC","sourcesContent":["import type { SoloNavMeshGeneratorConfig, TileCacheGeneratorConfig, TiledNavMeshGeneratorConfig } from \"@recast-navigation/generators\";\n\nimport { Logger } from \"core/Misc/logger\";\nimport type { Mesh } from \"core/Meshes/mesh\";\n\nimport type { INavMeshParametersV2 } from \"../types\";\nimport { GetPositionsAndIndices } from \"../common/getters\";\nimport { CreateSoloNavMeshConfig, CreateTileCacheNavMeshConfig, CreateTiledNavMeshConfig } from \"../common/config\";\nimport { GetRecast } from \"../factory/common\";\n\n/**\n * Builds a NavMesh and NavMeshQuery from meshes using provided parameters.\n * @param meshes The array of meshes used to create the NavMesh.\n * @param parameters The parameters used to configure the NavMesh generation.\n * @returns An object containing the NavMesh and NavMeshQuery.\n * @remarks This function generates a NavMesh based on the provided meshes and parameters.\n * It supports different configurations such as solo, tiled, and tile cache nav meshes.\n * If you need obstacles, ensure that `maxObstacles` is set to a value greater than 0.\n * Recommended values for `tileSize` are between 32 and 64 when using obstacles/tile cache.\n * If you need a tiled nav mesh, ensure that `tileSize` is set to a value greater than 0.\n * @throws Error if the NavMesh data is invalid or cannot be deserialized.\n */\nexport function GenerateNavMesh(meshes: Array<Mesh>, parameters: INavMeshParametersV2) {\n const recast = GetRecast();\n\n if (meshes.length === 0) {\n throw new Error(\"At least one mesh is needed to create the nav mesh.\");\n }\n\n const [positions, indices] = GetPositionsAndIndices(meshes);\n if (!positions || !indices) {\n throw new Error(\"Unable to get nav mesh. No vertices or indices.\");\n }\n\n // Decide on the type of nav mesh to generate based on parameters\n // If tileSize is set, we will generate a tiled nav mesh\n // If maxObstacles is set, we will generate a tile cache nav mesh\n // Otherwise, we will generate a solo nav mesh\n // Note: tileSize is only used for tiled nav meshes, not tile cache nav meshes\n // If both tileSize and maxObstacles are set, we will generate a tile cache\n const tileSize = parameters.tileSize ?? 0;\n const needsTileCache = (parameters.maxObstacles ?? 0) > 0;\n const needsTiledNavMesh = tileSize > 0;\n if (needsTileCache) {\n if (tileSize < 32 || tileSize > 64) {\n Logger.Warn(\"NavigationPlugin: Tile cache is enabled. Recommended tileSize is 32 to 64. Other values may lead to unexpected behavior.\");\n }\n }\n\n // Create the appropriate configuration based on the parameters\n const config = needsTileCache ? CreateTileCacheNavMeshConfig(parameters) : needsTiledNavMesh ? CreateTiledNavMeshConfig(parameters) : CreateSoloNavMeshConfig(parameters);\n const result = needsTileCache\n ? recast.generateTileCache(positions, indices, config as TileCacheGeneratorConfig, parameters.keepIntermediates)\n : needsTiledNavMesh\n ? recast.generateTiledNavMesh(positions, indices, config as TiledNavMeshGeneratorConfig, parameters.keepIntermediates)\n : recast.generateSoloNavMesh(positions, indices, config as SoloNavMeshGeneratorConfig, parameters.keepIntermediates);\n\n if (!result.success) {\n throw new Error(`Unable to generateSoloNavMesh: ${result.error}`);\n }\n\n return {\n navMesh: result.navMesh,\n intermediates: result.intermediates,\n navMeshQuery: new recast.NavMeshQuery(result.navMesh),\n tileCache: \"tileCache\" in result ? result.tileCache : undefined,\n };\n}\n"]}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * IMPORTANT!
3
+ * This file is still under construction and will change in the future.
4
+ * Workers are not yet supported.
5
+ * For more info visit: https://forum.babylonjs.com/t/replacing-recastjs-with-recast-navigation-js/56003/46
6
+ */
7
+ import type { NavMeshQuery, NavMesh, TileCache } from "@recast-navigation/core";
8
+ import type { Mesh } from "@onerjs/core/Meshes/mesh.js";
9
+ import type { INavMeshParametersV2 } from "../types.js";
10
+ /**
11
+ * Builds a NavMesh and NavMeshQuery from meshes using provided parameters.
12
+ * @param meshes The array of meshes used to create the NavMesh.
13
+ * @param parameters The parameters used to configure the NavMesh generation.
14
+ * @param workerOptions Options for the worker, including a completion callback and the worker instance.
15
+ * @throws Error if the NavMesh data is invalid or cannot be deserialized.
16
+ */
17
+ export declare function GenerateNavMeshWithWorker(meshes: Array<Mesh>, parameters: INavMeshParametersV2, workerOptions: {
18
+ /**
19
+ * Completion callback that is called when the NavMesh generation is complete.
20
+ * @param navMesh The generated NavMesh.
21
+ * @param navMeshQuery The NavMeshQuery associated with the generated NavMesh.
22
+ * @param tileCache Optional TileCache if tile cache generation was used.
23
+ */
24
+ completion: (navMesh: NavMesh, navMeshQuery: NavMeshQuery, tileCache?: TileCache) => void;
25
+ /**
26
+ * Worker instance used for asynchronous NavMesh generation.
27
+ */
28
+ worker: Worker;
29
+ }): void;