Skip to content

Commit

Permalink
fix: correctly cleanup Array, Raw Vec3, and \*Ref classes
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-mason committed May 4, 2024
1 parent a86d2c3 commit 365e0aa
Show file tree
Hide file tree
Showing 43 changed files with 685 additions and 249 deletions.
7 changes: 7 additions & 0 deletions .changeset/few-weeks-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@recast-navigation/core": minor
"@recast-navigation/wasm": minor
"recast-navigation": minor
---

fix: change findPolysAroundCircle resultCost to be a FloatArray, not a FloatRef
6 changes: 6 additions & 0 deletions .changeset/moody-boats-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@recast-navigation/core": minor
"recast-navigation": minor
---

feat(NavMeshQuery): rename closestPointOnPoly posOverPoly return to isPointOverPoly
6 changes: 6 additions & 0 deletions .changeset/sharp-maps-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@recast-navigation/core": minor
"recast-navigation": minor
---

feat(Arrays): rename 'free' to 'destroy' for consistency with other methods
6 changes: 6 additions & 0 deletions .changeset/short-geese-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@recast-navigation/core": minor
"recast-navigation": minor
---

fix: missing cleanup for Raw Vec3 and \*Ref classes
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ export const RecastAgent = forwardRef<RecastAgentRef, RecastAgentProps>(
return;
}

const navMeshQuery = new NavMeshQuery({ navMesh });
const navMeshQuery = new NavMeshQuery(navMesh);

const crowd = new Crowd({
navMesh,
const crowd = new Crowd(navMesh, {
maxAgents: 1,
maxAgentRadius: agentRadius,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/node-cjs-example/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Recast.init().then(() => {

const { navMesh } = RecastGenerators.generateSoloNavMesh(positions, indices, config);

const navMeshQuery = new Recast.NavMeshQuery({ navMesh });
const navMeshQuery = new Recast.NavMeshQuery(navMesh);

const { point: closestPoint } = navMeshQuery.findClosestPoint({ x: 2, y: 1, z: 2 });

Expand Down
2 changes: 1 addition & 1 deletion examples/node-esm-example/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const indices = groundMesh.geometry.index.array;

const { navMesh } = generateSoloNavMesh(positions, indices, config);

const navMeshQuery = new NavMeshQuery({ navMesh });
const navMeshQuery = new NavMeshQuery(navMesh);

const { point: closestPoint } = navMeshQuery.findClosestPoint({ x: 2, y: 1, z: 2 });

Expand Down
2 changes: 1 addition & 1 deletion examples/vite-example/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const App = () => {

if (!success) return;

const navMeshQuery = new NavMeshQuery({ navMesh });
const navMeshQuery = new NavMeshQuery(navMesh);

const navMeshHelper = new NavMeshHelper({
navMesh,
Expand Down
4 changes: 2 additions & 2 deletions packages/recast-navigation-core/src/arrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ abstract class BaseArray<
view.set(data);
}

free() {
this.raw.free();
destroy() {
Raw.destroy(this.raw);
}

getHeapView(): InstanceType<T> {
Expand Down
Loading

0 comments on commit 365e0aa

Please sign in to comment.