@recast-navigation/core 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import type R from '@recast-navigation/wasm';
2
- export declare type CreateNavMeshDataParams = {
2
+ export type CreateNavMeshDataParams = {
3
3
  verts: number[];
4
4
  vertCount: number;
5
5
  polys: number[];
@@ -32,9 +32,10 @@ export declare type CreateNavMeshDataParams = {
32
32
  ch: number;
33
33
  buildBvTree: boolean;
34
34
  };
35
- export declare type CreateNavMeshDataResult = R.CreateNavMeshDataResult;
35
+ export type CreateNavMeshDataResult = R.CreateNavMeshDataResult;
36
36
  export declare class NavMeshBuilder {
37
37
  raw: R.NavMeshBuilder;
38
38
  constructor();
39
39
  createNavMeshData(params: CreateNavMeshDataParams): CreateNavMeshDataResult;
40
+ destroy(): void;
40
41
  }
@@ -9,4 +9,5 @@ export declare class NavMeshExporter {
9
9
  * @returns data the Uint8Array that can be saved and reused
10
10
  */
11
11
  export(navMesh: NavMesh, tileCache?: TileCache): Uint8Array;
12
+ destroy(): void;
12
13
  }
@@ -1,7 +1,7 @@
1
1
  import type R from '@recast-navigation/wasm';
2
2
  import { NavMesh } from './nav-mesh';
3
3
  import { TileCache } from './tile-cache';
4
- export declare type NavMeshConfig = {
4
+ export type NavMeshConfig = {
5
5
  /**
6
6
  * The size of the non-navigable border around the heightfield.
7
7
  * [Limit: >=0] [Units: vx]
@@ -106,7 +106,7 @@ export declare type NavMeshConfig = {
106
106
  */
107
107
  maxLayers: number;
108
108
  };
109
- export declare type NavMeshGeneratorResult = {
109
+ export type NavMeshGeneratorResult = {
110
110
  success: boolean;
111
111
  navMesh: NavMesh;
112
112
  tileCache: TileCache;
@@ -121,4 +121,5 @@ export declare class NavMeshGenerator {
121
121
  * @param navMeshConfig optional configuration for the NavMesh
122
122
  */
123
123
  generate(positions: ArrayLike<number>, indices: ArrayLike<number>, navMeshConfig?: Partial<NavMeshConfig>): NavMeshGeneratorResult;
124
+ destroy(): void;
124
125
  }
@@ -1,7 +1,7 @@
1
1
  import type R from '@recast-navigation/wasm';
2
2
  import { NavMesh } from './nav-mesh';
3
3
  import { TileCache } from './tile-cache';
4
- export declare type NavMeshImporterResult = {
4
+ export type NavMeshImporterResult = {
5
5
  navMesh: NavMesh;
6
6
  tileCache: TileCache;
7
7
  };
@@ -13,4 +13,5 @@ export declare class NavMeshImporter {
13
13
  * @param data the Uint8Array returned by `getNavMeshExport`
14
14
  */
15
15
  import(data: Uint8Array): NavMeshImporterResult;
16
+ destroy(): void;
16
17
  }
@@ -1,7 +1,7 @@
1
1
  import type R from '@recast-navigation/wasm';
2
2
  import { NavMesh } from './nav-mesh';
3
3
  import { Vector3 } from './utils';
4
- export declare type NavMeshQueryParams = {
4
+ export type NavMeshQueryParams = {
5
5
  navMesh: NavMesh;
6
6
  /**
7
7
  * @default 2048
@@ -10,6 +10,8 @@ export declare type NavMeshQueryParams = {
10
10
  };
11
11
  export declare class NavMeshQuery {
12
12
  raw: R.NavMeshQuery;
13
+ private tmpVec1;
14
+ private tmpVec2;
13
15
  constructor({ navMesh, maxNodes }: NavMeshQueryParams);
14
16
  /**
15
17
  * Returns the closest point on the NavMesh to the given position.
@@ -25,7 +27,7 @@ export declare class NavMeshQuery {
25
27
  moveAlong(position: Vector3, destination: Vector3): Vector3;
26
28
  /**
27
29
  * Finds a path from the start position to the end position.
28
- *g
30
+ *
29
31
  * @returns an array of Vector3 positions that make up the path, or an empty array if no path was found.
30
32
  */
31
33
  computePath(start: Vector3, end: Vector3): Vector3[];
@@ -95,24 +95,28 @@ export declare class NavMeshGetTilesAtResult {
95
95
  constructor(raw: R.NavMeshGetTilesAtResult);
96
96
  tiles(index: number): dtMeshTile;
97
97
  tileCount(): number;
98
+ destroy(): void;
98
99
  }
99
100
  export declare class NavMeshAddTileResult {
100
101
  raw: R.NavMeshAddTileResult;
101
102
  constructor(raw: R.NavMeshAddTileResult);
102
103
  tileRef(): number;
103
104
  status(): number;
105
+ destroy(): void;
104
106
  }
105
107
  export declare class NavMeshRemoveTileResult {
106
108
  raw: R.NavMeshRemoveTileResult;
107
109
  constructor(raw: R.NavMeshRemoveTileResult);
108
110
  data(): number[];
109
111
  dataSize(): number;
112
+ destroy(): void;
110
113
  }
111
114
  export declare class NavMeshCalcTileLocResult {
112
115
  raw: R.NavMeshCalcTileLocResult;
113
116
  constructor(raw: R.NavMeshCalcTileLocResult);
114
117
  tileX(): number;
115
118
  tileY(): number;
119
+ destroy(): void;
116
120
  }
117
121
  export declare class NavMeshGetTileAndPolyByRefResult {
118
122
  raw: R.NavMeshGetTileAndPolyByRefResult;
@@ -120,6 +124,7 @@ export declare class NavMeshGetTileAndPolyByRefResult {
120
124
  tile(): dtMeshTile;
121
125
  poly(): dtPoly;
122
126
  status(): number;
127
+ destroy(): void;
123
128
  }
124
129
  export declare class NavMeshGetOffMeshConnectionPolyEndPointsResult {
125
130
  raw: R.NavMeshGetOffMeshConnectionPolyEndPointsResult;
@@ -127,32 +132,35 @@ export declare class NavMeshGetOffMeshConnectionPolyEndPointsResult {
127
132
  status(): number;
128
133
  startPos(): Vector3;
129
134
  endPos(): Vector3;
135
+ destroy(): void;
130
136
  }
131
137
  export declare class NavMeshGetPolyFlagsResult {
132
138
  raw: R.NavMeshGetPolyFlagsResult;
133
139
  constructor(raw: R.NavMeshGetPolyFlagsResult);
134
140
  flags(): number;
135
141
  status(): number;
142
+ destroy(): void;
136
143
  }
137
144
  export declare class NavMeshGetPolyAreaResult {
138
145
  raw: R.NavMeshGetPolyAreaResult;
139
146
  constructor(raw: R.NavMeshGetPolyAreaResult);
140
147
  area(): number;
141
148
  status(): number;
149
+ destroy(): void;
142
150
  }
143
151
  export declare class NavMeshStoreTileStateResult {
144
152
  raw: R.NavMeshStoreTileStateResult;
145
153
  constructor(raw: R.NavMeshStoreTileStateResult);
146
154
  data(): number[];
147
155
  dataSize(): number;
156
+ destroy(): void;
148
157
  }
149
158
  export declare class DebugNavMesh {
150
- raw: R.DebugNavMesh;
151
159
  positions: number[];
152
160
  indices: number[];
153
- constructor(debugNavMesh: R.DebugNavMesh);
161
+ constructor(navMesh: NavMesh);
154
162
  }
155
- export declare type NavMeshParams = {
163
+ export type NavMeshParams = {
156
164
  orig: Vector3;
157
165
  tileWidth: number;
158
166
  tileHeight: number;
@@ -1,18 +1,18 @@
1
1
  import type R from '@recast-navigation/wasm';
2
2
  import type { Vector3 } from './utils';
3
- export declare type ObstacleRef = R.dtObstacleRef;
4
- export declare type BoxObstacle = {
3
+ export type ObstacleRef = R.dtObstacleRef;
4
+ export type BoxObstacle = {
5
5
  type: 'box';
6
6
  ref: ObstacleRef;
7
7
  position: Vector3;
8
8
  extent: Vector3;
9
9
  angle: number;
10
10
  };
11
- export declare type CylinderObstacle = {
11
+ export type CylinderObstacle = {
12
12
  type: 'cylinder';
13
13
  ref: ObstacleRef;
14
14
  position: Vector3;
15
15
  radius: number;
16
16
  height: number;
17
17
  };
18
- export declare type Obstacle = BoxObstacle | CylinderObstacle;
18
+ export type Obstacle = BoxObstacle | CylinderObstacle;
@@ -2,7 +2,7 @@ import type R from '@recast-navigation/wasm';
2
2
  import { NavMesh } from './nav-mesh';
3
3
  import { BoxObstacle, CylinderObstacle, Obstacle, ObstacleRef } from './obstacle';
4
4
  import { Vector3 } from './utils';
5
- export declare type TileCacheParams = {
5
+ export type TileCacheParams = {
6
6
  orig: ReadonlyArray<number>;
7
7
  cs: number;
8
8
  ch: number;
@@ -15,7 +15,7 @@ export declare type TileCacheParams = {
15
15
  maxTiles: number;
16
16
  maxObstacles: number;
17
17
  };
18
- export declare type TileCacheUpdateResult = {
18
+ export type TileCacheUpdateResult = {
19
19
  status: number;
20
20
  upToDate: boolean;
21
21
  };
@@ -45,4 +45,5 @@ export declare class TileCache {
45
45
  * Removes an obstacle from the navigation mesh.
46
46
  */
47
47
  removeObstacle(obstacle: Obstacle | ObstacleRef): void;
48
+ destroy(): void;
48
49
  }
package/dist/utils.d.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  import type R from '@recast-navigation/wasm';
2
- export declare type Vector3 = {
2
+ export declare const emscripten: {
3
+ isNull: (obj: unknown) => boolean;
4
+ getPointer: (obj: unknown) => number;
5
+ destroy: (obj: unknown) => void;
6
+ };
7
+ export type Vector3 = {
3
8
  x: number;
4
9
  y: number;
5
10
  z: number;
6
11
  };
7
12
  export declare const vec3: {
8
- toRaw: ({ x, y, z }: Vector3) => R.Vec3;
9
- fromRaw: ({ x, y, z }: R.Vec3) => {
13
+ toRaw: ({ x, y, z }: Vector3, existing?: R.Vec3) => R.Vec3;
14
+ fromRaw: (vec3: R.Vec3, freeRaw?: boolean) => {
10
15
  x: number;
11
16
  y: number;
12
17
  z: number;
@@ -19,7 +24,3 @@ export declare const vec3: {
19
24
  toArray: ({ x, y, z }: Vector3) => number[];
20
25
  };
21
26
  export declare const array: <T>(getter: (index: number) => T, count: number) => T[];
22
- export declare const emscripten: {
23
- isNull: (obj: unknown) => boolean;
24
- getPointer: (obj: unknown) => number;
25
- };
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.1.1",
9
+ "version": "0.1.2",
10
10
  "license": "MIT",
11
11
  "homepage": "https://github.com/isaac-mason/recast-navigation-js",
12
12
  "bugs": {
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@babel/core": "^7.18.6",
29
- "@recast-navigation/wasm": "0.1.1",
29
+ "@recast-navigation/wasm": "0.1.2",
30
30
  "@rollup/plugin-commonjs": "^24.0.1",
31
31
  "@rollup/plugin-node-resolve": "^15.0.1",
32
32
  "@rollup/plugin-terser": "^0.4.0",
@@ -39,18 +39,18 @@
39
39
  "eslint-config-airbnb": "^18.2.1",
40
40
  "eslint-config-airbnb-base": "^14.2.1",
41
41
  "eslint-config-prettier": "^8.3.0",
42
- "eslint-import-resolver-typescript": "^2.4.0",
42
+ "eslint-import-resolver-typescript": "^3.5.5",
43
43
  "eslint-plugin-es": "^4.1.0",
44
- "eslint-plugin-import": "^2.24.2",
44
+ "eslint-plugin-import": "^2.27.5",
45
45
  "eslint-plugin-prettier": "^4.0.0",
46
- "eslint-plugin-simple-import-sort": "^7.0.0",
46
+ "eslint-plugin-simple-import-sort": "^10.0.0",
47
47
  "eslint-plugin-typescript-enum": "^2.1.0",
48
48
  "prettier": "^2.3.2",
49
49
  "rollup": "^3.20.0",
50
50
  "rollup-plugin-copy": "^3.4.0",
51
51
  "rollup-plugin-filesize": "^10.0.0",
52
- "typescript": "^4.5.4",
53
- "vitest": "^0.29.7"
52
+ "typescript": "^5.1.3",
53
+ "vitest": "^0.32.0"
54
54
  },
55
55
  "packageManager": "yarn@3.2.1"
56
56
  }