@recast-navigation/core 0.40.0 → 0.42.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/dist/arrays.d.ts +1 -1
- package/dist/crowd.d.ts +2 -2
- package/dist/debug-drawer-utils.d.ts +16 -5
- package/dist/detour.d.ts +2 -2
- package/dist/index.mjs +20 -18
- package/dist/nav-mesh-query.d.ts +2 -2
- package/dist/nav-mesh.d.ts +2 -2
- package/dist/recast.d.ts +3 -3
- package/dist/serdes/export.d.ts +2 -2
- package/dist/serdes/import.d.ts +1 -1
- package/dist/tile-cache.d.ts +2 -2
- package/package.json +11 -15
package/dist/arrays.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RawModule } from './raw';
|
|
1
|
+
import { type RawModule } from './raw';
|
|
2
2
|
type TypedArray = typeof Int32Array | typeof Uint32Array | typeof Uint8Array | typeof Uint16Array | typeof Float32Array;
|
|
3
3
|
declare abstract class BaseArray<RawType extends RawModule.IntArray | RawModule.UnsignedIntArray | RawModule.UnsignedCharArray | RawModule.UnsignedShortArray | RawModule.FloatArray, T extends TypedArray> {
|
|
4
4
|
raw: RawType;
|
package/dist/crowd.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NavMesh } from './nav-mesh';
|
|
2
2
|
import { NavMeshQuery, QueryFilter } from './nav-mesh-query';
|
|
3
|
-
import { RawModule } from './raw';
|
|
4
|
-
import { Vector3 } from './utils';
|
|
3
|
+
import { type RawModule } from './raw';
|
|
4
|
+
import { type Vector3 } from './utils';
|
|
5
5
|
export type CrowdAgentParams = {
|
|
6
6
|
/**
|
|
7
7
|
* The radius of the agent.
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { NavMesh } from './nav-mesh';
|
|
2
|
-
import { NavMeshQuery } from './nav-mesh-query';
|
|
3
|
-
import { RecastCompactHeightfield, RecastContourSet, RecastHeightfield, RecastHeightfieldLayer, RecastHeightfieldLayerSet, RecastPolyMesh, RecastPolyMeshDetail } from './recast';
|
|
1
|
+
import type { NavMesh } from './nav-mesh';
|
|
2
|
+
import type { NavMeshQuery } from './nav-mesh-query';
|
|
3
|
+
import type { RecastCompactHeightfield, RecastContourSet, RecastHeightfield, RecastHeightfieldLayer, RecastHeightfieldLayerSet, RecastPolyMesh, RecastPolyMeshDetail } from './recast';
|
|
4
4
|
export type DebugDrawerPrimitiveType = 'lines' | 'tris' | 'quads' | 'points';
|
|
5
5
|
export type DebugDrawerPrimitive = {
|
|
6
6
|
type: DebugDrawerPrimitiveType;
|
|
7
|
-
vertices: [
|
|
7
|
+
vertices: [
|
|
8
|
+
x: number,
|
|
9
|
+
y: number,
|
|
10
|
+
z: number,
|
|
11
|
+
r: number,
|
|
12
|
+
g: number,
|
|
13
|
+
b: number,
|
|
14
|
+
a: number
|
|
15
|
+
][];
|
|
8
16
|
};
|
|
9
17
|
/**
|
|
10
18
|
* Represents a helper class to visualize navigation cur and related data in PlayCanvas.
|
|
@@ -39,6 +47,9 @@ export declare class DebugDrawerUtils {
|
|
|
39
47
|
* Disposes of the debug drawer and releases resources.
|
|
40
48
|
*/
|
|
41
49
|
dispose(): void;
|
|
42
|
-
private rgbToDuRgba;
|
|
43
50
|
private vertex;
|
|
44
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Converts a color in 0xRRGGBBAA format to a duRGBA format.
|
|
54
|
+
*/
|
|
55
|
+
export declare const rgbToDuRgba: (hexColor: number) => number;
|
package/dist/detour.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UnsignedCharArray } from './arrays';
|
|
2
2
|
import { type RawModule } from './raw';
|
|
3
|
-
import { RecastPolyMesh, RecastPolyMeshDetail } from './recast';
|
|
4
|
-
import { Vector3, Vector3Tuple } from './utils';
|
|
3
|
+
import type { RecastPolyMesh, RecastPolyMeshDetail } from './recast';
|
|
4
|
+
import { type Vector3, type Vector3Tuple } from './utils';
|
|
5
5
|
export declare const statusSucceed: (status: number) => boolean;
|
|
6
6
|
export declare const statusFailed: (status: number) => boolean;
|
|
7
7
|
export declare const statusInProgress: (status: number) => boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -170,7 +170,7 @@ class IntArray extends BaseArray {
|
|
|
170
170
|
return Raw.Module.HEAP32;
|
|
171
171
|
}
|
|
172
172
|
static fromRaw(raw) {
|
|
173
|
-
return new
|
|
173
|
+
return new IntArray(raw);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
class UnsignedIntArray extends BaseArray {
|
|
@@ -182,7 +182,7 @@ class UnsignedIntArray extends BaseArray {
|
|
|
182
182
|
return Raw.Module.HEAPU32;
|
|
183
183
|
}
|
|
184
184
|
static fromRaw(raw) {
|
|
185
|
-
return new
|
|
185
|
+
return new UnsignedIntArray(raw);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
class UnsignedCharArray extends BaseArray {
|
|
@@ -194,7 +194,7 @@ class UnsignedCharArray extends BaseArray {
|
|
|
194
194
|
return Raw.Module.HEAPU8;
|
|
195
195
|
}
|
|
196
196
|
static fromRaw(raw) {
|
|
197
|
-
return new
|
|
197
|
+
return new UnsignedCharArray(raw);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
class UnsignedShortArray extends BaseArray {
|
|
@@ -206,7 +206,7 @@ class UnsignedShortArray extends BaseArray {
|
|
|
206
206
|
return Raw.Module.HEAPU16;
|
|
207
207
|
}
|
|
208
208
|
static fromRaw(raw) {
|
|
209
|
-
return new
|
|
209
|
+
return new UnsignedShortArray(raw);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
class FloatArray extends BaseArray {
|
|
@@ -218,7 +218,7 @@ class FloatArray extends BaseArray {
|
|
|
218
218
|
return Raw.Module.HEAPF32;
|
|
219
219
|
}
|
|
220
220
|
static fromRaw(raw) {
|
|
221
|
-
return new
|
|
221
|
+
return new FloatArray(raw);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
const VerticesArray = FloatArray;
|
|
@@ -314,7 +314,7 @@ const statusToReadableString = status => {
|
|
|
314
314
|
return 'in progress';
|
|
315
315
|
}
|
|
316
316
|
if (Raw.Detour.statusFailed(status)) {
|
|
317
|
-
let reason
|
|
317
|
+
let reason;
|
|
318
318
|
const DT_STATUS_REASONS = {
|
|
319
319
|
DT_WRONG_MAGIC: Detour.DT_WRONG_MAGIC,
|
|
320
320
|
DT_WRONG_VERSION: Detour.DT_WRONG_VERSION,
|
|
@@ -772,7 +772,7 @@ class QueryFilter {
|
|
|
772
772
|
return this.raw.getAreaCost(i);
|
|
773
773
|
}
|
|
774
774
|
setAreaCost(i, cost) {
|
|
775
|
-
|
|
775
|
+
this.raw.setAreaCost(i, cost);
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
778
|
class NavMeshQuery {
|
|
@@ -1898,11 +1898,11 @@ class DebugDrawerUtils {
|
|
|
1898
1898
|
return this.flush();
|
|
1899
1899
|
}
|
|
1900
1900
|
drawNavMeshPolysWithFlags(mesh, flags, col) {
|
|
1901
|
-
Raw.DetourDebugDraw.debugDrawNavMeshPolysWithFlags(this.debugDrawImpl, mesh.raw.m_navMesh, flags,
|
|
1901
|
+
Raw.DetourDebugDraw.debugDrawNavMeshPolysWithFlags(this.debugDrawImpl, mesh.raw.m_navMesh, flags, col);
|
|
1902
1902
|
return this.flush();
|
|
1903
1903
|
}
|
|
1904
1904
|
drawNavMeshPoly(mesh, ref, col) {
|
|
1905
|
-
Raw.DetourDebugDraw.debugDrawNavMeshPoly(this.debugDrawImpl, mesh.raw.m_navMesh, ref,
|
|
1905
|
+
Raw.DetourDebugDraw.debugDrawNavMeshPoly(this.debugDrawImpl, mesh.raw.m_navMesh, ref, col);
|
|
1906
1906
|
return this.flush();
|
|
1907
1907
|
}
|
|
1908
1908
|
/**
|
|
@@ -1911,13 +1911,6 @@ class DebugDrawerUtils {
|
|
|
1911
1911
|
dispose() {
|
|
1912
1912
|
Raw.Module.destroy(this.debugDrawImpl);
|
|
1913
1913
|
}
|
|
1914
|
-
rgbToDuRgba(color) {
|
|
1915
|
-
// convert hexadecimal rgb color to duRGBA format
|
|
1916
|
-
const r = color & 0xff;
|
|
1917
|
-
const g = color >> 8 & 0xff;
|
|
1918
|
-
const b = color >> 16 & 0xff;
|
|
1919
|
-
return r | g << 8 | b << 16 | 255 << 24;
|
|
1920
|
-
}
|
|
1921
1914
|
vertex(x, y, z, color) {
|
|
1922
1915
|
const r = (color & 0xff) / 255;
|
|
1923
1916
|
const g = (color >> 8 & 0xff) / 255;
|
|
@@ -1926,6 +1919,15 @@ class DebugDrawerUtils {
|
|
|
1926
1919
|
this.currentVertices.push([x, y, z, r, g, b, a]);
|
|
1927
1920
|
}
|
|
1928
1921
|
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Converts a color in 0xRRGGBBAA format to a duRGBA format.
|
|
1924
|
+
*/
|
|
1925
|
+
const rgbToDuRgba = hexColor => {
|
|
1926
|
+
const r = hexColor >> 16 & 0xff;
|
|
1927
|
+
const g = hexColor >> 8 & 0xff;
|
|
1928
|
+
const b = hexColor & 0xff;
|
|
1929
|
+
return r | g << 8 | b << 16 | 255 << 24;
|
|
1930
|
+
};
|
|
1929
1931
|
|
|
1930
1932
|
class NavMeshGetTilesAtResult {
|
|
1931
1933
|
constructor(raw) {
|
|
@@ -2853,7 +2855,7 @@ class RecastPolyMesh {
|
|
|
2853
2855
|
return this.raw.get_areas(index);
|
|
2854
2856
|
}
|
|
2855
2857
|
setAreas(index, value) {
|
|
2856
|
-
|
|
2858
|
+
this.raw.set_areas(index, value);
|
|
2857
2859
|
}
|
|
2858
2860
|
nverts() {
|
|
2859
2861
|
return this.raw.nverts;
|
|
@@ -3276,4 +3278,4 @@ const importTileCache = (data, tileCacheMeshProcess) => {
|
|
|
3276
3278
|
};
|
|
3277
3279
|
};
|
|
3278
3280
|
|
|
3279
|
-
export { ChunkIdsArray, Crowd, CrowdAgent, DebugDrawerUtils, Detour, DetourBVNode, DetourLink, DetourMeshHeader, DetourMeshTile, DetourOffMeshConnection, DetourPoly, DetourPolyDetail, DetourTileCacheParams, FloatArray, IntArray, NavMesh, NavMeshCalcTileLocResult, NavMeshCreateParams, NavMeshGetTilesAtResult, NavMeshParams, NavMeshQuery, NavMeshRemoveTileResult, NavMeshStoreTileStateResult, QueryFilter, Raw, Recast, RecastBuildContext, RecastChunkyTriMesh, RecastCompactCell, RecastCompactHeightfield, RecastCompactSpan, RecastContour, RecastContourSet, RecastHeightfield, RecastHeightfieldLayer, RecastHeightfieldLayerSet, RecastPolyMesh, RecastPolyMeshDetail, RecastSpan, RecastSpanPool, TileCache, TileCacheData, TileCacheMeshProcess, TriangleAreasArray, TrianglesArray, UnsignedCharArray, UnsignedIntArray, UnsignedShortArray, VerticesArray, allocCompactHeightfield, allocContourSet, allocHeightfield, allocHeightfieldLayerSet, allocPolyMesh, allocPolyMeshDetail, array, buildCompactHeightfield, buildContours, buildDistanceField, buildHeightfieldLayers, buildLayerRegions, buildPolyMesh, buildPolyMeshDetail, buildRegions, buildRegionsMonotone, buildTileCacheLayer, calcBounds, calcGridSize, clearUnwalkableTriangles, cloneRcConfig, copyPolyMesh, createHeightfield, createNavMeshData, createRcConfig, crowdAgentParamsDefaults, erodeWalkableArea, exportNavMesh, exportTileCache, filterLedgeSpans, filterLowHangingWalkableObstacles, filterWalkableLowHeightSpans, floodFillPruneNavMesh, freeCompactHeightfield, freeContourSet, freeHeightfield, freeHeightfieldLayerSet, freePolyMesh, freePolyMeshDetail, getCon, getDirForOffset, getDirOffsetX, getDirOffsetY, getHeightFieldSpanCount, getHeightfieldLayerAreas, getHeightfieldLayerCons, getHeightfieldLayerHeights, getNavMeshPositionsAndIndices, getRandomSeed, importNavMesh, importTileCache, init, markBoxArea, markConvexPolyArea, markCylinderArea, markWalkableTriangles, medianFilterWalkableArea, mergePolyMeshDetails, mergePolyMeshes, rasterizeTriangles, recastConfigDefaults, setCon, setRandomSeed, statusDetail, statusFailed, statusInProgress, statusSucceed, statusToReadableString, vec3 };
|
|
3281
|
+
export { ChunkIdsArray, Crowd, CrowdAgent, DebugDrawerUtils, Detour, DetourBVNode, DetourLink, DetourMeshHeader, DetourMeshTile, DetourOffMeshConnection, DetourPoly, DetourPolyDetail, DetourTileCacheParams, FloatArray, IntArray, NavMesh, NavMeshCalcTileLocResult, NavMeshCreateParams, NavMeshGetTilesAtResult, NavMeshParams, NavMeshQuery, NavMeshRemoveTileResult, NavMeshStoreTileStateResult, QueryFilter, Raw, Recast, RecastBuildContext, RecastChunkyTriMesh, RecastCompactCell, RecastCompactHeightfield, RecastCompactSpan, RecastContour, RecastContourSet, RecastHeightfield, RecastHeightfieldLayer, RecastHeightfieldLayerSet, RecastPolyMesh, RecastPolyMeshDetail, RecastSpan, RecastSpanPool, TileCache, TileCacheData, TileCacheMeshProcess, TriangleAreasArray, TrianglesArray, UnsignedCharArray, UnsignedIntArray, UnsignedShortArray, VerticesArray, allocCompactHeightfield, allocContourSet, allocHeightfield, allocHeightfieldLayerSet, allocPolyMesh, allocPolyMeshDetail, array, buildCompactHeightfield, buildContours, buildDistanceField, buildHeightfieldLayers, buildLayerRegions, buildPolyMesh, buildPolyMeshDetail, buildRegions, buildRegionsMonotone, buildTileCacheLayer, calcBounds, calcGridSize, clearUnwalkableTriangles, cloneRcConfig, copyPolyMesh, createHeightfield, createNavMeshData, createRcConfig, crowdAgentParamsDefaults, erodeWalkableArea, exportNavMesh, exportTileCache, filterLedgeSpans, filterLowHangingWalkableObstacles, filterWalkableLowHeightSpans, floodFillPruneNavMesh, freeCompactHeightfield, freeContourSet, freeHeightfield, freeHeightfieldLayerSet, freePolyMesh, freePolyMeshDetail, getCon, getDirForOffset, getDirOffsetX, getDirOffsetY, getHeightFieldSpanCount, getHeightfieldLayerAreas, getHeightfieldLayerCons, getHeightfieldLayerHeights, getNavMeshPositionsAndIndices, getRandomSeed, importNavMesh, importTileCache, init, markBoxArea, markConvexPolyArea, markCylinderArea, markWalkableTriangles, medianFilterWalkableArea, mergePolyMeshDetails, mergePolyMeshes, rasterizeTriangles, recastConfigDefaults, rgbToDuRgba, setCon, setRandomSeed, statusDetail, statusFailed, statusInProgress, statusSucceed, statusToReadableString, vec3 };
|
package/dist/nav-mesh-query.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FloatArray, UnsignedCharArray, UnsignedIntArray } from './arrays';
|
|
2
|
-
import { NavMesh } from './nav-mesh';
|
|
2
|
+
import type { NavMesh } from './nav-mesh';
|
|
3
3
|
import { type RawModule } from './raw';
|
|
4
|
-
import { Vector3 } from './utils';
|
|
4
|
+
import { type Vector3 } from './utils';
|
|
5
5
|
export declare class QueryFilter {
|
|
6
6
|
raw: RawModule.dtQueryFilter;
|
|
7
7
|
get includeFlags(): number;
|
package/dist/nav-mesh.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UnsignedCharArray } from './arrays';
|
|
1
|
+
import type { UnsignedCharArray } from './arrays';
|
|
2
2
|
import { DetourMeshTile, DetourOffMeshConnection, DetourPoly } from './detour';
|
|
3
3
|
import { type RawModule } from './raw';
|
|
4
|
-
import { Vector3 } from './utils';
|
|
4
|
+
import { type Vector3 } from './utils';
|
|
5
5
|
export declare class NavMeshGetTilesAtResult {
|
|
6
6
|
raw: RawModule.NavMeshGetTilesAtResult;
|
|
7
7
|
constructor(raw: RawModule.NavMeshGetTilesAtResult);
|
package/dist/recast.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Vector3Tuple } from 'three';
|
|
2
|
-
import { FloatArray, IntArray, UnsignedCharArray } from './arrays';
|
|
1
|
+
import type { Vector3Tuple } from 'three';
|
|
2
|
+
import { type FloatArray, IntArray, UnsignedCharArray } from './arrays';
|
|
3
3
|
import { type RawModule } from './raw';
|
|
4
|
-
import { Vector2Tuple, Vector3 } from './utils';
|
|
4
|
+
import { type Vector2Tuple, type Vector3 } from './utils';
|
|
5
5
|
export type RecastConfig = {
|
|
6
6
|
/**
|
|
7
7
|
* The size of the non-navigable border around the heightfield.
|
package/dist/serdes/export.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavMesh } from '../nav-mesh';
|
|
2
|
-
import { TileCache } from '../tile-cache';
|
|
1
|
+
import type { NavMesh } from '../nav-mesh';
|
|
2
|
+
import type { TileCache } from '../tile-cache';
|
|
3
3
|
export declare const exportNavMesh: (navMesh: NavMesh) => Uint8Array;
|
|
4
4
|
export declare const exportTileCache: (navMesh: NavMesh, tileCache: TileCache) => Uint8Array;
|
package/dist/serdes/import.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NavMesh } from '../nav-mesh';
|
|
2
2
|
import { type RawModule } from '../raw';
|
|
3
|
-
import { TileCache, TileCacheMeshProcess } from '../tile-cache';
|
|
3
|
+
import { TileCache, type TileCacheMeshProcess } from '../tile-cache';
|
|
4
4
|
export type ImportNavMeshResult = {
|
|
5
5
|
navMesh: NavMesh;
|
|
6
6
|
};
|
package/dist/tile-cache.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UnsignedCharArray, UnsignedShortArray } from './arrays';
|
|
2
2
|
import { NavMeshCreateParams } from './detour';
|
|
3
|
-
import { NavMesh } from './nav-mesh';
|
|
3
|
+
import type { NavMesh } from './nav-mesh';
|
|
4
4
|
import { type RawModule } from './raw';
|
|
5
|
-
import { Vector3 } from './utils';
|
|
5
|
+
import { type Vector3 } from './utils';
|
|
6
6
|
export type ObstacleRef = RawModule.dtObstacleRef;
|
|
7
7
|
export type BoxObstacle = {
|
|
8
8
|
type: 'box';
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"email": "isaac@isaacmason.com",
|
|
7
7
|
"url": "https://isaacmason.com/"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.42.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"homepage": "https://github.com/isaac-mason/recast-navigation-js",
|
|
12
12
|
"bugs": {
|
|
@@ -23,25 +23,21 @@
|
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "rollup --config rollup.config.js --bundleConfigAsCjs",
|
|
26
|
-
"test": "tsc"
|
|
27
|
-
"lint": "eslint src"
|
|
26
|
+
"test": "tsc"
|
|
28
27
|
},
|
|
29
28
|
"dependencies": {
|
|
30
|
-
"@recast-navigation/wasm": "0.
|
|
29
|
+
"@recast-navigation/wasm": "0.42.0"
|
|
31
30
|
},
|
|
32
31
|
"devDependencies": {
|
|
33
|
-
"@babel/core": "^7.
|
|
34
|
-
"@babel/preset-env": "^7.
|
|
35
|
-
"@babel/preset-typescript": "^7.
|
|
36
|
-
"@isaac-mason/eslint-config-typescript": "^0.0.9",
|
|
32
|
+
"@babel/core": "^7.28.0",
|
|
33
|
+
"@babel/preset-env": "^7.28.0",
|
|
34
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
37
35
|
"@rollup/plugin-babel": "^6.0.4",
|
|
38
|
-
"@rollup/plugin-commonjs": "^
|
|
39
|
-
"@rollup/plugin-node-resolve": "^
|
|
40
|
-
"@rollup/plugin-typescript": "^
|
|
41
|
-
"babel-loader": "^
|
|
42
|
-
"
|
|
43
|
-
"prettier": "^3.1.0",
|
|
44
|
-
"rollup": "^4.14.0",
|
|
36
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
37
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
38
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
39
|
+
"babel-loader": "^10.0.0",
|
|
40
|
+
"rollup": "^4.44.2",
|
|
45
41
|
"rollup-plugin-copy": "^3.4.0",
|
|
46
42
|
"rollup-plugin-filesize": "^10.0.0",
|
|
47
43
|
"typescript": "^5.4.3"
|