view3d-core 1.0.0 → 1.0.2
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/{SerializationPlugin-CBr1GY5q.js → SerializationPlugin-D418fw5V.js} +443 -436
- package/dist/SerializationPlugin-D418fw5V.js.map +1 -0
- package/dist/{SerializationPlugin-Cxn2UjuS.cjs → SerializationPlugin-DJVOx3pd.cjs} +377 -370
- package/dist/SerializationPlugin-DJVOx3pd.cjs.map +1 -0
- package/dist/index.cjs +108 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.js +1 -1
- package/package.json +8 -7
- package/dist/SerializationPlugin-CBr1GY5q.js.map +0 -1
- package/dist/SerializationPlugin-Cxn2UjuS.cjs.map +0 -1
- package/dist/plugins/index.d.ts +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const e = require("three"), t = require("gsap"),
|
|
4
|
-
function
|
|
3
|
+
const e = require("three"), t = require("gsap"), i = require("./SerializationPlugin-DJVOx3pd.cjs");
|
|
4
|
+
function s(e2) {
|
|
5
5
|
const t2 = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
6
6
|
if (e2) {
|
|
7
|
-
for (const
|
|
8
|
-
const
|
|
9
|
-
Object.defineProperty(t2,
|
|
7
|
+
for (const i2 in e2) if ("default" !== i2) {
|
|
8
|
+
const s2 = Object.getOwnPropertyDescriptor(e2, i2);
|
|
9
|
+
Object.defineProperty(t2, i2, s2.get ? s2 : { enumerable: true, get: () => e2[i2] });
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
return t2.default = e2, Object.freeze(t2);
|
|
13
13
|
}
|
|
14
|
-
const n =
|
|
14
|
+
const n = s(e);
|
|
15
15
|
class r {
|
|
16
16
|
constructor() {
|
|
17
17
|
this.listeners = /* @__PURE__ */ new Map();
|
|
18
18
|
}
|
|
19
19
|
on(e2, t2) {
|
|
20
20
|
this.listeners.has(e2) || this.listeners.set(e2, /* @__PURE__ */ new Set());
|
|
21
|
-
const
|
|
22
|
-
return this.listeners.get(e2).add(
|
|
21
|
+
const i2 = { callback: t2, once: false };
|
|
22
|
+
return this.listeners.get(e2).add(i2), () => {
|
|
23
23
|
var _a;
|
|
24
|
-
(_a = this.listeners.get(e2)) == null ? void 0 : _a.delete(
|
|
24
|
+
(_a = this.listeners.get(e2)) == null ? void 0 : _a.delete(i2);
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
once(e2, t2) {
|
|
28
28
|
this.listeners.has(e2) || this.listeners.set(e2, /* @__PURE__ */ new Set());
|
|
29
|
-
const
|
|
30
|
-
return this.listeners.get(e2).add(
|
|
29
|
+
const i2 = { callback: t2, once: true };
|
|
30
|
+
return this.listeners.get(e2).add(i2), () => {
|
|
31
31
|
var _a;
|
|
32
|
-
(_a = this.listeners.get(e2)) == null ? void 0 : _a.delete(
|
|
32
|
+
(_a = this.listeners.get(e2)) == null ? void 0 : _a.delete(i2);
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
off(e2, t2) {
|
|
36
36
|
if (!t2) return void this.listeners.delete(e2);
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
for (const e3 of
|
|
40
|
-
|
|
37
|
+
const i2 = this.listeners.get(e2);
|
|
38
|
+
if (i2) {
|
|
39
|
+
for (const e3 of i2) if (e3.callback === t2) {
|
|
40
|
+
i2.delete(e3);
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
emit(e2, t2) {
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
for (const e3 of
|
|
46
|
+
const i2 = this.listeners.get(e2);
|
|
47
|
+
if (!i2) return;
|
|
48
|
+
const s2 = [];
|
|
49
|
+
for (const e3 of i2) {
|
|
50
50
|
try {
|
|
51
51
|
e3.callback(t2);
|
|
52
52
|
} catch (e4) {
|
|
53
53
|
}
|
|
54
|
-
e3.once &&
|
|
54
|
+
e3.once && s2.push(e3);
|
|
55
55
|
}
|
|
56
|
-
for (const e3 of
|
|
56
|
+
for (const e3 of s2) i2.delete(e3);
|
|
57
57
|
}
|
|
58
58
|
hasListeners(e2) {
|
|
59
59
|
const t2 = this.listeners.get(e2);
|
|
@@ -99,17 +99,17 @@ class a {
|
|
|
99
99
|
this.scene.background = e2, this.events.emit("scene:background:change", { background: e2 });
|
|
100
100
|
}
|
|
101
101
|
setSkybox(e2) {
|
|
102
|
-
return new Promise((t2,
|
|
102
|
+
return new Promise((t2, i2) => {
|
|
103
103
|
new n.CubeTextureLoader().load(e2, (e3) => {
|
|
104
104
|
this.scene.background = e3, this.events.emit("scene:background:change", { background: e3 }), t2(e3);
|
|
105
|
-
}, void 0,
|
|
105
|
+
}, void 0, i2);
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
setEnvironmentMap(e2) {
|
|
109
|
-
return new Promise((t2,
|
|
109
|
+
return new Promise((t2, i2) => {
|
|
110
110
|
new n.CubeTextureLoader().load(e2, (e3) => {
|
|
111
111
|
this.envBackground = e3, t2(e3);
|
|
112
|
-
}, void 0,
|
|
112
|
+
}, void 0, i2);
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
add(...e2) {
|
|
@@ -156,10 +156,10 @@ class a {
|
|
|
156
156
|
}
|
|
157
157
|
const o = { fov: 50, near: 0.1, far: 1e5, position: { x: 10, y: 10, z: 10 } };
|
|
158
158
|
class c {
|
|
159
|
-
constructor(e2, t2,
|
|
160
|
-
this.container = e2, this.events = t2, this.config = { ...o, ...
|
|
161
|
-
const
|
|
162
|
-
this.camera = new n.PerspectiveCamera(this.config.fov,
|
|
159
|
+
constructor(e2, t2, i2) {
|
|
160
|
+
this.container = e2, this.events = t2, this.config = { ...o, ...i2 };
|
|
161
|
+
const s2 = e2.clientWidth / e2.clientHeight;
|
|
162
|
+
this.camera = new n.PerspectiveCamera(this.config.fov, s2, this.config.near, this.config.far), this.camera.name = "MainCamera", this.camera.position.set(this.config.position.x, this.config.position.y, this.config.position.z);
|
|
163
163
|
}
|
|
164
164
|
get position() {
|
|
165
165
|
return this.camera.position;
|
|
@@ -182,8 +182,8 @@ class c {
|
|
|
182
182
|
set far(e2) {
|
|
183
183
|
this.camera.far = e2, this.camera.updateProjectionMatrix(), this.events.emit("camera:change", { camera: this.camera });
|
|
184
184
|
}
|
|
185
|
-
setPosition(e2, t2,
|
|
186
|
-
this.camera.position.set(e2, t2,
|
|
185
|
+
setPosition(e2, t2, i2) {
|
|
186
|
+
this.camera.position.set(e2, t2, i2), this.events.emit("camera:change", { camera: this.camera });
|
|
187
187
|
}
|
|
188
188
|
lookAt(e2) {
|
|
189
189
|
e2 instanceof n.Vector3 ? this.camera.lookAt(e2) : this.camera.lookAt(e2.x, e2.y, e2.z), this.events.emit("camera:change", { camera: this.camera });
|
|
@@ -208,10 +208,10 @@ class c {
|
|
|
208
208
|
dispose() {
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
const h = { pixelRatio: "undefined" != typeof window ? window.devicePixelRatio : 1, antialias: true, alpha: true, logarithmicDepthBuffer: true, preserveDrawingBuffer: false, powerPreference: "high-performance", toneMapping: n.NoToneMapping, toneMappingExposure: 1, outputColorSpace: n.SRGBColorSpace, shadowMapEnabled: false, shadowMapType: n.PCFSoftShadowMap };
|
|
211
|
+
const h = { pixelRatio: "undefined" != typeof window ? Math.min(window.devicePixelRatio, 2) : 1, antialias: true, alpha: true, logarithmicDepthBuffer: true, preserveDrawingBuffer: false, powerPreference: "high-performance", toneMapping: n.NoToneMapping, toneMappingExposure: 1, outputColorSpace: n.SRGBColorSpace, shadowMapEnabled: false, shadowMapType: n.PCFSoftShadowMap };
|
|
212
212
|
class l {
|
|
213
|
-
constructor(e2, t2,
|
|
214
|
-
this.container = e2, this.events = t2, this.config = { ...h, ...
|
|
213
|
+
constructor(e2, t2, i2) {
|
|
214
|
+
this.container = e2, this.events = t2, this.config = { ...h, ...i2 }, this.config.pixelRatio = Math.min(this.config.pixelRatio, 2), this.renderer = new n.WebGLRenderer({ antialias: this.config.antialias, alpha: this.config.alpha, logarithmicDepthBuffer: this.config.logarithmicDepthBuffer, preserveDrawingBuffer: this.config.preserveDrawingBuffer, powerPreference: this.config.powerPreference }), this.renderer.setSize(e2.clientWidth, e2.clientHeight), this.renderer.setPixelRatio(this.config.pixelRatio), this.renderer.toneMapping = this.config.toneMapping, this.renderer.toneMappingExposure = this.config.toneMappingExposure, this.renderer.outputColorSpace = this.config.outputColorSpace, this.renderer.shadowMap.enabled = this.config.shadowMapEnabled, this.renderer.shadowMap.type = this.config.shadowMapType, e2.appendChild(this.renderer.domElement);
|
|
215
215
|
}
|
|
216
216
|
get domElement() {
|
|
217
217
|
return this.renderer.domElement;
|
|
@@ -220,7 +220,8 @@ class l {
|
|
|
220
220
|
return this.renderer.getPixelRatio();
|
|
221
221
|
}
|
|
222
222
|
set pixelRatio(e2) {
|
|
223
|
-
|
|
223
|
+
const t2 = Math.min(e2, 2);
|
|
224
|
+
this.renderer.setPixelRatio(t2), this.config.pixelRatio = t2;
|
|
224
225
|
}
|
|
225
226
|
getSize() {
|
|
226
227
|
const e2 = new n.Vector2();
|
|
@@ -276,13 +277,13 @@ class g {
|
|
|
276
277
|
if (t3 < this.fpsInterval) return;
|
|
277
278
|
this.lastFrameTime = e3 - t3 % this.fpsInterval;
|
|
278
279
|
}
|
|
279
|
-
const t2 = this.clock.getDelta(),
|
|
280
|
-
this.events.emit("render:before", { delta: t2, elapsed:
|
|
280
|
+
const t2 = this.clock.getDelta(), i2 = this.clock.getElapsedTime();
|
|
281
|
+
this.events.emit("render:before", { delta: t2, elapsed: i2 });
|
|
281
282
|
for (const e4 of this.frameCallbacks) try {
|
|
282
|
-
e4(t2,
|
|
283
|
+
e4(t2, i2);
|
|
283
284
|
} catch (e5) {
|
|
284
285
|
}
|
|
285
|
-
this.render(), this.events.emit("render:after", { delta: t2, elapsed:
|
|
286
|
+
this.render(), this.events.emit("render:after", { delta: t2, elapsed: i2 });
|
|
286
287
|
}, this.config = { ...p, ...e2 }, this.container = e2.container, this.events = new r(), this.clock = new n.Clock(false), this.sceneManager = new a(this.events), this.cameraManager = new c(this.container, this.events, e2.camera), this.sceneManager.scene.add(this.cameraManager.camera), this.rendererManager = new l(this.container, this.events, e2.renderer), void 0 !== this.config.fps && null !== this.config.fps && this.config.fps > 0 && (this.fpsInterval = 1e3 / this.config.fps), this.config.autoResize && this.setupAutoResize(), this.events.emit("engine:ready", void 0), this.config.autoStart && this.start();
|
|
287
288
|
}
|
|
288
289
|
get scene() {
|
|
@@ -337,7 +338,7 @@ class g {
|
|
|
337
338
|
let d = "/draco/";
|
|
338
339
|
const _m = class _m {
|
|
339
340
|
constructor(e2) {
|
|
340
|
-
this.progressList = [], this.commonFrameList = [], this.mixerList = [], this.shaderList = [], this.getDistanceScalePoint =
|
|
341
|
+
this.progressList = [], this.commonFrameList = [], this.mixerList = [], this.shaderList = [], this.getDistanceScalePoint = i.getDistanceScalePoint, this.getBestViewTarget = i.getBestViewTarget, this.config = e2, this.engine = new g({ container: e2.container, ...e2.engine, autoStart: false }), this.events = this.engine.events, this.plugins = new i.PluginManager({ engine: this.engine, events: this.events }), this.installCorePlugins(), this.engine.onUpdate((e3, t2) => {
|
|
341
342
|
this.onUpdate(e3, t2);
|
|
342
343
|
}), e2.sceneParams && this.restoreScene(e2.sceneParams), e2.meshListParams && e2.meshListParams.forEach((e3) => {
|
|
343
344
|
this.setModelFromInfo(e3.rootInfo, e3.group);
|
|
@@ -365,15 +366,15 @@ const _m = class _m {
|
|
|
365
366
|
return this.engine.renderer;
|
|
366
367
|
}
|
|
367
368
|
get viewer() {
|
|
368
|
-
const e2 = this.plugins.get("orbit-controller"), t2 = this.plugins.get("transform-controller"),
|
|
369
|
-
return { scene: this.scene, camera: this.camera, renderer: this.renderer, controls: e2 == null ? void 0 : e2.controls, transformControls: t2 == null ? void 0 : t2.controls, Composer:
|
|
369
|
+
const e2 = this.plugins.get("orbit-controller"), t2 = this.plugins.get("transform-controller"), i2 = this.plugins.get("composer"), s2 = this.plugins.get("css-renderer"), n2 = this.plugins.get("editor"), r2 = this.plugins.get("loader"), a2 = this.plugins.get("gui");
|
|
370
|
+
return { scene: this.scene, camera: this.camera, renderer: this.renderer, controls: e2 == null ? void 0 : e2.controls, transformControls: t2 == null ? void 0 : t2.controls, Composer: i2, CSS2DObject: s2 == null ? void 0 : s2.CSS2DObject, CSS3DObject: s2 == null ? void 0 : s2.CSS3DObject, MixerList: this.mixerList, ShaderList: this.shaderList, CommonFrameList: this.commonFrameList, handler: n2, modelControls: r2, currentInfo: n2 == null ? void 0 : n2.currentInfo, GUI: a2 == null ? void 0 : a2.gui, renderSceneResize: () => this.engine.resize(), destroySceneRender: () => this.dispose(), saveSceneEditor: () => this.saveSceneEditor() };
|
|
370
371
|
}
|
|
371
372
|
installCorePlugins() {
|
|
372
|
-
this.plugins.use(new
|
|
373
|
-
const e2 = new
|
|
374
|
-
this.plugins.use(e2), this.plugins.use(new
|
|
373
|
+
this.plugins.use(new i.OrbitControllerPlugin()), this.plugins.use(new i.TransformControllerPlugin());
|
|
374
|
+
const e2 = new i.LoaderPlugin({ dracoPath: _m.dracoPath });
|
|
375
|
+
this.plugins.use(e2), this.plugins.use(new i.ComposerPlugin()), this.plugins.use(new i.CSSRendererPlugin()), this.plugins.use(new i.EditorPlugin()), this.plugins.use(new i.GizmoPlugin({ grid: { enabled: true, size: 100, divisions: 100, colorCenterLine: 4473924, colorGrid: 8947848 }, axes: { enabled: true, size: 5 }, stats: { enabled: false, mode: 0 }, viewHelper: { enabled: false, size: 128, position: "bottom-right" }, box3Helper: { enabled: false, color: 16776960 } }));
|
|
375
376
|
const t2 = this.config.gui;
|
|
376
|
-
true !== (t2 == null ? void 0 : t2.useProxy) && this.plugins.use(new
|
|
377
|
+
true !== (t2 == null ? void 0 : t2.useProxy) && this.plugins.use(new i.GUIPlugin({ autoPlace: (t2 == null ? void 0 : t2.autoPlace) ?? true, width: (t2 == null ? void 0 : t2.width) ?? 300, useProxy: (t2 == null ? void 0 : t2.useProxy) ?? false }));
|
|
377
378
|
}
|
|
378
379
|
onUpdate(e2, t2) {
|
|
379
380
|
this.mixerList.forEach((e3) => {
|
|
@@ -386,20 +387,20 @@ const _m = class _m {
|
|
|
386
387
|
var _a;
|
|
387
388
|
(_a = e3.frameAnimationRender) == null ? void 0 : _a.call(e3);
|
|
388
389
|
});
|
|
389
|
-
const
|
|
390
|
-
|
|
390
|
+
const i2 = this.plugins.get("composer");
|
|
391
|
+
i2 && i2.render();
|
|
391
392
|
}
|
|
392
393
|
use(e2) {
|
|
393
394
|
return this.plugins.use(e2), this;
|
|
394
395
|
}
|
|
395
396
|
setModelFromInfo(e2, t2 = null) {
|
|
396
|
-
const
|
|
397
|
-
if (!
|
|
398
|
-
const
|
|
399
|
-
|
|
397
|
+
const i2 = this.plugins.get("loader");
|
|
398
|
+
if (!i2) throw new Error("Loader plugin not installed");
|
|
399
|
+
const s2 = i2.loadModel(e2), n2 = s2.complete;
|
|
400
|
+
s2.complete = (t3) => {
|
|
400
401
|
t3.rootInfo = e2, this.scene.add(t3), n2(t3);
|
|
401
402
|
};
|
|
402
|
-
const r2 = { loaderService:
|
|
403
|
+
const r2 = { loaderService: s2, rootInfo: e2, params: t2 };
|
|
403
404
|
return this.progressList.push(r2), r2;
|
|
404
405
|
}
|
|
405
406
|
setSky(e2) {
|
|
@@ -411,37 +412,37 @@ const _m = class _m {
|
|
|
411
412
|
});
|
|
412
413
|
}
|
|
413
414
|
setCss2dDOM(e2, t2) {
|
|
414
|
-
const
|
|
415
|
-
if (!
|
|
415
|
+
const i2 = this.plugins.get("css-renderer");
|
|
416
|
+
if (!i2) throw new Error("CSS Renderer plugin not installed");
|
|
416
417
|
e2.style.pointerEvents = "auto";
|
|
417
|
-
return
|
|
418
|
+
return i2.addCSS2D(e2, t2);
|
|
418
419
|
}
|
|
419
420
|
setCss3dDOM(e2, t2) {
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
422
|
-
return
|
|
421
|
+
const i2 = this.plugins.get("css-renderer");
|
|
422
|
+
if (!i2) throw new Error("CSS Renderer plugin not installed");
|
|
423
|
+
return i2.addCSS3D(e2, t2);
|
|
423
424
|
}
|
|
424
425
|
getSceneEvent(e2, t2) {
|
|
425
|
-
const
|
|
426
|
-
if (!
|
|
427
|
-
const
|
|
428
|
-
|
|
426
|
+
const i2 = this.plugins.get("editor");
|
|
427
|
+
if (!i2) return;
|
|
428
|
+
const s2 = i2.handleClick(e2);
|
|
429
|
+
s2 && t2(s2);
|
|
429
430
|
}
|
|
430
431
|
getRawSceneEvent() {
|
|
431
432
|
const e2 = new n.Raycaster(), t2 = new n.Vector2();
|
|
432
|
-
return { raycaster: e2, getIntersects: (
|
|
433
|
+
return { raycaster: e2, getIntersects: (i2, s2) => {
|
|
433
434
|
const n2 = this.renderer.domElement.getBoundingClientRect();
|
|
434
|
-
return t2.x = (
|
|
435
|
+
return t2.x = (i2.clientX - n2.left) / n2.width * 2 - 1, t2.y = -(i2.clientY - n2.top) / n2.height * 2 + 1, e2.setFromCamera(t2, this.camera), e2.intersectObjects(s2, true);
|
|
435
436
|
} };
|
|
436
437
|
}
|
|
437
|
-
setGsapAnimation(e2,
|
|
438
|
-
return t.to(e2, { ...
|
|
438
|
+
setGsapAnimation(e2, i2, s2 = {}) {
|
|
439
|
+
return t.to(e2, { ...i2, duration: 2, ease: "none", repeat: 0, yoyo: false, yoyoEase: true, ...s2 });
|
|
439
440
|
}
|
|
440
441
|
setModelAnimationPlay(e2) {
|
|
441
442
|
if (!e2.animationPlayParams || !e2.animations) return null;
|
|
442
|
-
const { speed: t2, actionIndexs:
|
|
443
|
-
const
|
|
444
|
-
return
|
|
443
|
+
const { speed: t2, actionIndexs: i2, startTime: s2, loop: r2 } = e2.animationPlayParams, a2 = new n.Clock(), o2 = new n.AnimationMixer(e2), c2 = e2.animations.filter((e3, t3) => i2[t3]).map((e3) => {
|
|
444
|
+
const i3 = o2.clipAction(e3);
|
|
445
|
+
return i3.loop = r2 ? n.LoopRepeat : n.LoopOnce, i3.time = s2, i3.timeScale = t2, i3.clampWhenFinished = true, i3.play(), i3;
|
|
445
446
|
});
|
|
446
447
|
return e2.mixerRender = () => {
|
|
447
448
|
o2.update(a2.getDelta());
|
|
@@ -452,19 +453,19 @@ const _m = class _m {
|
|
|
452
453
|
t2 > -1 && this.mixerList.splice(t2, 1);
|
|
453
454
|
}
|
|
454
455
|
setCurveAnimation(e2, t2 = 1) {
|
|
455
|
-
const
|
|
456
|
-
|
|
456
|
+
const i2 = this.commonFrameList, s2 = { id: Date.now(), curve: e2, time: 0, pause: false, speed: t2, frameCallback: null, frameEndCallback: null, start: function() {
|
|
457
|
+
i2.includes(this) || i2.push(this), this.pause = false;
|
|
457
458
|
}, destroy: function() {
|
|
458
|
-
const e3 =
|
|
459
|
-
e3 > -1 &&
|
|
459
|
+
const e3 = i2.indexOf(this);
|
|
460
|
+
e3 > -1 && i2.splice(e3, 1);
|
|
460
461
|
}, frameAnimationRender: () => {
|
|
461
462
|
var _a, _b;
|
|
462
|
-
if (
|
|
463
|
-
if (
|
|
464
|
-
const t3 = e2.getPointAt(
|
|
465
|
-
(_b =
|
|
463
|
+
if (s2.pause) return;
|
|
464
|
+
if (s2.time += s2.speed / 1e3, s2.time > 1 || s2.time < 0) return s2.time = s2.time > 1 ? 1 : 0, s2.pause = true, void ((_a = s2.frameEndCallback) == null ? void 0 : _a.call(s2));
|
|
465
|
+
const t3 = e2.getPointAt(s2.time);
|
|
466
|
+
(_b = s2.frameCallback) == null ? void 0 : _b.call(s2, t3);
|
|
466
467
|
} };
|
|
467
|
-
return
|
|
468
|
+
return s2;
|
|
468
469
|
}
|
|
469
470
|
setOutlinePass(e2 = []) {
|
|
470
471
|
const t2 = this.plugins.get("composer");
|
|
@@ -475,11 +476,11 @@ const _m = class _m {
|
|
|
475
476
|
t2 && t2.setMode(e2);
|
|
476
477
|
}
|
|
477
478
|
setTransformControlsProperty(e2, t2) {
|
|
478
|
-
const
|
|
479
|
-
|
|
479
|
+
const i2 = this.plugins.get("transform-controller");
|
|
480
|
+
i2 && i2.controls.hasOwnProperty(e2) && (i2.controls[e2] = t2);
|
|
480
481
|
}
|
|
481
482
|
getObjectViews(e2, t2) {
|
|
482
|
-
return
|
|
483
|
+
return i.getObjectViews(e2, t2 ?? this.camera.fov);
|
|
483
484
|
}
|
|
484
485
|
getSceneCurveList() {
|
|
485
486
|
return this.scene.children.filter((e2) => e2.isCurveMesh).map((e2) => {
|
|
@@ -505,25 +506,25 @@ const _m = class _m {
|
|
|
505
506
|
setGUIDomPosition(e2) {
|
|
506
507
|
const t2 = this.plugins.get("gui");
|
|
507
508
|
if (!t2 || !t2.domElement) return null;
|
|
508
|
-
const
|
|
509
|
-
return e2.appendChild(
|
|
510
|
-
|
|
509
|
+
const i2 = t2.domElement;
|
|
510
|
+
return e2.appendChild(i2), { GUIDom: i2, remove: () => {
|
|
511
|
+
i2.parentElement === e2 && e2.removeChild(i2);
|
|
511
512
|
} };
|
|
512
513
|
}
|
|
513
514
|
setOperateOption(e2, t2) {
|
|
514
|
-
const
|
|
515
|
+
const i2 = this.plugins.get("editor"), s2 = this.plugins.get("gizmo");
|
|
515
516
|
switch (e2) {
|
|
516
517
|
case "stats":
|
|
517
|
-
|
|
518
|
+
s2 && s2.setStatsVisible(t2);
|
|
518
519
|
break;
|
|
519
520
|
case "axes":
|
|
520
|
-
|
|
521
|
+
s2 && s2.setAxesVisible(t2);
|
|
521
522
|
break;
|
|
522
523
|
case "grid":
|
|
523
|
-
|
|
524
|
+
s2 && s2.setGridVisible(t2);
|
|
524
525
|
break;
|
|
525
526
|
case "openKey":
|
|
526
|
-
|
|
527
|
+
i2 && (i2.config.enableKeyboard = t2);
|
|
527
528
|
}
|
|
528
529
|
}
|
|
529
530
|
setSceneFromClassify(e2) {
|
|
@@ -532,42 +533,42 @@ const _m = class _m {
|
|
|
532
533
|
});
|
|
533
534
|
}
|
|
534
535
|
pointSyncTransform(e2, t2) {
|
|
535
|
-
const
|
|
536
|
-
return
|
|
536
|
+
const i2 = e2.clone();
|
|
537
|
+
return i2.applyMatrix4(t2.matrixWorld), i2;
|
|
537
538
|
}
|
|
538
539
|
meshGroupCloneMaterial(e2) {
|
|
539
540
|
e2.traverse((e3) => {
|
|
540
541
|
if (e3.isMesh) {
|
|
541
|
-
const t2 = e3,
|
|
542
|
-
|
|
542
|
+
const t2 = e3, i2 = t2;
|
|
543
|
+
i2.isCloneMaterial || (i2.originMaterial = t2.material, t2.material = Array.isArray(t2.material) ? t2.material.map((e4) => e4.clone()) : t2.material.clone(), i2.isCloneMaterial = true);
|
|
543
544
|
}
|
|
544
545
|
});
|
|
545
546
|
}
|
|
546
547
|
changeMeshMaterial(e2, t2) {
|
|
547
548
|
e2.traverse((e3) => {
|
|
548
549
|
if (e3.isMesh) {
|
|
549
|
-
const
|
|
550
|
-
(Array.isArray(
|
|
551
|
-
Object.entries(t2).forEach(([t3,
|
|
552
|
-
t3 in e4 && ("color" === t3 || "emissive" === t3 ? e4[t3].set(
|
|
550
|
+
const i2 = e3;
|
|
551
|
+
(Array.isArray(i2.material) ? i2.material : [i2.material]).forEach((e4) => {
|
|
552
|
+
Object.entries(t2).forEach(([t3, i3]) => {
|
|
553
|
+
t3 in e4 && ("color" === t3 || "emissive" === t3 ? e4[t3].set(i3) : e4[t3] = i3);
|
|
553
554
|
}), e4.needsUpdate = true;
|
|
554
555
|
});
|
|
555
556
|
}
|
|
556
557
|
});
|
|
557
558
|
}
|
|
558
559
|
changeMeshTransform(e2, t2) {
|
|
559
|
-
const
|
|
560
|
-
if (!
|
|
561
|
-
const t3 = e2.position.clone(),
|
|
562
|
-
|
|
563
|
-
e2.position.copy(t3), e2.rotation.copy(
|
|
560
|
+
const i2 = e2;
|
|
561
|
+
if (!i2.meshRevertTransform) {
|
|
562
|
+
const t3 = e2.position.clone(), s2 = e2.rotation.clone(), n2 = e2.scale.clone();
|
|
563
|
+
i2.meshRevertTransform = () => {
|
|
564
|
+
e2.position.copy(t3), e2.rotation.copy(s2), e2.scale.copy(n2);
|
|
564
565
|
};
|
|
565
566
|
}
|
|
566
567
|
t2.position && e2.position.set(t2.position.x ?? e2.position.x, t2.position.y ?? e2.position.y, t2.position.z ?? e2.position.z), t2.rotation && e2.rotation.set(t2.rotation.x ?? e2.rotation.x, t2.rotation.y ?? e2.rotation.y, t2.rotation.z ?? e2.rotation.z), t2.scale && e2.scale.set(t2.scale.x ?? e2.scale.x, t2.scale.y ?? e2.scale.y, t2.scale.z ?? e2.scale.z);
|
|
567
568
|
}
|
|
568
|
-
setGsapMeshAction(e2,
|
|
569
|
+
setGsapMeshAction(e2, i2, s2, n2) {
|
|
569
570
|
const { query: r2 } = n2;
|
|
570
|
-
|
|
571
|
+
i2.position && s2.position && (e2.position.set(i2.position.x, i2.position.y, i2.position.z), t.to(e2.position, { x: s2.position.x, y: s2.position.y, z: s2.position.z, ...r2 })), i2.rotation && s2.rotation && (e2.rotation.set(i2.rotation.x, i2.rotation.y, i2.rotation.z), t.to(e2.rotation, { x: s2.rotation.x, y: s2.rotation.y, z: s2.rotation.z, ...r2 })), i2.scale && s2.scale && (e2.scale.set(i2.scale.x, i2.scale.y, i2.scale.z), t.to(e2.scale, { x: s2.scale.x, y: s2.scale.y, z: s2.scale.z, ...r2 }));
|
|
571
572
|
}
|
|
572
573
|
start() {
|
|
573
574
|
this.engine.start();
|
|
@@ -591,7 +592,7 @@ function f(e2) {
|
|
|
591
592
|
const t2 = e2;
|
|
592
593
|
t2.map && t2.map.dispose(), t2.lightMap && t2.lightMap.dispose(), t2.bumpMap && t2.bumpMap.dispose(), t2.normalMap && t2.normalMap.dispose(), t2.specularMap && t2.specularMap.dispose(), t2.envMap && t2.envMap.dispose(), t2.alphaMap && t2.alphaMap.dispose(), t2.aoMap && t2.aoMap.dispose(), t2.displacementMap && t2.displacementMap.dispose(), t2.emissiveMap && t2.emissiveMap.dispose(), t2.gradientMap && t2.gradientMap.dispose(), t2.metalnessMap && t2.metalnessMap.dispose(), t2.roughnessMap && t2.roughnessMap.dispose();
|
|
593
594
|
}
|
|
594
|
-
exports.AnimationPlugin =
|
|
595
|
+
exports.AnimationPlugin = i.AnimationPlugin, exports.CSSRendererPlugin = i.CSSRendererPlugin, exports.ComposerPlugin = i.ComposerPlugin, exports.DrawingPlugin = i.DrawingPlugin, exports.EditorPlugin = i.EditorPlugin, exports.EnvironmentPlugin = i.EnvironmentPlugin, exports.GUIPlugin = i.GUIPlugin, exports.GeoMapPlugin = i.GeoMapPlugin, exports.GeometryPlugin = i.GeometryPlugin, exports.GizmoPlugin = i.GizmoPlugin, exports.LoaderPlugin = i.LoaderPlugin, exports.MaterialPlugin = i.MaterialPlugin, exports.OrbitControllerPlugin = i.OrbitControllerPlugin, exports.ParticlePlugin = i.ParticlePlugin, exports.PhysicsPlugin = i.PhysicsPlugin, exports.Plugin = i.Plugin, exports.PluginManager = i.PluginManager, exports.SerializationPlugin = i.SerializationPlugin, exports.ShaderPlugin = i.ShaderPlugin, exports.TextPlugin = i.TextPlugin, exports.TransformControllerPlugin = i.TransformControllerPlugin, exports.clamp = i.clamp, exports.createBox3Helper = i.createBox3Helper, exports.createRaycaster = i.createRaycaster, exports.degToRad = i.degToRad, exports.getBestViewTarget = i.getBestViewTarget, exports.getDistanceScalePoint = i.getDistanceScalePoint, exports.getObjectBox3 = i.getObjectBox3, exports.getObjectViews = i.getObjectViews, exports.getPointAtDistance = i.getPointAtDistance, exports.getRootModel = i.getRootModel, exports.getWebGLMouse = i.getWebGLMouse, exports.getWebGLMouseFromContainer = i.getWebGLMouseFromContainer, exports.lerp = i.lerp, exports.radToDeg = i.radToDeg, exports.raycastObjects = i.raycastObjects, exports.smoothstep = i.smoothstep, exports.CameraManager = c, exports.Engine = g, exports.EventEmitter = r, exports.RendererManager = l, exports.SceneManager = a, exports.ThreeEditor = m, exports.disposeMaterial = f, exports.disposeMesh = u, exports.disposeObject = function(e2) {
|
|
595
596
|
e2.traverse((e3) => {
|
|
596
597
|
e3.isMesh && u(e3);
|
|
597
598
|
});
|