@soonspacejs/plugin-pathfinding 2.11.70 → 2.11.71
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 +1 -0
- package/dist/index.esm.js +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-pathfinding",
|
|
3
3
|
"pluginName": "PathfindingPlugin",
|
|
4
|
-
"version": "2.11.
|
|
4
|
+
"version": "2.11.71",
|
|
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": "5baf7b852185a264678d38a3b40739c5308beded",
|
|
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.11.
|
|
22
|
+
"soonspacejs": "2.11.71"
|
|
23
23
|
}
|
|
24
24
|
}
|