@ridp/threejs 1.4.7 → 1.5.1
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 +378 -11
- package/dist/{PredictiveLoader-VyluUQ_9.js → PredictiveLoader-C9zJlZEQ.js} +853 -779
- package/dist/PredictiveLoader-Xy5S4HBr.cjs +2 -0
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +2 -2
- package/dist/{objectQuery-DV6aOB66.js → objectQuery-BfHUGPET.js} +1 -1
- package/dist/{objectQuery-E6g-_2wI.cjs → objectQuery-DNtwsgY8.cjs} +1 -1
- package/dist/threejs.cjs +2 -2
- package/dist/threejs.js +212 -169
- package/dist/{useBatchGLTFLoader-CaIsPkER.js → useBatchGLTFLoader-C1C8R5Ss.js} +1 -1
- package/dist/{useBatchGLTFLoader-DQt14QwC.cjs → useBatchGLTFLoader-DHJyQcpJ.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/package.json +1 -1
- package/dist/PredictiveLoader-Tnm0gRZR.cjs +0 -2
package/dist/threejs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { i as
|
|
5
|
-
import { d as
|
|
6
|
-
import { C as
|
|
7
|
-
import { I as
|
|
8
|
-
import { ModelOptimizer as
|
|
9
|
-
import { MathUtils as
|
|
10
|
-
const
|
|
1
|
+
var H = Object.defineProperty;
|
|
2
|
+
var A = (g, t, e) => t in g ? H(g, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[t] = e;
|
|
3
|
+
var n = (g, t, e) => A(g, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { i as se, o as oe, c as ie, b as ne, a as re, u as ae } from "./useBatchGLTFLoader-C1C8R5Ss.js";
|
|
5
|
+
import { d as P, S as j, s as X, j as Y } from "./PredictiveLoader-C9zJlZEQ.js";
|
|
6
|
+
import { C as ce, E as de, I as he, M as me, P as xe, q as fe, R as ge, n as ue, h as pe, g as Fe, b as Re, c as Me, a as ze, e as be, f as Ee, i as Le, l as Oe, m as we, o as Ce, k as ye, p as Te, r as Se, u as De } from "./PredictiveLoader-C9zJlZEQ.js";
|
|
7
|
+
import { I as Ie, c as He, a as Ae, g as Pe, b as je, d as Xe, i as Ye } from "./objectQuery-BfHUGPET.js";
|
|
8
|
+
import { ModelOptimizer as Ze, modelOptimizer as qe } from "./modelOptimizer-D6fRg-DF.js";
|
|
9
|
+
import { MathUtils as R, Scene as V, PerspectiveCamera as Z, WebGLRenderer as q, Box3 as B, Vector3 as l, Box3Helper as _ } from "three";
|
|
10
|
+
const G = "1.5.0", N = 50, W = 20, $ = 20, T = {
|
|
11
11
|
TOP: "top",
|
|
12
12
|
// 俯视(从上往下)
|
|
13
13
|
RIGHT: "right",
|
|
@@ -16,15 +16,15 @@ const N = "1.4.6", W = 50, k = 20, U = 20, v = {
|
|
|
16
16
|
// 左侧视
|
|
17
17
|
ISO: "iso"
|
|
18
18
|
// 正斜视(等轴测视角)
|
|
19
|
-
},
|
|
19
|
+
}, k = {
|
|
20
20
|
enableDamping: !0,
|
|
21
21
|
dampingFactor: 0.25,
|
|
22
22
|
screenSpacePanning: !1,
|
|
23
23
|
minDistance: 0.1,
|
|
24
24
|
maxDistance: 1e3,
|
|
25
|
-
maxPolarAngle:
|
|
25
|
+
maxPolarAngle: R.degToRad(60)
|
|
26
26
|
};
|
|
27
|
-
class
|
|
27
|
+
class U {
|
|
28
28
|
/**
|
|
29
29
|
* 构造函数
|
|
30
30
|
* @param {string} selector - DOM 容器选择器
|
|
@@ -38,22 +38,22 @@ class J {
|
|
|
38
38
|
* @param {boolean} [option.control.init=true] - 是否初始化控制器
|
|
39
39
|
* @param {Object} [option.control.options={}] - 控制器选项
|
|
40
40
|
*/
|
|
41
|
-
constructor(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
constructor(t, e) {
|
|
42
|
+
n(this, "isReady", !1);
|
|
43
|
+
n(this, "scene", null);
|
|
44
|
+
n(this, "camera", null);
|
|
45
|
+
n(this, "renderer", null);
|
|
46
|
+
n(this, "control", null);
|
|
47
|
+
n(this, "css3dRenderer", null);
|
|
48
|
+
n(this, "el", null);
|
|
49
|
+
n(this, "renderRequested", !1);
|
|
50
|
+
n(this, "selector", null);
|
|
51
|
+
n(this, "eventsListener", {});
|
|
52
|
+
n(this, "stats", null);
|
|
53
|
+
n(this, "isDispose", !1);
|
|
54
|
+
n(this, "version", "0.0.0");
|
|
55
|
+
n(this, "boxHelper", null);
|
|
56
|
+
n(this, "initOpt", {
|
|
57
57
|
css3d: !1,
|
|
58
58
|
stats: !1,
|
|
59
59
|
renderType: "change",
|
|
@@ -70,25 +70,25 @@ class J {
|
|
|
70
70
|
* 初始化场景
|
|
71
71
|
* @param {string} selector - DOM 容器选择器
|
|
72
72
|
*/
|
|
73
|
-
|
|
74
|
-
if (this.isDispose = !1, this.selector =
|
|
75
|
-
console.error(`ThreeIns: 找不到元素 ${
|
|
73
|
+
n(this, "setup", (t) => {
|
|
74
|
+
if (this.isDispose = !1, this.selector = t, this.el = document.querySelector(t), !this.el) {
|
|
75
|
+
console.error(`ThreeIns: 找不到元素 ${t}`);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
const [
|
|
79
|
-
if (this.updateCameraFOV(
|
|
80
|
-
this.control =
|
|
78
|
+
const [e, h] = this.getTargetSize();
|
|
79
|
+
if (this.updateCameraFOV(e, h), this.camera.position.set(0, 0, 0), this.camera.lookAt(0, 0, 0), this.camera.updateProjectionMatrix(), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(e, h), this.el.appendChild(this.renderer.domElement), this.initOpt.control && this.initOpt.control.init) {
|
|
80
|
+
this.control = P(this.camera, this.renderer.domElement);
|
|
81
81
|
const s = Object.assign(
|
|
82
|
-
|
|
82
|
+
k,
|
|
83
83
|
this.initOpt.control.options || {}
|
|
84
84
|
);
|
|
85
|
-
Object.keys(s).forEach((
|
|
86
|
-
this.control[
|
|
85
|
+
Object.keys(s).forEach((u) => {
|
|
86
|
+
this.control[u] = s[u];
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
setTimeout(() => {
|
|
90
90
|
this.isReady = !0;
|
|
91
|
-
},
|
|
91
|
+
}, W), this.initOpt.stats && this.initStats(), this.initOpt.css3d && this.initCss3dRenderer(), this.initOpt.renderType === "loop" ? this.animate() : this.initOpt.renderType === "change" && this.control && this.control.addEventListener(
|
|
92
92
|
"change",
|
|
93
93
|
this.requestRenderIfNotRequested
|
|
94
94
|
), this.initListener();
|
|
@@ -97,22 +97,22 @@ class J {
|
|
|
97
97
|
* WebGL 上下文丢失处理
|
|
98
98
|
* @param {Event} e - 事件对象
|
|
99
99
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
n(this, "onContextLost", (t) => {
|
|
101
|
+
t.preventDefault(), this.animationFrameId && cancelAnimationFrame(this.animationFrameId);
|
|
102
102
|
});
|
|
103
103
|
/**
|
|
104
104
|
* WebGL 上下文恢复处理
|
|
105
105
|
* @param {Event} e - 事件对象
|
|
106
106
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
n(this, "onContextRestored", (t) => {
|
|
108
|
+
t.preventDefault(), this.dispose(), setTimeout(() => {
|
|
109
109
|
this.setup(this.selector);
|
|
110
|
-
},
|
|
110
|
+
}, $);
|
|
111
111
|
});
|
|
112
112
|
/**
|
|
113
113
|
* 初始化事件监听器
|
|
114
114
|
*/
|
|
115
|
-
|
|
115
|
+
n(this, "initListener", () => {
|
|
116
116
|
this.initOpt.initListener && window && window.addEventListener("resize", this.onResize, !1), this.renderer.domElement.addEventListener(
|
|
117
117
|
"webglcontextlost",
|
|
118
118
|
this.onContextLost,
|
|
@@ -126,7 +126,7 @@ class J {
|
|
|
126
126
|
/**
|
|
127
127
|
* 移除事件监听器
|
|
128
128
|
*/
|
|
129
|
-
|
|
129
|
+
n(this, "removeListener", () => {
|
|
130
130
|
window && window.removeEventListener("resize", this.onResize, !1), this.renderer && this.renderer.domElement && (this.renderer.domElement.removeEventListener(
|
|
131
131
|
"webglcontextlost",
|
|
132
132
|
this.onContextLost,
|
|
@@ -140,19 +140,19 @@ class J {
|
|
|
140
140
|
/**
|
|
141
141
|
* 渲染循环(loop 模式)
|
|
142
142
|
*/
|
|
143
|
-
|
|
143
|
+
n(this, "animate", () => {
|
|
144
144
|
this.isDispose || (this.initOpt.renderType === "loop" && this.onRender(), this.animationFrameId = requestAnimationFrame(this.animate));
|
|
145
145
|
});
|
|
146
146
|
/**
|
|
147
147
|
* 执行渲染
|
|
148
148
|
*/
|
|
149
|
-
|
|
150
|
-
this.isDispose || (this.renderRequested = !1, this.stats && this.stats.update(), this.control && this.control.update(), this.renderer.render(this.scene, this.camera), this.css3dRenderer && this.css3dRenderer.render(this.scene, this.camera), this.eventsListener.onRender && this.eventsListener.onRender.length && this.eventsListener.onRender.forEach((
|
|
149
|
+
n(this, "onRender", () => {
|
|
150
|
+
this.isDispose || (this.renderRequested = !1, this.stats && this.stats.update(), this.control && this.control.update(), this.renderer.render(this.scene, this.camera), this.css3dRenderer && this.css3dRenderer.render(this.scene, this.camera), this.eventsListener.onRender && this.eventsListener.onRender.length && this.eventsListener.onRender.forEach((t) => t()));
|
|
151
151
|
});
|
|
152
152
|
/**
|
|
153
153
|
* 请求渲染(如果尚未请求)
|
|
154
154
|
*/
|
|
155
|
-
|
|
155
|
+
n(this, "requestRenderIfNotRequested", () => {
|
|
156
156
|
this.renderRequested || (this.renderRequested = !0, requestAnimationFrame(() => {
|
|
157
157
|
this.onRender();
|
|
158
158
|
}));
|
|
@@ -160,11 +160,11 @@ class J {
|
|
|
160
160
|
/**
|
|
161
161
|
* 处理窗口大小变化(带防抖)
|
|
162
162
|
*/
|
|
163
|
-
|
|
163
|
+
n(this, "onResize", () => {
|
|
164
164
|
this.resizeTimer && clearTimeout(this.resizeTimer), this.resizeTimer = setTimeout(() => {
|
|
165
|
-
const [
|
|
166
|
-
this.updateCameraFOV(
|
|
167
|
-
},
|
|
165
|
+
const [t, e] = this.getTargetSize();
|
|
166
|
+
this.updateCameraFOV(t, e), this.camera.lookAt(this.scene.position), this.renderer.setSize(t, e), this.css3dRenderer && this.css3dRenderer.setSize(t, e), this.onRender();
|
|
167
|
+
}, N);
|
|
168
168
|
});
|
|
169
169
|
/**
|
|
170
170
|
* @deprecated 此方法已弃用,请使用 setView() 方法代替
|
|
@@ -181,21 +181,25 @@ class J {
|
|
|
181
181
|
* @param {number} [scale=0.8] - 缩放比例,1=占满画布,0.5=50%,2.0=200%
|
|
182
182
|
* @returns {Object} 返回 setView 的结果
|
|
183
183
|
*/
|
|
184
|
-
|
|
184
|
+
n(this, "frameArea", (t, e) => (console.warn(
|
|
185
185
|
`[ThreeIns] frameArea() 已弃用,建议使用 setView() 方法。
|
|
186
186
|
旧用法: threeIns.frameArea(model, scale)
|
|
187
187
|
新用法: threeIns.setView(model, ViewType.ISO, { scale })`
|
|
188
|
-
), this.setView(
|
|
188
|
+
), this.setView(t, T.ISO, { scale: e, animate: !1, showBox: !1 })));
|
|
189
189
|
/**
|
|
190
190
|
* 切换到指定视角
|
|
191
191
|
* 根据视角类型自动调整相机位置和朝向,支持缩放比例控制
|
|
192
192
|
*
|
|
193
193
|
* @param {Object3D} model - 3D 物体对象
|
|
194
|
-
* @param {string} viewType -
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
194
|
+
* @param {string|Vector3} viewType - 视角类型,可以使用 ViewType 枚举或自定义 Vector3 方向向量
|
|
195
|
+
* - ViewType 枚举:
|
|
196
|
+
* - 'top': 俯视(从上往下看 Y 轴正方向)
|
|
197
|
+
* - 'right': 侧视(从右往左看 X 轴正方向)
|
|
198
|
+
* - 'left': 左侧视(从左往右看 X 轴负方向)
|
|
199
|
+
* - 'iso': 正斜视(等轴测视角,45°角)
|
|
200
|
+
* - Vector3 自定义方向:
|
|
201
|
+
* - 任意方向向量,如 Vector3(1, 1, 1)、Vector3(2, 0, 1)
|
|
202
|
+
* - 向量会被自动归一化,相对模型中心的任意角度
|
|
199
203
|
* @param {Object} [options] - 可选配置
|
|
200
204
|
* @param {number} [options.scale=1] - 缩放比例,控制模型在画布中的占比
|
|
201
205
|
* @param {string|Vector3} [options.position='center'] - 模型在画布中的位置
|
|
@@ -215,6 +219,8 @@ class J {
|
|
|
215
219
|
* // 导入 ViewType 枚举
|
|
216
220
|
* import { ThreeIns, ViewType } from 'threejs';
|
|
217
221
|
*
|
|
222
|
+
* // ============ 使用预设 ViewType ============
|
|
223
|
+
*
|
|
218
224
|
* // 切换到俯视,模型占满画布,居中显示
|
|
219
225
|
* threeIns.setView(model, ViewType.TOP);
|
|
220
226
|
*
|
|
@@ -244,77 +250,114 @@ class J {
|
|
|
244
250
|
* scale: 0.8
|
|
245
251
|
* });
|
|
246
252
|
*
|
|
253
|
+
* // ============ 使用自定义 Vector3 方向 ============
|
|
254
|
+
*
|
|
255
|
+
* // 从对角线方向查看模型(类似等轴测)
|
|
256
|
+
* threeIns.setView(model, new THREE.Vector3(1, 1, 1));
|
|
257
|
+
*
|
|
258
|
+
* // 从右前方查看模型
|
|
259
|
+
* threeIns.setView(model, new THREE.Vector3(2, 1, 1));
|
|
260
|
+
*
|
|
261
|
+
* // 从左侧平视模型
|
|
262
|
+
* threeIns.setView(model, new THREE.Vector3(0, 0, 1));
|
|
263
|
+
*
|
|
264
|
+
* // 从下方仰视模型
|
|
265
|
+
* threeIns.setView(model, new THREE.Vector3(0, -1, 1));
|
|
266
|
+
*
|
|
267
|
+
* // 自定义方向 + 其他选项
|
|
268
|
+
* threeIns.setView(model, new THREE.Vector3(1, 2, 1), {
|
|
269
|
+
* scale: 0.6,
|
|
270
|
+
* position: 'center',
|
|
271
|
+
* showBox: true,
|
|
272
|
+
* animate: true,
|
|
273
|
+
* duration: 1500
|
|
274
|
+
* });
|
|
275
|
+
*
|
|
247
276
|
* // 或者使用类静态属性(向后兼容)
|
|
248
277
|
* threeIns.setView(model, ThreeIns.ViewType.TOP);
|
|
249
278
|
*/
|
|
250
|
-
|
|
251
|
-
let s = h.scale || 0.8,
|
|
252
|
-
const
|
|
253
|
-
let
|
|
254
|
-
if (typeof
|
|
255
|
-
const
|
|
256
|
-
center: new
|
|
257
|
-
"top-left": new
|
|
258
|
-
"top-right": new
|
|
259
|
-
"bottom-left": new
|
|
260
|
-
"bottom-right": new
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
} else
|
|
264
|
-
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
n(this, "setView", (t, e, h = {}) => {
|
|
280
|
+
let s = h.scale || 0.8, u = h.offset || null, M = h.position || "center", z = h.showBox || !1, S = h.boxColor || 16776960, E = h.animate !== void 0 ? h.animate : !0, L = h.duration || 1e3;
|
|
281
|
+
const p = new B().setFromObject(t);
|
|
282
|
+
let d = p.getCenter(new l());
|
|
283
|
+
if (typeof M == "string") {
|
|
284
|
+
const i = p.getSize(new l()), r = {
|
|
285
|
+
center: new l(0, 0, 0),
|
|
286
|
+
"top-left": new l(-i.x * 0.3, i.y * 0.3, i.z * 0.3),
|
|
287
|
+
"top-right": new l(i.x * 0.3, i.y * 0.3, i.z * 0.3),
|
|
288
|
+
"bottom-left": new l(-i.x * 0.3, -i.y * 0.3, i.z * 0.3),
|
|
289
|
+
"bottom-right": new l(i.x * 0.3, -i.y * 0.3, i.z * 0.3)
|
|
290
|
+
}, c = r[M] || r.center;
|
|
291
|
+
typeof e == "string" ? e === "top" ? d.add(new l(c.x, 0, c.z)) : e === "right" || e === "left" ? d.add(new l(c.x, c.y, c.z)) : d.add(c) : d.add(c);
|
|
292
|
+
} else M instanceof l && d.add(M);
|
|
293
|
+
u && d.add(u);
|
|
294
|
+
const o = p.getSize(new l());
|
|
295
|
+
let F;
|
|
296
|
+
if (e instanceof l)
|
|
297
|
+
F = e.clone().normalize();
|
|
298
|
+
else {
|
|
299
|
+
const i = {
|
|
300
|
+
top: new l(0, 1, 0),
|
|
301
|
+
// 从上往下:Y 轴正方向
|
|
302
|
+
right: new l(1, 1, 1).normalize(),
|
|
303
|
+
// 从右往左:X 轴正方向
|
|
304
|
+
left: new l(-1, 1, 1).normalize(),
|
|
305
|
+
// 从左往右:X 轴负方向
|
|
306
|
+
iso: new l(0, 1, 1).normalize()
|
|
307
|
+
// 等轴测:从对角线上方俯视
|
|
308
|
+
};
|
|
309
|
+
F = i[e] || i.iso;
|
|
310
|
+
}
|
|
311
|
+
const O = this.camera.aspect, a = R.degToRad(this.camera.fov * 0.5), D = R.degToRad(80), m = Math.min(Math.atan(Math.tan(a) * O), D);
|
|
312
|
+
let x;
|
|
313
|
+
if (e instanceof l) {
|
|
314
|
+
const i = o.x * 0.5 / (Math.tan(m) * s), r = o.y * 0.5 / (Math.tan(a) * s), c = o.z * 0.5 / (Math.tan(a) * s);
|
|
315
|
+
x = Math.max(i, r, c);
|
|
316
|
+
} else if (e === "top") {
|
|
317
|
+
const i = o.x * 0.5 / (Math.tan(m) * s), r = o.z * 0.5 / (Math.tan(a) * s);
|
|
318
|
+
x = Math.max(i, r);
|
|
319
|
+
} else if (e === "right" || e === "left") {
|
|
320
|
+
const i = o.y * 0.5 / (Math.tan(a) * s), r = o.z * 0.5 / (Math.tan(a) * s);
|
|
321
|
+
x = Math.max(i, r);
|
|
282
322
|
} else {
|
|
283
|
-
const
|
|
284
|
-
|
|
323
|
+
const i = o.x * 0.5 / (Math.tan(m) * s), r = o.y * 0.5 / (Math.tan(a) * s), c = o.z * 0.5 / (Math.tan(a) * s);
|
|
324
|
+
x = Math.max(i, r, c);
|
|
285
325
|
}
|
|
286
|
-
const
|
|
287
|
-
if (z && (console.log("📍 相机位置验证:"), console.log(" - 方向向量:",
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
if (this.camera.position.lerpVectors(
|
|
291
|
-
const
|
|
292
|
-
|
|
326
|
+
const f = F.clone().multiplyScalar(x).add(d);
|
|
327
|
+
if (z && (console.log("📍 相机位置验证:"), console.log(" - 方向向量:", F), console.log(" - 距离:", x.toFixed(2)), console.log(" - 包围盒中心:", d), console.log(" - 计算公式: direction * distance + boxCenter"), console.log(" - 目标位置:", f), console.log(" - 实际相机与中心的距离:", f.clone().sub(d).length().toFixed(2))), z ? (this.boxHelper && (this.scene.remove(this.boxHelper), this.boxHelper = null), this.boxHelper = new _(p, S), this.scene.add(this.boxHelper)) : this.boxHelper && (this.scene.remove(this.boxHelper), this.boxHelper = null), E) {
|
|
328
|
+
const i = this.camera.position.clone(), r = this.control ? this.control.target.clone() : new l(0, 0, 0), c = d, v = Date.now(), w = () => {
|
|
329
|
+
const I = Date.now() - v, C = Math.min(I / L, 1), y = 1 - Math.pow(1 - C, 3);
|
|
330
|
+
if (this.camera.position.lerpVectors(i, f, y), this.control) {
|
|
331
|
+
const b = new l();
|
|
332
|
+
b.lerpVectors(r, c, y), this.control.target.copy(b), this.camera.lookAt(b);
|
|
293
333
|
} else
|
|
294
|
-
this.camera.lookAt(
|
|
295
|
-
this.camera.updateProjectionMatrix(), C < 1 ? requestAnimationFrame(
|
|
334
|
+
this.camera.lookAt(d);
|
|
335
|
+
this.camera.updateProjectionMatrix(), C < 1 ? requestAnimationFrame(w) : (this.camera.position.copy(f), this.camera.lookAt(d), this.camera.updateProjectionMatrix(), this.control && (this.control.target.copy(d), this.control.update()), this.onRender());
|
|
296
336
|
};
|
|
297
|
-
|
|
337
|
+
w();
|
|
298
338
|
} else
|
|
299
|
-
this.camera.position.copy(
|
|
339
|
+
this.camera.position.copy(f), this.camera.lookAt(d), this.camera.updateProjectionMatrix(), this.control && (this.control.target.copy(d), this.control.update()), this.onRender();
|
|
300
340
|
if (z) {
|
|
301
|
-
if (console.log("🎥 视角切换信息:"), console.log(" - 视角类型:",
|
|
302
|
-
const
|
|
303
|
-
console.log(" - 模型 X 尺寸 (宽度):",
|
|
304
|
-
} else if (
|
|
305
|
-
const
|
|
306
|
-
console.log(" -
|
|
341
|
+
if (console.log("🎥 视角切换信息:"), console.log(" - 视角类型:", e instanceof l ? `自定义 Vector3(${e.x.toFixed(2)}, ${e.y.toFixed(2)}, ${e.z.toFixed(2)})` : e), console.log(" - 相机位置:", f), console.log(" - 观察目标:", d), console.log(" - 方向向量:", F), console.log(" - 包围盒尺寸:", o), console.log(" - 包围盒中心:", p.getCenter(new l())), console.log(" - 水平 FOV:", R.radToDeg(m * 2).toFixed(2) + "°"), console.log(" - 垂直 FOV:", R.radToDeg(a * 2).toFixed(2) + "°"), console.log(" - 宽高比:", O.toFixed(4)), console.log(" - 模型宽度:", o.x.toFixed(2)), console.log(" - 模型高度:", o.y.toFixed(2)), console.log(" - 模型深度:", o.z.toFixed(2)), console.log(" - 传入的 scale 参数:", s), e instanceof l) {
|
|
342
|
+
const i = o.x * 0.5 / (Math.tan(m) * s), r = o.y * 0.5 / (Math.tan(a) * s), c = o.z * 0.5 / (Math.tan(a) * s);
|
|
343
|
+
console.log(" - 模型 X 尺寸 (宽度):", o.x.toFixed(2)), console.log(" - 模型 Y 尺寸 (高度):", o.y.toFixed(2)), console.log(" - 模型 Z 尺寸 (深度):", o.z.toFixed(2)), console.log(" - tan(halfFovX):", Math.tan(m).toFixed(4)), console.log(" - tan(halfFovY):", Math.tan(a).toFixed(4)), console.log(" - X方向距离计算: (", (o.x * 0.5).toFixed(2), ") / (", Math.tan(m).toFixed(4), " *", s, ") =", i.toFixed(2)), console.log(" - Y方向距离计算: (", (o.y * 0.5).toFixed(2), ") / (", Math.tan(a).toFixed(4), " *", s, ") =", r.toFixed(2)), console.log(" - Z方向距离计算: (", (o.z * 0.5).toFixed(2), ") / (", Math.tan(a).toFixed(4), " *", s, ") =", c.toFixed(2)), console.log(" - X方向距离 (scale=" + s + "):", i.toFixed(2)), console.log(" - Y方向距离 (scale=" + s + "):", r.toFixed(2)), console.log(" - Z方向距离 (scale=" + s + "):", c.toFixed(2)), console.log(" - 最大距离 (Max):", Math.max(i, r, c).toFixed(2));
|
|
344
|
+
} else if (e === "top") {
|
|
345
|
+
const i = o.x * 0.5 / (Math.tan(m) * s), r = o.z * 0.5 / (Math.tan(a) * s);
|
|
346
|
+
console.log(" - 模型 X 尺寸 (宽度):", o.x.toFixed(2)), console.log(" - 模型 Z 尺寸 (深度):", o.z.toFixed(2)), console.log(" - tan(halfFovX):", Math.tan(m).toFixed(4)), console.log(" - tan(halfFovY):", Math.tan(a).toFixed(4)), console.log(" - X方向距离计算: (", (o.x * 0.5).toFixed(2), ") / (", Math.tan(m).toFixed(4), " *", s, ") =", i.toFixed(2)), console.log(" - Z方向距离计算: (", (o.z * 0.5).toFixed(2), ") / (", Math.tan(a).toFixed(4), " *", s, ") =", r.toFixed(2)), console.log(" - X方向距离 (scale=" + s + "):", i.toFixed(2)), console.log(" - Z方向距离 (scale=" + s + "):", r.toFixed(2));
|
|
347
|
+
} else if (e === "right" || e === "left") {
|
|
348
|
+
const i = o.y * 0.5 / (Math.tan(a) * s), r = o.z * 0.5 / (Math.tan(a) * s);
|
|
349
|
+
console.log(" - Y方向距离 (scale=" + s + "):", i.toFixed(2)), console.log(" - Z方向距离 (scale=" + s + "):", r.toFixed(2));
|
|
307
350
|
} else {
|
|
308
|
-
const
|
|
309
|
-
console.log(" - 模型 X 尺寸 (宽度):",
|
|
351
|
+
const i = o.x * 0.5 / (Math.tan(m) * s), r = o.y * 0.5 / (Math.tan(a) * s), c = o.z * 0.5 / (Math.tan(a) * s);
|
|
352
|
+
console.log(" - 模型 X 尺寸 (宽度):", o.x.toFixed(2)), console.log(" - 模型 Y 尺寸 (高度):", o.y.toFixed(2)), console.log(" - 模型 Z 尺寸 (深度):", o.z.toFixed(2)), console.log(" - tan(halfFovX):", Math.tan(m).toFixed(4)), console.log(" - tan(halfFovY):", Math.tan(a).toFixed(4)), console.log(" - X方向距离计算: (", (o.x * 0.5).toFixed(2), ") / (", Math.tan(m).toFixed(4), " *", s, ") =", i.toFixed(2)), console.log(" - Y方向距离计算: (", (o.y * 0.5).toFixed(2), ") / (", Math.tan(a).toFixed(4), " *", s, ") =", r.toFixed(2)), console.log(" - Z方向距离计算: (", (o.z * 0.5).toFixed(2), ") / (", Math.tan(a).toFixed(4), " *", s, ") =", c.toFixed(2)), console.log(" - X方向距离 (scale=" + s + "):", i.toFixed(2)), console.log(" - Y方向距离 (scale=" + s + "):", r.toFixed(2)), console.log(" - Z方向距离 (scale=" + s + "):", c.toFixed(2)), console.log(" - 最大距离 (Max):", Math.max(i, r, c).toFixed(2));
|
|
310
353
|
}
|
|
311
|
-
console.log(" - 最终距离:",
|
|
354
|
+
console.log(" - 最终距离:", x.toFixed(2)), console.log(" - 缩放比例:", s), console.log(" - 动画:", E ? "是 (" + L + "ms)" : "否");
|
|
312
355
|
}
|
|
313
356
|
return {
|
|
314
|
-
position:
|
|
315
|
-
target:
|
|
316
|
-
distance:
|
|
317
|
-
viewType:
|
|
357
|
+
position: f,
|
|
358
|
+
target: d,
|
|
359
|
+
distance: x,
|
|
360
|
+
viewType: e
|
|
318
361
|
};
|
|
319
362
|
});
|
|
320
363
|
/**
|
|
@@ -323,14 +366,14 @@ class J {
|
|
|
323
366
|
* @param {Function} callback - 回调函数
|
|
324
367
|
* @returns {Function} 返回取消监听的函数
|
|
325
368
|
*/
|
|
326
|
-
|
|
327
|
-
}) : (this.eventsListener[
|
|
328
|
-
this.isReady = !1, this.scene = new
|
|
369
|
+
n(this, "on", (t, e) => !t || !e || typeof e != "function" ? (console.warn("ThreeIns.on: 无效的参数"), () => {
|
|
370
|
+
}) : (this.eventsListener[t] || (this.eventsListener[t] = []), this.eventsListener[t].push(e), () => this.off(t, e)));
|
|
371
|
+
this.isReady = !1, this.scene = new V({}), this.camera = new Z(50, 1, 0.1, 2e3), this.renderer = new q({
|
|
329
372
|
antialias: !0,
|
|
330
373
|
alpha: !0,
|
|
331
374
|
precision: "mediump",
|
|
332
375
|
logarithmicDepthBuffer: !0
|
|
333
|
-
}), this.version =
|
|
376
|
+
}), this.version = G, this.onContextLost = this.onContextLost.bind(this), this.onContextRestored = this.onContextRestored.bind(this), this.onResize = this.onResize.bind(this), this.animate = this.animate.bind(this), this.resizeTimer = null, this.animationFrameId = null, e && (this.initOpt = Object.assign(this.initOpt, e)), t && this.setup(t);
|
|
334
377
|
}
|
|
335
378
|
/**
|
|
336
379
|
* 更新相机 FOV 以适应容器尺寸
|
|
@@ -338,23 +381,23 @@ class J {
|
|
|
338
381
|
* @param {number} domW - 容器宽度
|
|
339
382
|
* @param {number} domH - 容器高度
|
|
340
383
|
*/
|
|
341
|
-
updateCameraFOV(
|
|
384
|
+
updateCameraFOV(t, e) {
|
|
342
385
|
const h = this.initOpt.initialFov || 50, s = Math.tan(Math.PI / 180 * h / 2);
|
|
343
|
-
this.camera.aspect =
|
|
386
|
+
this.camera.aspect = t / e, this.camera.fov = 360 / Math.PI * Math.atan(s * (e / t)), this.camera.updateProjectionMatrix();
|
|
344
387
|
}
|
|
345
388
|
/**
|
|
346
389
|
* 初始化性能统计
|
|
347
390
|
*/
|
|
348
391
|
initStats() {
|
|
349
|
-
this.stats = new
|
|
392
|
+
this.stats = new j(), this.stats.dom.style.cssText = "position:absolute;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", this.el.appendChild(this.stats.dom);
|
|
350
393
|
}
|
|
351
394
|
/**
|
|
352
395
|
* 初始化 CSS3D 渲染器
|
|
353
396
|
*/
|
|
354
397
|
initCss3dRenderer() {
|
|
355
|
-
this.css3dRenderer = new
|
|
356
|
-
const [
|
|
357
|
-
this.css3dRenderer.setSize(
|
|
398
|
+
this.css3dRenderer = new X();
|
|
399
|
+
const [t, e] = this.getTargetSize();
|
|
400
|
+
this.css3dRenderer.setSize(t, e), this.css3dRenderer.domElement.style.position = "absolute", this.css3dRenderer.domElement.style.pointerEvents = "none", this.css3dRenderer.domElement.style.top = 0, this.css3dRenderer.domElement.style.left = 0, this.el.appendChild(this.css3dRenderer.domElement);
|
|
358
401
|
}
|
|
359
402
|
/**
|
|
360
403
|
* 获取目标容器尺寸
|
|
@@ -369,64 +412,64 @@ class J {
|
|
|
369
412
|
* @param {string} event - 事件名称
|
|
370
413
|
* @param {Function} [callback] - 可选的回调函数,如果不提供则移除该事件的所有监听器
|
|
371
414
|
*/
|
|
372
|
-
off(
|
|
373
|
-
if (!
|
|
415
|
+
off(t, e) {
|
|
416
|
+
if (!t) {
|
|
374
417
|
this.eventsListener = {};
|
|
375
418
|
return;
|
|
376
419
|
}
|
|
377
|
-
this.eventsListener[
|
|
420
|
+
this.eventsListener[t] && (e ? this.eventsListener[t] = this.eventsListener[t].filter((h) => h !== e) : this.eventsListener[t] = []);
|
|
378
421
|
}
|
|
379
422
|
/**
|
|
380
423
|
* 清理所有资源
|
|
381
424
|
*/
|
|
382
425
|
dispose() {
|
|
383
|
-
this.isDispose || (this.isDispose = !0, this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null), this.resizeTimer && (clearTimeout(this.resizeTimer), this.resizeTimer = null), this.removeListener(), this.eventsListener = {}, this.stats && this.stats.dom && (this.stats.dom.remove(), this.stats = null), this.css3dRenderer && (this.css3dRenderer.domElement.remove(), this.css3dRenderer = null), this.boxHelper && (this.scene.remove(this.boxHelper), this.boxHelper = null), this.scene && (
|
|
426
|
+
this.isDispose || (this.isDispose = !0, this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null), this.resizeTimer && (clearTimeout(this.resizeTimer), this.resizeTimer = null), this.removeListener(), this.eventsListener = {}, this.stats && this.stats.dom && (this.stats.dom.remove(), this.stats = null), this.css3dRenderer && (this.css3dRenderer.domElement.remove(), this.css3dRenderer = null), this.boxHelper && (this.scene.remove(this.boxHelper), this.boxHelper = null), this.scene && (Y(this.scene), this.scene = null), this.renderer && (this.renderer.dispose(), this.renderer.domElement && this.renderer.domElement.remove(), this.renderer = null), this.control && (this.control.dispose(), this.control = null), this.camera = null, this.el = null, this.selector = null, console.log("ThreeIns: 资源已清理完成"));
|
|
384
427
|
}
|
|
385
428
|
}
|
|
386
429
|
// 存储包围盒辅助器
|
|
387
430
|
// 视角类型枚举(作为类静态属性引用,保持向后兼容)
|
|
388
|
-
|
|
431
|
+
n(U, "ViewType", T);
|
|
389
432
|
export {
|
|
390
|
-
|
|
433
|
+
ce as CacheMonitor,
|
|
391
434
|
de as ErrorType,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
435
|
+
he as IDBCache,
|
|
436
|
+
Ie as ImageLoader,
|
|
437
|
+
me as ModelLoadError,
|
|
438
|
+
Ze as ModelOptimizer,
|
|
439
|
+
xe as PredictiveLoader,
|
|
440
|
+
fe as ProgressiveSceneBuilder,
|
|
441
|
+
ge as RetryHelper,
|
|
442
|
+
U as ThreeIns,
|
|
443
|
+
T as ViewType,
|
|
444
|
+
ue as cacheMonitor,
|
|
445
|
+
pe as createArrowHelper,
|
|
446
|
+
Fe as createAxesHelper,
|
|
447
|
+
Re as createBox3Helper,
|
|
448
|
+
Me as createCameraHelper,
|
|
449
|
+
ze as createGridHelper,
|
|
450
|
+
He as createInfoPlane,
|
|
451
|
+
be as createMapControls,
|
|
452
|
+
P as createOrbitControl,
|
|
410
453
|
Ee as createRaycaster,
|
|
411
454
|
Le as createStats,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
455
|
+
Ae as createTagPlane,
|
|
456
|
+
Oe as dataToObject3D,
|
|
457
|
+
we as dataToObject3DSync,
|
|
458
|
+
Y as disposeThreeObject,
|
|
459
|
+
Pe as getCommonParent,
|
|
460
|
+
je as getObjectByUserData,
|
|
461
|
+
Xe as getRootObj,
|
|
462
|
+
Ye as initEnvImage,
|
|
463
|
+
se as intersectColor,
|
|
464
|
+
qe as modelOptimizer,
|
|
465
|
+
oe as obbObjects,
|
|
423
466
|
Ce as object3DToData,
|
|
424
467
|
ye as object3DToDataSync,
|
|
425
|
-
|
|
468
|
+
Te as predictiveLoader,
|
|
426
469
|
Se as rebuildScene,
|
|
427
|
-
|
|
470
|
+
ie as useBatchGLTFLoader,
|
|
428
471
|
De as useGLTFLoader,
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
472
|
+
ne as useObb,
|
|
473
|
+
re as useRaycaster,
|
|
474
|
+
ae as useThreeJs
|
|
432
475
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector3 as b, Matrix3 as re, MathUtils as q, Box3 as J, Matrix4 as ae, Ray as de, WebGLRenderer as me, Scene as pe, PerspectiveCamera as ye, Raycaster as be, Vector2 as ze, Color as xe } from "three";
|
|
2
2
|
import { ref as H, shallowRef as Se, onMounted as we, onUnmounted as ge, nextTick as K } from "vue";
|
|
3
|
-
import { d as ve, j as Me, S as Oe, s as Re, u as Ae } from "./PredictiveLoader-
|
|
3
|
+
import { d as ve, j as Me, S as Oe, s as Re, u as Ae } from "./PredictiveLoader-C9zJlZEQ.js";
|
|
4
4
|
const l = {
|
|
5
5
|
c: null,
|
|
6
6
|
// center
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const c=require("three"),C=require("vue"),I=require("./PredictiveLoader-
|
|
1
|
+
"use strict";const c=require("three"),C=require("vue"),I=require("./PredictiveLoader-Xy5S4HBr.cjs"),u={c:null,u:[new c.Vector3,new c.Vector3,new c.Vector3],e:[]},h={c:null,u:[new c.Vector3,new c.Vector3,new c.Vector3],e:[]},b=[[],[],[]],a=[[],[],[]],y=[],V=new c.Vector3,B=new c.Vector3,j=new c.Vector3,x=new c.Vector3,Z=new c.Vector3,K=new c.Vector3,v=new c.Matrix3,ee=new c.Box3,_=new c.Matrix4,te=new c.Matrix4,ne=new c.Ray;class G{constructor(e=new c.Vector3,r=new c.Vector3,s=new c.Matrix3){this.center=e,this.halfSize=r,this.rotation=s}set(e,r,s){return this.center=e,this.halfSize=r,this.rotation=s,this}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new this.constructor().copy(this)}getSize(e){return e.copy(this.halfSize).multiplyScalar(2)}clampPoint(e,r){const s=this.halfSize;x.subVectors(e,this.center),this.rotation.extractBasis(V,B,j),r.copy(this.center);const o=c.MathUtils.clamp(x.dot(V),-s.x,s.x);r.add(V.multiplyScalar(o));const t=c.MathUtils.clamp(x.dot(B),-s.y,s.y);r.add(B.multiplyScalar(t));const f=c.MathUtils.clamp(x.dot(j),-s.z,s.z);return r.add(j.multiplyScalar(f)),r}containsPoint(e){return x.subVectors(e,this.center),this.rotation.extractBasis(V,B,j),Math.abs(x.dot(V))<=this.halfSize.x&&Math.abs(x.dot(B))<=this.halfSize.y&&Math.abs(x.dot(j))<=this.halfSize.z}intersectsBox3(e){return this.intersectsOBB(le.fromBox3(e))}intersectsSphere(e){return this.clampPoint(e.center,K),K.distanceToSquared(e.center)<=e.radius*e.radius}intersectsOBB(e,r=Number.EPSILON){u.c=this.center,u.e[0]=this.halfSize.x,u.e[1]=this.halfSize.y,u.e[2]=this.halfSize.z,this.rotation.extractBasis(u.u[0],u.u[1],u.u[2]),h.c=e.center,h.e[0]=e.halfSize.x,h.e[1]=e.halfSize.y,h.e[2]=e.halfSize.z,e.rotation.extractBasis(h.u[0],h.u[1],h.u[2]);for(let t=0;t<3;t++)for(let f=0;f<3;f++)b[t][f]=u.u[t].dot(h.u[f]);x.subVectors(h.c,u.c),y[0]=x.dot(u.u[0]),y[1]=x.dot(u.u[1]),y[2]=x.dot(u.u[2]);for(let t=0;t<3;t++)for(let f=0;f<3;f++)a[t][f]=Math.abs(b[t][f])+r;let s,o;for(let t=0;t<3;t++)if(s=u.e[t],o=h.e[0]*a[t][0]+h.e[1]*a[t][1]+h.e[2]*a[t][2],Math.abs(y[t])>s+o)return!1;for(let t=0;t<3;t++)if(s=u.e[0]*a[0][t]+u.e[1]*a[1][t]+u.e[2]*a[2][t],o=h.e[t],Math.abs(y[0]*b[0][t]+y[1]*b[1][t]+y[2]*b[2][t])>s+o)return!1;return s=u.e[1]*a[2][0]+u.e[2]*a[1][0],o=h.e[1]*a[0][2]+h.e[2]*a[0][1],!(Math.abs(y[2]*b[1][0]-y[1]*b[2][0])>s+o||(s=u.e[1]*a[2][1]+u.e[2]*a[1][1],o=h.e[0]*a[0][2]+h.e[2]*a[0][0],Math.abs(y[2]*b[1][1]-y[1]*b[2][1])>s+o)||(s=u.e[1]*a[2][2]+u.e[2]*a[1][2],o=h.e[0]*a[0][1]+h.e[1]*a[0][0],Math.abs(y[2]*b[1][2]-y[1]*b[2][2])>s+o)||(s=u.e[0]*a[2][0]+u.e[2]*a[0][0],o=h.e[1]*a[1][2]+h.e[2]*a[1][1],Math.abs(y[0]*b[2][0]-y[2]*b[0][0])>s+o)||(s=u.e[0]*a[2][1]+u.e[2]*a[0][1],o=h.e[0]*a[1][2]+h.e[2]*a[1][0],Math.abs(y[0]*b[2][1]-y[2]*b[0][1])>s+o)||(s=u.e[0]*a[2][2]+u.e[2]*a[0][2],o=h.e[0]*a[1][1]+h.e[1]*a[1][0],Math.abs(y[0]*b[2][2]-y[2]*b[0][2])>s+o)||(s=u.e[0]*a[1][0]+u.e[1]*a[0][0],o=h.e[1]*a[2][2]+h.e[2]*a[2][1],Math.abs(y[1]*b[0][0]-y[0]*b[1][0])>s+o)||(s=u.e[0]*a[1][1]+u.e[1]*a[0][1],o=h.e[0]*a[2][2]+h.e[2]*a[2][0],Math.abs(y[1]*b[0][1]-y[0]*b[1][1])>s+o)||(s=u.e[0]*a[1][2]+u.e[1]*a[0][2],o=h.e[0]*a[2][1]+h.e[1]*a[2][0],Math.abs(y[1]*b[0][2]-y[0]*b[1][2])>s+o))}intersectsPlane(e){this.rotation.extractBasis(V,B,j);const r=this.halfSize.x*Math.abs(e.normal.dot(V))+this.halfSize.y*Math.abs(e.normal.dot(B))+this.halfSize.z*Math.abs(e.normal.dot(j)),s=e.normal.dot(this.center)-e.constant;return Math.abs(s)<=r}intersectRay(e,r){return this.getSize(Z),ee.setFromCenterAndSize(x.set(0,0,0),Z),_.setFromMatrix3(this.rotation),_.setPosition(this.center),te.copy(_).invert(),ne.copy(e).applyMatrix4(te),ne.intersectBox(ee,r)?r.applyMatrix4(_):null}intersectsRay(e){return this.intersectRay(e,x)!==null}fromBox3(e){return e.getCenter(this.center),e.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(e){return e.center.equals(this.center)&&e.halfSize.equals(this.halfSize)&&e.rotation.equals(this.rotation)}applyMatrix4(e){const r=e.elements;let s=x.set(r[0],r[1],r[2]).length();const o=x.set(r[4],r[5],r[6]).length(),t=x.set(r[8],r[9],r[10]).length();e.determinant()<0&&(s=-s),v.setFromMatrix4(e);const l=1/s,n=1/o,i=1/t;return v.elements[0]*=l,v.elements[1]*=l,v.elements[2]*=l,v.elements[3]*=n,v.elements[4]*=n,v.elements[5]*=n,v.elements[6]*=i,v.elements[7]*=i,v.elements[8]*=i,this.rotation.multiply(v),this.halfSize.x*=s,this.halfSize.y*=o,this.halfSize.z*=t,x.setFromMatrixPosition(e),this.center.add(x),this}}const le=new G,ue={enableDamping:!0,dampingFactor:.25,screenSpacePanning:!1,minDistance:.1,maxDistance:1e3,maxPolarAngle:c.MathUtils.degToRad(60)};function he(F,e){typeof console<"u"&&console.warn&&console.warn(`[ThreeIns] useThreeJs() Hook 已弃用,建议使用 ThreeIns 类代替。
|
|
2
2
|
旧用法: const { scene, camera } = useThreeJs(selector, options)
|
|
3
3
|
新用法: const threeIns = new ThreeIns(selector, options)
|
|
4
4
|
|