lythreeframe 1.2.29 → 1.2.31
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/bundle.cjs.js
CHANGED
|
@@ -1927,6 +1927,9 @@ class Pawn {
|
|
|
1927
1927
|
}
|
|
1928
1928
|
stopFocusing() {
|
|
1929
1929
|
}
|
|
1930
|
+
getFocuingData() {
|
|
1931
|
+
return null;
|
|
1932
|
+
}
|
|
1930
1933
|
destroy() {
|
|
1931
1934
|
}
|
|
1932
1935
|
}
|
|
@@ -2023,6 +2026,23 @@ class Orbital extends Pawn {
|
|
|
2023
2026
|
}
|
|
2024
2027
|
});
|
|
2025
2028
|
}
|
|
2029
|
+
getFocuingData() {
|
|
2030
|
+
if (!this.control || !this.camera) {
|
|
2031
|
+
return null;
|
|
2032
|
+
}
|
|
2033
|
+
// 相机当前位置
|
|
2034
|
+
const position = this.camera.position.clone();
|
|
2035
|
+
// 相机朝向
|
|
2036
|
+
const quaternion = this.camera.quaternion.clone();
|
|
2037
|
+
// 计算相机到目标的距离
|
|
2038
|
+
const target = this.control.target.clone();
|
|
2039
|
+
const distance = position.distanceTo(target);
|
|
2040
|
+
return {
|
|
2041
|
+
position: target,
|
|
2042
|
+
quaternion: quaternion,
|
|
2043
|
+
distance: distance
|
|
2044
|
+
};
|
|
2045
|
+
}
|
|
2026
2046
|
stopFocusing() {
|
|
2027
2047
|
if (this.anim) {
|
|
2028
2048
|
this.anim.kill();
|
|
@@ -3192,6 +3212,22 @@ class FirstPerson extends Pawn {
|
|
|
3192
3212
|
super(controller);
|
|
3193
3213
|
this._control = new PointerLockControls_js.PointerLockControls(controller.camera, controller.viewPort.canvas);
|
|
3194
3214
|
}
|
|
3215
|
+
getFocuingData() {
|
|
3216
|
+
var _a;
|
|
3217
|
+
if (!this._control || !((_a = this.controller) === null || _a === void 0 ? void 0 : _a.camera)) {
|
|
3218
|
+
return null;
|
|
3219
|
+
}
|
|
3220
|
+
// 获取相机当前位置和朝向
|
|
3221
|
+
const position = this.controller.camera.position.clone();
|
|
3222
|
+
const quaternion = this.controller.camera.quaternion.clone();
|
|
3223
|
+
// 计算相机到控制目标点的距离(FirstPerson 通常没有 target,这里设为 0)
|
|
3224
|
+
const distance = 0;
|
|
3225
|
+
return {
|
|
3226
|
+
position,
|
|
3227
|
+
quaternion,
|
|
3228
|
+
distance
|
|
3229
|
+
};
|
|
3230
|
+
}
|
|
3195
3231
|
}
|
|
3196
3232
|
|
|
3197
3233
|
function debounce(func, delay) {
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1925,6 +1925,9 @@ class Pawn {
|
|
|
1925
1925
|
}
|
|
1926
1926
|
stopFocusing() {
|
|
1927
1927
|
}
|
|
1928
|
+
getFocuingData() {
|
|
1929
|
+
return null;
|
|
1930
|
+
}
|
|
1928
1931
|
destroy() {
|
|
1929
1932
|
}
|
|
1930
1933
|
}
|
|
@@ -2021,6 +2024,23 @@ class Orbital extends Pawn {
|
|
|
2021
2024
|
}
|
|
2022
2025
|
});
|
|
2023
2026
|
}
|
|
2027
|
+
getFocuingData() {
|
|
2028
|
+
if (!this.control || !this.camera) {
|
|
2029
|
+
return null;
|
|
2030
|
+
}
|
|
2031
|
+
// 相机当前位置
|
|
2032
|
+
const position = this.camera.position.clone();
|
|
2033
|
+
// 相机朝向
|
|
2034
|
+
const quaternion = this.camera.quaternion.clone();
|
|
2035
|
+
// 计算相机到目标的距离
|
|
2036
|
+
const target = this.control.target.clone();
|
|
2037
|
+
const distance = position.distanceTo(target);
|
|
2038
|
+
return {
|
|
2039
|
+
position: target,
|
|
2040
|
+
quaternion: quaternion,
|
|
2041
|
+
distance: distance
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2024
2044
|
stopFocusing() {
|
|
2025
2045
|
if (this.anim) {
|
|
2026
2046
|
this.anim.kill();
|
|
@@ -3190,6 +3210,22 @@ class FirstPerson extends Pawn {
|
|
|
3190
3210
|
super(controller);
|
|
3191
3211
|
this._control = new PointerLockControls(controller.camera, controller.viewPort.canvas);
|
|
3192
3212
|
}
|
|
3213
|
+
getFocuingData() {
|
|
3214
|
+
var _a;
|
|
3215
|
+
if (!this._control || !((_a = this.controller) === null || _a === void 0 ? void 0 : _a.camera)) {
|
|
3216
|
+
return null;
|
|
3217
|
+
}
|
|
3218
|
+
// 获取相机当前位置和朝向
|
|
3219
|
+
const position = this.controller.camera.position.clone();
|
|
3220
|
+
const quaternion = this.controller.camera.quaternion.clone();
|
|
3221
|
+
// 计算相机到控制目标点的距离(FirstPerson 通常没有 target,这里设为 0)
|
|
3222
|
+
const distance = 0;
|
|
3223
|
+
return {
|
|
3224
|
+
position,
|
|
3225
|
+
quaternion,
|
|
3226
|
+
distance
|
|
3227
|
+
};
|
|
3228
|
+
}
|
|
3193
3229
|
}
|
|
3194
3230
|
|
|
3195
3231
|
function debounce(func, delay) {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Pawn } from "./Pawn";
|
|
2
2
|
import { Controller } from "../../Frame/Controller";
|
|
3
|
+
import { Vector3, Quaternion } from "three/webgpu";
|
|
3
4
|
export declare class FirstPerson extends Pawn {
|
|
4
5
|
constructor(controller: Controller);
|
|
6
|
+
getFocuingData(): {
|
|
7
|
+
position: Vector3;
|
|
8
|
+
quaternion: Quaternion;
|
|
9
|
+
distance: number;
|
|
10
|
+
} | null;
|
|
5
11
|
}
|
|
@@ -13,5 +13,10 @@ export declare class Orbital extends Pawn {
|
|
|
13
13
|
unpossess(): void;
|
|
14
14
|
onChange(): void;
|
|
15
15
|
focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number, onGoing?: (() => void) | null, onFinished?: (() => void) | null): void;
|
|
16
|
+
getFocuingData(): {
|
|
17
|
+
position: Vector3;
|
|
18
|
+
quaternion: Quaternion;
|
|
19
|
+
distance: number;
|
|
20
|
+
} | null;
|
|
16
21
|
stopFocusing(): void;
|
|
17
22
|
}
|
|
@@ -13,5 +13,10 @@ export declare abstract class Pawn {
|
|
|
13
13
|
unpossess(): void;
|
|
14
14
|
focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number, onGoing?: (() => void) | null, onFinished?: (() => void) | null): void;
|
|
15
15
|
stopFocusing(): void;
|
|
16
|
+
getFocuingData(): {
|
|
17
|
+
position: Vector3;
|
|
18
|
+
quaternion: Quaternion;
|
|
19
|
+
distance: number;
|
|
20
|
+
} | null;
|
|
16
21
|
destroy(): void;
|
|
17
22
|
}
|