@soonspacejs/plugin-patrol-controls 2.13.11 → 2.13.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1 +1,357 @@
1
- import{Vector3 as t,Matrix4 as s,Quaternion as i}from"three";const e=1e-5;class o{constructor(t){this.ssp=t,this.options={naviSpeed:1,rotateSpeed:1,eyeHeight:150,flyToStartPoint:!0,onUpdate:()=>{},onProgress:()=>{},onEnd:()=>{}},this.states={moveDuration:0,rotateDuration:0},this.nodes=[],this.nextPointIndex=0,this._nodeDistances=[],this._totalDistance=0,this._updatePercent=0,this._needsUpdateProgress=!1,this.isPaused=!1,this.isStoped=!0,this._positionTween=null,this._rotationTween=null,this._cameraViewpointData=null;const{cameraManager:s}=this.ssp.viewport;this.camera=s.mainCamera}start(t,s){this.isStoped?(this.ssp.controls.saveState(),this.ssp.controls.enabled=!1,this.init(t),this.initOptions(s),this.patrolStart()):this.ssp.utils.warn("巡检已经开始!")}setProgress(t){var s,i;this._updatePercent=Math.min(Math.max(t,0),1),this._needsUpdateProgress=!0,null===(s=this._positionTween)||void 0===s||s.stop(),null===(i=this._rotationTween)||void 0===i||i.stop()}setOptions(t){if(this.isStoped)return;const{naviSpeed:s,rotateSpeed:i}=t;if(s&&this._positionTween){const t=this.states.moveDuration*this.options.naviSpeed/s;this._positionTween.duration(t),this.states.moveDuration=t}if(i&&this._rotationTween){const t=this.states.rotateDuration*this.options.rotateSpeed/i;this._rotationTween.duration(t),this.states.rotateDuration=t}this.initOptions(t)}pause(){var t,s;this.isPaused||this.isStoped||(this._cameraViewpointData=this.ssp.getCameraViewpoint(),this.isPaused=!0,null===(t=this._positionTween)||void 0===t||t.pause(),null===(s=this._rotationTween)||void 0===s||s.pause())}resume(){var t,s;this.isPaused&&!this.isStoped&&(this._cameraViewpointData&&this.ssp.setCameraViewpoint(this._cameraViewpointData),this.isPaused=!1,null===(t=this._positionTween)||void 0===t||t.resume(),null===(s=this._rotationTween)||void 0===s||s.resume())}stop(){this.isStoped||(this.patrolStop(),this.ssp.controls.reset(),this.ssp.controls.enabled=!0)}init(t){this.isPaused=!1,this.isStoped=!1,this.nextPointIndex=0,this.nodes=[...t.nodes]}initOptions(s){const{eyeHeight:i,naviSpeed:e,rotateSpeed:o,flyToStartPoint:n=!0,onUpdate:a,onProgress:h,onEnd:r}=s;i&&(this.options.eyeHeight=i),e&&(this.options.naviSpeed=e),o&&(this.options.rotateSpeed=o),this.options.flyToStartPoint=n,a&&(this.options.onUpdate=a),h&&(this.options.onProgress=h),r&&(this.options.onEnd=r),this._nodeDistances.length=0,this._nodeDistances.push(0),this._totalDistance=0;for(let s=0,i=this.nodes.length;s<i-1;s++){const i=this.nodes[s],e=this.nodes[s+1];if(i&&e){const s=i.getWorldPosition(new t),o=e.getWorldPosition(new t);s.y+=this.options.eyeHeight,o.y+=this.options.eyeHeight;const n=s.distanceTo(o);this._nodeDistances.push(n),this._totalDistance+=n}}}computedRotation(t,e){const o=new s;o.lookAt(t,e,this.camera.up);return(new i).setFromRotationMatrix(o)}computeNextRotation(s=this.nextPointIndex){var e,o;const n=null===(e=this.nodes[s])||void 0===e?void 0:e.getWorldPosition(new t),a=null===(o=this.nodes[s+1])||void 0===o?void 0:o.getWorldPosition(new t);return n&&a?this.computedRotation(n,a):new i}async patrolStart(){return new Promise(async s=>{var i;const{controls:o}=this.ssp,{onUpdate:n,onProgress:a,onEnd:h}=this.options;if(this.nextPointIndex>=this.nodes.length)null==h||h(this.camera.position.clone()),s(!0);else{if(this._needsUpdateProgress){let s=this._totalDistance*this._updatePercent;for(let i=0,e=this._nodeDistances.length;i<e;i++)if(s-=this._nodeDistances[i],s<0){this.nextPointIndex=i,s+=this._nodeDistances[i];const e=s/this._nodeDistances[i]||0,n=this.nodes[i-1],a=this.nodes[i],h=new t,r=n.getWorldPosition(new t),d=a.getWorldPosition(new t);r.y+=this.options.eyeHeight,d.y+=this.options.eyeHeight;const p=(new t).subVectors(d,r).multiplyScalar(e);h.copy(r).add(p),o.setPosition(h.x,h.y,h.z),o.setTarget(d.x,d.y,d.z);break}this._needsUpdateProgress=!1}const s=this.nodes[this.nextPointIndex],h=s.getWorldPosition(new t);h.setY(h.y+this.options.eyeHeight);const r=o.getPosition(new t).distanceTo(h);if(this.states.moveDuration=0===this.nextPointIndex?1e3:r/this.options.naviSpeed/.6,o.setTarget(h.x,h.y,h.z),0!==this.nextPointIndex||this.options.flyToStartPoint)try{await this.ssp.animation({distance:o.distance},{distance:e},{duration:this.states.moveDuration},({distance:i})=>{var e;if(this.isPaused)null===(e=this._positionTween)||void 0===e||e.pause();else if(o.dollyTo(i),null==n||n(o.getPosition(new t),s,i),this._nodeDistances[this.nextPointIndex]>0){let t=this._nodeDistances.slice(0,this.nextPointIndex+1).reduce((t,s)=>t+s,0);t-=i,null==a||a({patrolled:t,total:this._totalDistance,percent:t/this._totalDistance})}},t=>{this._positionTween=t})}catch(t){}else o.dollyTo(e);if(this.nextPointIndex<this.nodes.length-1){const s=this.computeNextRotation(),e=this.camera.quaternion.angleTo(s);this.states.rotateDuration=0===this.nextPointIndex?1e3:300*e/this.options.rotateSpeed;const n=o.getPosition(new t),a=null===(i=this.nodes[this.nextPointIndex+1])||void 0===i?void 0:i.getWorldPosition(new t);a.y+=this.options.eyeHeight;try{await this.ssp.animation({t:0},{t:1},{duration:this.states.rotateDuration},({t:t})=>{var s;if(this.isPaused)return void(null===(s=this._rotationTween)||void 0===s||s.pause());const i=h.clone().sub(n).normalize(),e=a.clone().sub(h).normalize(),{x:r,y:d,z:p}=i.lerp(e,t).add(h);o.setTarget(r,d,p)},t=>{this._rotationTween=t})}catch(t){}}this._needsUpdateProgress||this.nextPointIndex++,this.isStoped||await this.patrolStart()}})}patrolStop(){var t,s;this.options={naviSpeed:1,rotateSpeed:1,eyeHeight:150,flyToStartPoint:!0,onUpdate:()=>{},onProgress:()=>{},onEnd:()=>{}},this.nodes=[],this.nextPointIndex=0,this.isPaused=!1,this.isStoped=!0,this._needsUpdateProgress=!1,null===(t=this._positionTween)||void 0===t||t.stop(),null===(s=this._rotationTween)||void 0===s||s.stop(),this._positionTween=null,this._rotationTween=null}}export{o as default};
1
+ import { Vector3, Matrix4, Quaternion } from 'three';
2
+
3
+ const EPS = 1e-5;
4
+ class PatrolControlsPlugin {
5
+ constructor(ssp) {
6
+ this.ssp = ssp;
7
+ this.options = {
8
+ naviSpeed: 1,
9
+ rotateSpeed: 1,
10
+ eyeHeight: 150,
11
+ flyToStartPoint: true,
12
+ onUpdate: () => { },
13
+ onProgress: () => { },
14
+ onEnd: () => { },
15
+ };
16
+ this.states = {
17
+ moveDuration: 0,
18
+ rotateDuration: 0,
19
+ };
20
+ // 路径节点列表
21
+ this.nodes = [];
22
+ this.nextPointIndex = 0;
23
+ /**
24
+ * y 轴加上 eyeHeight 的节点之间距离
25
+ */
26
+ this._nodeDistances = [];
27
+ this._totalDistance = 0;
28
+ /**
29
+ * 0 - 1
30
+ */
31
+ this._updatePercent = 0;
32
+ this._needsUpdateProgress = false;
33
+ this.isPaused = false;
34
+ this.isStoped = true;
35
+ this._positionTween = null;
36
+ this._rotationTween = null;
37
+ this._cameraViewpointData = null;
38
+ const { cameraManager, } = this.ssp.viewport;
39
+ this.camera = cameraManager.mainCamera;
40
+ }
41
+ /**
42
+ * 开始巡检
43
+ *
44
+ * @param path
45
+ * @param options
46
+ */
47
+ start(path, options) {
48
+ if (!this.isStoped) {
49
+ this.ssp.utils.warn('巡检已经开始!');
50
+ return;
51
+ }
52
+ this.ssp.controls.saveState();
53
+ this.ssp.controls.enabled = false;
54
+ this.init(path);
55
+ this.initOptions(options);
56
+ this.patrolStart();
57
+ }
58
+ /**
59
+ * 设置巡检进度
60
+ * @param percent 0 - 1(不包含 1)
61
+ */
62
+ setProgress(percent) {
63
+ var _a, _b;
64
+ this._updatePercent = Math.min(Math.max(percent, 0), 1);
65
+ this._needsUpdateProgress = true;
66
+ (_a = this._positionTween) === null || _a === void 0 ? void 0 : _a.stop();
67
+ (_b = this._rotationTween) === null || _b === void 0 ? void 0 : _b.stop();
68
+ }
69
+ /**
70
+ * 设置巡检参数
71
+ * @param options
72
+ * @returns
73
+ */
74
+ setOptions(options) {
75
+ if (this.isStoped)
76
+ return;
77
+ const { naviSpeed, rotateSpeed, } = options;
78
+ if (naviSpeed && this._positionTween) {
79
+ const newMoveDuration = this.states.moveDuration * this.options.naviSpeed / naviSpeed;
80
+ this._positionTween.duration(newMoveDuration);
81
+ this.states.moveDuration = newMoveDuration;
82
+ }
83
+ if (rotateSpeed && this._rotationTween) {
84
+ const newRotateDuration = this.states.rotateDuration * this.options.rotateSpeed / rotateSpeed;
85
+ this._rotationTween.duration(newRotateDuration);
86
+ this.states.rotateDuration = newRotateDuration;
87
+ }
88
+ this.initOptions(options);
89
+ }
90
+ /**
91
+ * 暂停巡检
92
+ */
93
+ pause() {
94
+ var _a, _b;
95
+ if (this.isPaused || this.isStoped)
96
+ return;
97
+ /**
98
+ * 保存巡检相机视角数据
99
+ */
100
+ this._cameraViewpointData = this.ssp.getCameraViewpoint();
101
+ this.isPaused = true;
102
+ (_a = this._positionTween) === null || _a === void 0 ? void 0 : _a.pause();
103
+ (_b = this._rotationTween) === null || _b === void 0 ? void 0 : _b.pause();
104
+ }
105
+ /**
106
+ * 恢复巡检
107
+ */
108
+ resume() {
109
+ var _a, _b;
110
+ if (!this.isPaused || this.isStoped)
111
+ return;
112
+ if (this._cameraViewpointData) {
113
+ this.ssp.setCameraViewpoint(this._cameraViewpointData);
114
+ }
115
+ this.isPaused = false;
116
+ (_a = this._positionTween) === null || _a === void 0 ? void 0 : _a.resume();
117
+ (_b = this._rotationTween) === null || _b === void 0 ? void 0 : _b.resume();
118
+ }
119
+ /**
120
+ * 中断巡检
121
+ */
122
+ stop() {
123
+ if (this.isStoped)
124
+ return;
125
+ this.patrolStop();
126
+ this.ssp.controls.reset();
127
+ this.ssp.controls.enabled = true;
128
+ }
129
+ init(path) {
130
+ this.isPaused = false;
131
+ this.isStoped = false;
132
+ this.nextPointIndex = 0;
133
+ // initPoints
134
+ this.nodes = [...path.nodes];
135
+ }
136
+ initOptions(options) {
137
+ const { eyeHeight, naviSpeed, rotateSpeed, flyToStartPoint = true, onUpdate, onProgress, onEnd, } = options;
138
+ eyeHeight && (this.options.eyeHeight = eyeHeight);
139
+ naviSpeed && (this.options.naviSpeed = naviSpeed);
140
+ rotateSpeed && (this.options.rotateSpeed = rotateSpeed);
141
+ this.options.flyToStartPoint = flyToStartPoint;
142
+ onUpdate && (this.options.onUpdate = onUpdate);
143
+ onProgress && (this.options.onProgress = onProgress);
144
+ onEnd && (this.options.onEnd = onEnd);
145
+ this._nodeDistances.length = 0;
146
+ this._nodeDistances.push(0);
147
+ this._totalDistance = 0;
148
+ // compute node distance,加上 eyeHeight
149
+ for (let i = 0, len = this.nodes.length; i < len - 1; i++) {
150
+ const currentNode = this.nodes[i], nextNode = this.nodes[i + 1];
151
+ if (currentNode && nextNode) {
152
+ const currentWorldPosition = currentNode.getWorldPosition(new Vector3()), nextWorldPosition = nextNode.getWorldPosition(new Vector3());
153
+ currentWorldPosition.y += this.options.eyeHeight;
154
+ nextWorldPosition.y += this.options.eyeHeight;
155
+ const distance = currentWorldPosition.distanceTo(nextWorldPosition);
156
+ this._nodeDistances.push(distance);
157
+ this._totalDistance += distance;
158
+ }
159
+ }
160
+ }
161
+ /**
162
+ * 计算两点之间的弧度
163
+ * @param sourcePoint
164
+ * @param targetPoint
165
+ * @returns
166
+ */
167
+ computedRotation(sourcePoint, targetPoint) {
168
+ const matrix4 = new Matrix4();
169
+ matrix4.lookAt(sourcePoint, targetPoint, this.camera.up);
170
+ const nextRotation = new Quaternion().setFromRotationMatrix(matrix4);
171
+ return nextRotation;
172
+ }
173
+ /**
174
+ * 计算下一弧度
175
+ * @returns
176
+ */
177
+ computeNextRotation(index = this.nextPointIndex) {
178
+ var _a, _b;
179
+ const currentPoint = (_a = this.nodes[index]) === null || _a === void 0 ? void 0 : _a.getWorldPosition(new Vector3());
180
+ const nextPoint = (_b = this.nodes[index + 1]) === null || _b === void 0 ? void 0 : _b.getWorldPosition(new Vector3());
181
+ return (currentPoint && nextPoint) ? this.computedRotation(currentPoint, nextPoint) : new Quaternion();
182
+ }
183
+ /**
184
+ * 开始巡检
185
+ * @returns
186
+ */
187
+ async patrolStart() {
188
+ return new Promise(async (resolve) => {
189
+ var _a;
190
+ const { controls, } = this.ssp;
191
+ const { onUpdate, onProgress, onEnd, } = this.options;
192
+ if (this.nextPointIndex >= this.nodes.length) {
193
+ // 巡检结束时
194
+ onEnd === null || onEnd === void 0 ? void 0 : onEnd(this.camera.position.clone());
195
+ resolve(true);
196
+ }
197
+ else {
198
+ /**
199
+ * 更新进度
200
+ */
201
+ if (this._needsUpdateProgress) {
202
+ let percentDistance = this._totalDistance * this._updatePercent;
203
+ for (let i = 0, len = this._nodeDistances.length; i < len; i++) {
204
+ percentDistance -= this._nodeDistances[i];
205
+ if (percentDistance < 0) {
206
+ /**
207
+ * 更新 index
208
+ */
209
+ this.nextPointIndex = i;
210
+ /**
211
+ * 更新相机位置
212
+ */
213
+ percentDistance += this._nodeDistances[i];
214
+ const percent = (percentDistance / this._nodeDistances[i]) || 0;
215
+ const prevNode = this.nodes[i - 1], nextNode = this.nodes[i];
216
+ const cameraPosition = new Vector3();
217
+ /**
218
+ * 其他点
219
+ */
220
+ const prevPosition = prevNode.getWorldPosition(new Vector3()), nextPosition = nextNode.getWorldPosition(new Vector3());
221
+ prevPosition.y += this.options.eyeHeight;
222
+ nextPosition.y += this.options.eyeHeight;
223
+ const diffPosition = new Vector3()
224
+ .subVectors(nextPosition, prevPosition)
225
+ .multiplyScalar(percent);
226
+ cameraPosition.copy(prevPosition).add(diffPosition);
227
+ controls.setPosition(cameraPosition.x, cameraPosition.y, cameraPosition.z);
228
+ controls.setTarget(nextPosition.x, nextPosition.y, nextPosition.z);
229
+ break;
230
+ }
231
+ }
232
+ this._needsUpdateProgress = false;
233
+ }
234
+ const nextNode = this.nodes[this.nextPointIndex];
235
+ const nextNodePosition = nextNode.getWorldPosition(new Vector3());
236
+ // 增加眼睛高度
237
+ nextNodePosition.setY(nextNodePosition.y + this.options.eyeHeight);
238
+ // 相机位置与下一点的距离
239
+ const positionDist = controls.getPosition(new Vector3()).distanceTo(nextNodePosition);
240
+ /**
241
+ * @todo 移动持续时间
242
+ */
243
+ this.states.moveDuration = this.nextPointIndex === 0 ? 1000 : positionDist / this.options.naviSpeed / 0.6;
244
+ controls.setTarget(nextNodePosition.x, nextNodePosition.y, nextNodePosition.z);
245
+ // 路径行行进
246
+ if (this.nextPointIndex === 0 && !this.options.flyToStartPoint) {
247
+ controls.dollyTo(EPS);
248
+ }
249
+ else {
250
+ try {
251
+ await this.ssp.animation({ distance: controls.distance, }, { distance: EPS, }, {
252
+ duration: this.states.moveDuration,
253
+ }, ({ distance, }) => {
254
+ var _a;
255
+ if (this.isPaused) {
256
+ (_a = this._positionTween) === null || _a === void 0 ? void 0 : _a.pause();
257
+ return;
258
+ }
259
+ controls.dollyTo(distance);
260
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(controls.getPosition(new Vector3()), nextNode, distance);
261
+ /**
262
+ * progress
263
+ */
264
+ if (this._nodeDistances[this.nextPointIndex] > 0) {
265
+ let patrolled = this._nodeDistances.slice(0, this.nextPointIndex + 1).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
266
+ patrolled -= distance;
267
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress({
268
+ patrolled,
269
+ total: this._totalDistance,
270
+ percent: patrolled / this._totalDistance,
271
+ });
272
+ }
273
+ }, tween => {
274
+ this._positionTween = tween;
275
+ });
276
+ }
277
+ catch (_b) {
278
+ /**
279
+ * stop
280
+ */
281
+ }
282
+ }
283
+ // 节点转弯
284
+ if (this.nextPointIndex < this.nodes.length - 1) {
285
+ const nextRotation = this.computeNextRotation();
286
+ const rotationDist = this.camera.quaternion.angleTo(nextRotation);
287
+ /**
288
+ * @todo
289
+ */
290
+ this.states.rotateDuration = this.nextPointIndex === 0 ? 1000 : rotationDist * 300 / this.options.rotateSpeed;
291
+ const currentPosition = controls.getPosition(new Vector3());
292
+ const nextPoint = (_a = this.nodes[this.nextPointIndex + 1]) === null || _a === void 0 ? void 0 : _a.getWorldPosition(new Vector3());
293
+ nextPoint.y += this.options.eyeHeight;
294
+ try {
295
+ await this.ssp.animation({ t: 0, }, { t: 1, }, {
296
+ duration: this.states.rotateDuration,
297
+ }, ({ t, }) => {
298
+ var _a;
299
+ if (this.isPaused) {
300
+ (_a = this._rotationTween) === null || _a === void 0 ? void 0 : _a.pause();
301
+ return;
302
+ }
303
+ const diff1 = nextNodePosition
304
+ .clone()
305
+ .sub(currentPosition)
306
+ .normalize();
307
+ const diff2 = nextPoint
308
+ .clone()
309
+ .sub(nextNodePosition)
310
+ .normalize();
311
+ const { x, y, z, } = diff1
312
+ .lerp(diff2, t)
313
+ .add(nextNodePosition);
314
+ controls.setTarget(x, y, z);
315
+ }, tween => {
316
+ this._rotationTween = tween;
317
+ });
318
+ }
319
+ catch (_c) {
320
+ /**
321
+ * stop
322
+ */
323
+ }
324
+ }
325
+ if (!this._needsUpdateProgress)
326
+ this.nextPointIndex++;
327
+ if (!this.isStoped) {
328
+ await this.patrolStart();
329
+ }
330
+ }
331
+ });
332
+ }
333
+ patrolStop() {
334
+ var _a, _b;
335
+ this.options = {
336
+ naviSpeed: 1,
337
+ rotateSpeed: 1,
338
+ eyeHeight: 150,
339
+ flyToStartPoint: true,
340
+ onUpdate: () => { },
341
+ onProgress: () => { },
342
+ onEnd: () => { },
343
+ };
344
+ this.nodes = [];
345
+ this.nextPointIndex = 0;
346
+ this.isPaused = false;
347
+ this.isStoped = true;
348
+ this._needsUpdateProgress = false;
349
+ (_a = this._positionTween) === null || _a === void 0 ? void 0 : _a.stop();
350
+ (_b = this._rotationTween) === null || _b === void 0 ? void 0 : _b.stop();
351
+ this._positionTween = null;
352
+ this._rotationTween = null;
353
+ }
354
+ }
355
+
356
+ export { PatrolControlsPlugin as default };
357
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { PerspectiveCamera, OrthographicCamera, Vector3, Matrix4, Quaternion, } from 'three'\nimport SoonSpace from 'soonspacejs'\nimport type { CameraViewpointData, Position, } from 'soonspacejs'\nimport type { Node, } from 'soonspacejs'\nimport type { Topology, } from 'soonspacejs'\nimport type { Tween, } from 'three/examples/jsm/libs/tween.module.js'\n\nconst EPS = 1e-5\n\nexport type ProgressParams = {\n patrolled: number;\n total: number;\n percent: number;\n}\n\nexport interface DefaultOptions {\n /*\n * 眼睛高度\n */\n eyeHeight: number;\n /**\n * 巡检速度\n */\n naviSpeed: number;\n /**\n * 相机转向速度\n */\n rotateSpeed: number;\n /**\n * 是否飞向起始点位置\n */\n flyToStartPoint: boolean;\n /**\n * 更新回调\n */\n onUpdate: ( realTimePosition: Position, nextNode: Node, toNextNodeDistance: number ) => void;\n /**\n * 巡检进度\n */\n onProgress: ( params: ProgressParams ) => void;\n /**\n * 结束回调\n */\n onEnd: ( endPosition: Position ) => void;\n}\n\nexport type StartOptions = Partial<DefaultOptions>\n\nexport type ResetOptions = Pick<StartOptions, 'eyeHeight' | 'naviSpeed' | 'rotateSpeed'>\n\nexport default class PatrolControlsPlugin {\n\n camera: PerspectiveCamera | OrthographicCamera\n\n options: DefaultOptions = {\n naviSpeed: 1,\n rotateSpeed: 1,\n eyeHeight: 150,\n flyToStartPoint: true,\n onUpdate: () => { },\n onProgress: () => {},\n onEnd: () => { },\n }\n\n states = {\n moveDuration: 0,\n rotateDuration: 0,\n }\n\n // 路径节点列表\n nodes: Node[] = []\n nextPointIndex = 0\n /**\n * y 轴加上 eyeHeight 的节点之间距离\n */\n _nodeDistances: number[] = []\n _totalDistance = 0\n\n /**\n * 0 - 1\n */\n _updatePercent = 0\n _needsUpdateProgress = false\n\n isPaused = false\n isStoped = true\n\n _positionTween: Tween<{distance: number}> | null = null\n _rotationTween: Tween<{t: number}> | null = null\n _cameraViewpointData: CameraViewpointData | null = null\n\n constructor ( readonly ssp: SoonSpace ) {\n\n const { cameraManager, } = this.ssp.viewport\n\n this.camera = cameraManager.mainCamera\n \n }\n\n /**\n * 开始巡检\n * \n * @param path \n * @param options \n */\n start ( path: Topology, options: StartOptions ) {\n\n if ( !this.isStoped ) {\n\n this.ssp.utils.warn( '巡检已经开始!' )\n\n return\n \n }\n\n this.ssp.controls.saveState()\n this.ssp.controls.enabled = false\n\n this.init( path )\n this.initOptions( options )\n this.patrolStart()\n\n }\n\n /**\n * 设置巡检进度\n * @param percent 0 - 1(不包含 1)\n */\n setProgress ( percent: number ) {\n\n this._updatePercent = Math.min( Math.max( percent, 0 ), 1 )\n this._needsUpdateProgress = true\n this._positionTween?.stop()\n this._rotationTween?.stop()\n\n }\n\n /**\n * 设置巡检参数\n * @param options \n * @returns \n */\n setOptions ( options: ResetOptions ) {\n\n if ( this.isStoped ) return\n\n const { naviSpeed, rotateSpeed, } = options\n\n if ( naviSpeed && this._positionTween ) {\n\n const newMoveDuration = this.states.moveDuration * this.options.naviSpeed / naviSpeed\n\n this._positionTween.duration( newMoveDuration )\n this.states.moveDuration = newMoveDuration\n \n }\n\n if ( rotateSpeed && this._rotationTween ) {\n\n const newRotateDuration = this.states.rotateDuration * this.options.rotateSpeed / rotateSpeed\n\n this._rotationTween.duration( newRotateDuration )\n this.states.rotateDuration = newRotateDuration\n \n }\n\n this.initOptions( options )\n\n }\n\n /**\n * 暂停巡检\n */\n pause () {\n\n if ( this.isPaused || this.isStoped ) return\n\n /**\n * 保存巡检相机视角数据\n */\n this._cameraViewpointData = this.ssp.getCameraViewpoint()\n\n this.isPaused = true\n this._positionTween?.pause()\n this._rotationTween?.pause()\n\n }\n\n /**\n * 恢复巡检\n */\n resume () {\n\n if ( !this.isPaused || this.isStoped ) return\n\n if ( this._cameraViewpointData ) {\n\n this.ssp.setCameraViewpoint( this._cameraViewpointData )\n \n }\n\n this.isPaused = false\n this._positionTween?.resume()\n this._rotationTween?.resume()\n\n }\n\n /**\n * 中断巡检\n */\n stop () {\n\n if ( this.isStoped ) return\n\n this.patrolStop()\n\n this.ssp.controls.reset()\n this.ssp.controls.enabled = true\n\n }\n\n private init ( path: Topology ) {\n\n this.isPaused = false\n this.isStoped = false\n this.nextPointIndex = 0\n\n // initPoints\n this.nodes = [ ...path.nodes ]\n \n }\n\n private initOptions ( options: StartOptions ) {\n\n const { eyeHeight, naviSpeed, rotateSpeed, flyToStartPoint = true, onUpdate, onProgress, onEnd, } = options\n\n eyeHeight && ( this.options.eyeHeight = eyeHeight )\n naviSpeed && ( this.options.naviSpeed = naviSpeed )\n rotateSpeed && ( this.options.rotateSpeed = rotateSpeed )\n\n this.options.flyToStartPoint = flyToStartPoint\n\n onUpdate && ( this.options.onUpdate = onUpdate )\n onProgress && ( this.options.onProgress = onProgress )\n onEnd && ( this.options.onEnd = onEnd )\n\n this._nodeDistances.length = 0\n this._nodeDistances.push( 0 )\n this._totalDistance = 0\n\n // compute node distance,加上 eyeHeight\n for ( let i = 0, len = this.nodes.length;i < len - 1;i++ ) {\n\n const currentNode = this.nodes[ i ], nextNode = this.nodes[ i + 1 ]\n\n if ( currentNode && nextNode ) {\n\n const currentWorldPosition = currentNode.getWorldPosition( new Vector3() ),\n nextWorldPosition = nextNode.getWorldPosition( new Vector3() )\n\n currentWorldPosition.y += this.options.eyeHeight\n nextWorldPosition.y += this.options.eyeHeight\n\n const distance = currentWorldPosition.distanceTo( nextWorldPosition )\n\n this._nodeDistances.push( distance )\n this._totalDistance += distance\n \n }\n \n }\n\n }\n\n /**\n * 计算两点之间的弧度\n * @param sourcePoint \n * @param targetPoint \n * @returns \n */\n private computedRotation ( sourcePoint: Vector3, targetPoint: Vector3 ): Quaternion {\n \n const matrix4 = new Matrix4()\n\n matrix4.lookAt( sourcePoint, targetPoint, this.camera.up )\n\n const nextRotation = new Quaternion().setFromRotationMatrix( matrix4 )\n\n return nextRotation\n \n }\n\n /**\n * 计算下一弧度\n * @returns \n */\n private computeNextRotation ( index = this.nextPointIndex ): Quaternion {\n\n const currentPoint = this.nodes[ index ]?.getWorldPosition( new Vector3() )\n const nextPoint = this.nodes[ index + 1 ]?.getWorldPosition( new Vector3() )\n\n return ( currentPoint && nextPoint ) ? this.computedRotation( currentPoint, nextPoint ) : new Quaternion()\n\n }\n\n /**\n * 开始巡检\n * @returns \n */\n private async patrolStart (): Promise<boolean> {\n\n return new Promise( async resolve => {\n\n const { controls, } = this.ssp\n\n const {\n onUpdate,\n onProgress,\n onEnd,\n } = this.options\n\n if ( this.nextPointIndex >= this.nodes.length ) {\n\n // 巡检结束时\n onEnd?.( this.camera.position.clone() )\n resolve( true )\n \n } else {\n\n /**\n * 更新进度\n */\n if ( this._needsUpdateProgress ) {\n\n let percentDistance = this._totalDistance * this._updatePercent\n\n for ( let i = 0, len = this._nodeDistances.length;i < len;i++ ) {\n\n percentDistance -= this._nodeDistances[ i ]\n\n if ( percentDistance < 0 ) {\n\n /**\n * 更新 index\n */\n this.nextPointIndex = i\n\n /**\n * 更新相机位置\n */\n percentDistance += this._nodeDistances[ i ]\n\n const percent = ( percentDistance / this._nodeDistances[ i ] ) || 0\n\n const prevNode = this.nodes[ i - 1 ], nextNode = this.nodes[ i ]\n\n const cameraPosition = new Vector3()\n\n /**\n * 其他点\n */\n const prevPosition = prevNode.getWorldPosition( new Vector3() ),\n nextPosition = nextNode.getWorldPosition( new Vector3() )\n\n prevPosition.y += this.options.eyeHeight\n nextPosition.y += this.options.eyeHeight\n\n const diffPosition = new Vector3()\n .subVectors( nextPosition, prevPosition )\n .multiplyScalar( percent )\n\n cameraPosition.copy( prevPosition ).add( diffPosition )\n\n controls.setPosition( cameraPosition.x, cameraPosition.y, cameraPosition.z )\n controls.setTarget( nextPosition.x, nextPosition.y, nextPosition.z )\n\n break\n \n }\n \n }\n\n this._needsUpdateProgress = false\n \n }\n\n const nextNode = this.nodes[ this.nextPointIndex ]\n const nextNodePosition = nextNode.getWorldPosition( new Vector3() )\n\n // 增加眼睛高度\n nextNodePosition.setY( nextNodePosition.y + this.options.eyeHeight )\n \n // 相机位置与下一点的距离\n const positionDist = controls.getPosition( new Vector3() ).distanceTo( nextNodePosition )\n\n /**\n * @todo 移动持续时间\n */\n this.states.moveDuration = this.nextPointIndex === 0 ? 1000 : positionDist / this.options.naviSpeed / 0.6\n\n controls.setTarget( nextNodePosition.x, nextNodePosition.y, nextNodePosition.z )\n\n // 路径行行进\n if ( this.nextPointIndex === 0 && !this.options.flyToStartPoint ) {\n\n controls.dollyTo( EPS )\n\n } else {\n\n try {\n\n await this.ssp.animation(\n { distance: controls.distance, },\n { distance: EPS, },\n {\n duration: this.states.moveDuration,\n },\n ( { distance, } ) => {\n \n if ( this.isPaused ) {\n \n this._positionTween?.pause()\n \n return\n \n }\n\n controls.dollyTo( distance )\n\n onUpdate?.( controls.getPosition( new Vector3() ), nextNode, distance )\n \n /**\n * progress\n */\n if ( this._nodeDistances[ this.nextPointIndex ] > 0 ) {\n\n let patrolled = this._nodeDistances.slice( 0, this.nextPointIndex + 1 ).reduce( ( accumulator, currentValue ) => accumulator + currentValue, 0 )\n\n patrolled -= distance\n \n onProgress?.( {\n patrolled, \n total: this._totalDistance,\n percent: patrolled / this._totalDistance,\n } )\n \n }\n \n },\n tween => {\n \n this._positionTween = tween\n \n }\n )\n \n } catch {\n \n /**\n * stop\n */\n\n }\n\n }\n\n // 节点转弯\n if ( this.nextPointIndex < this.nodes.length - 1 ) {\n\n const nextRotation = this.computeNextRotation()\n const rotationDist = this.camera.quaternion.angleTo( nextRotation )\n\n /**\n * @todo \n */\n this.states.rotateDuration = this.nextPointIndex === 0 ? 1000 : rotationDist * 300 / this.options.rotateSpeed\n\n const currentPosition = controls.getPosition( new Vector3() )\n const nextPoint = this.nodes[ this.nextPointIndex + 1 ]?.getWorldPosition( new Vector3() )\n\n nextPoint.y += this.options.eyeHeight\n \n try {\n\n await this.ssp.animation(\n { t: 0, },\n { t: 1, },\n {\n duration: this.states.rotateDuration,\n },\n ( { t, } ) => {\n \n if ( this.isPaused ) {\n \n this._rotationTween?.pause()\n\n return\n \n }\n\n const diff1 = nextNodePosition\n .clone()\n .sub( currentPosition )\n .normalize()\n const diff2 = nextPoint\n .clone()\n .sub( nextNodePosition )\n .normalize()\n \n const { x, y, z, } = diff1\n .lerp( diff2, t )\n .add( nextNodePosition )\n\n controls.setTarget( x, y, z )\n \n },\n tween => {\n \n this._rotationTween = tween\n \n }\n )\n \n } catch {\n\n /**\n * stop\n */\n\n }\n\n }\n\n if ( !this._needsUpdateProgress ) this.nextPointIndex++\n\n if ( !this.isStoped ) {\n\n await this.patrolStart()\n\n }\n\n }\n\n } )\n\n }\n\n private patrolStop () {\n\n this.options = {\n naviSpeed: 1,\n rotateSpeed: 1,\n eyeHeight: 150,\n flyToStartPoint: true,\n onUpdate: () => { },\n onProgress: () => {},\n onEnd: () => { },\n }\n\n this.nodes = []\n this.nextPointIndex = 0\n this.isPaused = false\n this.isStoped = true\n\n this._needsUpdateProgress = false\n\n this._positionTween?.stop()\n this._rotationTween?.stop()\n\n this._positionTween = null\n this._rotationTween = null\n \n }\n\n}\n"],"names":[],"mappings":";;AAOA,MAAM,GAAG,GAAG,IAAI,CAAA;AA2CF,MAAO,oBAAoB,CAAA;AAyCvC,IAAA,WAAA,CAAuB,GAAc,EAAA;QAAd,IAAG,CAAA,GAAA,GAAH,GAAG,CAAW;AArCrC,QAAA,IAAA,CAAA,OAAO,GAAmB;AACxB,YAAA,SAAS,EAAE,CAAC;AACZ,YAAA,WAAW,EAAE,CAAC;AACd,YAAA,SAAS,EAAE,GAAG;AACd,YAAA,eAAe,EAAE,IAAI;AACrB,YAAA,QAAQ,EAAE,MAAK,GAAI;AACnB,YAAA,UAAU,EAAE,MAAK,GAAG;AACpB,YAAA,KAAK,EAAE,MAAK,GAAI;SACjB,CAAA;AAED,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,YAAA,YAAY,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AACrB,YAAA,QAAQ,EAAE,MAAK,GAAI;AACnB,YAAA,UAAU,EAAE,MAAK,GAAG;AACpB,YAAA,KAAK,EAAE,MAAK,GAAI;SACjB,CAAA;AAED,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;AACf,QAAA,IAAI,CAAC,cAAc,GAAG,CAAC,CAAA;AACvB,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;AACrB,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;AAEpB,QAAA,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAA;AAEjC,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAI,EAAE,CAAA;AAC3B,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAI,EAAE,CAAA;AAE3B,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;AAC1B,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;KAE3B;AAEF;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-patrol-controls",
3
3
  "pluginName": "PatrolControlsPlugin",
4
- "version": "2.13.11",
4
+ "version": "2.13.14",
5
5
  "description": "Patrol-controls plugin for SoonSpace.js",
6
6
  "main": "dist/index.esm.js",
7
7
  "module": "dist/index.esm.js",
@@ -13,8 +13,8 @@
13
13
  ],
14
14
  "author": "xunwei",
15
15
  "license": "UNLICENSED",
16
- "gitHead": "08bf9efb38c291f22ca044b936fd49269c716bbb",
16
+ "gitHead": "71d91773a54276b7cbb0a0525ba5f921345f121f",
17
17
  "peerDependencies": {
18
- "soonspacejs": "2.13.11"
18
+ "soonspacejs": "2.13.14"
19
19
  }
20
20
  }