import { type DebugDrawerPrimitive, type DebugDrawerPrimitiveType, type NavMesh, type NavMeshQuery, type RecastCompactHeightfield, type RecastContourSet, type RecastHeightfield, type RecastHeightfieldLayer, type RecastHeightfieldLayerSet, type RecastPolyMesh, type RecastPolyMeshDetail } from "@recast-navigation/core"; import { type GreasedLineMaterialOptions } from "@babylonjs/core/Materials/GreasedLine/greasedLineMaterialInterfaces.js"; import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js"; import { type GreasedLineMeshOptions } from "@babylonjs/core/Meshes/GreasedLine/greasedLineBaseMesh.js"; import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js"; import { type Scene } from "@babylonjs/core/scene.js"; import { type GeneratorIntermediates } from "../types.js"; export declare const DebugLayerOption: { HEIGHTFIELD_SOLID: string; HEIGHTFIELD_WALKABLE: string; COMPACT_HEIGHTFIELD_SOLID: string; COMPACT_HEIGHTFIELD_REGIONS: string; COMPACT_HEIGHTFIELD_DISTANCE: string; RAW_CONTOURS: string; CONTOURS: string; POLY_MESH: string; POLY_MESH_DETAIL: string; NAVMESH: string; NAVMESH_BV_TREE: string; }; export type DebugLayerOptions = (typeof DebugLayerOption)[keyof typeof DebugLayerOption]; /** * NavigationDebugger is a utility class for visualizing navigation meshes and related data in a Babylon.js scene. * It provides methods to draw various navigation-related primitives such as points, lines, triangles, and quads. * It also supports drawing heightfields, compact heightfields, contours, poly meshes, and nav meshes. */ export declare class NavigationDebugger { private _scene; /** * The name of the debug mesh used for navigation debugging. * This is used to group all navigation debug meshes under a single name for easier management */ static NAV_MESH_DEBUG_NAME: string; /** * The name of the debug mesh used for visualization of the navigation mesh using points. */ static NAV_MESH_DEBUG_NAME_POINTS: string; /** * The name of the debug mesh used for visualization of the navigation mesh using triangles. */ static NAV_MESH_DEBUG_NAME_TRIS: string; /** * The name of the debug mesh used for visualization of the navigation mesh using quads. */ static NAV_MESH_DEBUG_NAME_QUADS: string; /** * The name of the debug mesh used for visualization of the navigation mesh using lines. */ static NAV_MESH_DEBUG_NAME_LINES: string; /** * The material used for rendering triangles in the navigation debug visualization. */ triMaterial: StandardMaterial; /** * The material used for rendering points in the navigation debug visualization. */ pointMaterial: StandardMaterial; /** * The list of line materials used in the navigation debug visualization. */ lineMaterials: StandardMaterial[]; /** * The parent node for the debug drawer. */ debugDrawerParentNode: TransformNode; /** * * Gets or sets the primitive types to be drawn by the debug drawer. * * This allows you to control which types of primitives (points, lines, tris, quads) are rendered in the navigation debug visualization. * * The default value is `["points", "lines", "tris", "quads"]`. * * You can modify this property to include or exclude specific primitive types based on your debugging needs. * @returns An array of primitive types that the debug drawer will render. */ get primitiveTypes(): DebugDrawerPrimitiveType[]; set primitiveTypes(value: DebugDrawerPrimitiveType[]); private _lineMaterialOptions; private _pointMesh; private _debugDrawerUtils; private _primitiveTypes; constructor(_scene: Scene, options?: { parent?: { node?: TransformNode | string; }; primitiveTypes?: DebugDrawerPrimitiveType[]; materials?: { triMaterial?: StandardMaterial; pointMaterial?: StandardMaterial; lineMaterialOptions: { greasedLineMaterialOptions: Partial; greasedLineMeshOptions: Partial; }; }; }); /** * Resets the debug drawer by disposing of all child meshes in the debug drawer parent node. * This is useful for clearing the debug visualization before drawing new primitives. */ clear(): void; /** * Disposes of the debug drawer, including all meshes and materials used for rendering. * This method should be called when the debug drawer is no longer needed to free up resources. */ dispose(): void; /** * This method iterates through the provided primitives and draws them based on their type. * It supports drawing points, lines, triangles, and quads, depending on the primitive type. * @param primitives An array of debug drawer primitives to be drawn. * @param options Optional parameters to control the drawing behavior, such as whether to join meshes. */ drawPrimitives(primitives: DebugDrawerPrimitive[], options?: { joinMeshes?: boolean; }): void; /** * Draws a heightfield as solid using the debug drawer utilities. * @param hf The heightfield to draw as solid. */ drawHeightfieldSolid(hf: RecastHeightfield): void; /** * Draws a heightfield as walkable using the debug drawer utilities. * @param hf The heightfield to draw as walkable. */ drawHeightfieldWalkable(hf: RecastHeightfield): void; /** * Draws a compact heightfield as solid using the debug drawer utilities. * @param chf The compact heightfield to draw as solid. */ drawCompactHeightfieldSolid(chf: RecastCompactHeightfield): void; /** * Draws the regions of a compact heightfield using the debug drawer utilities. * @param chf The compact heightfield to draw regions for. */ drawCompactHeightfieldRegions(chf: RecastCompactHeightfield): void; /** * Draws the distance field of a compact heightfield using the debug drawer utilities. * @param chf The compact heightfield to draw the distance for. */ drawCompactHeightfieldDistance(chf: RecastCompactHeightfield): void; /** * Draws a heightfield layer using the debug drawer utilities. * @param layer The heightfield layer to draw. * @param idx The index of the layer to draw. */ drawHeightfieldLayer(layer: RecastHeightfieldLayer, idx: number): void; /** * Draws the layers of a heightfield using the debug drawer utilities. * @param lset The heightfield layer set containing the layers to draw. */ drawHeightfieldLayers(lset: RecastHeightfieldLayerSet): void; /** * Draws the region connections of a RecastContourSet using the debug drawer utilities. * @param cset RecastContourSet to draw * @param alpha The alpha value for the drawn contours, default is 1. */ drawRegionConnections(cset: RecastContourSet, alpha?: number): void; /** * Draws raw contours from a RecastContourSet using the debug drawer utilities. * @param cset RecastContourSet to draw * @param alpha The alpha value for the drawn contours, default is 1. */ drawRawContours(cset: RecastContourSet, alpha?: number): void; /** * Draws contours from a RecastContourSet using the debug drawer utilities. * @param cset RecastContourSet to draw * @param alpha The alpha value for the drawn contours, default is 1. */ drawContours(cset: RecastContourSet, alpha?: number): void; /** * Draws a poly mesh using the debug drawer utilities. * @param mesh RecastPolyMesh to draw */ drawPolyMesh(mesh: RecastPolyMesh): void; /** * Draws a poly mesh detail using the debug drawer utilities. * @param dmesh RecastPolyMeshDetail to draw */ drawPolyMeshDetail(dmesh: RecastPolyMeshDetail): void; /** * Draws a NavMesh using the debug drawer utilities. * @param mesh NavMesh to draw * @param flags Flags to control the drawing behavior, default is 0. */ drawNavMesh(mesh: NavMesh, flags?: number): void; /** * Draws a NavMesh with closed list using the debug drawer utilities. * @param mesh NavMesh to draw * @param query NavMeshQuery to use for drawing the closed list. * @param flags Flags to control the drawing behavior, default is 0. */ drawNavMeshWithClosedList(mesh: NavMesh, query: NavMeshQuery, flags?: number): void; /** * Draws the nodes of a NavMesh using the debug drawer utilities. * @param query NavMeshQuery to use for drawing the nodes. */ drawNavMeshNodes(query: NavMeshQuery): void; /** * Draws the bounding volume tree of a NavMesh using the debug drawer utilities. * @param mesh NavMesh to draw the bounding volume tree for. */ drawNavMeshBVTree(mesh: NavMesh): void; /** * Draws the portals of a NavMesh using the debug drawer utilities. * @param mesh NavMesh to draw the portals for. */ drawNavMeshPortals(mesh: NavMesh): void; /** * Draws polygons of a NavMesh with specific flags using the debug drawer utilities. * @param mesh NavMesh to draw the polygons with specific flags. * @param flags The flags to filter the polygons to be drawn. * @param col The color to use for the drawn polygons, represented as a number. */ drawNavMeshPolysWithFlags(mesh: NavMesh, flags: number, col: number): void; /** * Draws polygons of a NavMesh with specific reference and color using the debug drawer utilities. * @param mesh NavMesh to draw the polygons with specific reference and color. * @param ref The reference number of the polygons to be drawn. * @param col The color to use for the drawn polygons, represented as a number. */ drawNavMeshPoly(mesh: NavMesh, ref: number, col: number): void; /** * Get the intermediates from the generator * @param intermediates - The generator intermediates * @returns An object containing lists of heightfields, compact heightfields, contour sets */ getIntermediates: (intermediates: GeneratorIntermediates) => { heightfieldList: RecastHeightfield[]; compactHeightfieldList: RecastCompactHeightfield[]; contourSetList: RecastContourSet[]; polyMeshList: RecastPolyMesh[]; polyMeshDetailList: RecastPolyMeshDetail[]; }; /** * Draw debug information based on the selected option * @param navMesh - The navigation mesh to draw * @param intermediates - The generator intermediates containing the data to draw * @param scene - The scene to draw in * @param option - The debug drawer option to use * @remarks This method will reset the debug drawer before drawing. */ draw(navMesh: NavMesh, intermediates: GeneratorIntermediates, scene: Scene, option: DebugLayerOptions): void; private _drawPoints; private _drawLines; private _drawTris; private _drawQuads; /** * Merge the debug meshes for better performance */ private _joinDebugMeshes; private _convertUnindexedToIndexed; }