@babylonjs/addons 8.56.2 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/atmosphere/Shaders/ShadersInclude/atmosphereFragmentDeclaration.js.map +1 -1
- package/atmosphere/Shaders/ShadersInclude/atmosphereFunctions.js.map +1 -1
- package/atmosphere/Shaders/ShadersInclude/atmosphereUboDeclaration.js.map +1 -1
- package/atmosphere/Shaders/ShadersInclude/atmosphereVertexDeclaration.js.map +1 -1
- package/atmosphere/Shaders/ShadersInclude/depthFunctions.js.map +1 -1
- package/atmosphere/Shaders/aerialPerspective.fragment.js.map +1 -1
- package/atmosphere/Shaders/compositeAerialPerspective.fragment.js.map +1 -1
- package/atmosphere/Shaders/compositeGlobeAtmosphere.fragment.js.map +1 -1
- package/atmosphere/Shaders/compositeSky.fragment.js.map +1 -1
- package/atmosphere/Shaders/diffuseSkyIrradiance.fragment.js.map +1 -1
- package/atmosphere/Shaders/fullscreenTriangle.vertex.js.map +1 -1
- package/atmosphere/Shaders/multiScattering.fragment.js.map +1 -1
- package/atmosphere/Shaders/skyView.fragment.js.map +1 -1
- package/atmosphere/Shaders/transmittance.fragment.js.map +1 -1
- package/atmosphere/ShadersWGSL/ShadersInclude/atmosphereFunctions.js.map +1 -1
- package/atmosphere/ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js.map +1 -1
- package/atmosphere/ShadersWGSL/ShadersInclude/depthFunctions.js.map +1 -1
- package/atmosphere/ShadersWGSL/aerialPerspective.fragment.js.map +1 -1
- package/atmosphere/ShadersWGSL/compositeAerialPerspective.fragment.js.map +1 -1
- package/atmosphere/ShadersWGSL/compositeGlobeAtmosphere.fragment.js.map +1 -1
- package/atmosphere/ShadersWGSL/compositeSky.fragment.js.map +1 -1
- package/atmosphere/ShadersWGSL/diffuseSkyIrradiance.fragment.js.map +1 -1
- package/atmosphere/ShadersWGSL/fullscreenTriangle.vertex.js.map +1 -1
- package/atmosphere/ShadersWGSL/multiScattering.fragment.js.map +1 -1
- package/atmosphere/ShadersWGSL/skyView.fragment.js.map +1 -1
- package/atmosphere/ShadersWGSL/transmittance.fragment.js.map +1 -1
- package/atmosphere/atmosphere.d.ts +9 -9
- package/atmosphere/atmosphere.js.map +1 -1
- package/atmosphere/atmosphereOptions.d.ts +3 -3
- package/atmosphere/atmosphereOptions.js.map +1 -1
- package/atmosphere/atmospherePBRMaterialPlugin.d.ts +5 -5
- package/atmosphere/atmospherePBRMaterialPlugin.js.map +1 -1
- package/atmosphere/atmospherePerCameraVariables.d.ts +2 -2
- package/atmosphere/atmospherePerCameraVariables.js.map +1 -1
- package/atmosphere/atmospherePhysicalProperties.d.ts +1 -1
- package/atmosphere/atmospherePhysicalProperties.js.map +1 -1
- package/atmosphere/atmospherePhysicalPropertiesOptions.d.ts +1 -1
- package/atmosphere/atmospherePhysicalPropertiesOptions.js.map +1 -1
- package/atmosphere/diffuseSkyIrradianceLut.d.ts +2 -2
- package/atmosphere/diffuseSkyIrradianceLut.js.map +1 -1
- package/atmosphere/sampling.d.ts +1 -1
- package/atmosphere/sampling.js.map +1 -1
- package/atmosphere/transmittanceLut.d.ts +3 -3
- package/atmosphere/transmittanceLut.js.map +1 -1
- package/htmlMesh/htmlMesh.d.ts +2 -2
- package/htmlMesh/htmlMesh.js.map +1 -1
- package/htmlMesh/htmlMeshRenderer.d.ts +3 -3
- package/htmlMesh/htmlMeshRenderer.js.map +1 -1
- package/htmlMesh/pointerEventsCapture.js.map +1 -1
- package/htmlMesh/pointerEventsCaptureBehavior.d.ts +2 -2
- package/htmlMesh/pointerEventsCaptureBehavior.js.map +1 -1
- package/msdfText/fontAsset.d.ts +3 -3
- package/msdfText/fontAsset.js.map +1 -1
- package/msdfText/paragraphOptions.d.ts +3 -3
- package/msdfText/paragraphOptions.js.map +1 -1
- package/msdfText/sdf/font.d.ts +1 -1
- package/msdfText/sdf/font.js.map +1 -1
- package/msdfText/sdf/glyph.d.ts +1 -1
- package/msdfText/sdf/glyph.js.map +1 -1
- package/msdfText/sdf/line.d.ts +1 -1
- package/msdfText/sdf/line.js.map +1 -1
- package/msdfText/sdf/paragraph.d.ts +3 -3
- package/msdfText/sdf/paragraph.js.map +1 -1
- package/msdfText/shaders/msdf.fragment.js.map +1 -1
- package/msdfText/shaders/msdf.vertex.js.map +1 -1
- package/msdfText/shadersWGSL/msdf.fragment.js.map +1 -1
- package/msdfText/shadersWGSL/msdf.vertex.js.map +1 -1
- package/msdfText/textRenderer.d.ts +6 -6
- package/msdfText/textRenderer.js.map +1 -1
- package/navigation/common/config.d.ts +3 -3
- package/navigation/common/config.js.map +1 -1
- package/navigation/common/convert.d.ts +1 -1
- package/navigation/common/convert.js.map +1 -1
- package/navigation/common/getters.js.map +1 -1
- package/navigation/common/smooth-path.d.ts +2 -2
- package/navigation/common/smooth-path.js.map +1 -1
- package/navigation/common/tile-cache.d.ts +1 -1
- package/navigation/common/tile-cache.js.map +1 -1
- package/navigation/common/utils.d.ts +1 -1
- package/navigation/common/utils.js.map +1 -1
- package/navigation/debug/NavigationDebugger.d.ts +5 -5
- package/navigation/debug/NavigationDebugger.js.map +1 -1
- package/navigation/debug/simple-debug.d.ts +3 -3
- package/navigation/debug/simple-debug.js.map +1 -1
- package/navigation/factory/common.d.ts +1 -1
- package/navigation/factory/common.js.map +1 -1
- package/navigation/factory/factory.single-thread.d.ts +1 -1
- package/navigation/factory/factory.single-thread.js.map +1 -1
- package/navigation/factory/factory.worker.js +6 -0
- package/navigation/factory/factory.worker.js.map +1 -1
- package/navigation/generator/generator.common.d.ts +1 -1
- package/navigation/generator/generator.common.js.map +1 -1
- package/navigation/generator/generator.single-thread.d.ts +2 -2
- package/navigation/generator/generator.single-thread.js.map +1 -1
- package/navigation/generator/generator.worker.d.ts +3 -3
- package/navigation/generator/generator.worker.js.map +1 -1
- package/navigation/generator/injection.d.ts +1 -1
- package/navigation/generator/injection.js.map +1 -1
- package/navigation/plugin/RecastJSCrowd.d.ts +7 -7
- package/navigation/plugin/RecastJSCrowd.js.map +1 -1
- package/navigation/plugin/RecastNavigationJSPlugin.d.ts +7 -7
- package/navigation/plugin/RecastNavigationJSPlugin.js.map +1 -1
- package/navigation/types.d.ts +6 -6
- package/navigation/types.js.map +1 -1
- package/navigation/worker/navmesh-worker.js +1 -1
- package/navigation/worker/navmesh-worker.js.map +1 -1
- package/package.json +4 -4
- package/readme.md +12 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smooth-path.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/common/smooth-path.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAA0B,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;AAC7B,MAAM,YAAY,GAAG,IAAI,OAAO,EAAE,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC7B,OAAgB,EAChB,YAA0B,EAC1B,KAAmB,EACnB,GAAiB,EACjB,OAuBC;IAED,OAAO,oBAAoB,CAAC,qBAAqB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACnG,CAAC;AAED,SAAS,qBAAqB,CAC1B,OAAgB,EAChB,YAA0B,EAC1B,KAAmB,EACnB,GAAiB,EACjB,OAOC;IAED,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,YAAY,CAAC,aAAa,CAAC;IAC7D,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,YAAY,CAAC,uBAAuB,CAAC;IACjF,MAAM,mBAAmB,GAAG,OAAO,EAAE,mBAAmB,IAAI,IAAI,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,EAAE,CAAC;gBAC3B,GAAG,GAAG,CAAC,CAAC;gBACR,MAAM;YACV,CAAC;QACL,CAAC;IACL,CAAC;IAED,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACV,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IACjC,CAAC;AACL,CAAC","sourcesContent":["import type { NavMeshQuery, NavMesh, QueryFilter } from \"@recast-navigation/core\";\n\nimport type { IVector3Like } from \"core/Maths/math.like\";\nimport { Vector3 } from \"core/Maths/math.vector\";\n\nimport { ConvertNavPathPoints } from \"./convert\";\nimport type { RecastInjection, SteerTargetResult } from \"../types\";\nimport { ComputePathError, type ComputePathResult } from \"../types\";\nimport { GetRecast } from \"../factory/common\";\n\nconst _DELTA = new Vector3();\nconst _MOVE_TARGET = new Vector3();\n\n/**\n * Compute a smooth navigation path from start to end. Returns an empty array if no path can be computed\n * @param navMesh the navigation mesh to use\n * @param navmeshQuery the navigation mesh query to use\n * @param start world position\n * @param end world position\n * @param options options object\n * @returns array containing world position composing the path\n */\nexport function ComputeSmoothPath(\n navMesh: NavMesh,\n navmeshQuery: NavMeshQuery,\n start: IVector3Like,\n end: IVector3Like,\n options?: {\n filter?: QueryFilter;\n halfExtents?: IVector3Like;\n\n /**\n * @default 256\n */\n maxPathPolys?: number;\n\n /**\n * @default 2048\n */\n maxSmoothPathPoints?: number;\n\n /**\n * @default 0.5\n */\n stepSize?: number;\n\n /**\n * @default 0.01\n */\n slop?: number;\n }\n): Vector3[] {\n return ConvertNavPathPoints(ComputeSmoothPathImpl(navMesh, navmeshQuery, start, end, options));\n}\n\nfunction ComputeSmoothPathImpl(\n navMesh: NavMesh,\n navMeshQuery: NavMeshQuery,\n start: IVector3Like,\n end: IVector3Like,\n options?: {\n filter?: QueryFilter;\n halfExtents?: IVector3Like;\n maxPathPolys?: number;\n maxSmoothPathPoints?: number;\n stepSize?: number;\n slop?: number;\n }\n): ComputePathResult {\n const recast = GetRecast();\n const filter = options?.filter ?? navMeshQuery.defaultFilter;\n const halfExtents = options?.halfExtents ?? navMeshQuery.defaultQueryHalfExtents;\n const maxSmoothPathPoints = options?.maxSmoothPathPoints ?? 2048;\n const maxPathPolys = options?.maxPathPolys ?? 256;\n const stepSize = options?.stepSize ?? 0.5;\n const slop = options?.slop ?? 0.01;\n\n // find nearest polygons for start and end positions\n const startNearestPolyResult = navMeshQuery.findNearestPoly(start, {\n filter,\n halfExtents,\n });\n\n if (!startNearestPolyResult.success) {\n return {\n success: false,\n error: {\n type: ComputePathError.START_NEAREST_POLY_FAILED,\n status: startNearestPolyResult.status,\n },\n path: [],\n };\n }\n\n const endNearestPolyResult = navMeshQuery.findNearestPoly(end, {\n filter,\n halfExtents,\n });\n\n if (!endNearestPolyResult.success) {\n return {\n success: false,\n error: {\n type: ComputePathError.END_NEAREST_POLY_FAILED,\n status: endNearestPolyResult.status,\n },\n path: [],\n };\n }\n\n const startRef = startNearestPolyResult.nearestRef;\n const endRef = endNearestPolyResult.nearestRef;\n\n // find polygon path\n const findPathResult = navMeshQuery.findPath(startRef, endRef, start, end, {\n filter,\n maxPathPolys,\n });\n\n if (!findPathResult.success) {\n return {\n success: false,\n error: {\n type: ComputePathError.FIND_PATH_FAILED,\n status: findPathResult.status,\n },\n path: [],\n };\n }\n\n if (findPathResult.polys.size <= 0) {\n return {\n success: false,\n error: {\n type: ComputePathError.NO_POLYGON_PATH_FOUND,\n },\n path: [],\n };\n }\n\n const lastPoly = findPathResult.polys.get(findPathResult.polys.size - 1);\n\n let closestEnd = end;\n\n if (lastPoly !== endRef) {\n const lastPolyClosestPointResult = navMeshQuery.closestPointOnPoly(lastPoly, end);\n\n if (!lastPolyClosestPointResult.success) {\n return {\n success: false,\n error: {\n type: ComputePathError.NO_CLOSEST_POINT_ON_LAST_POLYGON_FOUND,\n status: lastPolyClosestPointResult.status,\n },\n path: [],\n };\n }\n\n closestEnd = lastPolyClosestPointResult.closestPoint;\n }\n\n // Iterate over the path to find a smooth path on the detail mesh\n const iterPos = new Vector3(start.x, start.y, start.z);\n const targetPos = new Vector3(closestEnd.x, closestEnd.y, closestEnd.z);\n\n const polys = Array.from(findPathResult.polys.getHeapView());\n const smoothPath: Vector3[] = [];\n\n smoothPath.push(iterPos.clone());\n\n while (polys.length > 0 && smoothPath.length < maxSmoothPathPoints) {\n // Find location to steer towards\n const steerTarget = getSteerTarget(navMeshQuery, iterPos, targetPos, slop, polys, recast);\n\n if (!steerTarget.success) {\n break;\n }\n\n const isEndOfPath = steerTarget.steerPosFlag & recast.Detour.DT_STRAIGHTPATH_END;\n const isOffMeshConnection = steerTarget.steerPosFlag & recast.Detour.DT_STRAIGHTPATH_OFFMESH_CONNECTION;\n\n // Find movement delta.\n const steerPos = steerTarget.steerPos;\n const delta = _DELTA.copyFrom(steerPos).subtract(iterPos);\n let len = Math.sqrt(delta.dot(delta));\n\n // If the steer target is the end of the path or an off-mesh connection, do not move past the location.\n if ((isEndOfPath || isOffMeshConnection) && len < stepSize) {\n len = 1;\n } else {\n len = stepSize / len;\n }\n\n const moveTarget = _MOVE_TARGET.copyFrom(iterPos).addInPlace(delta.scale(len));\n\n // Move\n const moveAlongSurface = navMeshQuery.moveAlongSurface(polys[0], iterPos, moveTarget, { filter, maxVisitedSize: 16 });\n\n if (!moveAlongSurface.success) {\n break;\n }\n\n const result = moveAlongSurface.resultPosition;\n\n fixupCorridor(polys, maxPathPolys, moveAlongSurface.visited);\n fixupShortcuts(polys, navMesh, recast);\n\n const polyHeightResult = navMeshQuery.getPolyHeight(polys[0], result);\n\n if (polyHeightResult.success) {\n result.y = polyHeightResult.height;\n }\n\n iterPos.copyFromFloats(result.x, result.y, result.z);\n\n // Handle end of path and off-mesh links when close enough\n if (isEndOfPath && inRange(iterPos, steerTarget.steerPos, slop, 1.0)) {\n // Reached end of path\n iterPos.copyFrom(targetPos);\n\n if (smoothPath.length < maxSmoothPathPoints) {\n smoothPath.push(new Vector3(iterPos.x, iterPos.y, iterPos.z));\n }\n\n break;\n } else if (isOffMeshConnection && inRange(iterPos, steerTarget.steerPos, slop, 1.0)) {\n // Reached off-mesh connection.\n\n // Advance the path up to and over the off-mesh connection.\n const offMeshConRef = steerTarget.steerPosRef;\n\n // Advance the path up to and over the off-mesh connection.\n let prevPolyRef = 0;\n let polyRef = polys[0];\n let npos = 0;\n while (npos < polys.length && polyRef !== offMeshConRef) {\n prevPolyRef = polyRef;\n polyRef = polys[npos];\n npos++;\n }\n\n for (let i = npos; i < polys.length; i++) {\n polys[i - npos] = polys[i];\n }\n polys.splice(npos, polys.length - npos);\n\n // Handle the connection\n const offMeshConnectionPolyEndPoints = navMesh.getOffMeshConnectionPolyEndPoints(prevPolyRef, polyRef);\n\n if (offMeshConnectionPolyEndPoints.success) {\n if (smoothPath.length < maxSmoothPathPoints) {\n smoothPath.push(new Vector3(iterPos.x, iterPos.y, iterPos.z));\n\n // Hack to make the dotted path not visible during off-mesh connection.\n if (smoothPath.length & 1) {\n smoothPath.push(new Vector3(iterPos.x, iterPos.y, iterPos.z));\n }\n\n // Move position at the other side of the off-mesh link.\n iterPos.copyFromFloats(offMeshConnectionPolyEndPoints.end.x, offMeshConnectionPolyEndPoints.end.y, offMeshConnectionPolyEndPoints.end.z);\n\n const endPositionPolyHeight = navMeshQuery.getPolyHeight(polys[0], iterPos);\n\n if (endPositionPolyHeight.success) {\n iterPos.y = endPositionPolyHeight.height;\n }\n }\n }\n }\n\n // Store results.\n if (smoothPath.length < maxSmoothPathPoints) {\n smoothPath.push(new Vector3(iterPos.x, iterPos.y, iterPos.z));\n }\n }\n\n return {\n success: true,\n path: smoothPath,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction getSteerTarget(navMeshQuery: NavMeshQuery, start: Vector3, end: Vector3, minTargetDist: number, pathPolys: number[], recast: RecastInjection): SteerTargetResult {\n const maxSteerPoints = 3;\n const straightPath = navMeshQuery.findStraightPath(start, end, pathPolys, {\n maxStraightPathPoints: maxSteerPoints,\n });\n\n if (!straightPath.success) {\n return {\n success: false,\n };\n }\n\n const outPoints: Vector3[] = [];\n for (let i = 0; i < straightPath.straightPathCount; i++) {\n const point = new Vector3(straightPath.straightPath.get(i * 3), straightPath.straightPath.get(i * 3 + 1), straightPath.straightPath.get(i * 3 + 2));\n\n outPoints.push(point);\n }\n\n // Find vertex far enough to steer to\n let ns = 0;\n while (ns < outPoints.length) {\n // Stop at Off-Mesh link or when point is further than slop away\n if (straightPath.straightPathFlags.get(ns) & recast.Detour.DT_STRAIGHTPATH_OFFMESH_CONNECTION) {\n break;\n }\n\n const posA = outPoints[ns];\n const posB = start;\n\n if (!inRange(posA, posB, minTargetDist, 1000.0)) {\n break;\n }\n\n ns++;\n }\n\n // Failed to find good point to steer to\n if (ns >= straightPath.straightPathCount) {\n return {\n success: false,\n };\n }\n\n const steerPos = outPoints[ns];\n const steerPosFlag = straightPath.straightPathFlags.get(ns);\n const steerPosRef = straightPath.straightPathRefs.get(ns);\n\n return {\n success: true,\n steerPos,\n steerPosFlag,\n steerPosRef,\n points: outPoints,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction inRange(a: Vector3, b: Vector3, r: number, h: number) {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const dz = b.z - a.z;\n return dx * dx + dz * dz < r * r && Math.abs(dy) < h;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction fixupCorridor(pathPolys: number[], maxPath: number, visitedPolyRefs: number[]) {\n let furthestPath = -1;\n let furthestVisited = -1;\n\n // Find furthest common polygon.\n for (let i = pathPolys.length - 1; i >= 0; i--) {\n let found = false;\n for (let j = visitedPolyRefs.length - 1; j >= 0; j--) {\n if (pathPolys[i] === visitedPolyRefs[j]) {\n furthestPath = i;\n furthestVisited = j;\n found = true;\n }\n }\n if (found) {\n break;\n }\n }\n\n // If no intersection found just return current path.\n if (furthestPath === -1 || furthestVisited === -1) {\n return pathPolys;\n }\n\n // Concatenate paths.\n\n // Adjust beginning of the buffer to include the visited.\n const req = visitedPolyRefs.length - furthestVisited;\n const orig = Math.min(furthestPath + 1, pathPolys.length);\n\n let size = Math.max(0, pathPolys.length - orig);\n\n if (req + size > maxPath) {\n size = maxPath - req;\n }\n if (size) {\n pathPolys.splice(req, size, ...pathPolys.slice(orig, orig + size));\n }\n\n // Store visited\n for (let i = 0; i < req; i++) {\n pathPolys[i] = visitedPolyRefs[visitedPolyRefs.length - (1 + i)];\n }\n\n return pathPolys;\n}\n\n/**\n * This function checks if the path has a small U-turn, that is,\n * a polygon further in the path is adjacent to the first polygon\n * in the path. If that happens, a shortcut is taken.\n * This can happen if the target (T) location is at tile boundary,\n * and we're (S) approaching it parallel to the tile edge.\n * The choice at the vertex can be arbitrary,\n * +---+---+\n * |:::|:::|\n * +-S-+-T-+\n * |:::| | -- the step can end up in here, resulting U-turn path.\n * +---+---+\n * @param pathPolys The path polygons to check for U-turns.\n * @param navMesh The navigation mesh used to check adjacency.\n * @param recast The recast injection to use.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction fixupShortcuts(pathPolys: number[], navMesh: NavMesh, recast: RecastInjection) {\n if (pathPolys.length < 3) {\n return;\n }\n\n // Get connected polygons\n const maxNeis = 16;\n let nneis = 0;\n const neis: number[] = [];\n\n const tileAndPoly = navMesh.getTileAndPolyByRef(pathPolys[0]);\n\n if (!tileAndPoly.success) {\n return;\n }\n\n const poly = tileAndPoly.poly;\n const tile = tileAndPoly.tile;\n for (let k = poly.firstLink(); k !== recast.Detour.DT_NULL_LINK; k = tile.links(k).next()) {\n const link = tile.links(k);\n\n if (link.ref() !== 0) {\n if (nneis < maxNeis) {\n neis.push(link.ref());\n nneis++;\n }\n }\n }\n\n // If any of the neighbour polygons is within the next few polygons\n // in the path, short cut to that polygon directly.\n const maxLookAhead = 6;\n let cut = 0;\n for (let i = Math.min(maxLookAhead, pathPolys.length) - 1; i > 1 && cut === 0; i--) {\n for (let j = 0; j < nneis; j++) {\n if (pathPolys[i] === neis[j]) {\n cut = i;\n break;\n }\n }\n }\n\n if (cut > 1) {\n pathPolys.splice(1, cut - 1);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"smooth-path.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/common/smooth-path.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAgD,gBAAgB,EAA0B,MAAM,UAAU,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;AAC7B,MAAM,YAAY,GAAG,IAAI,OAAO,EAAE,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC7B,OAAgB,EAChB,YAA0B,EAC1B,KAAmB,EACnB,GAAiB,EACjB,OAuBC;IAED,OAAO,oBAAoB,CAAC,qBAAqB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACnG,CAAC;AAED,SAAS,qBAAqB,CAC1B,OAAgB,EAChB,YAA0B,EAC1B,KAAmB,EACnB,GAAiB,EACjB,OAOC;IAED,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,YAAY,CAAC,aAAa,CAAC;IAC7D,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,YAAY,CAAC,uBAAuB,CAAC;IACjF,MAAM,mBAAmB,GAAG,OAAO,EAAE,mBAAmB,IAAI,IAAI,CAAC;IACjE,MAAM,YAAY,GAAG,OAAO,EAAE,YAAY,IAAI,GAAG,CAAC;IAClD,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,GAAG,CAAC;IAC1C,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,IAAI,C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AAC,CAAC,CAAC;IACjC,CAAC;AACL,CAAC","sourcesContent":["import { type NavMeshQuery, type NavMesh, type QueryFilter } from \"@recast-navigation/core\";\n\nimport { type IVector3Like } from \"core/Maths/math.like\";\nimport { Vector3 } from \"core/Maths/math.vector\";\n\nimport { ConvertNavPathPoints } from \"./convert\";\nimport { type RecastInjection, type SteerTargetResult, ComputePathError, type ComputePathResult } from \"../types\";\nimport { GetRecast } from \"../factory/common\";\n\nconst _DELTA = new Vector3();\nconst _MOVE_TARGET = new Vector3();\n\n/**\n * Compute a smooth navigation path from start to end. Returns an empty array if no path can be computed\n * @param navMesh the navigation mesh to use\n * @param navmeshQuery the navigation mesh query to use\n * @param start world position\n * @param end world position\n * @param options options object\n * @returns array containing world position composing the path\n */\nexport function ComputeSmoothPath(\n navMesh: NavMesh,\n navmeshQuery: NavMeshQuery,\n start: IVector3Like,\n end: IVector3Like,\n options?: {\n filter?: QueryFilter;\n halfExtents?: IVector3Like;\n\n /**\n * @default 256\n */\n maxPathPolys?: number;\n\n /**\n * @default 2048\n */\n maxSmoothPathPoints?: number;\n\n /**\n * @default 0.5\n */\n stepSize?: number;\n\n /**\n * @default 0.01\n */\n slop?: number;\n }\n): Vector3[] {\n return ConvertNavPathPoints(ComputeSmoothPathImpl(navMesh, navmeshQuery, start, end, options));\n}\n\nfunction ComputeSmoothPathImpl(\n navMesh: NavMesh,\n navMeshQuery: NavMeshQuery,\n start: IVector3Like,\n end: IVector3Like,\n options?: {\n filter?: QueryFilter;\n halfExtents?: IVector3Like;\n maxPathPolys?: number;\n maxSmoothPathPoints?: number;\n stepSize?: number;\n slop?: number;\n }\n): ComputePathResult {\n const recast = GetRecast();\n const filter = options?.filter ?? navMeshQuery.defaultFilter;\n const halfExtents = options?.halfExtents ?? navMeshQuery.defaultQueryHalfExtents;\n const maxSmoothPathPoints = options?.maxSmoothPathPoints ?? 2048;\n const maxPathPolys = options?.maxPathPolys ?? 256;\n const stepSize = options?.stepSize ?? 0.5;\n const slop = options?.slop ?? 0.01;\n\n // find nearest polygons for start and end positions\n const startNearestPolyResult = navMeshQuery.findNearestPoly(start, {\n filter,\n halfExtents,\n });\n\n if (!startNearestPolyResult.success) {\n return {\n success: false,\n error: {\n type: ComputePathError.START_NEAREST_POLY_FAILED,\n status: startNearestPolyResult.status,\n },\n path: [],\n };\n }\n\n const endNearestPolyResult = navMeshQuery.findNearestPoly(end, {\n filter,\n halfExtents,\n });\n\n if (!endNearestPolyResult.success) {\n return {\n success: false,\n error: {\n type: ComputePathError.END_NEAREST_POLY_FAILED,\n status: endNearestPolyResult.status,\n },\n path: [],\n };\n }\n\n const startRef = startNearestPolyResult.nearestRef;\n const endRef = endNearestPolyResult.nearestRef;\n\n // find polygon path\n const findPathResult = navMeshQuery.findPath(startRef, endRef, start, end, {\n filter,\n maxPathPolys,\n });\n\n if (!findPathResult.success) {\n return {\n success: false,\n error: {\n type: ComputePathError.FIND_PATH_FAILED,\n status: findPathResult.status,\n },\n path: [],\n };\n }\n\n if (findPathResult.polys.size <= 0) {\n return {\n success: false,\n error: {\n type: ComputePathError.NO_POLYGON_PATH_FOUND,\n },\n path: [],\n };\n }\n\n const lastPoly = findPathResult.polys.get(findPathResult.polys.size - 1);\n\n let closestEnd = end;\n\n if (lastPoly !== endRef) {\n const lastPolyClosestPointResult = navMeshQuery.closestPointOnPoly(lastPoly, end);\n\n if (!lastPolyClosestPointResult.success) {\n return {\n success: false,\n error: {\n type: ComputePathError.NO_CLOSEST_POINT_ON_LAST_POLYGON_FOUND,\n status: lastPolyClosestPointResult.status,\n },\n path: [],\n };\n }\n\n closestEnd = lastPolyClosestPointResult.closestPoint;\n }\n\n // Iterate over the path to find a smooth path on the detail mesh\n const iterPos = new Vector3(start.x, start.y, start.z);\n const targetPos = new Vector3(closestEnd.x, closestEnd.y, closestEnd.z);\n\n const polys = Array.from(findPathResult.polys.getHeapView());\n const smoothPath: Vector3[] = [];\n\n smoothPath.push(iterPos.clone());\n\n while (polys.length > 0 && smoothPath.length < maxSmoothPathPoints) {\n // Find location to steer towards\n const steerTarget = getSteerTarget(navMeshQuery, iterPos, targetPos, slop, polys, recast);\n\n if (!steerTarget.success) {\n break;\n }\n\n const isEndOfPath = steerTarget.steerPosFlag & recast.Detour.DT_STRAIGHTPATH_END;\n const isOffMeshConnection = steerTarget.steerPosFlag & recast.Detour.DT_STRAIGHTPATH_OFFMESH_CONNECTION;\n\n // Find movement delta.\n const steerPos = steerTarget.steerPos;\n const delta = _DELTA.copyFrom(steerPos).subtract(iterPos);\n let len = Math.sqrt(delta.dot(delta));\n\n // If the steer target is the end of the path or an off-mesh connection, do not move past the location.\n if ((isEndOfPath || isOffMeshConnection) && len < stepSize) {\n len = 1;\n } else {\n len = stepSize / len;\n }\n\n const moveTarget = _MOVE_TARGET.copyFrom(iterPos).addInPlace(delta.scale(len));\n\n // Move\n const moveAlongSurface = navMeshQuery.moveAlongSurface(polys[0], iterPos, moveTarget, { filter, maxVisitedSize: 16 });\n\n if (!moveAlongSurface.success) {\n break;\n }\n\n const result = moveAlongSurface.resultPosition;\n\n fixupCorridor(polys, maxPathPolys, moveAlongSurface.visited);\n fixupShortcuts(polys, navMesh, recast);\n\n const polyHeightResult = navMeshQuery.getPolyHeight(polys[0], result);\n\n if (polyHeightResult.success) {\n result.y = polyHeightResult.height;\n }\n\n iterPos.copyFromFloats(result.x, result.y, result.z);\n\n // Handle end of path and off-mesh links when close enough\n if (isEndOfPath && inRange(iterPos, steerTarget.steerPos, slop, 1.0)) {\n // Reached end of path\n iterPos.copyFrom(targetPos);\n\n if (smoothPath.length < maxSmoothPathPoints) {\n smoothPath.push(new Vector3(iterPos.x, iterPos.y, iterPos.z));\n }\n\n break;\n } else if (isOffMeshConnection && inRange(iterPos, steerTarget.steerPos, slop, 1.0)) {\n // Reached off-mesh connection.\n\n // Advance the path up to and over the off-mesh connection.\n const offMeshConRef = steerTarget.steerPosRef;\n\n // Advance the path up to and over the off-mesh connection.\n let prevPolyRef = 0;\n let polyRef = polys[0];\n let npos = 0;\n while (npos < polys.length && polyRef !== offMeshConRef) {\n prevPolyRef = polyRef;\n polyRef = polys[npos];\n npos++;\n }\n\n for (let i = npos; i < polys.length; i++) {\n polys[i - npos] = polys[i];\n }\n polys.splice(npos, polys.length - npos);\n\n // Handle the connection\n const offMeshConnectionPolyEndPoints = navMesh.getOffMeshConnectionPolyEndPoints(prevPolyRef, polyRef);\n\n if (offMeshConnectionPolyEndPoints.success) {\n if (smoothPath.length < maxSmoothPathPoints) {\n smoothPath.push(new Vector3(iterPos.x, iterPos.y, iterPos.z));\n\n // Hack to make the dotted path not visible during off-mesh connection.\n if (smoothPath.length & 1) {\n smoothPath.push(new Vector3(iterPos.x, iterPos.y, iterPos.z));\n }\n\n // Move position at the other side of the off-mesh link.\n iterPos.copyFromFloats(offMeshConnectionPolyEndPoints.end.x, offMeshConnectionPolyEndPoints.end.y, offMeshConnectionPolyEndPoints.end.z);\n\n const endPositionPolyHeight = navMeshQuery.getPolyHeight(polys[0], iterPos);\n\n if (endPositionPolyHeight.success) {\n iterPos.y = endPositionPolyHeight.height;\n }\n }\n }\n }\n\n // Store results.\n if (smoothPath.length < maxSmoothPathPoints) {\n smoothPath.push(new Vector3(iterPos.x, iterPos.y, iterPos.z));\n }\n }\n\n return {\n success: true,\n path: smoothPath,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction getSteerTarget(navMeshQuery: NavMeshQuery, start: Vector3, end: Vector3, minTargetDist: number, pathPolys: number[], recast: RecastInjection): SteerTargetResult {\n const maxSteerPoints = 3;\n const straightPath = navMeshQuery.findStraightPath(start, end, pathPolys, {\n maxStraightPathPoints: maxSteerPoints,\n });\n\n if (!straightPath.success) {\n return {\n success: false,\n };\n }\n\n const outPoints: Vector3[] = [];\n for (let i = 0; i < straightPath.straightPathCount; i++) {\n const point = new Vector3(straightPath.straightPath.get(i * 3), straightPath.straightPath.get(i * 3 + 1), straightPath.straightPath.get(i * 3 + 2));\n\n outPoints.push(point);\n }\n\n // Find vertex far enough to steer to\n let ns = 0;\n while (ns < outPoints.length) {\n // Stop at Off-Mesh link or when point is further than slop away\n if (straightPath.straightPathFlags.get(ns) & recast.Detour.DT_STRAIGHTPATH_OFFMESH_CONNECTION) {\n break;\n }\n\n const posA = outPoints[ns];\n const posB = start;\n\n if (!inRange(posA, posB, minTargetDist, 1000.0)) {\n break;\n }\n\n ns++;\n }\n\n // Failed to find good point to steer to\n if (ns >= straightPath.straightPathCount) {\n return {\n success: false,\n };\n }\n\n const steerPos = outPoints[ns];\n const steerPosFlag = straightPath.straightPathFlags.get(ns);\n const steerPosRef = straightPath.straightPathRefs.get(ns);\n\n return {\n success: true,\n steerPos,\n steerPosFlag,\n steerPosRef,\n points: outPoints,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction inRange(a: Vector3, b: Vector3, r: number, h: number) {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const dz = b.z - a.z;\n return dx * dx + dz * dz < r * r && Math.abs(dy) < h;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction fixupCorridor(pathPolys: number[], maxPath: number, visitedPolyRefs: number[]) {\n let furthestPath = -1;\n let furthestVisited = -1;\n\n // Find furthest common polygon.\n for (let i = pathPolys.length - 1; i >= 0; i--) {\n let found = false;\n for (let j = visitedPolyRefs.length - 1; j >= 0; j--) {\n if (pathPolys[i] === visitedPolyRefs[j]) {\n furthestPath = i;\n furthestVisited = j;\n found = true;\n }\n }\n if (found) {\n break;\n }\n }\n\n // If no intersection found just return current path.\n if (furthestPath === -1 || furthestVisited === -1) {\n return pathPolys;\n }\n\n // Concatenate paths.\n\n // Adjust beginning of the buffer to include the visited.\n const req = visitedPolyRefs.length - furthestVisited;\n const orig = Math.min(furthestPath + 1, pathPolys.length);\n\n let size = Math.max(0, pathPolys.length - orig);\n\n if (req + size > maxPath) {\n size = maxPath - req;\n }\n if (size) {\n pathPolys.splice(req, size, ...pathPolys.slice(orig, orig + size));\n }\n\n // Store visited\n for (let i = 0; i < req; i++) {\n pathPolys[i] = visitedPolyRefs[visitedPolyRefs.length - (1 + i)];\n }\n\n return pathPolys;\n}\n\n/**\n * This function checks if the path has a small U-turn, that is,\n * a polygon further in the path is adjacent to the first polygon\n * in the path. If that happens, a shortcut is taken.\n * This can happen if the target (T) location is at tile boundary,\n * and we're (S) approaching it parallel to the tile edge.\n * The choice at the vertex can be arbitrary,\n * +---+---+\n * |:::|:::|\n * +-S-+-T-+\n * |:::| | -- the step can end up in here, resulting U-turn path.\n * +---+---+\n * @param pathPolys The path polygons to check for U-turns.\n * @param navMesh The navigation mesh used to check adjacency.\n * @param recast The recast injection to use.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction fixupShortcuts(pathPolys: number[], navMesh: NavMesh, recast: RecastInjection) {\n if (pathPolys.length < 3) {\n return;\n }\n\n // Get connected polygons\n const maxNeis = 16;\n let nneis = 0;\n const neis: number[] = [];\n\n const tileAndPoly = navMesh.getTileAndPolyByRef(pathPolys[0]);\n\n if (!tileAndPoly.success) {\n return;\n }\n\n const poly = tileAndPoly.poly;\n const tile = tileAndPoly.tile;\n for (let k = poly.firstLink(); k !== recast.Detour.DT_NULL_LINK; k = tile.links(k).next()) {\n const link = tile.links(k);\n\n if (link.ref() !== 0) {\n if (nneis < maxNeis) {\n neis.push(link.ref());\n nneis++;\n }\n }\n }\n\n // If any of the neighbour polygons is within the next few polygons\n // in the path, short cut to that polygon directly.\n const maxLookAhead = 6;\n let cut = 0;\n for (let i = Math.min(maxLookAhead, pathPolys.length) - 1; i > 1 && cut === 0; i--) {\n for (let j = 0; j < nneis; j++) {\n if (pathPolys[i] === neis[j]) {\n cut = i;\n break;\n }\n }\n }\n\n if (cut > 1) {\n pathPolys.splice(1, cut - 1);\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type NavMesh, type OffMeshConnectionParams, type TileCache } from "@recast-navigation/core";
|
|
2
2
|
/**
|
|
3
3
|
* Creates a default tile cache mesh process function
|
|
4
4
|
* @param offMeshConnections offMeshConnections
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-cache.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/common/tile-cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAAC,qBAAgD,EAAE,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC;IACrH,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,mBAAwC,EAAE,SAA4B,EAAE,SAA6B,EAAE,EAAE;QACpJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;YACvD,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YACvB,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC;QAED,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,mBAAmB,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;QAClE,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAgB,EAAE,SAAoB;IAC7E,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO,CAAC,QAAQ,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC/B,CAAC;AACL,CAAC","sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"tile-cache.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/common/tile-cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAAC,qBAAgD,EAAE,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC;IACrH,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,mBAAwC,EAAE,SAA4B,EAAE,SAA6B,EAAE,EAAE;QACpJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;YACvD,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YACvB,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC;QAED,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,mBAAmB,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;QAClE,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAgB,EAAE,SAAoB;IAC7E,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO,CAAC,QAAQ,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC/B,CAAC;AACL,CAAC","sourcesContent":["import { type NavMesh, type NavMeshCreateParams, type OffMeshConnectionParams, type TileCache, type UnsignedCharArray, type UnsignedShortArray } from \"@recast-navigation/core\";\n\nimport { GetRecast } from \"../factory/common\";\n\n/**\n * Creates a default tile cache mesh process function\n * @param offMeshConnections offMeshConnections\n * @param area the area to be set for each poly\n * @param flags the flags to be set for each poly\n * @returns the tile cache mesh process function\n */\nexport function CreateDefaultTileCacheMeshProcess(offMeshConnections: OffMeshConnectionParams[] = [], area = 0, flags = 1) {\n return new (GetRecast().TileCacheMeshProcess)((navMeshCreateParams: NavMeshCreateParams, polyAreas: UnsignedCharArray, polyFlags: UnsignedShortArray) => {\n for (let i = 0; i < navMeshCreateParams.polyCount(); ++i) {\n polyAreas.set(i, area);\n polyFlags.set(i, flags);\n }\n\n if (offMeshConnections.length > 0) {\n navMeshCreateParams.setOffMeshConnections(offMeshConnections);\n }\n });\n}\n\n/**\n * Waits until the tile cache is fully updated\n * @param navMesh The NavMesh\n * @param tileCache THe TileCache\n */\nexport function WaitForFullTileCacheUpdate(navMesh: NavMesh, tileCache: TileCache) {\n let upToDate = false;\n while (!upToDate) {\n const result = tileCache.update(navMesh);\n upToDate = result.upToDate;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IVector3Like } from "@babylonjs/core/Maths/math.like.js";
|
|
2
2
|
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
3
|
/**
|
|
4
4
|
* Utility function based on Chaikin's alogrithm for navigation path smoothing and segment generation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/common/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/common/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAsB,EAAE,UAAU,GAAG,CAAC;IACvE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,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,MAAM,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { type IVector3Like } from \"core/Maths/math.like\";\nimport { Vector3 } from \"core/Maths/math.vector\";\n\n/**\n * Utility function based on Chaikin's alogrithm for navigation path smoothing and segment generation.\n * @param points Array of points to be smoothed, where each point is an object with x, y, and z properties.\n * @param iterations Number of smoothing iterations to apply. Default 1.\n * @returns A new array of smoothed points after applying the Chaikin's algorithm.\n */\nexport function GetChaikinSmoothPath(points: IVector3Like[], iterations = 1) {\n for (let i = 0; i < iterations; i++) {\n const smoothed = [];\n for (let j = 0; j < points.length - 1; j++) {\n const p0 = points[j];\n const p1 = points[j + 1];\n\n smoothed.push({\n x: 0.75 * p0.x + 0.25 * p1.x,\n y: 0.75 * p0.y + 0.25 * p1.y,\n z: 0.75 * p0.z + 0.25 * p1.z,\n });\n\n smoothed.push({\n x: 0.25 * p0.x + 0.75 * p1.x,\n y: 0.25 * p0.y + 0.75 * p1.y,\n z: 0.25 * p0.z + 0.75 * p1.z,\n });\n }\n\n if (points[0].x === points[points.length - 1].x && points[0].y === points[points.length - 1].y && points[0].z === points[points.length - 1].z) {\n smoothed.push(smoothed[0]);\n }\n\n points = smoothed;\n }\n return points;\n}\n\n/**\n * Generates a series of points that create an L-shaped path between each pair of points in the input navigation segment.\n * The path consists of a horizontal segment followed by a vertical segment, or vice versa,\n * depending on the relative distances between the x and z coordinates of the points.\n * @param navSegment An array of Vector3 points representing the navigation segment.\n * @returns An array of Vector3 points representing the L-shaped path.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function GetLShapedPath(navSegment: Vector3[]) {\n const points = [];\n for (let j = 0; j < navSegment.length - 1; j++) {\n const p0 = navSegment[j];\n const p1 = navSegment[j + 1];\n const p01 = getLShapedPoint(p0, p1);\n points.push(p0, new Vector3(p01.x, p1.y, p01.z), p1);\n }\n return points;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction getLShapedPoint(pointA: IVector3Like, pointB: IVector3Like) {\n const { x: x1, z: y1 } = pointA;\n const { x: x2, z: y2 } = pointB;\n\n let pointC;\n\n // Determine turn direction automatically based on the offset\n if (Math.abs(x2 - x1) >= Math.abs(y2 - y1)) {\n // Horizontal-then-vertical turn\n pointC = { x: x2, z: y1 };\n } else {\n // Vertical-then-horizontal turn\n pointC = { x: x1, z: y2 };\n }\n\n return pointC;\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
1
|
+
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";
|
|
2
|
+
import { type GreasedLineMaterialOptions } from "@babylonjs/core/Materials/GreasedLine/greasedLineMaterialInterfaces.js";
|
|
3
3
|
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type GreasedLineMeshOptions } from "@babylonjs/core/Meshes/GreasedLine/greasedLineBaseMesh.js";
|
|
5
5
|
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
6
|
-
import type
|
|
7
|
-
import type
|
|
6
|
+
import { type Scene } from "@babylonjs/core/scene.js";
|
|
7
|
+
import { type GeneratorIntermediates } from "../types.js";
|
|
8
8
|
export declare const DebugLayerOption: {
|
|
9
9
|
HEIGHTFIELD_SOLID: string;
|
|
10
10
|
HEIGHTFIELD_WALKABLE: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationDebugger.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/debug/NavigationDebugger.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;A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AI,CAAC,qBAAqB,CAAC;QAC/C,CAAC;IACL,CAAC;IAEO,0BAA0B,CAAC,IAAU;QACzC,MAAM,UAAU,GAAG,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QAEvC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;YAC5D,OAAO;QACX,CAAC;QAED,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAEjE,MAAM,aAAa,GAAG,IAAI,UAAU,EAAE,CAAC;QACvC,aAAa,CAAC,SAAS,GAAG,SAAS,CAAC;QACpC,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC;QAEhC,aAAa,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;;AA9pBD;;;GAGG;AACW,sCAAmB,GAAG,gBAAgB,AAAnB,CAAoB;AAErD;;GAEG;AACW,6CAA0B,GAAG,uBAAuB,AAA1B,CAA2B;AAEnE;;GAEG;AACW,2CAAwB,GAAG,qBAAqB,AAAxB,CAAyB;AAE/D;;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"]}
|
|
1
|
+
{"version":3,"file":"NavigationDebugger.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/debug/NavigationDebugger.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB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IAAI,CAAC,qBAAqB,CAAC;QAC/C,CAAC;IACL,CAAC;IAEO,0BAA0B,CAAC,IAAU;QACzC,MAAM,UAAU,GAAG,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QAEvC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;YAC5D,OAAO;QACX,CAAC;QAED,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAEjE,MAAM,aAAa,GAAG,IAAI,UAAU,EAAE,CAAC;QACvC,aAAa,CAAC,SAAS,GAAG,SAAS,CAAC;QACpC,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC;QAEhC,aAAa,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;;AA9pBD;;;GAGG;AACW,sCAAmB,GAAG,gBAAgB,AAAnB,CAAoB;AAErD;;GAEG;AACW,6CAA0B,GAAG,uBAAuB,AAA1B,CAA2B;AAEnE;;GAEG;AACW,2CAAwB,GAAG,qBAAqB,AAAxB,CAAyB;AAE/D;;GAEG;AACW,4CAAyB,GAAG,sBAAsB,AAAzB,CAA0B;AAEjE;;GAEG;AACW,4CAAyB,GAAG,sBAAsB,AAAzB,CAA0B","sourcesContent":["import {\n type DebugDrawerPrimitive,\n type DebugDrawerPrimitiveType,\n type NavMesh,\n type NavMeshQuery,\n type RecastCompactHeightfield,\n type RecastContourSet,\n type RecastHeightfield,\n type RecastHeightfieldLayer,\n type RecastHeightfieldLayerSet,\n type RecastPolyMesh,\n type RecastPolyMeshDetail,\n type 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, type 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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
1
|
+
import { type NavMesh } from "@recast-navigation/core";
|
|
2
|
+
import { type Scene } from "@babylonjs/core/scene.js";
|
|
3
|
+
import { type Node } from "@babylonjs/core/node.js";
|
|
4
4
|
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates a debug mesh for visualizing a NavMesh in the scene.
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"simple-debug.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/debug/simple-debug.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/factory/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/factory/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;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;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAA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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 * Initializes the Recast navigation library.\n *\n * @param options Optional configuration. options.version: The version of Recast to use. options.instance: A custom Recast instance to inject instead of loading one.\n * @returns A promise that resolves when initialization is complete.\n */\nexport async function InitRecast(options?: { version?: string; instance?: RecastInjection }) {\n const version = options?.version ?? \"0.43.0\";\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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RecastNavigationJSPluginV2 } from "../plugin/RecastNavigationJSPlugin.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type RecastInjection } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a navigation plugin for the given scene.
|
|
5
5
|
* @returns A promise that resolves to the created navigation plugin.
|
|
@@ -1 +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;AAEhF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,OAA0D;IACxG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IAE1B,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 type
|
|
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;AAEhF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,OAA0D;IACxG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IAE1B,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 { type RecastInjection } from \"../types\";\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 * @param options Optional configuration. options.version: The version of Recast to use. options.instance: A custom Recast instance to inject instead of loading one.\n * @remarks This function initializes the Recast module and sets up the navigation plugin.\n */\nexport async function CreateNavigationPluginAsync(options?: { version?: string; instance?: RecastInjection }) {\n await InitRecast(options);\n\n const navigationPlugin = new RecastNavigationJSPluginV2(GetRecast());\n InjectGenerators(navigationPlugin);\n\n return navigationPlugin;\n}\n"]}
|
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
*/
|
|
1
7
|
import { init as initRecast } from "@recast-navigation/core";
|
|
2
8
|
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
|
3
9
|
import { RecastNavigationJSPluginV2 } from "../plugin/RecastNavigationJSPlugin.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.worker.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/factory/factory.worker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.worker.js","sourceRoot":"","sources":["../../../../../dev/addons/src/navigation/factory/factory.worker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAmD,IAAI,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9G,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;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, type NavMeshQuery, type TileCache, 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"]}
|
|
@@ -1 +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
|
|
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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
1
|
+
import { type Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
|
2
|
+
import { type INavMeshParametersV2 } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds a NavMesh and NavMeshQuery from meshes using provided parameters.
|
|
5
5
|
* @param meshes The array of meshes used to create the NavMesh.
|