@recast-navigation/three 0.34.0 → 0.35.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/README.md +17 -21
- package/dist/debug/debug-drawer.d.ts +7 -9
- package/dist/helpers/crowd-helper.d.ts +1 -2
- package/dist/helpers/nav-mesh-helper.d.ts +3 -4
- package/dist/helpers/off-mesh-connections-helper.d.ts +1 -2
- package/dist/helpers/tile-cache-helper.d.ts +1 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ To import the three.js glue, you can either use the `three` entrypoint in `recas
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { init } from 'recast-navigation'
|
|
19
|
-
import { ... } from 'recast-navigation/three';
|
|
19
|
+
import { ... } from '@recast-navigation/three';
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Or you can use the packages directly:
|
|
@@ -44,7 +44,7 @@ This package provides convenience functions for generating nav meshes from THREE
|
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
46
|
import { init } from 'recast-navigation';
|
|
47
|
-
import { threeToSoloNavMesh, threeToTiledNavMesh, threeToTileCache } from 'recast-navigation/three';
|
|
47
|
+
import { threeToSoloNavMesh, threeToTiledNavMesh, threeToTileCache } from '@recast-navigation/three';
|
|
48
48
|
import * as THREE from 'three';
|
|
49
49
|
|
|
50
50
|
/* initialize the library */
|
|
@@ -93,7 +93,7 @@ This library provides helpers that are used in conjunction with the core library
|
|
|
93
93
|
This package provides a `DebugDrawer` utility that can visualise a navmesh and other generation intermediates.
|
|
94
94
|
|
|
95
95
|
```ts
|
|
96
|
-
import { DebugDrawer } from 'recast-navigation/three';
|
|
96
|
+
import { DebugDrawer } from '@recast-navigation/three';
|
|
97
97
|
|
|
98
98
|
const debugDrawer = new DebugDrawer();
|
|
99
99
|
|
|
@@ -116,9 +116,9 @@ This package provides helpers for visualizing various recast-navigation objects
|
|
|
116
116
|
#### `NavMeshHelper`
|
|
117
117
|
|
|
118
118
|
```ts
|
|
119
|
-
import { NavMeshHelper } from 'recast-navigation/three';
|
|
119
|
+
import { NavMeshHelper } from '@recast-navigation/three';
|
|
120
120
|
|
|
121
|
-
const navMeshHelper = new NavMeshHelper(
|
|
121
|
+
const navMeshHelper = new NavMeshHelper(navMesh);
|
|
122
122
|
|
|
123
123
|
scene.add(navMeshHelper);
|
|
124
124
|
|
|
@@ -129,11 +129,11 @@ navMeshHelper.update();
|
|
|
129
129
|
#### `OffMeshConnectionsHelper`
|
|
130
130
|
|
|
131
131
|
```ts
|
|
132
|
-
import { OffMeshConnectionsHelper } from 'recast-navigation/three';
|
|
132
|
+
import { OffMeshConnectionsHelper } from '@recast-navigation/three';
|
|
133
133
|
|
|
134
|
-
const offMeshConnectionsHelper = new OffMeshConnectionsHelper(
|
|
135
|
-
offMeshConnections
|
|
136
|
-
|
|
134
|
+
const offMeshConnectionsHelper = new OffMeshConnectionsHelper(
|
|
135
|
+
offMeshConnections
|
|
136
|
+
);
|
|
137
137
|
|
|
138
138
|
scene.add(offMeshConnectionsHelper);
|
|
139
139
|
```
|
|
@@ -143,9 +143,9 @@ scene.add(offMeshConnectionsHelper);
|
|
|
143
143
|
Visualises obstacles in a `TileCache`.
|
|
144
144
|
|
|
145
145
|
```ts
|
|
146
|
-
import { TileCacheHelper } from 'recast-navigation/three';
|
|
146
|
+
import { TileCacheHelper } from '@recast-navigation/three';
|
|
147
147
|
|
|
148
|
-
const tileCacheHelper = new TileCacheHelper(
|
|
148
|
+
const tileCacheHelper = new TileCacheHelper(tileCache);
|
|
149
149
|
|
|
150
150
|
scene.add(tileCacheHelper);
|
|
151
151
|
|
|
@@ -158,9 +158,9 @@ tileCacheHelper.update();
|
|
|
158
158
|
Visualises agents in a `Crowd`.
|
|
159
159
|
|
|
160
160
|
```ts
|
|
161
|
-
import { CrowdHelper } from 'recast-navigation/three';
|
|
161
|
+
import { CrowdHelper } from '@recast-navigation/three';
|
|
162
162
|
|
|
163
|
-
const crowdHelper = new CrowdHelper(
|
|
163
|
+
const crowdHelper = new CrowdHelper(crowd);
|
|
164
164
|
|
|
165
165
|
scene.add(crowdHelper);
|
|
166
166
|
|
|
@@ -175,8 +175,7 @@ You can optionally provide custom materials to the helpers.
|
|
|
175
175
|
```ts
|
|
176
176
|
// NavMeshHelper
|
|
177
177
|
const navMeshMaterial = new THREE.MeshBasicMaterial({ color: 'red' });
|
|
178
|
-
const navMeshHelper = new NavMeshHelper({
|
|
179
|
-
navMesh,
|
|
178
|
+
const navMeshHelper = new NavMeshHelper(navMesh, {
|
|
180
179
|
navMeshMaterial,
|
|
181
180
|
});
|
|
182
181
|
|
|
@@ -190,8 +189,7 @@ const offMeshConnectionExitCircleMaterial = new THREE.MeshBasicMaterial({
|
|
|
190
189
|
const offMeshConnectionLineMaterial = new THREE.LineBasicMaterial({
|
|
191
190
|
color: 'white',
|
|
192
191
|
});
|
|
193
|
-
const offMeshConnectionsHelper = new OffMeshConnectionsHelper({
|
|
194
|
-
offMeshConnections,
|
|
192
|
+
const offMeshConnectionsHelper = new OffMeshConnectionsHelper(offMeshConnections, {
|
|
195
193
|
entryCircleMaterial: offMeshConnectionEntryCircleMaterial,
|
|
196
194
|
exitCircleMaterial: offMeshConnectionExitCircleMaterial,
|
|
197
195
|
lineMaterial: offMeshConnectionLineMaterial,
|
|
@@ -199,15 +197,13 @@ const offMeshConnectionsHelper = new OffMeshConnectionsHelper({
|
|
|
199
197
|
|
|
200
198
|
// TileCacheHelper
|
|
201
199
|
const obstacleMaterial = new THREE.MeshBasicMaterial({ color: 'blue' });
|
|
202
|
-
const tileCacheHelper = new TileCacheHelper({
|
|
203
|
-
tileCache,
|
|
200
|
+
const tileCacheHelper = new TileCacheHelper(tileCache, {
|
|
204
201
|
obstacleMaterial,
|
|
205
202
|
});
|
|
206
203
|
|
|
207
204
|
// CrowdHelper
|
|
208
205
|
const agentMaterial = new THREE.MeshBasicMaterial({ color: 'red' });
|
|
209
|
-
const crowdHelper = new CrowdHelper({
|
|
210
|
-
crowd,
|
|
206
|
+
const crowdHelper = new CrowdHelper(crowd, {
|
|
211
207
|
agentMaterial,
|
|
212
208
|
});
|
|
213
209
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavMesh, NavMeshQuery, RecastCompactHeightfield, RecastContourSet, RecastHeightfield, RecastHeightfieldLayer, RecastHeightfieldLayerSet, RecastPolyMesh, RecastPolyMeshDetail } from '@recast-navigation/core';
|
|
1
|
+
import { DebugDrawerPrimitive, NavMesh, NavMeshQuery, RecastCompactHeightfield, RecastContourSet, RecastHeightfield, RecastHeightfieldLayer, RecastHeightfieldLayerSet, RecastPolyMesh, RecastPolyMeshDetail } from '@recast-navigation/core';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import { LineMaterial } from 'three/addons';
|
|
4
4
|
export type DebugDrawerParams = {
|
|
@@ -11,10 +11,9 @@ export declare class DebugDrawer extends THREE.Group {
|
|
|
11
11
|
pointMaterial: THREE.Material;
|
|
12
12
|
pointGeometry: THREE.SphereGeometry;
|
|
13
13
|
lineMaterial: LineMaterial;
|
|
14
|
-
private
|
|
15
|
-
private currentVertices;
|
|
16
|
-
private currentPrimitive;
|
|
14
|
+
private debugDrawerUtils;
|
|
17
15
|
constructor({ triMaterial, pointMaterial, lineMaterial, }?: DebugDrawerParams);
|
|
16
|
+
drawPrimitives(primitives: DebugDrawerPrimitive[]): void;
|
|
18
17
|
drawHeightfieldSolid(hf: RecastHeightfield): void;
|
|
19
18
|
drawHeightfieldWalkable(hf: RecastHeightfield): void;
|
|
20
19
|
drawCompactHeightfieldSolid(chf: RecastCompactHeightfield): void;
|
|
@@ -36,9 +35,8 @@ export declare class DebugDrawer extends THREE.Group {
|
|
|
36
35
|
drawNavMeshPoly(mesh: NavMesh, ref: number, col: number): void;
|
|
37
36
|
reset(): void;
|
|
38
37
|
dispose(): void;
|
|
39
|
-
private
|
|
40
|
-
private
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
private endQuads;
|
|
38
|
+
private drawPoints;
|
|
39
|
+
private drawLines;
|
|
40
|
+
private drawTris;
|
|
41
|
+
private drawQuads;
|
|
44
42
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Crowd } from '@recast-navigation/core';
|
|
2
2
|
import { Material, Mesh, Object3D } from 'three';
|
|
3
3
|
export type CrowdHelperParams = {
|
|
4
|
-
crowd: Crowd;
|
|
5
4
|
agentMaterial?: Material;
|
|
6
5
|
};
|
|
7
6
|
export declare class CrowdHelper extends Object3D {
|
|
8
7
|
agentMeshes: Map<number, Mesh>;
|
|
9
8
|
recastCrowd: Crowd;
|
|
10
9
|
agentMaterial: Material;
|
|
11
|
-
constructor(
|
|
10
|
+
constructor(crowd: Crowd, params?: CrowdHelperParams);
|
|
12
11
|
/**
|
|
13
12
|
* Update the three debug view of the crowd agents.
|
|
14
13
|
*
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { NavMesh } from '@recast-navigation/core';
|
|
2
2
|
import { BufferGeometry, Material, Mesh, Object3D } from 'three';
|
|
3
3
|
export type NavMeshHelperParams = {
|
|
4
|
-
navMesh: NavMesh;
|
|
5
4
|
navMeshMaterial?: Material;
|
|
6
5
|
};
|
|
7
6
|
export declare class NavMeshHelper extends Object3D {
|
|
8
7
|
navMesh: NavMesh;
|
|
9
|
-
navMeshMaterial: Material;
|
|
10
8
|
mesh: Mesh;
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
navMeshMaterial: Material;
|
|
10
|
+
navMeshGeometry: BufferGeometry;
|
|
11
|
+
constructor(navMesh: NavMesh, params?: NavMeshHelperParams);
|
|
13
12
|
/**
|
|
14
13
|
* Update the three debug nav mesh.
|
|
15
14
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { OffMeshConnectionParams } from '@recast-navigation/core';
|
|
2
2
|
import { LineBasicMaterial, Material, Object3D } from 'three';
|
|
3
3
|
export type OffMeshConnectionsHelperParams = {
|
|
4
|
-
offMeshConnections?: OffMeshConnectionParams[];
|
|
5
4
|
entryCircleMaterial?: Material;
|
|
6
5
|
exitCircleMaterial?: Material;
|
|
7
6
|
lineMaterial?: LineBasicMaterial;
|
|
@@ -11,7 +10,7 @@ export declare class OffMeshConnectionsHelper extends Object3D {
|
|
|
11
10
|
entryCircleMaterial: Material;
|
|
12
11
|
exitCircleMaterial: Material;
|
|
13
12
|
lineMaterial: LineBasicMaterial;
|
|
14
|
-
constructor(
|
|
13
|
+
constructor(offMeshConnections: OffMeshConnectionParams[], params?: OffMeshConnectionsHelperParams);
|
|
15
14
|
/**
|
|
16
15
|
* Update the three debug view of the off mesh connections.
|
|
17
16
|
*/
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Obstacle, TileCache } from '@recast-navigation/core';
|
|
2
2
|
import { Material, Mesh, Object3D } from 'three';
|
|
3
3
|
export type TileCacheHelperParams = {
|
|
4
|
-
tileCache: TileCache;
|
|
5
4
|
obstacleMaterial?: Material;
|
|
6
5
|
};
|
|
7
6
|
export declare class TileCacheHelper extends Object3D {
|
|
8
7
|
tileCache: TileCache;
|
|
9
8
|
obstacleMeshes: Map<Obstacle, Mesh>;
|
|
10
9
|
obstacleMaterial: Material;
|
|
11
|
-
constructor(
|
|
10
|
+
constructor(tileCache: TileCache, params?: TileCacheHelperParams);
|
|
12
11
|
/**
|
|
13
12
|
* Update the obstacle meshes.
|
|
14
13
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Raw as t}from"@recast-navigation/core";import*as e from"three";import{Box3 as n,Vector3 as i,InstancedBufferGeometry as r,Float32BufferAttribute as s,InstancedInterleavedBuffer as a,InterleavedBufferAttribute as o,WireframeGeometry as l,Sphere as d,UniformsLib as c,Vector2 as h,ShaderLib as u,UniformsUtils as p,ShaderMaterial as f,Vector4 as m,Matrix4 as w,Line3 as g,Mesh as y,MathUtils as v,Object3D as b,MeshBasicMaterial as x,CylinderGeometry as D,BufferGeometry as M,BufferAttribute as S,LineBasicMaterial as A,CircleGeometry as _,CatmullRomCurve3 as E,Line as z,BoxGeometry as U}from"three";import{generateSoloNavMesh as C,generateTiledNavMesh as I,generateTileCache as P}from"@recast-navigation/generators";const B=new n,L=new i;class R extends r{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new s([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new s([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new a(e,6,1);return this.setAttribute("instanceStart",new o(n,3,0)),this.setAttribute("instanceEnd",new o(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new a(e,6,1);return this.setAttribute("instanceColorStart",new o(n,3,0)),this.setAttribute("instanceColorEnd",new o(n,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new l(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new n);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),B.setFromBufferAttribute(e),this.boundingBox.union(B))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new d),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let r=0,s=t.count;r<s;r++)L.fromBufferAttribute(t,r),i=Math.max(i,n.distanceToSquared(L)),L.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(L));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}c.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new h(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},u.line={uniforms:p.merge([c.common,c.fog,c.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class T extends f{constructor(t){super({type:"LineMaterial",uniforms:p.clone(u.line.uniforms),vertexShader:u.line.vertexShader,fragmentShader:u.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){!0===t!==this.dashed&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(!0===t!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===t?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const N=new m,V=new i,O=new i,H=new m,W=new m,F=new m,G=new i,j=new w,k=new g,q=new i,Q=new n,$=new d,J=new m;let X,K;function Y(t,e,n){return J.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),J.multiplyScalar(1/J.w),J.x=K/n.width,J.y=K/n.height,J.applyMatrix4(t.projectionMatrixInverse),J.multiplyScalar(1/J.w),Math.abs(Math.max(J.x,J.y))}class Z extends y{constructor(t=new R,e=new T({color:16777215*Math.random()})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,i=new Float32Array(2*e.count);for(let t=0,r=0,s=e.count;t<s;t++,r+=2)V.fromBufferAttribute(e,t),O.fromBufferAttribute(n,t),i[r]=0===r?0:i[r-1],i[r+1]=i[r]+V.distanceTo(O);const r=new a(i,2,1);return t.setAttribute("instanceDistanceStart",new o(r,1,0)),t.setAttribute("instanceDistanceEnd",new o(r,1,1)),this}raycast(t,e){const n=this.material.worldUnits,r=t.camera;null!==r||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=void 0!==t.params.Line2&&t.params.Line2.threshold||0;X=t.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;let d,c;if(K=l.linewidth+s,null===o.boundingSphere&&o.computeBoundingSphere(),$.copy(o.boundingSphere).applyMatrix4(a),n)d=.5*K;else{d=Y(r,Math.max(r.near,$.distanceToPoint(X.origin)),l.resolution)}if($.radius+=d,!1!==X.intersectsSphere($)){if(null===o.boundingBox&&o.computeBoundingBox(),Q.copy(o.boundingBox).applyMatrix4(a),n)c=.5*K;else{c=Y(r,Math.max(r.near,Q.distanceToPoint(X.origin)),l.resolution)}Q.expandByScalar(c),!1!==X.intersectsBox(Q)&&(n?function(t,e){const n=t.matrixWorld,r=t.geometry,s=r.attributes.instanceStart,a=r.attributes.instanceEnd;for(let o=0,l=Math.min(r.instanceCount,s.count);o<l;o++){k.start.fromBufferAttribute(s,o),k.end.fromBufferAttribute(a,o),k.applyMatrix4(n);const r=new i,l=new i;X.distanceSqToSegment(k.start,k.end,l,r),l.distanceTo(r)<.5*K&&e.push({point:l,pointOnLine:r,distance:X.origin.distanceTo(l),object:t,face:null,faceIndex:o,uv:null,uv1:null})}}(this,e):function(t,e,n){const r=e.projectionMatrix,s=t.material.resolution,a=t.matrixWorld,o=t.geometry,l=o.attributes.instanceStart,d=o.attributes.instanceEnd,c=Math.min(o.instanceCount,l.count),h=-e.near;X.at(1,F),F.w=1,F.applyMatrix4(e.matrixWorldInverse),F.applyMatrix4(r),F.multiplyScalar(1/F.w),F.x*=s.x/2,F.y*=s.y/2,F.z=0,G.copy(F),j.multiplyMatrices(e.matrixWorldInverse,a);for(let e=0,o=c;e<o;e++){if(H.fromBufferAttribute(l,e),W.fromBufferAttribute(d,e),H.w=1,W.w=1,H.applyMatrix4(j),W.applyMatrix4(j),H.z>h&&W.z>h)continue;if(H.z>h){const t=H.z-W.z,e=(H.z-h)/t;H.lerp(W,e)}else if(W.z>h){const t=W.z-H.z,e=(W.z-h)/t;W.lerp(H,e)}H.applyMatrix4(r),W.applyMatrix4(r),H.multiplyScalar(1/H.w),W.multiplyScalar(1/W.w),H.x*=s.x/2,H.y*=s.y/2,W.x*=s.x/2,W.y*=s.y/2,k.start.copy(H),k.start.z=0,k.end.copy(W),k.end.z=0;const o=k.closestPointToPointParameter(G,!0);k.at(o,q);const c=v.lerp(H.z,W.z,o),u=c>=-1&&c<=1,p=G.distanceTo(q)<.5*K;if(u&&p){k.start.fromBufferAttribute(l,e),k.end.fromBufferAttribute(d,e),k.start.applyMatrix4(a),k.end.applyMatrix4(a);const r=new i,s=new i;X.distanceSqToSegment(k.start,k.end,s,r),n.push({point:s,pointOnLine:r,distance:X.origin.distanceTo(s),object:t,face:null,faceIndex:e,uv:null,uv1:null})}}}(this,r,e))}}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(N),this.material.uniforms.resolution.value.set(N.z,N.w))}}const tt=new e.Color;class et extends e.Group{pointGeometry=new e.SphereGeometry(.02,32,32);currentVertices=[];currentPrimitive=0;constructor({triMaterial:n,pointMaterial:i,lineMaterial:r}={}){super(),this.triMaterial=n??new e.MeshBasicMaterial({vertexColors:!0,transparent:!0,opacity:.4,depthWrite:!1}),this.pointMaterial=i??new e.MeshBasicMaterial,this.lineMaterial=r??new T({color:16777215,linewidth:2,vertexColors:!0,polygonOffset:!0,polygonOffsetFactor:-4,polygonOffsetUnits:-10}),this.debugDrawImpl=new t.Module.DebugDrawImpl,this.debugDrawImpl.handleBegin=(t,e)=>{this.currentPrimitive=t,this.currentVertices=[]},this.debugDrawImpl.handleDepthMask=t=>{},this.debugDrawImpl.handleTexture=t=>{},this.debugDrawImpl.handleVertexWithColor=(t,e,n,i)=>{this.vertex(t,e,n,i)},this.debugDrawImpl.handleVertexWithColorAndUV=(t,e,n,i,r,s)=>{this.vertex(t,e,n,i)},this.debugDrawImpl.handleEnd=()=>{this.currentPrimitive===t.Module.DU_DRAW_LINES?this.endLines():this.currentPrimitive===t.Module.DU_DRAW_TRIS?this.endTris():this.currentPrimitive===t.Module.DU_DRAW_QUADS?this.endQuads():this.currentPrimitive===t.Module.DU_DRAW_POINTS&&this.endPoints()}}drawHeightfieldSolid(e){t.RecastDebugDraw.debugDrawHeightfieldSolid(this.debugDrawImpl,e.raw)}drawHeightfieldWalkable(e){t.RecastDebugDraw.debugDrawHeightfieldWalkable(this.debugDrawImpl,e.raw)}drawCompactHeightfieldSolid(e){t.RecastDebugDraw.debugDrawCompactHeightfieldSolid(this.debugDrawImpl,e.raw)}drawCompactHeightfieldRegions(e){t.RecastDebugDraw.debugDrawCompactHeightfieldRegions(this.debugDrawImpl,e.raw)}drawCompactHeightfieldDistance(e){t.RecastDebugDraw.debugDrawCompactHeightfieldDistance(this.debugDrawImpl,e.raw)}drawHeightfieldLayer(e,n){t.RecastDebugDraw.debugDrawHeightfieldLayer(this.debugDrawImpl,e.raw,n)}drawHeightfieldLayers(e){t.RecastDebugDraw.debugDrawHeightfieldLayers(this.debugDrawImpl,e.raw)}drawRegionConnections(e,n=1){t.RecastDebugDraw.debugDrawRegionConnections(this.debugDrawImpl,e.raw,n)}drawRawContours(e,n=1){t.RecastDebugDraw.debugDrawRawContours(this.debugDrawImpl,e.raw,n)}drawContours(e,n=1){t.RecastDebugDraw.debugDrawContours(this.debugDrawImpl,e.raw,n)}drawPolyMesh(e){t.RecastDebugDraw.debugDrawPolyMesh(this.debugDrawImpl,e.raw)}drawPolyMeshDetail(e){t.RecastDebugDraw.debugDrawPolyMeshDetail(this.debugDrawImpl,e.raw)}drawNavMesh(e,n=0){t.DetourDebugDraw.debugDrawNavMesh(this.debugDrawImpl,e.raw.getNavMesh(),n)}drawNavMeshWithClosedList(e,n,i=0){t.DetourDebugDraw.debugDrawNavMeshWithClosedList(this.debugDrawImpl,e.raw.m_navMesh,n.raw.m_navQuery,i)}drawNavMeshNodes(e){t.DetourDebugDraw.debugDrawNavMeshNodes(this.debugDrawImpl,e.raw.m_navQuery)}drawNavMeshBVTree(e){t.DetourDebugDraw.debugDrawNavMeshBVTree(this.debugDrawImpl,e.raw.m_navMesh)}drawNavMeshPortals(e){t.DetourDebugDraw.debugDrawNavMeshPortals(this.debugDrawImpl,e.raw.m_navMesh)}drawNavMeshPolysWithFlags(e,n,i){t.DetourDebugDraw.debugDrawNavMeshPolysWithFlags(this.debugDrawImpl,e.raw.m_navMesh,n,i)}drawNavMeshPoly(e,n,i){t.DetourDebugDraw.debugDrawNavMeshPoly(this.debugDrawImpl,e.raw.m_navMesh,n,i)}reset(){for(const t of this.children)(t instanceof e.Mesh||t instanceof Z)&&t.geometry.dispose();this.clear()}dispose(){this.reset(),t.Module.destroy(this.debugDrawImpl),this.pointGeometry.dispose(),this.triMaterial.dispose(),this.pointMaterial.dispose(),this.lineMaterial.dispose()}vertex(t,e,n,i){const r=(i>>16&255)/255,s=(i>>8&255)/255,a=(255&i)/255,o=(i>>24&255)/255;this.currentVertices.push([t,e,n,r,s,a,o])}endPoints(){const t=this.pointGeometry,n=new e.InstancedMesh(t,this.pointMaterial,this.currentVertices.length);for(let t=0;t<this.currentVertices.length;t++){const[i,r,s,a,o,l]=this.currentVertices[t];n.setMatrixAt(t,(new e.Matrix4).setPosition(i,r,s)),n.setColorAt(t,tt.setRGB(a,o,l))}n.instanceMatrix.needsUpdate=!0,this.add(n)}endLines(){const t=new R,e=[],n=[];for(let t=0;t<this.currentVertices.length;t+=2){const[i,r,s,a,o,l]=this.currentVertices[t],[d,c,h,u,p,f]=this.currentVertices[t+1];e.push(i,r,s),e.push(d,c,h),n.push(a,o,l),n.push(u,p,f)}t.setPositions(e),t.setColors(n);const i=new Z(t,this.lineMaterial);this.add(i)}endTris(){const t=new e.BufferGeometry,n=new Float32Array(3*this.currentVertices.length),i=new Float32Array(3*this.currentVertices.length);for(let t=0;t<this.currentVertices.length;t++){const[e,r,s,a,o,l]=this.currentVertices[t];n[3*t+0]=e,n[3*t+1]=r,n[3*t+2]=s,i[3*t+0]=a,i[3*t+1]=o,i[3*t+2]=l}t.setAttribute("position",new e.BufferAttribute(n,3)),t.setAttribute("color",new e.BufferAttribute(i,3));const r=this.triMaterial,s=new e.Mesh(t,r);this.add(s)}endQuads(){const t=[],n=[];for(let e=0;e<this.currentVertices.length;e+=4){const i=[this.currentVertices[e],this.currentVertices[e+1],this.currentVertices[e+2],this.currentVertices[e],this.currentVertices[e+2],this.currentVertices[e+3]];for(const[e,r,s,a,o,l]of i)t.push(e,r,s),n.push(a,o,l)}const i=new e.BufferGeometry;i.setAttribute("position",new e.BufferAttribute(new Float32Array(t),3)),i.setAttribute("color",new e.BufferAttribute(new Float32Array(n),3));const r=this.triMaterial,s=new e.Mesh(i,r);this.add(s)}}class nt extends b{agentMeshes=new Map;constructor({crowd:t,agentMaterial:e}){super(),this.recastCrowd=t,this.agentMaterial=e??new x({color:"red"}),this.update()}update(){const t=this.recastCrowd.getAgents(),e=new Set(this.agentMeshes.keys());for(const n of t){e.delete(n.agentIndex);const t=n.position(),r=n.velocity();let s=this.agentMeshes.get(n.agentIndex);void 0===s?(s=this.createAgentMesh(n),this.add(s),this.agentMeshes.set(n.agentIndex,s)):this.updateAgentGeometry(s,n),s.position.set(t.x,t.y+n.height/2,t.z),s.lookAt((new i).copy(s.position).add(r))}for(const t of e){const e=this.agentMeshes.get(t);e&&(this.remove(e),this.agentMeshes.delete(t))}}createAgentMesh(t){const e=new y;return e.material=this.agentMaterial,this.updateAgentGeometry(e,t),e.userData={radius:t.radius,height:t.height},e}updateAgentGeometry(t,e){if(t.userData.radius!==e.radius||t.userData.height!==e.height){const n=new D(e.radius,e.radius,e.height);t.geometry.dispose(),t.geometry=n,t.userData.radius=e.radius,t.userData.height=e.height}}}class it extends b{constructor({navMesh:t,navMeshMaterial:e}){super(),this.navMesh=t,this.geometry=new M,this.navMeshMaterial=e||new x({color:"orange",transparent:!0,opacity:.7,depthWrite:!1}),this.update(),this.mesh=new y(this.geometry,this.navMeshMaterial),this.add(this.mesh)}update(){const[t,e]=this.navMesh.getDebugNavMesh();this.geometry.setAttribute("position",new S(Float32Array.from(t),3)),this.geometry.setIndex(new S(Uint32Array.from(e),1)),this.geometry.computeVertexNormals()}}class rt extends b{constructor({offMeshConnections:t,entryCircleMaterial:e,exitCircleMaterial:n,lineMaterial:i}){super(),this.offMeshConnections=t??[],this.entryCircleMaterial=e??new x({color:"green"}),this.exitCircleMaterial=n??new x({color:"blue"}),this.lineMaterial=i??new A({color:"red"}),this.update()}update(){this.clear();for(const t of this.offMeshConnections){const e=new _(t.radius,16),n=new y(e,this.entryCircleMaterial);n.position.copy(t.startPosition),n.position.y+=.001,n.rotation.x=-Math.PI/2,this.add(n);const r=new y(e,t.bidirectional?this.entryCircleMaterial:this.exitCircleMaterial);r.position.copy(t.endPosition),r.position.y+=.001,r.rotation.x=-Math.PI/2,this.add(r);const s=(new i).copy(t.startPosition),a=(new i).copy(t.endPosition),o=(new i).addVectors(s,a).multiplyScalar(.5);o.y*=1.2;const l=new E([s,o,a]).getPoints(50),d=(new M).setFromPoints(l),c=new z(d,this.lineMaterial);this.add(c)}}}class st extends b{obstacleMeshes=new Map;constructor({tileCache:t,obstacleMaterial:e}){super(),this.tileCache=t,this.obstacleMaterial=e||new x({color:"red",wireframe:!0,wireframeLinewidth:2}),this.update()}update(){const t=new Set(this.obstacleMeshes.keys());for(const[,e]of this.tileCache.obstacles){const n=this.obstacleMeshes.get(e);if(t.delete(e),!n){const{position:t}=e,n=new y(void 0,this.obstacleMaterial);if(n.position.copy(t),"box"===e.type){const{halfExtents:t,angle:i}=e;n.geometry=new U(2*t.x,2*t.y,2*t.z),n.rotation.y=i}else{if("cylinder"!==e.type)throw new Error(`Unknown obstacle type: ${e}`);{const{radius:t,height:i}=e;n.geometry=new D(t,t,i,16),n.position.y+=i/2}}this.add(n),this.obstacleMeshes.set(e,n)}}for(const e of t){const t=this.obstacleMeshes.get(e);t&&(this.remove(t),this.obstacleMeshes.delete(e))}}}const at=new i,ot=t=>{const e=[];for(const n of t){const t=n.geometry.attributes.position;if(!t||3!==t.itemSize)continue;let i=n;const r=n.geometry.getIndex()?.array;if(void 0===r){i=i.clone(),i.geometry=n.geometry.clone();const e=[];for(let n=0;n<t.count;n++)e.push(n);i.geometry.setIndex(e)}e.push(i)}const n=[],i=[],r={};let s=0;for(const t of e){t.updateMatrixWorld();const e=t.geometry.attributes.position.array,a=t.geometry.getIndex().array;for(let o=0;o<a.length;o++){const l=3*a[o],d=at.set(e[l],e[l+1],e[l+2]);t.localToWorld(d);const c=`${d.x}_${d.y}_${d.z}`;let h=r[c];h||(r[c]=h=s,n.push(d.x,d.y,d.z),s++),i.push(h)}}return[Float32Array.from(n),Uint32Array.from(i)]},lt=(t,e={},n=!1)=>{const[i,r]=ot(t);return C(i,r,e,n)},dt=(t,e={},n=!1)=>{const[i,r]=ot(t);return I(i,r,e,n)},ct=(t,e={},n=!1)=>{const[i,r]=ot(t);return P(i,r,e,n)};export{nt as CrowdHelper,et as DebugDrawer,it as NavMeshHelper,rt as OffMeshConnectionsHelper,st as TileCacheHelper,ot as getPositionsAndIndices,lt as threeToSoloNavMesh,ct as threeToTileCache,dt as threeToTiledNavMesh};
|
|
1
|
+
import{DebugDrawerUtils as t}from"@recast-navigation/core";import*as e from"three";import{Box3 as n,Vector3 as i,InstancedBufferGeometry as s,Float32BufferAttribute as r,InstancedInterleavedBuffer as a,InterleavedBufferAttribute as o,WireframeGeometry as d,Sphere as l,UniformsLib as c,Vector2 as h,ShaderLib as u,UniformsUtils as p,ShaderMaterial as f,Vector4 as w,Matrix4 as m,Line3 as v,Mesh as g,MathUtils as y,Object3D as b,MeshBasicMaterial as x,CylinderGeometry as M,BufferGeometry as S,BufferAttribute as A,LineBasicMaterial as U,CircleGeometry as P,CatmullRomCurve3 as D,Line as _,BoxGeometry as z}from"three";import{mergePositionsAndIndices as E,generateSoloNavMesh as C,generateTiledNavMesh as B,generateTileCache as L}from"@recast-navigation/generators";const T=new n,N=new i;class O extends s{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new r([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new r([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new a(e,6,1);return this.setAttribute("instanceStart",new o(n,3,0)),this.setAttribute("instanceEnd",new o(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new a(e,6,1);return this.setAttribute("instanceColorStart",new o(n,3,0)),this.setAttribute("instanceColorEnd",new o(n,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new d(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new n);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),T.setFromBufferAttribute(e),this.boundingBox.union(T))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new l),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let s=0,r=t.count;s<r;s++)N.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(N)),N.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(N));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}c.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new h(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},u.line={uniforms:p.merge([c.common,c.fog,c.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class H extends f{constructor(t){super({type:"LineMaterial",uniforms:p.clone(u.line.uniforms),vertexShader:u.line.vertexShader,fragmentShader:u.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){!0===t!==this.dashed&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(!0===t!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===t?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const G=new w,W=new i,F=new i,R=new w,I=new w,j=new w,V=new i,k=new m,q=new v,Q=new i,J=new n,X=new l,$=new w;let K,Y;function Z(t,e,n){return $.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),$.multiplyScalar(1/$.w),$.x=Y/n.width,$.y=Y/n.height,$.applyMatrix4(t.projectionMatrixInverse),$.multiplyScalar(1/$.w),Math.abs(Math.max($.x,$.y))}class tt extends g{constructor(t=new O,e=new H({color:16777215*Math.random()})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,i=new Float32Array(2*e.count);for(let t=0,s=0,r=e.count;t<r;t++,s+=2)W.fromBufferAttribute(e,t),F.fromBufferAttribute(n,t),i[s]=0===s?0:i[s-1],i[s+1]=i[s]+W.distanceTo(F);const s=new a(i,2,1);return t.setAttribute("instanceDistanceStart",new o(s,1,0)),t.setAttribute("instanceDistanceEnd",new o(s,1,1)),this}raycast(t,e){const n=this.material.worldUnits,s=t.camera;null!==s||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=void 0!==t.params.Line2&&t.params.Line2.threshold||0;K=t.ray;const a=this.matrixWorld,o=this.geometry,d=this.material;let l,c;if(Y=d.linewidth+r,null===o.boundingSphere&&o.computeBoundingSphere(),X.copy(o.boundingSphere).applyMatrix4(a),n)l=.5*Y;else{l=Z(s,Math.max(s.near,X.distanceToPoint(K.origin)),d.resolution)}if(X.radius+=l,!1!==K.intersectsSphere(X)){if(null===o.boundingBox&&o.computeBoundingBox(),J.copy(o.boundingBox).applyMatrix4(a),n)c=.5*Y;else{c=Z(s,Math.max(s.near,J.distanceToPoint(K.origin)),d.resolution)}J.expandByScalar(c),!1!==K.intersectsBox(J)&&(n?function(t,e){const n=t.matrixWorld,s=t.geometry,r=s.attributes.instanceStart,a=s.attributes.instanceEnd;for(let o=0,d=Math.min(s.instanceCount,r.count);o<d;o++){q.start.fromBufferAttribute(r,o),q.end.fromBufferAttribute(a,o),q.applyMatrix4(n);const s=new i,d=new i;K.distanceSqToSegment(q.start,q.end,d,s),d.distanceTo(s)<.5*Y&&e.push({point:d,pointOnLine:s,distance:K.origin.distanceTo(d),object:t,face:null,faceIndex:o,uv:null,uv1:null})}}(this,e):function(t,e,n){const s=e.projectionMatrix,r=t.material.resolution,a=t.matrixWorld,o=t.geometry,d=o.attributes.instanceStart,l=o.attributes.instanceEnd,c=Math.min(o.instanceCount,d.count),h=-e.near;K.at(1,j),j.w=1,j.applyMatrix4(e.matrixWorldInverse),j.applyMatrix4(s),j.multiplyScalar(1/j.w),j.x*=r.x/2,j.y*=r.y/2,j.z=0,V.copy(j),k.multiplyMatrices(e.matrixWorldInverse,a);for(let e=0,o=c;e<o;e++){if(R.fromBufferAttribute(d,e),I.fromBufferAttribute(l,e),R.w=1,I.w=1,R.applyMatrix4(k),I.applyMatrix4(k),R.z>h&&I.z>h)continue;if(R.z>h){const t=R.z-I.z,e=(R.z-h)/t;R.lerp(I,e)}else if(I.z>h){const t=I.z-R.z,e=(I.z-h)/t;I.lerp(R,e)}R.applyMatrix4(s),I.applyMatrix4(s),R.multiplyScalar(1/R.w),I.multiplyScalar(1/I.w),R.x*=r.x/2,R.y*=r.y/2,I.x*=r.x/2,I.y*=r.y/2,q.start.copy(R),q.start.z=0,q.end.copy(I),q.end.z=0;const o=q.closestPointToPointParameter(V,!0);q.at(o,Q);const c=y.lerp(R.z,I.z,o),u=c>=-1&&c<=1,p=V.distanceTo(Q)<.5*Y;if(u&&p){q.start.fromBufferAttribute(d,e),q.end.fromBufferAttribute(l,e),q.start.applyMatrix4(a),q.end.applyMatrix4(a);const s=new i,r=new i;K.distanceSqToSegment(q.start,q.end,r,s),n.push({point:r,pointOnLine:s,distance:K.origin.distanceTo(r),object:t,face:null,faceIndex:e,uv:null,uv1:null})}}}(this,s,e))}}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(G),this.material.uniforms.resolution.value.set(G.z,G.w))}}const et=new e.Color;class nt extends e.Group{pointGeometry=new e.SphereGeometry(.02,32,32);constructor({triMaterial:n,pointMaterial:i,lineMaterial:s}={}){super(),this.debugDrawerUtils=new t,this.triMaterial=n??new e.MeshBasicMaterial({vertexColors:!0,transparent:!0,opacity:.4,depthWrite:!1}),this.pointMaterial=i??new e.MeshBasicMaterial,this.lineMaterial=s??new H({color:16777215,linewidth:2,vertexColors:!0,polygonOffset:!0,polygonOffsetFactor:-4,polygonOffsetUnits:-10})}drawPrimitives(t){for(const e of t)switch(e.type){case"points":this.drawPoints(e);break;case"lines":this.drawLines(e);break;case"tris":this.drawTris(e);break;case"quads":this.drawQuads(e)}}drawHeightfieldSolid(t){const e=this.debugDrawerUtils.drawHeightfieldSolid(t);this.drawPrimitives(e)}drawHeightfieldWalkable(t){const e=this.debugDrawerUtils.drawHeightfieldWalkable(t);this.drawPrimitives(e)}drawCompactHeightfieldSolid(t){const e=this.debugDrawerUtils.drawCompactHeightfieldSolid(t);this.drawPrimitives(e)}drawCompactHeightfieldRegions(t){const e=this.debugDrawerUtils.drawCompactHeightfieldRegions(t);this.drawPrimitives(e)}drawCompactHeightfieldDistance(t){const e=this.debugDrawerUtils.drawCompactHeightfieldDistance(t);this.drawPrimitives(e)}drawHeightfieldLayer(t,e){const n=this.debugDrawerUtils.drawHeightfieldLayer(t,e);this.drawPrimitives(n)}drawHeightfieldLayers(t){const e=this.debugDrawerUtils.drawHeightfieldLayers(t);this.drawPrimitives(e)}drawRegionConnections(t,e=1){const n=this.debugDrawerUtils.drawRegionConnections(t,e);this.drawPrimitives(n)}drawRawContours(t,e=1){const n=this.debugDrawerUtils.drawRawContours(t,e);this.drawPrimitives(n)}drawContours(t,e=1){const n=this.debugDrawerUtils.drawContours(t,e);this.drawPrimitives(n)}drawPolyMesh(t){const e=this.debugDrawerUtils.drawPolyMesh(t);this.drawPrimitives(e)}drawPolyMeshDetail(t){const e=this.debugDrawerUtils.drawPolyMeshDetail(t);this.drawPrimitives(e)}drawNavMesh(t,e=0){const n=this.debugDrawerUtils.drawNavMesh(t,e);this.drawPrimitives(n)}drawNavMeshWithClosedList(t,e,n=0){const i=this.debugDrawerUtils.drawNavMeshWithClosedList(t,e,n);this.drawPrimitives(i)}drawNavMeshNodes(t){const e=this.debugDrawerUtils.drawNavMeshNodes(t);this.drawPrimitives(e)}drawNavMeshBVTree(t){const e=this.debugDrawerUtils.drawNavMeshBVTree(t);this.drawPrimitives(e)}drawNavMeshPortals(t){const e=this.debugDrawerUtils.drawNavMeshPortals(t);this.drawPrimitives(e)}drawNavMeshPolysWithFlags(t,e,n){const i=this.debugDrawerUtils.drawNavMeshPolysWithFlags(t,e,n);this.drawPrimitives(i)}drawNavMeshPoly(t,e,n){const i=this.debugDrawerUtils.drawNavMeshPoly(t,e,n);this.drawPrimitives(i)}reset(){for(const t of this.children)(t instanceof e.Mesh||t instanceof tt)&&t.geometry.dispose();this.clear()}dispose(){this.debugDrawerUtils.dispose(),this.reset(),this.pointGeometry.dispose(),this.triMaterial.dispose(),this.pointMaterial.dispose(),this.lineMaterial.dispose()}drawPoints(t){const n=this.pointGeometry,i=new e.InstancedMesh(n,this.pointMaterial,t.vertices.length/3);for(let n=0;n<t.vertices.length/7;n++){const[s,r,a,o,d,l]=t.vertices[n];i.setMatrixAt(n,(new e.Matrix4).setPosition(s,r,a)),i.setColorAt(n,et.setRGB(o,d,l))}i.instanceMatrix.needsUpdate=!0,this.add(i)}drawLines(t){const e=new O,n=[],i=[];for(let e=0;e<t.vertices.length;e+=2){const[s,r,a,o,d,l]=t.vertices[e],[c,h,u,p,f,w]=t.vertices[e+1];n.push(s,r,a),n.push(c,h,u),i.push(o,d,l),i.push(p,f,w)}e.setPositions(n),e.setColors(i);const s=new tt(e,this.lineMaterial);this.add(s)}drawTris(t){const n=new e.BufferGeometry,i=new Float32Array(3*t.vertices.length),s=new Float32Array(3*t.vertices.length);for(let e=0;e<t.vertices.length;e++){const[n,r,a,o,d,l]=t.vertices[e];i[3*e+0]=n,i[3*e+1]=r,i[3*e+2]=a,s[3*e+0]=o,s[3*e+1]=d,s[3*e+2]=l}n.setAttribute("position",new e.BufferAttribute(i,3)),n.setAttribute("color",new e.BufferAttribute(s,3));const r=this.triMaterial,a=new e.Mesh(n,r);this.add(a)}drawQuads(t){const n=[],i=[];for(let e=0;e<t.vertices.length;e+=4){const s=[t.vertices[e],t.vertices[e+1],t.vertices[e+2],t.vertices[e],t.vertices[e+2],t.vertices[e+3]];for(const[t,e,r,a,o,d]of s)n.push(t,e,r),i.push(a,o,d)}const s=new e.BufferGeometry;s.setAttribute("position",new e.BufferAttribute(new Float32Array(n),3)),s.setAttribute("color",new e.BufferAttribute(new Float32Array(i),3));const r=this.triMaterial,a=new e.Mesh(s,r);this.add(a)}}class it extends b{agentMeshes=new Map;constructor(t,e){super(),this.recastCrowd=t,this.agentMaterial=e?.agentMaterial??new x({color:"red"}),this.update()}update(){const t=this.recastCrowd.getAgents(),e=new Set(this.agentMeshes.keys());for(const n of t){e.delete(n.agentIndex);const t=n.position(),s=n.velocity();let r=this.agentMeshes.get(n.agentIndex);void 0===r?(r=this.createAgentMesh(n),this.add(r),this.agentMeshes.set(n.agentIndex,r)):this.updateAgentGeometry(r,n),r.position.set(t.x,t.y+n.height/2,t.z),r.lookAt((new i).copy(r.position).add(s))}for(const t of e){const e=this.agentMeshes.get(t);e&&(this.remove(e),this.agentMeshes.delete(t))}}createAgentMesh(t){const e=new g;return e.material=this.agentMaterial,this.updateAgentGeometry(e,t),e.userData={radius:t.radius,height:t.height},e}updateAgentGeometry(t,e){if(t.userData.radius!==e.radius||t.userData.height!==e.height){const n=new M(e.radius,e.radius,e.height);t.geometry.dispose(),t.geometry=n,t.userData.radius=e.radius,t.userData.height=e.height}}}class st extends b{constructor(t,e){super(),this.navMesh=t,this.navMeshGeometry=new S,this.navMeshMaterial=e?.navMeshMaterial?e.navMeshMaterial:new x({color:"orange",transparent:!0,opacity:.7,depthWrite:!1}),this.update(),this.mesh=new g(this.navMeshGeometry,this.navMeshMaterial),this.add(this.mesh)}update(){const[t,e]=this.navMesh.getDebugNavMesh();this.navMeshGeometry.setAttribute("position",new A(Float32Array.from(t),3)),this.navMeshGeometry.setIndex(new A(Uint32Array.from(e),1)),this.navMeshGeometry.computeVertexNormals()}}class rt extends b{constructor(t,e){super(),this.offMeshConnections=t??[],this.entryCircleMaterial=e?.entryCircleMaterial??new x({color:"green"}),this.exitCircleMaterial=e?.exitCircleMaterial??new x({color:"blue"}),this.lineMaterial=e?.lineMaterial??new U({color:"red"}),this.update()}update(){this.clear();for(const t of this.offMeshConnections){const e=new P(t.radius,16),n=new g(e,this.entryCircleMaterial);n.position.copy(t.startPosition),n.position.y+=.001,n.rotation.x=-Math.PI/2,this.add(n);const s=new g(e,t.bidirectional?this.entryCircleMaterial:this.exitCircleMaterial);s.position.copy(t.endPosition),s.position.y+=.001,s.rotation.x=-Math.PI/2,this.add(s);const r=(new i).copy(t.startPosition),a=(new i).copy(t.endPosition),o=(new i).addVectors(r,a).multiplyScalar(.5);o.y*=1.2;const d=new D([r,o,a]).getPoints(50),l=(new S).setFromPoints(d),c=new _(l,this.lineMaterial);this.add(c)}}}class at extends b{obstacleMeshes=new Map;constructor(t,e){super(),this.tileCache=t,this.obstacleMaterial=e?.obstacleMaterial?e.obstacleMaterial:new x({color:"red",wireframe:!0,wireframeLinewidth:2}),this.update()}update(){const t=new Set(this.obstacleMeshes.keys());for(const[,e]of this.tileCache.obstacles){const n=this.obstacleMeshes.get(e);if(t.delete(e),!n){const{position:t}=e,n=new g(void 0,this.obstacleMaterial);if(n.position.copy(t),"box"===e.type){const{halfExtents:t,angle:i}=e;n.geometry=new z(2*t.x,2*t.y,2*t.z),n.rotation.y=i}else{if("cylinder"!==e.type)throw new Error(`Unknown obstacle type: ${e}`);{const{radius:t,height:i}=e;n.geometry=new M(t,t,i,16),n.position.y+=i/2}}this.add(n),this.obstacleMeshes.set(e,n)}}for(const e of t){const t=this.obstacleMeshes.get(e);t&&(this.remove(t),this.obstacleMeshes.delete(e))}}}const ot=new i,dt=t=>{const e=[];for(const n of t){const t=n.geometry.attributes.position;if(!t||3!==t.itemSize)continue;n.updateMatrixWorld();const i=new Float32Array(t.array);for(let t=0;t<i.length;t+=3){const e=ot.set(i[t],i[t+1],i[t+2]);n.localToWorld(e),i[t]=e.x,i[t+1]=e.y,i[t+2]=e.z}let s=n.geometry.getIndex()?.array;if(void 0===s){const e=[];for(let n=0;n<t.count;n++)e.push(n);s=e}e.push({positions:i,indices:s})}return E(e)},lt=(t,e={},n=!1)=>{const[i,s]=dt(t);return C(i,s,e,n)},ct=(t,e={},n=!1)=>{const[i,s]=dt(t);return B(i,s,e,n)},ht=(t,e={},n=!1)=>{const[i,s]=dt(t);return L(i,s,e,n)};export{it as CrowdHelper,nt as DebugDrawer,st as NavMeshHelper,rt as OffMeshConnectionsHelper,at as TileCacheHelper,dt as getPositionsAndIndices,lt as threeToSoloNavMesh,ht as threeToTileCache,ct as threeToTiledNavMesh};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js","../../../node_modules/three/examples/jsm/lines/LineMaterial.js","../../../node_modules/three/examples/jsm/lines/LineSegments2.js","../src/debug/debug-drawer.ts","../src/helpers/crowd-helper.ts","../src/helpers/nav-mesh-helper.ts","../src/helpers/off-mesh-connections-helper.ts","../src/helpers/tile-cache-helper.ts","../src/utils/get-positions-and-indices.ts","../src/utils/generators.ts"],"sourcesContent":["import {\n\tBox3,\n\tFloat32BufferAttribute,\n\tInstancedBufferGeometry,\n\tInstancedInterleavedBuffer,\n\tInterleavedBufferAttribute,\n\tSphere,\n\tVector3,\n\tWireframeGeometry\n} from 'three';\n\nconst _box = new Box3();\nconst _vector = new Vector3();\n\nclass LineSegmentsGeometry extends InstancedBufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isLineSegmentsGeometry = true;\n\n\t\tthis.type = 'LineSegmentsGeometry';\n\n\t\tconst positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ];\n\t\tconst uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ];\n\t\tconst index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];\n\n\t\tthis.setIndex( index );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst start = this.attributes.instanceStart;\n\t\tconst end = this.attributes.instanceEnd;\n\n\t\tif ( start !== undefined ) {\n\n\t\t\tstart.applyMatrix4( matrix );\n\n\t\t\tend.applyMatrix4( matrix );\n\n\t\t\tstart.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetPositions( array ) {\n\n\t\tlet lineSegments;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\tlineSegments = array;\n\n\t\t} else if ( Array.isArray( array ) ) {\n\n\t\t\tlineSegments = new Float32Array( array );\n\n\t\t}\n\n\t\tconst instanceBuffer = new InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz\n\n\t\tthis.setAttribute( 'instanceStart', new InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz\n\t\tthis.setAttribute( 'instanceEnd', new InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz\n\n\t\t//\n\n\t\tthis.computeBoundingBox();\n\t\tthis.computeBoundingSphere();\n\n\t\treturn this;\n\n\t}\n\n\tsetColors( array ) {\n\n\t\tlet colors;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\tcolors = array;\n\n\t\t} else if ( Array.isArray( array ) ) {\n\n\t\t\tcolors = new Float32Array( array );\n\n\t\t}\n\n\t\tconst instanceColorBuffer = new InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb\n\n\t\tthis.setAttribute( 'instanceColorStart', new InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb\n\t\tthis.setAttribute( 'instanceColorEnd', new InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb\n\n\t\treturn this;\n\n\t}\n\n\tfromWireframeGeometry( geometry ) {\n\n\t\tthis.setPositions( geometry.attributes.position.array );\n\n\t\treturn this;\n\n\t}\n\n\tfromEdgesGeometry( geometry ) {\n\n\t\tthis.setPositions( geometry.attributes.position.array );\n\n\t\treturn this;\n\n\t}\n\n\tfromMesh( mesh ) {\n\n\t\tthis.fromWireframeGeometry( new WireframeGeometry( mesh.geometry ) );\n\n\t\t// set colors, maybe\n\n\t\treturn this;\n\n\t}\n\n\tfromLineSegments( lineSegments ) {\n\n\t\tconst geometry = lineSegments.geometry;\n\n\t\tthis.setPositions( geometry.attributes.position.array ); // assumes non-indexed\n\n\t\t// set colors, maybe\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst start = this.attributes.instanceStart;\n\t\tconst end = this.attributes.instanceEnd;\n\n\t\tif ( start !== undefined && end !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( start );\n\n\t\t\t_box.setFromBufferAttribute( end );\n\n\t\t\tthis.boundingBox.union( _box );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tconst start = this.attributes.instanceStart;\n\t\tconst end = this.attributes.instanceEnd;\n\n\t\tif ( start !== undefined && end !== undefined ) {\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\tthis.boundingBox.getCenter( center );\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = start.count; i < il; i ++ ) {\n\n\t\t\t\t_vector.fromBufferAttribute( start, i );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );\n\n\t\t\t\t_vector.fromBufferAttribute( end, i );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON() {\n\n\t\t// todo\n\n\t}\n\n\tapplyMatrix( matrix ) {\n\n\t\tconsole.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' );\n\n\t\treturn this.applyMatrix4( matrix );\n\n\t}\n\n}\n\nexport { LineSegmentsGeometry };\n","import {\n\tShaderLib,\n\tShaderMaterial,\n\tUniformsLib,\n\tUniformsUtils,\n\tVector2,\n} from 'three';\n\nUniformsLib.line = {\n\n\tworldUnits: { value: 1 },\n\tlinewidth: { value: 1 },\n\tresolution: { value: new Vector2( 1, 1 ) },\n\tdashOffset: { value: 0 },\n\tdashScale: { value: 1 },\n\tdashSize: { value: 1 },\n\tgapSize: { value: 1 } // todo FIX - maybe change to totalSize\n\n};\n\nShaderLib[ 'line' ] = {\n\n\tuniforms: UniformsUtils.merge( [\n\t\tUniformsLib.common,\n\t\tUniformsLib.fog,\n\t\tUniformsLib.line\n\t] ),\n\n\tvertexShader:\n\t/* glsl */`\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t`,\n\n\tfragmentShader:\n\t/* glsl */`\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t`\n};\n\nclass LineMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( {\n\n\t\t\ttype: 'LineMaterial',\n\n\t\t\tuniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ),\n\n\t\t\tvertexShader: ShaderLib[ 'line' ].vertexShader,\n\t\t\tfragmentShader: ShaderLib[ 'line' ].fragmentShader,\n\n\t\t\tclipping: true // required for clipping support\n\n\t\t} );\n\n\t\tthis.isLineMaterial = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget color() {\n\n\t\treturn this.uniforms.diffuse.value;\n\n\t}\n\n\tset color( value ) {\n\n\t\tthis.uniforms.diffuse.value = value;\n\n\t}\n\n\tget worldUnits() {\n\n\t\treturn 'WORLD_UNITS' in this.defines;\n\n\t}\n\n\tset worldUnits( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.defines.WORLD_UNITS = '';\n\n\t\t} else {\n\n\t\t\tdelete this.defines.WORLD_UNITS;\n\n\t\t}\n\n\t}\n\n\tget linewidth() {\n\n\t\treturn this.uniforms.linewidth.value;\n\n\t}\n\n\tset linewidth( value ) {\n\n\t\tif ( ! this.uniforms.linewidth ) return;\n\t\tthis.uniforms.linewidth.value = value;\n\n\t}\n\n\tget dashed() {\n\n\t\treturn 'USE_DASH' in this.defines;\n\n\t}\n\n\tset dashed( value ) {\n\n\t\tif ( ( value === true ) !== this.dashed ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.defines.USE_DASH = '';\n\n\t\t} else {\n\n\t\t\tdelete this.defines.USE_DASH;\n\n\t\t}\n\n\t}\n\n\tget dashScale() {\n\n\t\treturn this.uniforms.dashScale.value;\n\n\t}\n\n\tset dashScale( value ) {\n\n\t\tthis.uniforms.dashScale.value = value;\n\n\t}\n\n\tget dashSize() {\n\n\t\treturn this.uniforms.dashSize.value;\n\n\t}\n\n\tset dashSize( value ) {\n\n\t\tthis.uniforms.dashSize.value = value;\n\n\t}\n\n\tget dashOffset() {\n\n\t\treturn this.uniforms.dashOffset.value;\n\n\t}\n\n\tset dashOffset( value ) {\n\n\t\tthis.uniforms.dashOffset.value = value;\n\n\t}\n\n\tget gapSize() {\n\n\t\treturn this.uniforms.gapSize.value;\n\n\t}\n\n\tset gapSize( value ) {\n\n\t\tthis.uniforms.gapSize.value = value;\n\n\t}\n\n\tget opacity() {\n\n\t\treturn this.uniforms.opacity.value;\n\n\t}\n\n\tset opacity( value ) {\n\n\t\tif ( ! this.uniforms ) return;\n\t\tthis.uniforms.opacity.value = value;\n\n\t}\n\n\tget resolution() {\n\n\t\treturn this.uniforms.resolution.value;\n\n\t}\n\n\tset resolution( value ) {\n\n\t\tthis.uniforms.resolution.value.copy( value );\n\n\t}\n\n\tget alphaToCoverage() {\n\n\t\treturn 'USE_ALPHA_TO_COVERAGE' in this.defines;\n\n\t}\n\n\tset alphaToCoverage( value ) {\n\n\t\tif ( ! this.defines ) return;\n\n\t\tif ( ( value === true ) !== this.alphaToCoverage ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.defines.USE_ALPHA_TO_COVERAGE = '';\n\n\t\t} else {\n\n\t\t\tdelete this.defines.USE_ALPHA_TO_COVERAGE;\n\n\t\t}\n\n\t}\n\n}\n\nexport { LineMaterial };\n","import {\n\tBox3,\n\tInstancedInterleavedBuffer,\n\tInterleavedBufferAttribute,\n\tLine3,\n\tMathUtils,\n\tMatrix4,\n\tMesh,\n\tSphere,\n\tVector3,\n\tVector4\n} from 'three';\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';\nimport { LineMaterial } from '../lines/LineMaterial.js';\n\nconst _viewport = new Vector4();\n\nconst _start = new Vector3();\nconst _end = new Vector3();\n\nconst _start4 = new Vector4();\nconst _end4 = new Vector4();\n\nconst _ssOrigin = new Vector4();\nconst _ssOrigin3 = new Vector3();\nconst _mvMatrix = new Matrix4();\nconst _line = new Line3();\nconst _closestPoint = new Vector3();\n\nconst _box = new Box3();\nconst _sphere = new Sphere();\nconst _clipToWorldVector = new Vector4();\n\nlet _ray, _lineWidth;\n\n// Returns the margin required to expand by in world space given the distance from the camera,\n// line width, resolution, and camera projection\nfunction getWorldSpaceHalfWidth( camera, distance, resolution ) {\n\n\t// transform into clip space, adjust the x and y values by the pixel width offset, then\n\t// transform back into world space to get world offset. Note clip space is [-1, 1] so full\n\t// width does not need to be halved.\n\t_clipToWorldVector.set( 0, 0, - distance, 1.0 ).applyMatrix4( camera.projectionMatrix );\n\t_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );\n\t_clipToWorldVector.x = _lineWidth / resolution.width;\n\t_clipToWorldVector.y = _lineWidth / resolution.height;\n\t_clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse );\n\t_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );\n\n\treturn Math.abs( Math.max( _clipToWorldVector.x, _clipToWorldVector.y ) );\n\n}\n\nfunction raycastWorldUnits( lineSegments, intersects ) {\n\n\tconst matrixWorld = lineSegments.matrixWorld;\n\tconst geometry = lineSegments.geometry;\n\tconst instanceStart = geometry.attributes.instanceStart;\n\tconst instanceEnd = geometry.attributes.instanceEnd;\n\tconst segmentCount = Math.min( geometry.instanceCount, instanceStart.count );\n\n\tfor ( let i = 0, l = segmentCount; i < l; i ++ ) {\n\n\t\t_line.start.fromBufferAttribute( instanceStart, i );\n\t\t_line.end.fromBufferAttribute( instanceEnd, i );\n\n\t\t_line.applyMatrix4( matrixWorld );\n\n\t\tconst pointOnLine = new Vector3();\n\t\tconst point = new Vector3();\n\n\t\t_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );\n\t\tconst isInside = point.distanceTo( pointOnLine ) < _lineWidth * 0.5;\n\n\t\tif ( isInside ) {\n\n\t\t\tintersects.push( {\n\t\t\t\tpoint,\n\t\t\t\tpointOnLine,\n\t\t\t\tdistance: _ray.origin.distanceTo( point ),\n\t\t\t\tobject: lineSegments,\n\t\t\t\tface: null,\n\t\t\t\tfaceIndex: i,\n\t\t\t\tuv: null,\n\t\t\t\tuv1: null,\n\t\t\t} );\n\n\t\t}\n\n\t}\n\n}\n\nfunction raycastScreenSpace( lineSegments, camera, intersects ) {\n\n\tconst projectionMatrix = camera.projectionMatrix;\n\tconst material = lineSegments.material;\n\tconst resolution = material.resolution;\n\tconst matrixWorld = lineSegments.matrixWorld;\n\n\tconst geometry = lineSegments.geometry;\n\tconst instanceStart = geometry.attributes.instanceStart;\n\tconst instanceEnd = geometry.attributes.instanceEnd;\n\tconst segmentCount = Math.min( geometry.instanceCount, instanceStart.count );\n\n\tconst near = - camera.near;\n\n\t//\n\n\t// pick a point 1 unit out along the ray to avoid the ray origin\n\t// sitting at the camera origin which will cause \"w\" to be 0 when\n\t// applying the projection matrix.\n\t_ray.at( 1, _ssOrigin );\n\n\t// ndc space [ - 1.0, 1.0 ]\n\t_ssOrigin.w = 1;\n\t_ssOrigin.applyMatrix4( camera.matrixWorldInverse );\n\t_ssOrigin.applyMatrix4( projectionMatrix );\n\t_ssOrigin.multiplyScalar( 1 / _ssOrigin.w );\n\n\t// screen space\n\t_ssOrigin.x *= resolution.x / 2;\n\t_ssOrigin.y *= resolution.y / 2;\n\t_ssOrigin.z = 0;\n\n\t_ssOrigin3.copy( _ssOrigin );\n\n\t_mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );\n\n\tfor ( let i = 0, l = segmentCount; i < l; i ++ ) {\n\n\t\t_start4.fromBufferAttribute( instanceStart, i );\n\t\t_end4.fromBufferAttribute( instanceEnd, i );\n\n\t\t_start4.w = 1;\n\t\t_end4.w = 1;\n\n\t\t// camera space\n\t\t_start4.applyMatrix4( _mvMatrix );\n\t\t_end4.applyMatrix4( _mvMatrix );\n\n\t\t// skip the segment if it's entirely behind the camera\n\t\tconst isBehindCameraNear = _start4.z > near && _end4.z > near;\n\t\tif ( isBehindCameraNear ) {\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\t// trim the segment if it extends behind camera near\n\t\tif ( _start4.z > near ) {\n\n\t\t\tconst deltaDist = _start4.z - _end4.z;\n\t\t\tconst t = ( _start4.z - near ) / deltaDist;\n\t\t\t_start4.lerp( _end4, t );\n\n\t\t} else if ( _end4.z > near ) {\n\n\t\t\tconst deltaDist = _end4.z - _start4.z;\n\t\t\tconst t = ( _end4.z - near ) / deltaDist;\n\t\t\t_end4.lerp( _start4, t );\n\n\t\t}\n\n\t\t// clip space\n\t\t_start4.applyMatrix4( projectionMatrix );\n\t\t_end4.applyMatrix4( projectionMatrix );\n\n\t\t// ndc space [ - 1.0, 1.0 ]\n\t\t_start4.multiplyScalar( 1 / _start4.w );\n\t\t_end4.multiplyScalar( 1 / _end4.w );\n\n\t\t// screen space\n\t\t_start4.x *= resolution.x / 2;\n\t\t_start4.y *= resolution.y / 2;\n\n\t\t_end4.x *= resolution.x / 2;\n\t\t_end4.y *= resolution.y / 2;\n\n\t\t// create 2d segment\n\t\t_line.start.copy( _start4 );\n\t\t_line.start.z = 0;\n\n\t\t_line.end.copy( _end4 );\n\t\t_line.end.z = 0;\n\n\t\t// get closest point on ray to segment\n\t\tconst param = _line.closestPointToPointParameter( _ssOrigin3, true );\n\t\t_line.at( param, _closestPoint );\n\n\t\t// check if the intersection point is within clip space\n\t\tconst zPos = MathUtils.lerp( _start4.z, _end4.z, param );\n\t\tconst isInClipSpace = zPos >= - 1 && zPos <= 1;\n\n\t\tconst isInside = _ssOrigin3.distanceTo( _closestPoint ) < _lineWidth * 0.5;\n\n\t\tif ( isInClipSpace && isInside ) {\n\n\t\t\t_line.start.fromBufferAttribute( instanceStart, i );\n\t\t\t_line.end.fromBufferAttribute( instanceEnd, i );\n\n\t\t\t_line.start.applyMatrix4( matrixWorld );\n\t\t\t_line.end.applyMatrix4( matrixWorld );\n\n\t\t\tconst pointOnLine = new Vector3();\n\t\t\tconst point = new Vector3();\n\n\t\t\t_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );\n\n\t\t\tintersects.push( {\n\t\t\t\tpoint: point,\n\t\t\t\tpointOnLine: pointOnLine,\n\t\t\t\tdistance: _ray.origin.distanceTo( point ),\n\t\t\t\tobject: lineSegments,\n\t\t\t\tface: null,\n\t\t\t\tfaceIndex: i,\n\t\t\t\tuv: null,\n\t\t\t\tuv1: null,\n\t\t\t} );\n\n\t\t}\n\n\t}\n\n}\n\nclass LineSegments2 extends Mesh {\n\n\tconstructor( geometry = new LineSegmentsGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineSegments2 = true;\n\n\t\tthis.type = 'LineSegments2';\n\n\t}\n\n\t// for backwards-compatibility, but could be a method of LineSegmentsGeometry...\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst instanceStart = geometry.attributes.instanceStart;\n\t\tconst instanceEnd = geometry.attributes.instanceEnd;\n\t\tconst lineDistances = new Float32Array( 2 * instanceStart.count );\n\n\t\tfor ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) {\n\n\t\t\t_start.fromBufferAttribute( instanceStart, i );\n\t\t\t_end.fromBufferAttribute( instanceEnd, i );\n\n\t\t\tlineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];\n\t\t\tlineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end );\n\n\t\t}\n\n\t\tconst instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1\n\n\t\tgeometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0\n\t\tgeometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst worldUnits = this.material.worldUnits;\n\t\tconst camera = raycaster.camera;\n\n\t\tif ( camera === null && ! worldUnits ) {\n\n\t\t\tconsole.error( 'LineSegments2: \"Raycaster.camera\" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.' );\n\n\t\t}\n\n\t\tconst threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;\n\n\t\t_ray = raycaster.ray;\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\t_lineWidth = material.linewidth + threshold;\n\n\t\t// check if we intersect the sphere bounds\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\t_sphere.copy( geometry.boundingSphere ).applyMatrix4( matrixWorld );\n\n\t\t// increase the sphere bounds by the worst case line screen space width\n\t\tlet sphereMargin;\n\t\tif ( worldUnits ) {\n\n\t\t\tsphereMargin = _lineWidth * 0.5;\n\n\t\t} else {\n\n\t\t\tconst distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( _ray.origin ) );\n\t\t\tsphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, material.resolution );\n\n\t\t}\n\n\t\t_sphere.radius += sphereMargin;\n\n\t\tif ( _ray.intersectsSphere( _sphere ) === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// check if we intersect the box bounds\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\t_box.copy( geometry.boundingBox ).applyMatrix4( matrixWorld );\n\n\t\t// increase the box bounds by the worst case line width\n\t\tlet boxMargin;\n\t\tif ( worldUnits ) {\n\n\t\t\tboxMargin = _lineWidth * 0.5;\n\n\t\t} else {\n\n\t\t\tconst distanceToBox = Math.max( camera.near, _box.distanceToPoint( _ray.origin ) );\n\t\t\tboxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, material.resolution );\n\n\t\t}\n\n\t\t_box.expandByScalar( boxMargin );\n\n\t\tif ( _ray.intersectsBox( _box ) === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( worldUnits ) {\n\n\t\t\traycastWorldUnits( this, intersects );\n\n\t\t} else {\n\n\t\t\traycastScreenSpace( this, camera, intersects );\n\n\t\t}\n\n\t}\n\n\tonBeforeRender( renderer ) {\n\n\t\tconst uniforms = this.material.uniforms;\n\n\t\tif ( uniforms && uniforms.resolution ) {\n\n\t\t\trenderer.getViewport( _viewport );\n\t\t\tthis.material.uniforms.resolution.value.set( _viewport.z, _viewport.w );\n\n\t\t}\n\n\t}\n\n}\n\nexport { LineSegments2 };\n",null,null,null,null,null,null,null],"names":["_box","Box3","_vector","Vector3","LineSegmentsGeometry","InstancedBufferGeometry","constructor","super","this","isLineSegmentsGeometry","type","setIndex","setAttribute","Float32BufferAttribute","applyMatrix4","matrix","start","attributes","instanceStart","end","instanceEnd","undefined","needsUpdate","boundingBox","computeBoundingBox","boundingSphere","computeBoundingSphere","setPositions","array","lineSegments","Float32Array","Array","isArray","instanceBuffer","InstancedInterleavedBuffer","InterleavedBufferAttribute","setColors","colors","instanceColorBuffer","fromWireframeGeometry","geometry","position","fromEdgesGeometry","fromMesh","mesh","WireframeGeometry","fromLineSegments","setFromBufferAttribute","union","Sphere","center","getCenter","maxRadiusSq","i","il","count","fromBufferAttribute","Math","max","distanceToSquared","radius","sqrt","isNaN","console","error","toJSON","applyMatrix","warn","UniformsLib","line","worldUnits","value","linewidth","resolution","Vector2","dashOffset","dashScale","dashSize","gapSize","ShaderLib","uniforms","UniformsUtils","merge","common","fog","vertexShader","fragmentShader","LineMaterial","ShaderMaterial","parameters","clone","clipping","isLineMaterial","setValues","color","diffuse","defines","WORLD_UNITS","dashed","USE_DASH","opacity","copy","alphaToCoverage","USE_ALPHA_TO_COVERAGE","_viewport","Vector4","_start","_end","_start4","_end4","_ssOrigin","_ssOrigin3","_mvMatrix","Matrix4","_line","Line3","_closestPoint","_sphere","_clipToWorldVector","_ray","_lineWidth","getWorldSpaceHalfWidth","camera","distance","set","projectionMatrix","multiplyScalar","w","x","width","y","height","projectionMatrixInverse","abs","LineSegments2","Mesh","material","random","isLineSegments2","computeLineDistances","lineDistances","j","l","distanceTo","instanceDistanceBuffer","raycast","raycaster","intersects","threshold","params","Line2","ray","matrixWorld","sphereMargin","boxMargin","near","distanceToPoint","origin","intersectsSphere","expandByScalar","intersectsBox","min","instanceCount","pointOnLine","point","distanceSqToSegment","push","object","face","faceIndex","uv","uv1","raycastWorldUnits","segmentCount","at","matrixWorldInverse","z","multiplyMatrices","deltaDist","t","lerp","param","closestPointToPointParameter","zPos","MathUtils","isInClipSpace","isInside","raycastScreenSpace","onBeforeRender","renderer","getViewport","_color","THREE","Color","DebugDrawer","Group","pointGeometry","SphereGeometry","currentVertices","currentPrimitive","triMaterial","pointMaterial","lineMaterial","MeshBasicMaterial","vertexColors","transparent","depthWrite","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","debugDrawImpl","Raw","Module","DebugDrawImpl","handleBegin","primitive","_size","handleDepthMask","_state","handleTexture","handleVertexWithColor","vertex","handleVertexWithColorAndUV","_u","_v","handleEnd","DU_DRAW_LINES","endLines","DU_DRAW_TRIS","endTris","DU_DRAW_QUADS","endQuads","DU_DRAW_POINTS","endPoints","drawHeightfieldSolid","hf","RecastDebugDraw","debugDrawHeightfieldSolid","raw","drawHeightfieldWalkable","debugDrawHeightfieldWalkable","drawCompactHeightfieldSolid","chf","debugDrawCompactHeightfieldSolid","drawCompactHeightfieldRegions","debugDrawCompactHeightfieldRegions","drawCompactHeightfieldDistance","debugDrawCompactHeightfieldDistance","drawHeightfieldLayer","layer","idx","debugDrawHeightfieldLayer","drawHeightfieldLayers","lset","debugDrawHeightfieldLayers","drawRegionConnections","cset","alpha","debugDrawRegionConnections","drawRawContours","debugDrawRawContours","drawContours","debugDrawContours","drawPolyMesh","debugDrawPolyMesh","drawPolyMeshDetail","dmesh","debugDrawPolyMeshDetail","drawNavMesh","flags","DetourDebugDraw","debugDrawNavMesh","getNavMesh","drawNavMeshWithClosedList","query","debugDrawNavMeshWithClosedList","m_navMesh","m_navQuery","drawNavMeshNodes","debugDrawNavMeshNodes","drawNavMeshBVTree","debugDrawNavMeshBVTree","drawNavMeshPortals","debugDrawNavMeshPortals","drawNavMeshPolysWithFlags","col","debugDrawNavMeshPolysWithFlags","drawNavMeshPoly","ref","debugDrawNavMeshPoly","reset","child","children","dispose","clear","destroy","r","g","b","a","instancedMesh","InstancedMesh","length","setMatrixAt","setPosition","setColorAt","setRGB","instanceMatrix","add","lineSegmentsGeometry","positions","x1","y1","z1","r1","g1","b1","x2","y2","z2","r2","g2","b2","BufferGeometry","BufferAttribute","vertices","CrowdHelper","Object3D","agentMeshes","Map","crowd","agentMaterial","recastCrowd","update","agents","getAgents","unseen","Set","keys","agent","delete","agentIndex","velocity","agentMesh","get","createAgentMesh","updateAgentGeometry","lookAt","agentId","remove","userData","agentParams","CylinderGeometry","NavMeshHelper","navMesh","navMeshMaterial","indices","getDebugNavMesh","from","Uint32Array","computeVertexNormals","OffMeshConnectionsHelper","offMeshConnections","entryCircleMaterial","exitCircleMaterial","LineBasicMaterial","offMeshConnection","circleGeometry","CircleGeometry","startMesh","startPosition","rotation","PI","endMesh","bidirectional","endPosition","middle","addVectors","curvePoints","CatmullRomCurve3","getPoints","lineGeometry","setFromPoints","Line","TileCacheHelper","obstacleMeshes","tileCache","obstacleMaterial","wireframe","wireframeLinewidth","obstacle","obstacles","obstacleMesh","halfExtents","angle","BoxGeometry","Error","tmpVec3","getPositionsAndIndices","meshes","meshesToMerge","positionAttribute","itemSize","meshToMerge","index","getIndex","ascendingIndex","mergedPositions","mergedIndices","positionToIndex","indexCounter","updateMatrixWorld","pt","pos","localToWorld","key","threeToSoloNavMesh","navMeshGeneratorConfig","keepIntermediates","generateSoloNavMesh","threeToTiledNavMesh","generateTiledNavMesh","threeToTileCache","generateTileCache"],"mappings":"mtBAWA,MAAMA,EAAO,IAAIC,EACXC,EAAU,IAAIC,EAEpB,MAAMC,UAA6BC,EAElC,WAAAC,GAECC,QAEAC,KAAKC,wBAAyB,EAE9BD,KAAKE,KAAO,uBAMZF,KAAKG,SAFS,CAAE,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,IAGnEH,KAAKI,aAAc,WAAY,IAAIC,EALjB,EAAI,EAAG,EAAG,EAAG,EAAG,EAAG,GAAK,EAAG,EAAG,EAAG,EAAG,EAAG,GAAK,EAAG,EAAG,EAAG,EAAG,EAAG,GAAK,GAAK,EAAG,EAAG,GAAK,EAAG,GAK/B,IACtEL,KAAKI,aAAc,KAAM,IAAIC,EALjB,EAAI,EAAG,EAAG,EAAG,GAAK,EAAG,EAAG,EAAG,GAAK,GAAK,EAAG,GAAK,GAAK,GAAK,EAAG,GAAK,GAKjB,GAE1D,CAED,YAAAC,CAAcC,GAEb,MAAMC,EAAQR,KAAKS,WAAWC,cACxBC,EAAMX,KAAKS,WAAWG,YAwB5B,YAtBeC,IAAVL,IAEJA,EAAMF,aAAcC,GAEpBI,EAAIL,aAAcC,GAElBC,EAAMM,aAAc,GAIK,OAArBd,KAAKe,aAETf,KAAKgB,qBAIuB,OAAxBhB,KAAKiB,gBAETjB,KAAKkB,wBAIClB,IAEP,CAED,YAAAmB,CAAcC,GAEb,IAAIC,EAECD,aAAiBE,aAErBD,EAAeD,EAEJG,MAAMC,QAASJ,KAE1BC,EAAe,IAAIC,a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ExC,IAAK,IAAIyB,EAAI,EAAGA,EAAI+V,EAAMtG,OAAQzP,IAAK,CACrC,MAAMuW,EAAgB,EAAXR,EAAM/V,GAEXwW,EAAMhB,GAAQjR,IAClB0L,EAAUsG,GACVtG,EAAUsG,EAAK,GACftG,EAAUsG,EAAK,IAEjBhX,EAAKkX,aAAaD,GAElB,MAAME,EAAS,GAAAF,EAAI7R,KAAK6R,EAAI3R,KAAK2R,EAAI7O,IACrC,IAAI0E,EAAM+J,EAAgBM,GAErBrK,IACH+J,EAAgBM,GAAOrK,EAAMgK,EAC7BH,EAAgBjP,KAAKuP,EAAI7R,EAAG6R,EAAI3R,EAAG2R,EAAI7O,GACvC0O,KAGFF,EAAclP,KAAKoF,EACrB,CACF,CAEA,MAAO,CAAC5N,aAAawU,KAAKiD,GAAkBhD,YAAYD,KAAKkD,GAAe,EC5DjEQ,GAAqBA,CAChCjB,EACAkB,EAA8D,CAAA,EAC9DC,GAAoB,KAEpB,MAAO5G,EAAW8C,GAAW0C,GAAuBC,GAEpD,OAAOoB,EACL7G,EACA8C,EACA6D,EACAC,EACD,EAGUE,GAAsBA,CACjCrB,EACAkB,EAA+D,CAAA,EAC/DC,GAAoB,KAEpB,MAAO5G,EAAW8C,GAAW0C,GAAuBC,GAEpD,OAAOsB,EACL/G,EACA8C,EACA6D,EACAC,EACD,EAGUI,GAAmBA,CAC9BvB,EACAkB,EAA4D,CAAA,EAC5DC,GAAoB,KAEpB,MAAO5G,EAAW8C,GAAW0C,GAAuBC,GAEpD,OAAOwB,EACLjH,EACA8C,EACA6D,EACAC,EACD","x_google_ignoreList":[0,1,2]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js","../../../node_modules/three/examples/jsm/lines/LineMaterial.js","../../../node_modules/three/examples/jsm/lines/LineSegments2.js","../src/debug/debug-drawer.ts","../src/helpers/crowd-helper.ts","../src/helpers/nav-mesh-helper.ts","../src/helpers/off-mesh-connections-helper.ts","../src/helpers/tile-cache-helper.ts","../src/utils/get-positions-and-indices.ts","../src/utils/generators.ts"],"sourcesContent":["import {\n\tBox3,\n\tFloat32BufferAttribute,\n\tInstancedBufferGeometry,\n\tInstancedInterleavedBuffer,\n\tInterleavedBufferAttribute,\n\tSphere,\n\tVector3,\n\tWireframeGeometry\n} from 'three';\n\nconst _box = new Box3();\nconst _vector = new Vector3();\n\nclass LineSegmentsGeometry extends InstancedBufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isLineSegmentsGeometry = true;\n\n\t\tthis.type = 'LineSegmentsGeometry';\n\n\t\tconst positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ];\n\t\tconst uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ];\n\t\tconst index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];\n\n\t\tthis.setIndex( index );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst start = this.attributes.instanceStart;\n\t\tconst end = this.attributes.instanceEnd;\n\n\t\tif ( start !== undefined ) {\n\n\t\t\tstart.applyMatrix4( matrix );\n\n\t\t\tend.applyMatrix4( matrix );\n\n\t\t\tstart.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetPositions( array ) {\n\n\t\tlet lineSegments;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\tlineSegments = array;\n\n\t\t} else if ( Array.isArray( array ) ) {\n\n\t\t\tlineSegments = new Float32Array( array );\n\n\t\t}\n\n\t\tconst instanceBuffer = new InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz\n\n\t\tthis.setAttribute( 'instanceStart', new InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz\n\t\tthis.setAttribute( 'instanceEnd', new InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz\n\n\t\t//\n\n\t\tthis.computeBoundingBox();\n\t\tthis.computeBoundingSphere();\n\n\t\treturn this;\n\n\t}\n\n\tsetColors( array ) {\n\n\t\tlet colors;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\tcolors = array;\n\n\t\t} else if ( Array.isArray( array ) ) {\n\n\t\t\tcolors = new Float32Array( array );\n\n\t\t}\n\n\t\tconst instanceColorBuffer = new InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb\n\n\t\tthis.setAttribute( 'instanceColorStart', new InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb\n\t\tthis.setAttribute( 'instanceColorEnd', new InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb\n\n\t\treturn this;\n\n\t}\n\n\tfromWireframeGeometry( geometry ) {\n\n\t\tthis.setPositions( geometry.attributes.position.array );\n\n\t\treturn this;\n\n\t}\n\n\tfromEdgesGeometry( geometry ) {\n\n\t\tthis.setPositions( geometry.attributes.position.array );\n\n\t\treturn this;\n\n\t}\n\n\tfromMesh( mesh ) {\n\n\t\tthis.fromWireframeGeometry( new WireframeGeometry( mesh.geometry ) );\n\n\t\t// set colors, maybe\n\n\t\treturn this;\n\n\t}\n\n\tfromLineSegments( lineSegments ) {\n\n\t\tconst geometry = lineSegments.geometry;\n\n\t\tthis.setPositions( geometry.attributes.position.array ); // assumes non-indexed\n\n\t\t// set colors, maybe\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst start = this.attributes.instanceStart;\n\t\tconst end = this.attributes.instanceEnd;\n\n\t\tif ( start !== undefined && end !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( start );\n\n\t\t\t_box.setFromBufferAttribute( end );\n\n\t\t\tthis.boundingBox.union( _box );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tconst start = this.attributes.instanceStart;\n\t\tconst end = this.attributes.instanceEnd;\n\n\t\tif ( start !== undefined && end !== undefined ) {\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\tthis.boundingBox.getCenter( center );\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = start.count; i < il; i ++ ) {\n\n\t\t\t\t_vector.fromBufferAttribute( start, i );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );\n\n\t\t\t\t_vector.fromBufferAttribute( end, i );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON() {\n\n\t\t// todo\n\n\t}\n\n\tapplyMatrix( matrix ) {\n\n\t\tconsole.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' );\n\n\t\treturn this.applyMatrix4( matrix );\n\n\t}\n\n}\n\nexport { LineSegmentsGeometry };\n","import {\n\tShaderLib,\n\tShaderMaterial,\n\tUniformsLib,\n\tUniformsUtils,\n\tVector2,\n} from 'three';\n\nUniformsLib.line = {\n\n\tworldUnits: { value: 1 },\n\tlinewidth: { value: 1 },\n\tresolution: { value: new Vector2( 1, 1 ) },\n\tdashOffset: { value: 0 },\n\tdashScale: { value: 1 },\n\tdashSize: { value: 1 },\n\tgapSize: { value: 1 } // todo FIX - maybe change to totalSize\n\n};\n\nShaderLib[ 'line' ] = {\n\n\tuniforms: UniformsUtils.merge( [\n\t\tUniformsLib.common,\n\t\tUniformsLib.fog,\n\t\tUniformsLib.line\n\t] ),\n\n\tvertexShader:\n\t/* glsl */`\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t`,\n\n\tfragmentShader:\n\t/* glsl */`\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t`\n};\n\nclass LineMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( {\n\n\t\t\ttype: 'LineMaterial',\n\n\t\t\tuniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ),\n\n\t\t\tvertexShader: ShaderLib[ 'line' ].vertexShader,\n\t\t\tfragmentShader: ShaderLib[ 'line' ].fragmentShader,\n\n\t\t\tclipping: true // required for clipping support\n\n\t\t} );\n\n\t\tthis.isLineMaterial = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget color() {\n\n\t\treturn this.uniforms.diffuse.value;\n\n\t}\n\n\tset color( value ) {\n\n\t\tthis.uniforms.diffuse.value = value;\n\n\t}\n\n\tget worldUnits() {\n\n\t\treturn 'WORLD_UNITS' in this.defines;\n\n\t}\n\n\tset worldUnits( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.defines.WORLD_UNITS = '';\n\n\t\t} else {\n\n\t\t\tdelete this.defines.WORLD_UNITS;\n\n\t\t}\n\n\t}\n\n\tget linewidth() {\n\n\t\treturn this.uniforms.linewidth.value;\n\n\t}\n\n\tset linewidth( value ) {\n\n\t\tif ( ! this.uniforms.linewidth ) return;\n\t\tthis.uniforms.linewidth.value = value;\n\n\t}\n\n\tget dashed() {\n\n\t\treturn 'USE_DASH' in this.defines;\n\n\t}\n\n\tset dashed( value ) {\n\n\t\tif ( ( value === true ) !== this.dashed ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.defines.USE_DASH = '';\n\n\t\t} else {\n\n\t\t\tdelete this.defines.USE_DASH;\n\n\t\t}\n\n\t}\n\n\tget dashScale() {\n\n\t\treturn this.uniforms.dashScale.value;\n\n\t}\n\n\tset dashScale( value ) {\n\n\t\tthis.uniforms.dashScale.value = value;\n\n\t}\n\n\tget dashSize() {\n\n\t\treturn this.uniforms.dashSize.value;\n\n\t}\n\n\tset dashSize( value ) {\n\n\t\tthis.uniforms.dashSize.value = value;\n\n\t}\n\n\tget dashOffset() {\n\n\t\treturn this.uniforms.dashOffset.value;\n\n\t}\n\n\tset dashOffset( value ) {\n\n\t\tthis.uniforms.dashOffset.value = value;\n\n\t}\n\n\tget gapSize() {\n\n\t\treturn this.uniforms.gapSize.value;\n\n\t}\n\n\tset gapSize( value ) {\n\n\t\tthis.uniforms.gapSize.value = value;\n\n\t}\n\n\tget opacity() {\n\n\t\treturn this.uniforms.opacity.value;\n\n\t}\n\n\tset opacity( value ) {\n\n\t\tif ( ! this.uniforms ) return;\n\t\tthis.uniforms.opacity.value = value;\n\n\t}\n\n\tget resolution() {\n\n\t\treturn this.uniforms.resolution.value;\n\n\t}\n\n\tset resolution( value ) {\n\n\t\tthis.uniforms.resolution.value.copy( value );\n\n\t}\n\n\tget alphaToCoverage() {\n\n\t\treturn 'USE_ALPHA_TO_COVERAGE' in this.defines;\n\n\t}\n\n\tset alphaToCoverage( value ) {\n\n\t\tif ( ! this.defines ) return;\n\n\t\tif ( ( value === true ) !== this.alphaToCoverage ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.defines.USE_ALPHA_TO_COVERAGE = '';\n\n\t\t} else {\n\n\t\t\tdelete this.defines.USE_ALPHA_TO_COVERAGE;\n\n\t\t}\n\n\t}\n\n}\n\nexport { LineMaterial };\n","import {\n\tBox3,\n\tInstancedInterleavedBuffer,\n\tInterleavedBufferAttribute,\n\tLine3,\n\tMathUtils,\n\tMatrix4,\n\tMesh,\n\tSphere,\n\tVector3,\n\tVector4\n} from 'three';\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';\nimport { LineMaterial } from '../lines/LineMaterial.js';\n\nconst _viewport = new Vector4();\n\nconst _start = new Vector3();\nconst _end = new Vector3();\n\nconst _start4 = new Vector4();\nconst _end4 = new Vector4();\n\nconst _ssOrigin = new Vector4();\nconst _ssOrigin3 = new Vector3();\nconst _mvMatrix = new Matrix4();\nconst _line = new Line3();\nconst _closestPoint = new Vector3();\n\nconst _box = new Box3();\nconst _sphere = new Sphere();\nconst _clipToWorldVector = new Vector4();\n\nlet _ray, _lineWidth;\n\n// Returns the margin required to expand by in world space given the distance from the camera,\n// line width, resolution, and camera projection\nfunction getWorldSpaceHalfWidth( camera, distance, resolution ) {\n\n\t// transform into clip space, adjust the x and y values by the pixel width offset, then\n\t// transform back into world space to get world offset. Note clip space is [-1, 1] so full\n\t// width does not need to be halved.\n\t_clipToWorldVector.set( 0, 0, - distance, 1.0 ).applyMatrix4( camera.projectionMatrix );\n\t_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );\n\t_clipToWorldVector.x = _lineWidth / resolution.width;\n\t_clipToWorldVector.y = _lineWidth / resolution.height;\n\t_clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse );\n\t_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );\n\n\treturn Math.abs( Math.max( _clipToWorldVector.x, _clipToWorldVector.y ) );\n\n}\n\nfunction raycastWorldUnits( lineSegments, intersects ) {\n\n\tconst matrixWorld = lineSegments.matrixWorld;\n\tconst geometry = lineSegments.geometry;\n\tconst instanceStart = geometry.attributes.instanceStart;\n\tconst instanceEnd = geometry.attributes.instanceEnd;\n\tconst segmentCount = Math.min( geometry.instanceCount, instanceStart.count );\n\n\tfor ( let i = 0, l = segmentCount; i < l; i ++ ) {\n\n\t\t_line.start.fromBufferAttribute( instanceStart, i );\n\t\t_line.end.fromBufferAttribute( instanceEnd, i );\n\n\t\t_line.applyMatrix4( matrixWorld );\n\n\t\tconst pointOnLine = new Vector3();\n\t\tconst point = new Vector3();\n\n\t\t_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );\n\t\tconst isInside = point.distanceTo( pointOnLine ) < _lineWidth * 0.5;\n\n\t\tif ( isInside ) {\n\n\t\t\tintersects.push( {\n\t\t\t\tpoint,\n\t\t\t\tpointOnLine,\n\t\t\t\tdistance: _ray.origin.distanceTo( point ),\n\t\t\t\tobject: lineSegments,\n\t\t\t\tface: null,\n\t\t\t\tfaceIndex: i,\n\t\t\t\tuv: null,\n\t\t\t\tuv1: null,\n\t\t\t} );\n\n\t\t}\n\n\t}\n\n}\n\nfunction raycastScreenSpace( lineSegments, camera, intersects ) {\n\n\tconst projectionMatrix = camera.projectionMatrix;\n\tconst material = lineSegments.material;\n\tconst resolution = material.resolution;\n\tconst matrixWorld = lineSegments.matrixWorld;\n\n\tconst geometry = lineSegments.geometry;\n\tconst instanceStart = geometry.attributes.instanceStart;\n\tconst instanceEnd = geometry.attributes.instanceEnd;\n\tconst segmentCount = Math.min( geometry.instanceCount, instanceStart.count );\n\n\tconst near = - camera.near;\n\n\t//\n\n\t// pick a point 1 unit out along the ray to avoid the ray origin\n\t// sitting at the camera origin which will cause \"w\" to be 0 when\n\t// applying the projection matrix.\n\t_ray.at( 1, _ssOrigin );\n\n\t// ndc space [ - 1.0, 1.0 ]\n\t_ssOrigin.w = 1;\n\t_ssOrigin.applyMatrix4( camera.matrixWorldInverse );\n\t_ssOrigin.applyMatrix4( projectionMatrix );\n\t_ssOrigin.multiplyScalar( 1 / _ssOrigin.w );\n\n\t// screen space\n\t_ssOrigin.x *= resolution.x / 2;\n\t_ssOrigin.y *= resolution.y / 2;\n\t_ssOrigin.z = 0;\n\n\t_ssOrigin3.copy( _ssOrigin );\n\n\t_mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );\n\n\tfor ( let i = 0, l = segmentCount; i < l; i ++ ) {\n\n\t\t_start4.fromBufferAttribute( instanceStart, i );\n\t\t_end4.fromBufferAttribute( instanceEnd, i );\n\n\t\t_start4.w = 1;\n\t\t_end4.w = 1;\n\n\t\t// camera space\n\t\t_start4.applyMatrix4( _mvMatrix );\n\t\t_end4.applyMatrix4( _mvMatrix );\n\n\t\t// skip the segment if it's entirely behind the camera\n\t\tconst isBehindCameraNear = _start4.z > near && _end4.z > near;\n\t\tif ( isBehindCameraNear ) {\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\t// trim the segment if it extends behind camera near\n\t\tif ( _start4.z > near ) {\n\n\t\t\tconst deltaDist = _start4.z - _end4.z;\n\t\t\tconst t = ( _start4.z - near ) / deltaDist;\n\t\t\t_start4.lerp( _end4, t );\n\n\t\t} else if ( _end4.z > near ) {\n\n\t\t\tconst deltaDist = _end4.z - _start4.z;\n\t\t\tconst t = ( _end4.z - near ) / deltaDist;\n\t\t\t_end4.lerp( _start4, t );\n\n\t\t}\n\n\t\t// clip space\n\t\t_start4.applyMatrix4( projectionMatrix );\n\t\t_end4.applyMatrix4( projectionMatrix );\n\n\t\t// ndc space [ - 1.0, 1.0 ]\n\t\t_start4.multiplyScalar( 1 / _start4.w );\n\t\t_end4.multiplyScalar( 1 / _end4.w );\n\n\t\t// screen space\n\t\t_start4.x *= resolution.x / 2;\n\t\t_start4.y *= resolution.y / 2;\n\n\t\t_end4.x *= resolution.x / 2;\n\t\t_end4.y *= resolution.y / 2;\n\n\t\t// create 2d segment\n\t\t_line.start.copy( _start4 );\n\t\t_line.start.z = 0;\n\n\t\t_line.end.copy( _end4 );\n\t\t_line.end.z = 0;\n\n\t\t// get closest point on ray to segment\n\t\tconst param = _line.closestPointToPointParameter( _ssOrigin3, true );\n\t\t_line.at( param, _closestPoint );\n\n\t\t// check if the intersection point is within clip space\n\t\tconst zPos = MathUtils.lerp( _start4.z, _end4.z, param );\n\t\tconst isInClipSpace = zPos >= - 1 && zPos <= 1;\n\n\t\tconst isInside = _ssOrigin3.distanceTo( _closestPoint ) < _lineWidth * 0.5;\n\n\t\tif ( isInClipSpace && isInside ) {\n\n\t\t\t_line.start.fromBufferAttribute( instanceStart, i );\n\t\t\t_line.end.fromBufferAttribute( instanceEnd, i );\n\n\t\t\t_line.start.applyMatrix4( matrixWorld );\n\t\t\t_line.end.applyMatrix4( matrixWorld );\n\n\t\t\tconst pointOnLine = new Vector3();\n\t\t\tconst point = new Vector3();\n\n\t\t\t_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );\n\n\t\t\tintersects.push( {\n\t\t\t\tpoint: point,\n\t\t\t\tpointOnLine: pointOnLine,\n\t\t\t\tdistance: _ray.origin.distanceTo( point ),\n\t\t\t\tobject: lineSegments,\n\t\t\t\tface: null,\n\t\t\t\tfaceIndex: i,\n\t\t\t\tuv: null,\n\t\t\t\tuv1: null,\n\t\t\t} );\n\n\t\t}\n\n\t}\n\n}\n\nclass LineSegments2 extends Mesh {\n\n\tconstructor( geometry = new LineSegmentsGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineSegments2 = true;\n\n\t\tthis.type = 'LineSegments2';\n\n\t}\n\n\t// for backwards-compatibility, but could be a method of LineSegmentsGeometry...\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst instanceStart = geometry.attributes.instanceStart;\n\t\tconst instanceEnd = geometry.attributes.instanceEnd;\n\t\tconst lineDistances = new Float32Array( 2 * instanceStart.count );\n\n\t\tfor ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) {\n\n\t\t\t_start.fromBufferAttribute( instanceStart, i );\n\t\t\t_end.fromBufferAttribute( instanceEnd, i );\n\n\t\t\tlineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];\n\t\t\tlineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end );\n\n\t\t}\n\n\t\tconst instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1\n\n\t\tgeometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0\n\t\tgeometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst worldUnits = this.material.worldUnits;\n\t\tconst camera = raycaster.camera;\n\n\t\tif ( camera === null && ! worldUnits ) {\n\n\t\t\tconsole.error( 'LineSegments2: \"Raycaster.camera\" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.' );\n\n\t\t}\n\n\t\tconst threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;\n\n\t\t_ray = raycaster.ray;\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\t_lineWidth = material.linewidth + threshold;\n\n\t\t// check if we intersect the sphere bounds\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\t_sphere.copy( geometry.boundingSphere ).applyMatrix4( matrixWorld );\n\n\t\t// increase the sphere bounds by the worst case line screen space width\n\t\tlet sphereMargin;\n\t\tif ( worldUnits ) {\n\n\t\t\tsphereMargin = _lineWidth * 0.5;\n\n\t\t} else {\n\n\t\t\tconst distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( _ray.origin ) );\n\t\t\tsphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, material.resolution );\n\n\t\t}\n\n\t\t_sphere.radius += sphereMargin;\n\n\t\tif ( _ray.intersectsSphere( _sphere ) === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// check if we intersect the box bounds\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\t_box.copy( geometry.boundingBox ).applyMatrix4( matrixWorld );\n\n\t\t// increase the box bounds by the worst case line width\n\t\tlet boxMargin;\n\t\tif ( worldUnits ) {\n\n\t\t\tboxMargin = _lineWidth * 0.5;\n\n\t\t} else {\n\n\t\t\tconst distanceToBox = Math.max( camera.near, _box.distanceToPoint( _ray.origin ) );\n\t\t\tboxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, material.resolution );\n\n\t\t}\n\n\t\t_box.expandByScalar( boxMargin );\n\n\t\tif ( _ray.intersectsBox( _box ) === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( worldUnits ) {\n\n\t\t\traycastWorldUnits( this, intersects );\n\n\t\t} else {\n\n\t\t\traycastScreenSpace( this, camera, intersects );\n\n\t\t}\n\n\t}\n\n\tonBeforeRender( renderer ) {\n\n\t\tconst uniforms = this.material.uniforms;\n\n\t\tif ( uniforms && uniforms.resolution ) {\n\n\t\t\trenderer.getViewport( _viewport );\n\t\t\tthis.material.uniforms.resolution.value.set( _viewport.z, _viewport.w );\n\n\t\t}\n\n\t}\n\n}\n\nexport { LineSegments2 };\n",null,null,null,null,null,null,null],"names":["_box","Box3","_vector","Vector3","LineSegmentsGeometry","InstancedBufferGeometry","constructor","super","this","isLineSegmentsGeometry","type","setIndex","setAttribute","Float32BufferAttribute","applyMatrix4","matrix","start","attributes","instanceStart","end","instanceEnd","undefined","needsUpdate","boundingBox","computeBoundingBox","boundingSphere","computeBoundingSphere","setPositions","array","lineSegments","Float32Array","Array","isArray","instanceBuffer","InstancedInterleavedBuffer","InterleavedBufferAttribute","setColors","colors","instanceColorBuffer","fromWireframeGeometry","geometry","position","fromEdgesGeometry","fromMesh","mesh","WireframeGeometry","fromLineSegments","setFromBufferAttribute","union","Sphere","center","getCenter","maxRadiusSq","i","il","count","fromBufferAttribute","Math","max","distanceToSquared","radius","sqrt","isNaN","console","error","toJSON","applyMatrix","warn","UniformsLib","line","worldUnits","value","linewidth","resolution","Vector2","dashOffset","dashScale","dashSize","gapSize","ShaderLib","uniforms","UniformsUtils","merge","common","fog","vertexShader","fragmentShader","LineMaterial","ShaderMaterial","parameters","clone","clipping","isLineMaterial","setValues","color","diffuse","defines","WORLD_UNITS","dashed","USE_DASH","opacity","copy","alphaToCoverage","USE_ALPHA_TO_COVERAGE","_viewport","Vector4","_start","_end","_start4","_end4","_ssOrigin","_ssOrigin3","_mvMatrix","Matrix4","_line","Line3","_closestPoint","_sphere","_clipToWorldVector","_ray","_lineWidth","getWorldSpaceHalfWidth","camera","distance","set","projectionMatrix","multiplyScalar","w","x","width","y","height","projectionMatrixInverse","abs","LineSegments2","Mesh","material","random","isLineSegments2","computeLineDistances","lineDistances","j","l","distanceTo","instanceDistanceBuffer","raycast","raycaster","intersects","threshold","params","Line2","ray","matrixWorld","sphereMargin","boxMargin","near","distanceToPoint","origin","intersectsSphere","expandByScalar","intersectsBox","min","instanceCount","pointOnLine","point","distanceSqToSegment","push","object","face","faceIndex","uv","uv1","raycastWorldUnits","segmentCount","at","matrixWorldInverse","z","multiplyMatrices","deltaDist","t","lerp","param","closestPointToPointParameter","zPos","MathUtils","isInClipSpace","isInside","raycastScreenSpace","onBeforeRender","renderer","getViewport","_color","THREE","Color","DebugDrawer","Group","pointGeometry","SphereGeometry","triMaterial","pointMaterial","lineMaterial","debugDrawerUtils","DebugDrawerUtils","MeshBasicMaterial","vertexColors","transparent","depthWrite","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","drawPrimitives","primitives","primitive","drawPoints","drawLines","drawTris","drawQuads","drawHeightfieldSolid","hf","drawHeightfieldWalkable","drawCompactHeightfieldSolid","chf","drawCompactHeightfieldRegions","drawCompactHeightfieldDistance","drawHeightfieldLayer","layer","idx","drawHeightfieldLayers","lset","drawRegionConnections","cset","alpha","drawRawContours","drawContours","drawPolyMesh","drawPolyMeshDetail","dmesh","drawNavMesh","flags","drawNavMeshWithClosedList","query","drawNavMeshNodes","drawNavMeshBVTree","drawNavMeshPortals","drawNavMeshPolysWithFlags","col","drawNavMeshPoly","ref","reset","child","children","dispose","clear","instancedMesh","InstancedMesh","vertices","length","r","g","b","setMatrixAt","setPosition","setColorAt","setRGB","instanceMatrix","add","lineSegmentsGeometry","positions","x1","y1","z1","r1","g1","b1","x2","y2","z2","r2","g2","b2","BufferGeometry","BufferAttribute","CrowdHelper","Object3D","agentMeshes","Map","crowd","recastCrowd","agentMaterial","update","agents","getAgents","unseen","Set","keys","agent","delete","agentIndex","velocity","agentMesh","get","createAgentMesh","updateAgentGeometry","lookAt","agentId","remove","userData","agentParams","CylinderGeometry","NavMeshHelper","navMesh","navMeshGeometry","navMeshMaterial","indices","getDebugNavMesh","from","Uint32Array","computeVertexNormals","OffMeshConnectionsHelper","offMeshConnections","entryCircleMaterial","exitCircleMaterial","LineBasicMaterial","offMeshConnection","circleGeometry","CircleGeometry","startMesh","startPosition","rotation","PI","endMesh","bidirectional","endPosition","middle","addVectors","curvePoints","CatmullRomCurve3","getPoints","lineGeometry","setFromPoints","Line","TileCacheHelper","obstacleMeshes","tileCache","obstacleMaterial","wireframe","wireframeLinewidth","obstacle","obstacles","obstacleMesh","halfExtents","angle","BoxGeometry","Error","_position","getPositionsAndIndices","meshes","toMerge","positionAttribute","itemSize","updateMatrixWorld","pos","localToWorld","getIndex","ascendingIndex","mergePositionsAndIndices","threeToSoloNavMesh","navMeshGeneratorConfig","keepIntermediates","generateSoloNavMesh","threeToTiledNavMesh","generateTiledNavMesh","threeToTileCache","generateTileCache"],"mappings":"8vBAWA,MAAMA,EAAO,IAAIC,EACXC,EAAU,IAAIC,EAEpB,MAAMC,UAA6BC,EAElC,WAAAC,GAECC,QAEAC,KAAKC,wBAAyB,EAE9BD,KAAKE,KAAO,uBAMZF,KAAKG,SAFS,CAAE,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,IAGnEH,KAAKI,aAAc,WAAY,IAAIC,EALjB,EAAI,EAAG,EAAG,EAAG,EAAG,EAAG,GAAK,EAAG,EAAG,EAAG,EAAG,EAAG,GAAK,EAAG,EAAG,EAAG,EAAG,EAAG,GAAK,GAAK,EAAG,EAAG,GAAK,EAAG,GAK/B,IACtEL,KAAKI,aAAc,KAAM,IAAIC,EALjB,EAAI,EAAG,EAAG,EAAG,GAAK,EA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AW0C,GAAuBC,GAEpD,OAAOa,EACLtG,EACA8C,EACAsD,EACAC,EACD,EAGUE,GAAsBA,CACjCd,EACAW,EAA+D,CAAA,EAC/DC,GAAoB,KAEpB,MAAOrG,EAAW8C,GAAW0C,GAAuBC,GAEpD,OAAOe,EACLxG,EACA8C,EACAsD,EACAC,EACD,EAGUI,GAAmBA,CAC9BhB,EACAW,EAA4D,CAAA,EAC5DC,GAAoB,KAEpB,MAAOrG,EAAW8C,GAAW0C,GAAuBC,GAEpD,OAAOiB,EACL1G,EACA8C,EACAsD,EACAC,EACD","x_google_ignoreList":[0,1,2]}
|
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.
|
|
9
|
+
"version": "0.35.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"homepage": "https://github.com/isaac-mason/recast-navigation-js",
|
|
12
12
|
"bugs": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"lint": "eslint src"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@recast-navigation/core": "0.
|
|
31
|
-
"@recast-navigation/generators": "0.
|
|
30
|
+
"@recast-navigation/core": "0.35.0",
|
|
31
|
+
"@recast-navigation/generators": "0.35.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@types/three": "0.x.x",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
45
45
|
"@rollup/plugin-terser": "^0.4.3",
|
|
46
46
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
47
|
-
"@types/three": "^0.
|
|
47
|
+
"@types/three": "^0.169.0",
|
|
48
48
|
"eslint": "^9.6.0",
|
|
49
49
|
"prettier": "^3.1.0",
|
|
50
50
|
"rollup": "^4.14.0",
|
|
51
51
|
"rollup-plugin-copy": "^3.4.0",
|
|
52
52
|
"rollup-plugin-filesize": "^10.0.0",
|
|
53
|
-
"three": "^0.
|
|
53
|
+
"three": "^0.169.0",
|
|
54
54
|
"typescript": "^5.4.3"
|
|
55
55
|
},
|
|
56
56
|
"packageManager": "yarn@3.2.1"
|