@recast-navigation/core 0.26.0 → 0.28.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 CHANGED
@@ -1,4 +1,4 @@
1
- import RawModule from './raw-module';
1
+ import { 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;
@@ -9,40 +9,75 @@ declare abstract class BaseArray<RawType extends RawModule.IntArray | RawModule.
9
9
  set(i: number, value: number): void;
10
10
  resize(size: number): void;
11
11
  copy(data: InstanceType<T> | number[]): void;
12
- free(): void;
12
+ destroy(): void;
13
13
  getHeapView(): InstanceType<T>;
14
14
  toTypedArray(): InstanceType<T>;
15
15
  protected abstract getHeap(): InstanceType<T>;
16
16
  }
17
17
  export declare class IntArray extends BaseArray<RawModule.IntArray, typeof Int32Array> {
18
18
  typedArrayClass: Int32ArrayConstructor;
19
- constructor(raw?: RawModule.IntArray);
19
+ /**
20
+ * Creates a new IntArray.
21
+ */
22
+ constructor();
23
+ /**
24
+ * Creates a wrapper around an existing raw IntArray object.
25
+ */
26
+ constructor(raw: RawModule.IntArray);
20
27
  protected getHeap(): Int32Array;
21
- static fromRaw(raw?: RawModule.IntArray): IntArray;
28
+ static fromRaw(raw: RawModule.IntArray): IntArray;
22
29
  }
23
30
  export declare class UnsignedIntArray extends BaseArray<RawModule.UnsignedIntArray, typeof Uint32Array> {
24
31
  typedArrayClass: Uint32ArrayConstructor;
25
- constructor(raw?: RawModule.UnsignedIntArray);
32
+ /**
33
+ * Creates a new UnsignedIntArray.
34
+ */
35
+ constructor();
36
+ /**
37
+ * Creates a wrapper around an existing raw UnsignedIntArray object.
38
+ */
39
+ constructor(raw: RawModule.UnsignedIntArray);
26
40
  protected getHeap(): Uint32Array;
27
- static fromRaw(raw?: RawModule.UnsignedIntArray): UnsignedIntArray;
41
+ static fromRaw(raw: RawModule.UnsignedIntArray): UnsignedIntArray;
28
42
  }
29
43
  export declare class UnsignedCharArray extends BaseArray<RawModule.UnsignedCharArray, typeof Uint8Array> {
30
44
  typedArrayClass: Uint8ArrayConstructor;
31
- constructor(raw?: RawModule.UnsignedCharArray);
45
+ /**
46
+ * Creates a new UnsignedCharArray.
47
+ */
48
+ constructor();
49
+ /**
50
+ * Creates a wrapper around an existing raw UnsignedCharArray object.
51
+ */
52
+ constructor(raw: RawModule.UnsignedCharArray);
32
53
  protected getHeap(): Uint8Array;
33
- static fromRaw(raw?: RawModule.UnsignedCharArray): UnsignedCharArray;
54
+ static fromRaw(raw: RawModule.UnsignedCharArray): UnsignedCharArray;
34
55
  }
35
56
  export declare class UnsignedShortArray extends BaseArray<RawModule.UnsignedShortArray, typeof Uint16Array> {
36
57
  typedArrayClass: Uint16ArrayConstructor;
37
- constructor(raw?: RawModule.UnsignedShortArray);
58
+ /**
59
+ * Creates a new UnsignedShortArray.
60
+ */
61
+ constructor();
62
+ /**
63
+ * Creates a wrapper around an existing raw UnsignedShortArray object.
64
+ */
65
+ constructor(raw: RawModule.UnsignedShortArray);
38
66
  protected getHeap(): Uint16Array;
39
- static fromRaw(raw?: RawModule.UnsignedShortArray): UnsignedShortArray;
67
+ static fromRaw(raw: RawModule.UnsignedShortArray): UnsignedShortArray;
40
68
  }
