@soonspacejs/plugin-pathfinding 2.13.10 → 2.13.11
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/index.d.ts +25 -25
- package/dist/index.esm.js +1 -1
- package/dist/utils.d.ts +6 -6
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Object3D } from 'three';
|
|
2
|
-
import { NavMesh, Crowd, CrowdParams } from '@recast-navigation/core';
|
|
3
|
-
import { SoloNavMeshGeneratorConfig } from '@recast-navigation/generators';
|
|
4
|
-
import { DebugDrawer, CrowdHelper, CrowdHelperParams } from '@recast-navigation/three';
|
|
5
|
-
import SoonSpace from 'soonspacejs';
|
|
6
|
-
declare class PathfindingPlugin {
|
|
7
|
-
readonly ssp: SoonSpace;
|
|
8
|
-
navMesh: NavMesh | null;
|
|
9
|
-
crowd: Crowd | null;
|
|
10
|
-
debugDrawer: DebugDrawer | null;
|
|
11
|
-
crowdHelper: CrowdHelper | null;
|
|
12
|
-
constructor(ssp: SoonSpace);
|
|
13
|
-
createSoloNavMesh(objects: Object3D[], config?: Partial<SoloNavMeshGeneratorConfig>): NavMesh | null;
|
|
14
|
-
disposeSoloNavMesh(): void;
|
|
15
|
-
_crowdUpdate: () => void;
|
|
16
|
-
createCrowd(params: CrowdParams): Crowd | null;
|
|
17
|
-
disposeCrowd(): void;
|
|
18
|
-
createDebugDrawer(): DebugDrawer | null;
|
|
19
|
-
disposeDebugDrawer(): void;
|
|
20
|
-
createCrowdHelper(params?: CrowdHelperParams): CrowdHelper | null;
|
|
21
|
-
disposeCrowdHelper(): void;
|
|
22
|
-
dispose(): void;
|
|
23
|
-
}
|
|
24
|
-
export default PathfindingPlugin;
|
|
25
|
-
export * from './utils';
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
import { NavMesh, Crowd, CrowdParams } from '@recast-navigation/core';
|
|
3
|
+
import { SoloNavMeshGeneratorConfig } from '@recast-navigation/generators';
|
|
4
|
+
import { DebugDrawer, CrowdHelper, CrowdHelperParams } from '@recast-navigation/three';
|
|
5
|
+
import SoonSpace from 'soonspacejs';
|
|
6
|
+
declare class PathfindingPlugin {
|
|
7
|
+
readonly ssp: SoonSpace;
|
|
8
|
+
navMesh: NavMesh | null;
|
|
9
|
+
crowd: Crowd | null;
|
|
10
|
+
debugDrawer: DebugDrawer | null;
|
|
11
|
+
crowdHelper: CrowdHelper | null;
|
|
12
|
+
constructor(ssp: SoonSpace);
|
|
13
|
+
createSoloNavMesh(objects: Object3D[], config?: Partial<SoloNavMeshGeneratorConfig>): NavMesh | null;
|
|
14
|
+
disposeSoloNavMesh(): void;
|
|
15
|
+
_crowdUpdate: () => void;
|
|
16
|
+
createCrowd(params: CrowdParams): Crowd | null;
|
|
17
|
+
disposeCrowd(): void;
|
|
18
|
+
createDebugDrawer(): DebugDrawer | null;
|
|
19
|
+
disposeDebugDrawer(): void;
|
|
20
|
+
createCrowdHelper(params?: CrowdHelperParams): CrowdHelper | null;
|
|
21
|
+
disposeCrowdHelper(): void;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}
|
|
24
|
+
export default PathfindingPlugin;
|
|
25
|
+
export * from './utils';
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Matrix4 as e,Mesh as s,InstancedMesh as r,MeshStandardMaterial as t}from"three";import{Crowd as o}from"@recast-navigation/core";import{generateSoloNavMesh as i}from"@recast-navigation/generators";import{DebugDrawer as a,CrowdHelper as d}from"@recast-navigation/three";import h from"soonspacejs";import{StaticGeometryGenerator as n}from"three-mesh-bvh";function c(r){const t=r.name,o=r.geometry,i=r.material,a=r.count,d=[];for(let h=0;h<a;h++){const a=new e;r.getMatrixAt(h,a);const n=new s(o,i);n.name=`${t}_${h}`,d.push(n),a.premultiply(r.matrixWorld),n.matrix.copy(a),n.matrixWorld.copy(a),a.decompose(n.position,n.quaternion,n.scale)}return d}function p(e){var s;const t=[];e.forEach(
|
|
1
|
+
import{Matrix4 as e,Mesh as s,InstancedMesh as r,MeshStandardMaterial as t}from"three";import{Crowd as o}from"@recast-navigation/core";import{generateSoloNavMesh as i}from"@recast-navigation/generators";import{DebugDrawer as a,CrowdHelper as d}from"@recast-navigation/three";import h from"soonspacejs";import{StaticGeometryGenerator as n}from"three-mesh-bvh";function c(r){const t=r.name,o=r.geometry,i=r.material,a=r.count,d=[];for(let h=0;h<a;h++){const a=new e;r.getMatrixAt(h,a);const n=new s(o,i);n.name=`${t}_${h}`,d.push(n),a.premultiply(r.matrixWorld),n.matrix.copy(a),n.matrixWorld.copy(a),a.decompose(n.position,n.quaternion,n.scale)}return d}function p(e){var s;const t=[];e.forEach(e=>{e.traverse(e=>{"Mesh"===e.type&&(e instanceof r?t.push(...c(e)):t.push(e))})});const o=new n(t);o.applyWorldTransforms=!0,o.attributes=["position","index"];const i=o.generate();return{positions:i.attributes.position.array,indices:null===(s=i.index)||void 0===s?void 0:s.array}}const{warn:l}=h.utils;class w{constructor(e){this.ssp=e,this.navMesh=null,this.crowd=null,this.debugDrawer=null,this.crowdHelper=null,this._crowdUpdate=()=>{var e;this.crowd&&(this.crowd.update(this.ssp.viewport.state.delta),null===(e=this.crowdHelper)||void 0===e||e.update(),this.crowd.getActiveAgentCount()>0&&this.ssp.render())}}createSoloNavMesh(e,s={}){if(this.navMesh)return l("navmesh 已经存在,请先调用 disposeNavMesh()"),this.navMesh;const{positions:r,indices:t}=p(e),o=i(r,t,s);return o.success?(this.navMesh=o.navMesh,this.navMesh):null}disposeSoloNavMesh(){var e;null===(e=this.navMesh)||void 0===e||e.destroy(),this.navMesh=null}createCrowd(e){return this.crowd?(l("crowd 已经存在,请先调用 disposeCrowd()"),this.crowd):this.navMesh?(this.crowd=new o(this.navMesh,e),this.ssp.signals.beforeRender.add(this._crowdUpdate),this.crowd):(l("navmesh 不存在,请先调用 createSoloNavMesh()"),null)}disposeCrowd(){var e;null===(e=this.crowd)||void 0===e||e.destroy(),this.crowd=null,this.ssp.signals.beforeRender.remove(this._crowdUpdate)}createDebugDrawer(){return this.debugDrawer?(l("debug drawer 已经存在,请先调用 disposeDebugDrawer()"),this.debugDrawer):this.navMesh?(this.debugDrawer=new a,this.debugDrawer.drawNavMesh(this.navMesh,0),this.ssp.addObject(this.debugDrawer),this.debugDrawer):(l("navmesh 不存在,请先调用 createSoloNavMesh()"),null)}disposeDebugDrawer(){this.debugDrawer&&(this.debugDrawer.dispose(),this.ssp.removeObject(this.debugDrawer),this.debugDrawer=null)}createCrowdHelper(e={agentMaterial:new t({color:65280})}){return this.crowdHelper?(l("crowd helper 已经存在,请先调用 disposeCrowdHelper()"),this.crowdHelper):this.crowd?(this.crowdHelper=new d(this.crowd,e),this.ssp.addObject(this.crowdHelper),this.crowdHelper):(l("crowd 不存在,请先调用 createCrowd()"),null)}disposeCrowdHelper(){this.crowdHelper&&(this.crowdHelper.agentMeshes.forEach(e=>{e.geometry.dispose(),e.material.dispose()}),this.ssp.removeObject(this.crowdHelper))}dispose(){this.disposeSoloNavMesh(),this.disposeCrowd(),this.disposeDebugDrawer(),this.disposeCrowdHelper()}}export{c as deInstancingMesh,w as default,p as getVertices};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InstancedMesh, Mesh, Object3D } from 'three';
|
|
2
|
-
export declare function deInstancingMesh(insMesh: InstancedMesh): Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes>, import("three").Material | import("three").Material[], import("three").Object3DEventMap>[];
|
|
3
|
-
export declare function getVertices(objects: Object3D[]): {
|
|
4
|
-
positions: Float32Array
|
|
5
|
-
indices: Uint32Array
|
|
6
|
-
};
|
|
1
|
+
import { InstancedMesh, Mesh, Object3D } from 'three';
|
|
2
|
+
export declare function deInstancingMesh(insMesh: InstancedMesh): Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, import("three").Material | import("three").Material[], import("three").Object3DEventMap>[];
|
|
3
|
+
export declare function getVertices(objects: Object3D[]): {
|
|
4
|
+
positions: Float32Array<ArrayBufferLike>;
|
|
5
|
+
indices: Uint32Array<ArrayBufferLike>;
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-pathfinding",
|
|
3
3
|
"pluginName": "PathfindingPlugin",
|
|
4
|
-
"version": "2.13.
|
|
4
|
+
"version": "2.13.11",
|
|
5
5
|
"description": "Pathfinding plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
],
|
|
14
14
|
"author": "xuek,jiangqi",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "08bf9efb38c291f22ca044b936fd49269c716bbb",
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@recast-navigation/core": "^0.38.0",
|
|
19
19
|
"@recast-navigation/generators": "^0.38.0",
|
|
20
20
|
"@recast-navigation/three": "^0.38.0",
|
|
21
21
|
"@recast-navigation/wasm": "^0.38.0",
|
|
22
|
-
"soonspacejs": "2.13.
|
|
22
|
+
"soonspacejs": "2.13.11"
|
|
23
23
|
}
|
|
24
24
|
}
|