41
69
  export declare class FloatArray extends BaseArray<RawModule.FloatArray, typeof Float32Array> {
42
70
  typedArrayClass: Float32ArrayConstructor;
43
- constructor(raw?: RawModule.FloatArray);
71
+ /**
72
+ * Creates a new FloatArray.
73
+ */
74
+ constructor();
75
+ /**
76
+ * Creates a wrapper around an existing raw FloatArray object.
77
+ */
78
+ constructor(raw: RawModule.FloatArray);
44
79
  protected getHeap(): Float32Array;
45
- static fromRaw(raw?: RawModule.FloatArray): FloatArray;
80
+ static fromRaw(raw: RawModule.FloatArray): FloatArray;
46
81
  }
47
82
  export declare const VerticesArray: typeof FloatArray;
48
83
  export declare const TrianglesArray: typeof IntArray;
package/dist/crowd.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { NavMesh } from './nav-mesh';
2
2
  import { NavMeshQuery, QueryFilter } from './nav-mesh-query';
3
- import type R from './raw-module';
3
+ import { RawModule } from './raw';
4
4
  import { Vector3 } from './utils';
5
5
  export type CrowdAgentParams = {
6
6
  /**
@@ -67,7 +67,7 @@ export declare const crowdAgentParamsDefaults: CrowdAgentParams;
67
67
  export declare class CrowdAgent implements CrowdAgentParams {
68
68
  crowd: Crowd;
69
69
  agentIndex: number;
70
- raw: R.dtCrowdAgent;
70
+ raw: RawModule.dtCrowdAgent;
71
71
  get radius(): number;
72
72
  set radius(value: number);
73
73
  get height(): number;
@@ -169,13 +169,9 @@ export type CrowdParams = {
169
169
  * [Limit: > 0]
170
170
  */
171
171
  maxAgentRadius: number;
172
- /**
173
- * The navigation mesh to use for planning.
174
- */
175
- navMesh: NavMesh;
176
172
  };
177
173
  export declare class Crowd {
178
- raw: R.dtCrowd;
174
+ raw: RawModule.dtCrowd;
179
175
  /**
180
176
  * The agents in the crowd.
181
177
  */
@@ -204,7 +200,20 @@ export declare class Crowd {
204
200
  * The NavMeshQuery used to find nearest polys for commands
205
201
  */
206
202
  navMeshQuery: NavMeshQuery;
207
- constructor({ maxAgents, maxAgentRadius, navMesh }: CrowdParams);
203
+ /**
204
+ *
205
+ * @param navMesh the navmesh the crowd will use for planning
206
+ * @param param1 the crowd parameters
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * const crowd = new Crowd(navMesh, {
211
+ * maxAgents: 100,
212
+ * maxAgentRadius: 1,
213
+ * });
214
+ * ```
215
+ */
216
+ constructor(navMesh: NavMesh, { maxAgents, maxAgentRadius }: CrowdParams);
208
217
  /**
209
218
  * Updates the crowd
210
219
  */
package/dist/detour.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { UnsignedCharArray } from './arrays';
2
- import type R from './raw-module';
2
+ import { type RawModule } from './raw';
3
3
  import { RecastPolyMesh, RecastPolyMeshDetail } from './recast';
4
4
  import { Vector3, Vector3Tuple } from './utils';
5
5
  export declare const statusSucceed: (status: number) => boolean;
@@ -8,16 +8,16 @@ export declare const statusInProgress: (status: number) => boolean;
8
8
  export declare const statusDetail: (status: number, detail: number) => boolean;
9
9
  export declare const statusToReadableString: (status: number) => string;
10
10
  export declare class DetourPolyDetail {
11
- raw: R.dtPolyDetail;
12
- constructor(raw: R.dtPolyDetail);
11
+ raw: RawModule.dtPolyDetail;
12
+ constructor(raw: RawModule.dtPolyDetail);
13
13
  vertBase(): number;
14
14
  triBase(): number;
15
15
  vertCount(): number;
16
16
  triCount(): number;
17
17
  }
18
18
  export declare class DetourLink {
19
- raw: R.dtLink;
20
- constructor(raw: R.dtLink);
19
+ raw: RawModule.dtLink;
20
+ constructor(raw: RawModule.dtLink);
21
21
  ref(): number;
22
22
  next(): number;
23
23
  edge(): number;
@@ -26,15 +26,15 @@ export declare class DetourLink {
26
26
  bmax(): number;
27
27
  }
28
28
  export declare class DetourBVNode {
29
- raw: R.dtBVNode;
30
- constructor(raw: R.dtBVNode);
29
+ raw: RawModule.dtBVNode;
30
+ constructor(raw: RawModule.dtBVNode);
31
31
  bmin(): Vector3;
32
32
  bmax(): Vector3;
33
33
  i(): number;
34
34
  }
35
35
  export declare class DetourOffMeshConnection {
36
- raw: R.dtOffMeshConnection;
37
- constructor(raw: R.dtOffMeshConnection);
36
+ raw: RawModule.dtOffMeshConnection;
37
+ constructor(raw: RawModule.dtOffMeshConnection);
38
38
  pos(index: number): number;
39
39
  rad(): number;
40
40
  poly(): number;
@@ -43,8 +43,8 @@ export declare class DetourOffMeshConnection {
43
43
  userId(): number;
44
44
  }
45
45
  export declare class DetourMeshHeader {
46
- raw: R.dtMeshHeader;
47
- constructor(raw: R.dtMeshHeader);
46
+ raw: RawModule.dtMeshHeader;
47
+ constructor(raw: RawModule.dtMeshHeader);
48
48
  magic(): number;
49
49
  version(): number;
50
50
  x(): number;
@@ -68,8 +68,8 @@ export declare class DetourMeshHeader {
68
68
  bvQuantFactor(): number;
69
69
  }
70
70
  export declare class DetourPoly {
71
- raw: R.dtPoly;
72
- constructor(raw: R.dtPoly);
71
+ raw: RawModule.dtPoly;
72
+ constructor(raw: RawModule.dtPoly);
73
73
  firstLink(): number;
74
74
  verts(index: number): number;
75
75
  neis(index: number): number;
@@ -79,8 +79,8 @@ export declare class DetourPoly {
79
79
  getType(): number;
80
80
  }
81
81
  export declare class DetourMeshTile {
82
- raw: R.dtMeshTile;
83
- constructor(raw: R.dtMeshTile);
82
+ raw: RawModule.dtMeshTile;
83
+ constructor(raw: RawModule.dtMeshTile);
84
84
  salt(): number;
85
85
  linksFreeList(): number;
86
86
  header(): DetourMeshHeader | null;
@@ -117,8 +117,15 @@ export type OffMeshConnectionParams = {
117
117
  userId?: number;
118
118
  };
119
119
  export declare class NavMeshCreateParams {
120
- raw: R.dtNavMeshCreateParams;
121
- constructor(raw?: R.dtNavMeshCreateParams);
120
+ raw: RawModule.dtNavMeshCreateParams;
121
+ /**
122
+ * Creates a new NavMeshCreateParams object.
123
+ */
124
+ constructor();
125
+ /**
126
+ * Creates a wrapper around an existing raw NavMeshCreateParams object.
127
+ */
128
+ constructor(raw: RawModule.dtNavMeshCreateParams);
122
129
  setPolyMeshCreateParams(polyMesh: RecastPolyMesh): void;
123
130
  setPolyMeshDetailCreateParams(polyMeshDetail: RecastPolyMeshDetail): void;
124
131
  setOffMeshConnections(offMeshConnections: OffMeshConnectionParams[]): void;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import Wasm from './raw-module';
2
1
  export * from './arrays';
3
2
  export * from './crowd';
4
3
  export * from './detour';
@@ -9,4 +8,3 @@ export * from './recast';
9
8
  export * from './serdes';
10
9
  export * from './tile-cache';
11
10
  export * from './utils';
12
- export { Wasm };