@shjjs/visual-ui 1.0.17 → 1.0.18
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/es/commons/core/datasource/utils/axios.d.ts +70 -0
- package/es/commons/core/datasource/utils/axios.mjs +134 -0
- package/es/commons/core/datasource/utils/request.d.ts +1 -1
- package/es/commons/core/datasource/utils/request.mjs +1 -3
- package/es/components/commons-gaussian-splatting-view/index.vue.mjs +2 -2
- package/es/components/commons-gaussian-splatting-view/index.vue2.mjs +45 -46
- package/es/components/commons-product-model/index.vue.mjs +2 -2
- package/es/components/commons-product-model/index.vue2.mjs +58 -59
- package/es/components/commons-three-loader/index.vue.mjs +2 -2
- package/es/components/commons-three-loader/index.vue2.mjs +71 -72
- package/es/components/commons-three-loader3/index.vue.mjs +2 -2
- package/es/components/commons-three-loader3/index.vue2.mjs +45 -46
- package/es/widgets.css +1 -1
- package/lib/commons/core/datasource/utils/axios.js +1 -0
- package/lib/commons/core/datasource/utils/request.js +1 -1
- package/lib/components/commons-gaussian-splatting-view/index.vue.js +1 -1
- package/lib/components/commons-gaussian-splatting-view/index.vue2.js +1 -1
- package/lib/components/commons-product-model/index.vue.js +1 -1
- package/lib/components/commons-product-model/index.vue2.js +1 -1
- package/lib/components/commons-three-loader/index.vue.js +1 -1
- package/lib/components/commons-three-loader/index.vue2.js +1 -1
- package/lib/components/commons-three-loader3/index.vue.js +1 -1
- package/lib/components/commons-three-loader3/index.vue2.js +1 -1
- package/lib/widgets.css +1 -1
- package/package.json +1 -1
- package/es/commons/utils/babylon/ColorConvert.d.ts +0 -3
- package/es/commons/utils/babylon/ColorConvert.mjs +0 -21
- package/lib/commons/utils/babylon/ColorConvert.js +0 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (h, l,
|
|
4
|
-
import { defineComponent as
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var _ = (h, l, m) => l in h ? I(h, l, { enumerable: !0, configurable: !0, writable: !0, value: m }) : h[l] = m;
|
|
3
|
+
var d = (h, l, m) => _(h, typeof l != "symbol" ? l + "" : l, m);
|
|
4
|
+
import { defineComponent as z, watch as f, createElementBlock as B, openBlock as D, createElementVNode as U, createCommentVNode as V, normalizeClass as K, unref as P, toDisplayString as W, ref as S, onMounted as q, onBeforeUnmount as N } from "vue";
|
|
5
5
|
import "@babylonjs/loaders/glTF";
|
|
6
|
-
import { cloneDeep as
|
|
7
|
-
import { useResizeObserver as
|
|
8
|
-
import { Engine as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
...te,
|
|
6
|
+
import { cloneDeep as c, isEqual as g } from "lodash";
|
|
7
|
+
import { useResizeObserver as J } from "@vueuse/core";
|
|
8
|
+
import { Engine as Y, Scene as j, Color4 as y, Color3 as b, DefaultRenderingPipeline as Q, DepthOfFieldEffectBlurLevel as A, Vector3 as v, DirectionalLight as X, ShadowGenerator as Z, Tools as G, SceneLoader as $ } from "@babylonjs/core";
|
|
9
|
+
const O = { class: "zerov-widget" }, ee = z({ name: "zv-commons-product-model" }), re = /* @__PURE__ */ z({
|
|
10
|
+
...ee,
|
|
12
11
|
props: {
|
|
13
12
|
basicOption: {},
|
|
14
13
|
basicEvents: {},
|
|
@@ -18,10 +17,10 @@ const ie = { class: "zerov-widget" }, te = k({ name: "zv-commons-product-model"
|
|
|
18
17
|
"on-load-success",
|
|
19
18
|
"on-play-animation"
|
|
20
19
|
],
|
|
21
|
-
setup(h, { expose: l, emit:
|
|
22
|
-
const x =
|
|
23
|
-
const u =
|
|
24
|
-
class
|
|
20
|
+
setup(h, { expose: l, emit: m }) {
|
|
21
|
+
const x = m, o = h, T = (i, s) => {
|
|
22
|
+
const u = S(), w = S(), E = S(!0);
|
|
23
|
+
class k {
|
|
25
24
|
// eslint-disable-next-line no-useless-constructor
|
|
26
25
|
constructor(e) {
|
|
27
26
|
// optional, but needed due to interface definitions
|
|
@@ -29,13 +28,13 @@ const ie = { class: "zerov-widget" }, te = k({ name: "zv-commons-product-model"
|
|
|
29
28
|
this.loadingUIText = e;
|
|
30
29
|
}
|
|
31
30
|
displayLoadingUI() {
|
|
32
|
-
u.value && (
|
|
31
|
+
u.value && (E.value = !0);
|
|
33
32
|
}
|
|
34
33
|
hideLoadingUI() {
|
|
35
|
-
u.value && (
|
|
34
|
+
u.value && (E.value = !1);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
class
|
|
37
|
+
class M {
|
|
39
38
|
constructor(e, t, n) {
|
|
40
39
|
d(this, "scene");
|
|
41
40
|
d(this, "engine");
|
|
@@ -48,46 +47,46 @@ const ie = { class: "zerov-widget" }, te = k({ name: "zv-commons-product-model"
|
|
|
48
47
|
d(this, "defaultPipeline");
|
|
49
48
|
this.canvas = e, this.option = t, this.events = n;
|
|
50
49
|
try {
|
|
51
|
-
this.engine = new
|
|
50
|
+
this.engine = new Y(this.canvas, !0, {}, !1), this.engine.loadingScreen = new k(""), window.addEventListener("resize", () => {
|
|
52
51
|
this.engine.resize();
|
|
53
52
|
}), this.scene = this.createScene();
|
|
54
53
|
} catch {
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
createScene() {
|
|
58
|
-
return this.engine.displayLoadingUI(), this.scene = new
|
|
57
|
+
return this.engine.displayLoadingUI(), this.scene = new j(this.engine), this.option.scene.colorShow ? this.scene.clearColor = y.FromHexString(this.option.scene.color || "#000000") : this.scene.clearColor = new y(0, 0, 0, 0), this.scene.fogEnabled = this.option.scene.fogEnabled, this.scene.fogMode = this.option.scene.fogMode || 1, this.scene.fogColor = b.FromHexString(this.option.scene.fogColor || "#ffffff"), this.scene.fogEnd = this.option.scene.fogEnd || 60, this.scene.fogStart = this.option.scene.fogStart || 1, this.scene.fogDensity = this.option.scene.fogDensity || 0.1, this.scene.createDefaultCamera(!0, !1, !0), this.updateMeshs(this.scene), this.scene;
|
|
59
58
|
}
|
|
60
59
|
updateScenePipeline(e) {
|
|
61
|
-
this.scene.activeCamera && e && (e.enabled ? (this.defaultPipeline || (this.defaultPipeline = new
|
|
60
|
+
this.scene.activeCamera && e && (e.enabled ? (this.defaultPipeline || (this.defaultPipeline = new Q(
|
|
62
61
|
"defaultPipeline",
|
|
63
62
|
!0,
|
|
64
63
|
this.scene,
|
|
65
64
|
[this.scene.activeCamera]
|
|
66
|
-
)), this.defaultPipeline.samples = e.samples ? 4 : 1, this.defaultPipeline.fxaaEnabled = e.fxaaEnabled, this.defaultPipeline.grainEnabled = e.grainEnabled, this.defaultPipeline.grain.intensity = e.grainIntensity, this.defaultPipeline.grain.animated = e.grainAnimated, this.defaultPipeline.bloomEnabled = e.bloomEnabled, this.defaultPipeline.bloomThreshold = e.bloomThreshold, this.defaultPipeline.bloomWeight = e.bloomWeight, this.defaultPipeline.bloomKernel = e.bloomKernel, this.defaultPipeline.bloomScale = e.bloomScale, this.defaultPipeline.depthOfFieldEnabled = e.depthOfFieldEnabled, e.depthOfFieldBlurLevel < 1 ? this.defaultPipeline.depthOfFieldBlurLevel =
|
|
65
|
+
)), this.defaultPipeline.samples = e.samples ? 4 : 1, this.defaultPipeline.fxaaEnabled = e.fxaaEnabled, this.defaultPipeline.grainEnabled = e.grainEnabled, this.defaultPipeline.grain.intensity = e.grainIntensity, this.defaultPipeline.grain.animated = e.grainAnimated, this.defaultPipeline.bloomEnabled = e.bloomEnabled, this.defaultPipeline.bloomThreshold = e.bloomThreshold, this.defaultPipeline.bloomWeight = e.bloomWeight, this.defaultPipeline.bloomKernel = e.bloomKernel, this.defaultPipeline.bloomScale = e.bloomScale, this.defaultPipeline.depthOfFieldEnabled = e.depthOfFieldEnabled, e.depthOfFieldBlurLevel < 1 ? this.defaultPipeline.depthOfFieldBlurLevel = A.Low : e.depthOfFieldBlurLevel < 2 ? this.defaultPipeline.depthOfFieldBlurLevel = A.Medium : e.depthOfFieldBlurLevel < 3 && (this.defaultPipeline.depthOfFieldBlurLevel = A.High), this.defaultPipeline.depthOfField.focusDistance = e.depthOfFieldFocusDistance, this.defaultPipeline.depthOfField.fStop = e.depthOfFieldFStop, this.defaultPipeline.depthOfField.focalLength = e.depthOfFieldFocalLength, this.defaultPipeline.chromaticAberrationEnabled = e.chromaticAberrationEnabled, this.defaultPipeline.chromaticAberration.aberrationAmount = e.chromaticAberrationAberrationAmount, this.defaultPipeline.chromaticAberration.radialIntensity = e.chromaticAberrationRadialIntensity, e.chromaticAberrationDirection === 0 ? (this.defaultPipeline.chromaticAberration.direction.x = 0, this.defaultPipeline.chromaticAberration.direction.y = 0) : (this.defaultPipeline.chromaticAberration.direction.x = Math.sin(e.chromaticAberrationDirection), this.defaultPipeline.chromaticAberration.direction.y = Math.cos(e.chromaticAberrationDirection)), this.defaultPipeline.sharpenEnabled = e.sharpenEnabled, this.defaultPipeline.sharpen.edgeAmount = e.sharpenEdgeAmount, this.defaultPipeline.sharpen.colorAmount = e.sharpenColorAmount) : this.defaultPipeline && (this.defaultPipeline.dispose(), this.defaultPipeline = null));
|
|
67
66
|
}
|
|
68
67
|
updateScene(e) {
|
|
69
|
-
e.colorShow ? this.scene.clearColor =
|
|
68
|
+
e.colorShow ? this.scene.clearColor = y.FromHexString(e.color || "#000000") : this.scene.clearColor = new y(0, 0, 0, 0), this.scene.fogEnabled = e.fogEnabled, this.scene.fogMode = e.fogMode || 1, this.scene.fogColor = b.FromHexString(e.fogColor || "#ffffff"), this.scene.fogEnd = e.fogEnd || 60, this.scene.fogStart = e.fogStart || 1, this.scene.fogDensity = e.fogDensity || 0.1;
|
|
70
69
|
}
|
|
71
70
|
updateShadowsLight(e) {
|
|
72
71
|
if (e.show) {
|
|
73
72
|
if (this.shadowsLight) {
|
|
74
|
-
this.shadowsLight.direction = new v(...e.direction), this.shadowsLight.position = new v(...e.position), this.shadowsLight.intensity = e.intensity, this.shadowsLight.diffuse =
|
|
73
|
+
this.shadowsLight.direction = new v(...e.direction), this.shadowsLight.position = new v(...e.position), this.shadowsLight.intensity = e.intensity, this.shadowsLight.diffuse = b.FromHexString(e.diffuse || "#ffffff"), this.shadowGenerator.mapSize = e.mapSize;
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
this.shadowsLight = new
|
|
76
|
+
this.shadowsLight = new X("shadowsLight", new v(...e.direction), this.scene), this.shadowsLight.intensity = e.intensity || 0.6, this.shadowsLight.diffuse = b.FromHexString(e.diffuse || "#ffffff"), this.shadowsLight.position = new v(...e.position), this.shadowGenerator = new Z(e.mapSize, this.shadowsLight);
|
|
78
77
|
} else
|
|
79
78
|
this.shadowsLight && (this.shadowsLight.dispose(), this.shadowsLight = null);
|
|
80
79
|
}
|
|
81
80
|
updateCamera(e) {
|
|
82
81
|
const t = this.scene.activeCamera;
|
|
83
|
-
t && (e.radius && (t.radius = e.radius), t.beta =
|
|
82
|
+
t && (e.radius && (t.radius = e.radius), t.beta = G.ToRadians(e.beta), t.alpha = G.ToRadians(e.alpha), t.useAutoRotationBehavior = e.autoRotation, t.wheelDeltaPercentage = e.wheelDeltaPercentage || 0.01, t.panningSensibility = 1 / (e.panningSensibility || 0.01), t.lowerRadiusLimit = e.lowerRadiusLimit, t.upperRadiusLimit = e.upperRadiusLimit, t.lowerBetaLimit = 0, t.upperBetaLimit = Math.PI / 2.1);
|
|
84
83
|
}
|
|
85
84
|
updateDefaultEnvironment(e) {
|
|
86
85
|
this.environmentHelper && this.environmentHelper.dispose(), this.environmentHelper = this.scene.createDefaultEnvironment({
|
|
87
86
|
// 是否创建地面
|
|
88
87
|
createGround: e.createGround,
|
|
89
88
|
// 地面颜色
|
|
90
|
-
groundColor:
|
|
89
|
+
groundColor: b.FromHexString(e.groundColor || "#ffffff"),
|
|
91
90
|
// 地面大小
|
|
92
91
|
groundSize: e.groundSize || 15,
|
|
93
92
|
// 地面透明度
|
|
@@ -127,8 +126,8 @@ const ie = { class: "zerov-widget" }, te = k({ name: "zv-commons-product-model"
|
|
|
127
126
|
}), this.environmentHelper.ground && (this.environmentHelper.ground.position.y += 0.01);
|
|
128
127
|
}
|
|
129
128
|
updateMeshs(e) {
|
|
130
|
-
e.meshes.forEach((t) => setTimeout(() => t.dispose())),
|
|
131
|
-
|
|
129
|
+
e.meshes.forEach((t) => setTimeout(() => t.dispose())), $.ImportMeshAsync("", this.option.meshs.url, "", e, (t) => {
|
|
130
|
+
w.value = (t.loaded / t.total * 100).toFixed(2);
|
|
132
131
|
}).then((t) => {
|
|
133
132
|
const n = t.meshes;
|
|
134
133
|
if (this.option.animationGroups = e.animationGroups.map((r) => ({
|
|
@@ -169,71 +168,71 @@ const ie = { class: "zerov-widget" }, te = k({ name: "zv-commons-product-model"
|
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
|
-
const p =
|
|
173
|
-
return
|
|
174
|
-
i.meshs && (p.value = new
|
|
171
|
+
const p = S();
|
|
172
|
+
return q(() => {
|
|
173
|
+
i.meshs && (p.value = new M(u.value, i, s).run(), J(u.value, (R) => {
|
|
175
174
|
p.value && p.value.engine.resize();
|
|
176
175
|
}));
|
|
177
|
-
}),
|
|
176
|
+
}), N(() => {
|
|
178
177
|
p.value && p.value.dispose();
|
|
179
178
|
}), {
|
|
180
179
|
canvasRef: u,
|
|
181
180
|
babylon: p,
|
|
182
|
-
Babylon:
|
|
183
|
-
babylonLoadingStatus:
|
|
184
|
-
babylonLoadingTitle:
|
|
181
|
+
Babylon: M,
|
|
182
|
+
babylonLoadingStatus: E,
|
|
183
|
+
babylonLoadingTitle: w
|
|
185
184
|
};
|
|
186
|
-
}, { canvasRef:
|
|
185
|
+
}, { canvasRef: L, babylon: a, Babylon: C, babylonLoadingStatus: F, babylonLoadingTitle: H } = T(o.basicOption, o.basicEvents);
|
|
187
186
|
return l({
|
|
188
187
|
playAnimation: (i, s) => {
|
|
189
|
-
const u = i[0].value,
|
|
188
|
+
const u = i[0].value, w = {
|
|
190
189
|
loop: i[1].keys[0].defaultValue,
|
|
191
190
|
speedRatio: i[1].keys[1].defaultValue
|
|
192
191
|
};
|
|
193
|
-
a.value.playAnimation(u,
|
|
192
|
+
a.value.playAnimation(u, w);
|
|
194
193
|
}
|
|
195
|
-
}),
|
|
196
|
-
!
|
|
194
|
+
}), f(() => c(o.basicOption.environment), (i, s) => {
|
|
195
|
+
!g(i, s) && a.value && a.value.updateDefaultEnvironment(i);
|
|
197
196
|
}, {
|
|
198
197
|
deep: !0
|
|
199
|
-
}),
|
|
200
|
-
!
|
|
198
|
+
}), f(() => c(o.basicOption.shadow), (i, s) => {
|
|
199
|
+
!g(i, s) && a.value && a.value.updateShadowsLight(i);
|
|
201
200
|
}, {
|
|
202
201
|
deep: !0
|
|
203
|
-
}),
|
|
204
|
-
!
|
|
202
|
+
}), f(() => c(o.basicOption.camera), (i, s) => {
|
|
203
|
+
!g(i, s) && a.value && a.value.updateCamera(i);
|
|
205
204
|
}, {
|
|
206
205
|
deep: !0
|
|
207
|
-
}),
|
|
208
|
-
!
|
|
206
|
+
}), f(() => c(o.basicOption.meshs), (i, s) => {
|
|
207
|
+
!g(i, s) && a.value && (a.value.dispose(), a.value = new C(L.value, o.basicOption, o.basicEvents).run());
|
|
209
208
|
}, {
|
|
210
209
|
deep: !0
|
|
211
|
-
}),
|
|
212
|
-
!
|
|
210
|
+
}), f(() => c(o.basicOption.defaultAnimation), (i, s) => {
|
|
211
|
+
!g(i, s) && a.value && (a.value.dispose(), a.value = new C(L.value, o.basicOption, o.basicEvents).run());
|
|
213
212
|
}, {
|
|
214
213
|
deep: !0
|
|
215
|
-
}),
|
|
216
|
-
!
|
|
214
|
+
}), f(() => c(o.basicOption.scene), (i, s) => {
|
|
215
|
+
!g(i, s) && a.value && a.value.updateScene(i);
|
|
217
216
|
}, {
|
|
218
217
|
deep: !0
|
|
219
|
-
}),
|
|
220
|
-
!
|
|
218
|
+
}), f(() => c(o.basicOption.pipelineOption), (i, s) => {
|
|
219
|
+
!g(i, s) && a.value && a.value.updateScenePipeline(i);
|
|
221
220
|
}, {
|
|
222
221
|
deep: !0
|
|
223
|
-
}), (i, s) => (
|
|
224
|
-
|
|
222
|
+
}), (i, s) => (D(), B("div", O, [
|
|
223
|
+
U("canvas", {
|
|
225
224
|
ref_key: "canvasRef",
|
|
226
|
-
ref:
|
|
227
|
-
class:
|
|
225
|
+
ref: L,
|
|
226
|
+
class: K(["widget", { show: !P(F) }])
|
|
228
227
|
}, null, 2),
|
|
229
|
-
|
|
228
|
+
P(F) ? (D(), B("div", {
|
|
230
229
|
key: 0,
|
|
231
230
|
ref: "babylonLoadingRef",
|
|
232
231
|
class: "babylon-loading"
|
|
233
|
-
}, " 正在加载模型...(" +
|
|
232
|
+
}, " 正在加载模型...(" + W(P(H)) + "%) ", 513)) : V("", !0)
|
|
234
233
|
]));
|
|
235
234
|
}
|
|
236
235
|
});
|
|
237
236
|
export {
|
|
238
|
-
|
|
237
|
+
re as default
|
|
239
238
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2f6cb8d6"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as default
|
|
7
7
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var v = (f, u,
|
|
4
|
-
import { defineComponent as
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var k = (f, u, g) => u in f ? U(f, u, { enumerable: !0, configurable: !0, writable: !0, value: g }) : f[u] = g;
|
|
3
|
+
var v = (f, u, g) => k(f, typeof u != "symbol" ? u + "" : u, g);
|
|
4
|
+
import { defineComponent as I, watch as r, createElementBlock as T, openBlock as M, createElementVNode as q, createCommentVNode as N, normalizeClass as V, unref as E, toDisplayString as K, ref as L, onMounted as J, onBeforeUnmount as Z } from "vue";
|
|
5
5
|
import "@babylonjs/loaders/glTF";
|
|
6
|
-
import { cloneDeep as
|
|
7
|
-
import { Vector3 as c, Engine as
|
|
8
|
-
import { useResizeObserver as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
...ae,
|
|
6
|
+
import { cloneDeep as d, isEqual as h } from "lodash";
|
|
7
|
+
import { Vector3 as c, Engine as j, Scene as Q, Color4 as P, Color3 as y, DefaultRenderingPipeline as X, DepthOfFieldEffectBlurLevel as R, ArcRotateCamera as Y, Tools as S, HemisphericLight as $, DirectionalLight as O, PointLight as ee, SceneLoader as ie } from "@babylonjs/core";
|
|
8
|
+
import { useResizeObserver as te } from "@vueuse/core";
|
|
9
|
+
const se = { class: "zerov-widget" }, oe = I({ name: "zv-commons-three-loader" }), ce = /* @__PURE__ */ I({
|
|
10
|
+
...oe,
|
|
12
11
|
props: {
|
|
13
12
|
basicOption: {},
|
|
14
13
|
basicEvents: {},
|
|
@@ -18,10 +17,10 @@ const ne = { class: "zerov-widget" }, ae = _({ name: "zv-commons-three-loader" }
|
|
|
18
17
|
"on-load-success",
|
|
19
18
|
"on-play-animation"
|
|
20
19
|
],
|
|
21
|
-
setup(f, { expose: u, emit:
|
|
22
|
-
const x =
|
|
23
|
-
const
|
|
24
|
-
class
|
|
20
|
+
setup(f, { expose: u, emit: g }) {
|
|
21
|
+
const x = g, a = f, H = (t, n) => {
|
|
22
|
+
const b = L(), B = L(), A = L(!0);
|
|
23
|
+
class W {
|
|
25
24
|
// eslint-disable-next-line no-useless-constructor
|
|
26
25
|
constructor(e) {
|
|
27
26
|
// optional, but needed due to interface definitions
|
|
@@ -29,13 +28,13 @@ const ne = { class: "zerov-widget" }, ae = _({ name: "zv-commons-three-loader" }
|
|
|
29
28
|
this.loadingUIText = e;
|
|
30
29
|
}
|
|
31
30
|
displayLoadingUI() {
|
|
32
|
-
|
|
31
|
+
b.value && (A.value = !0);
|
|
33
32
|
}
|
|
34
33
|
hideLoadingUI() {
|
|
35
|
-
|
|
34
|
+
b.value && (A.value = !1);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
class
|
|
37
|
+
class D {
|
|
39
38
|
constructor(e, s, i) {
|
|
40
39
|
v(this, "scene");
|
|
41
40
|
v(this, "engine");
|
|
@@ -43,17 +42,17 @@ const ne = { class: "zerov-widget" }, ae = _({ name: "zv-commons-three-loader" }
|
|
|
43
42
|
v(this, "defaultPipeline");
|
|
44
43
|
this.canvas = e, this.option = s, this.events = i;
|
|
45
44
|
try {
|
|
46
|
-
this.engine = new
|
|
45
|
+
this.engine = new j(this.canvas, !0, {}, !1), this.engine.loadingScreen = new W(""), window.addEventListener("resize", () => {
|
|
47
46
|
this.engine.resize();
|
|
48
47
|
}), this.scene = this.createScene();
|
|
49
48
|
} catch {
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
createScene() {
|
|
53
|
-
return this.scene = new
|
|
52
|
+
return this.scene = new Q(this.engine), this.option.scene.colorShow ? this.scene.clearColor = P.FromHexString(this.option.scene.color || "#000000") : this.scene.clearColor = new P(0, 0, 0, 0), this.scene.fogEnabled = this.option.scene.fogEnabled, this.scene.fogMode = this.option.scene.fogMode || 1, this.scene.fogColor = y.FromHexString(this.option.scene.fogColor || "#ffffff"), this.scene.fogEnd = this.option.scene.fogEnd || 60, this.scene.fogStart = this.option.scene.fogStart || 1, this.scene.fogDensity = this.option.scene.fogDensity || 0.1, this.createCamera(this.option.camera, this.scene), this.createLights(this.option.lights, this.scene), this.createMeshs(this.scene), this.scene;
|
|
54
53
|
}
|
|
55
54
|
updateScenePipeline(e) {
|
|
56
|
-
this.scene.activeCamera && e && (e.enabled ? (this.defaultPipeline || (this.defaultPipeline = new
|
|
55
|
+
this.scene.activeCamera && e && (e.enabled ? (this.defaultPipeline || (this.defaultPipeline = new X(
|
|
57
56
|
"defaultPipeline",
|
|
58
57
|
!0,
|
|
59
58
|
this.scene,
|
|
@@ -61,15 +60,15 @@ const ne = { class: "zerov-widget" }, ae = _({ name: "zv-commons-three-loader" }
|
|
|
61
60
|
)), this.defaultPipeline.samples = e.samples ? 4 : 1, this.defaultPipeline.fxaaEnabled = e.fxaaEnabled, this.defaultPipeline.grainEnabled = e.grainEnabled, this.defaultPipeline.grain.intensity = e.grainIntensity, this.defaultPipeline.grain.animated = e.grainAnimated, this.defaultPipeline.bloomEnabled = e.bloomEnabled, this.defaultPipeline.bloomThreshold = e.bloomThreshold, this.defaultPipeline.bloomWeight = e.bloomWeight, this.defaultPipeline.bloomKernel = e.bloomKernel, this.defaultPipeline.bloomScale = e.bloomScale, this.defaultPipeline.depthOfFieldEnabled = e.depthOfFieldEnabled, e.depthOfFieldBlurLevel < 1 ? this.defaultPipeline.depthOfFieldBlurLevel = R.Low : e.depthOfFieldBlurLevel < 2 ? this.defaultPipeline.depthOfFieldBlurLevel = R.Medium : e.depthOfFieldBlurLevel < 3 && (this.defaultPipeline.depthOfFieldBlurLevel = R.High), this.defaultPipeline.depthOfField.focusDistance = e.depthOfFieldFocusDistance, this.defaultPipeline.depthOfField.fStop = e.depthOfFieldFStop, this.defaultPipeline.depthOfField.focalLength = e.depthOfFieldFocalLength, this.defaultPipeline.chromaticAberrationEnabled = e.chromaticAberrationEnabled, this.defaultPipeline.chromaticAberration.aberrationAmount = e.chromaticAberrationAberrationAmount, this.defaultPipeline.chromaticAberration.radialIntensity = e.chromaticAberrationRadialIntensity, e.chromaticAberrationDirection === 0 ? (this.defaultPipeline.chromaticAberration.direction.x = 0, this.defaultPipeline.chromaticAberration.direction.y = 0) : (this.defaultPipeline.chromaticAberration.direction.x = Math.sin(e.chromaticAberrationDirection), this.defaultPipeline.chromaticAberration.direction.y = Math.cos(e.chromaticAberrationDirection)), this.defaultPipeline.sharpenEnabled = e.sharpenEnabled, this.defaultPipeline.sharpen.edgeAmount = e.sharpenEdgeAmount, this.defaultPipeline.sharpen.colorAmount = e.sharpenColorAmount) : this.defaultPipeline && (this.defaultPipeline.dispose(), this.defaultPipeline = null));
|
|
62
61
|
}
|
|
63
62
|
updateScene(e) {
|
|
64
|
-
e.colorShow ? this.scene.clearColor =
|
|
63
|
+
e.colorShow ? this.scene.clearColor = P.FromHexString(e.color || "#000000") : this.scene.clearColor = new P(0, 0, 0, 0), this.scene.fogEnabled = e.fogEnabled, this.scene.fogMode = e.fogMode || 1, this.scene.fogColor = y.FromHexString(e.fogColor || "#ffffff"), this.scene.fogEnd = e.fogEnd || 60, this.scene.fogStart = e.fogStart || 1, this.scene.fogDensity = e.fogDensity || 0.1;
|
|
65
64
|
}
|
|
66
65
|
createCamera(e, s) {
|
|
67
|
-
const i = new
|
|
68
|
-
i.attachControl(
|
|
66
|
+
const i = new Y("", S.ToRadians(e.alpha || 90), S.ToRadians(e.beta || 75), e.radius || 1, new c(...e.target), s);
|
|
67
|
+
i.attachControl(b.value, !0), i.useAutoRotationBehavior = e.autoRotation, i.wheelDeltaPercentage = e.wheelDeltaPercentage || 0.01, i.zoomToMouseLocation = e.zoomToMouseLocation, i.lowerRadiusLimit = e.lowerRadiusLimit, i.upperRadiusLimit = e.upperRadiusLimit, i.minZ = 0.01;
|
|
69
68
|
}
|
|
70
69
|
updateCamera(e) {
|
|
71
70
|
const s = this.scene.activeCamera;
|
|
72
|
-
s && (e.radius && (s.radius = e.radius), s.beta =
|
|
71
|
+
s && (e.radius && (s.radius = e.radius), s.beta = S.ToRadians(e.beta), s.alpha = S.ToRadians(e.alpha), s.useAutoRotationBehavior = e.autoRotation, s.zoomToMouseLocation = e.zoomToMouseLocation, s.wheelDeltaPercentage = e.wheelDeltaPercentage || 0.01, s.lowerRadiusLimit = e.lowerRadiusLimit, s.upperRadiusLimit = e.upperRadiusLimit, s.target = new c(...e.target));
|
|
73
72
|
}
|
|
74
73
|
createLights(e, s) {
|
|
75
74
|
this.scene && this.scene.lights && this.scene.lights.forEach((i, l) => {
|
|
@@ -79,23 +78,23 @@ const ne = { class: "zerov-widget" }, ae = _({ name: "zv-commons-three-loader" }
|
|
|
79
78
|
}), setTimeout(() => {
|
|
80
79
|
e.forEach((i) => {
|
|
81
80
|
if (i.type === "HemisphericLight") {
|
|
82
|
-
const l = new
|
|
83
|
-
l.intensity = i.intensity !== void 0 ? i.intensity : 0.5, l.groundColor =
|
|
81
|
+
const l = new $("", new c(...i.direction), s);
|
|
82
|
+
l.intensity = i.intensity !== void 0 ? i.intensity : 0.5, l.groundColor = y.FromHexString(i.groundColor || "#ffffff"), l.diffuse = y.FromHexString(i.diffuse || "#ffffff");
|
|
84
83
|
}
|
|
85
84
|
if (i.type === "DirectionalLight") {
|
|
86
|
-
const l = new
|
|
87
|
-
l.intensity = i.intensity !== void 0 ? i.intensity : 0.5, l.diffuse =
|
|
85
|
+
const l = new O("", new c(...i.direction), s);
|
|
86
|
+
l.intensity = i.intensity !== void 0 ? i.intensity : 0.5, l.diffuse = y.FromHexString(i.diffuse || "#ffffff");
|
|
88
87
|
}
|
|
89
88
|
if (i.type === "PointLight") {
|
|
90
|
-
const l = new
|
|
91
|
-
l.intensity = i.intensity !== void 0 ? i.intensity : 0.5, l.diffuse =
|
|
89
|
+
const l = new ee("", new c(...i.position), s);
|
|
90
|
+
l.intensity = i.intensity !== void 0 ? i.intensity : 0.5, l.diffuse = y.FromHexString(i.diffuse || "#ffffff");
|
|
92
91
|
}
|
|
93
92
|
});
|
|
94
93
|
});
|
|
95
94
|
}
|
|
96
95
|
createMeshs(e) {
|
|
97
|
-
e.meshes.forEach((s) => setTimeout(() => s.dispose())),
|
|
98
|
-
|
|
96
|
+
e.meshes.forEach((s) => setTimeout(() => s.dispose())), ie.ImportMeshAsync("", this.option.meshs.url, "", e, (s) => {
|
|
97
|
+
B.value = (s.loaded / s.total * 100).toFixed(2);
|
|
99
98
|
}).then((s) => {
|
|
100
99
|
this.meshe = s.meshes, this.updateScenePipeline(this.option.pipelineOption), this.option.animationGroups = e.animationGroups.map((i) => ({
|
|
101
100
|
uniqueId: i.uniqueId,
|
|
@@ -113,14 +112,14 @@ const ne = { class: "zerov-widget" }, ae = _({ name: "zv-commons-three-loader" }
|
|
|
113
112
|
}
|
|
114
113
|
setMeshSize(e) {
|
|
115
114
|
if (e.autoSize) {
|
|
116
|
-
const i = this.meshe[0].getBoundingInfo().boundingBox,
|
|
115
|
+
const i = this.meshe[0].getBoundingInfo().boundingBox, p = 0.7 / (Math.max(
|
|
117
116
|
i.maximumWorld.x - i.minimumWorld.x,
|
|
118
117
|
i.maximumWorld.y - i.minimumWorld.y,
|
|
119
118
|
i.maximumWorld.z - i.minimumWorld.z
|
|
120
119
|
) || 1);
|
|
121
|
-
this.meshe[0].scaling = new c(
|
|
122
|
-
const
|
|
123
|
-
this.meshe[0].position = this.meshe[0].position.subtract(
|
|
120
|
+
this.meshe[0].scaling = new c(p, p, p);
|
|
121
|
+
const G = i.centerWorld;
|
|
122
|
+
this.meshe[0].position = this.meshe[0].position.subtract(G.multiplyByFloats(p, p, p)), this.meshe[0].rotation = new c(0, 0, 0);
|
|
124
123
|
} else {
|
|
125
124
|
const { position: s, scaling: i, rotation: l } = e;
|
|
126
125
|
this.meshe[0].position.set(s[0] || 0, s[1] || 0, s[2] || 0), this.meshe[0].scaling.set(i[0] || 1, i[1] || 1, i[2] || 1), this.meshe[0].rotation = new c(l[0] || 0, l[1] || 0, l[2] || 0);
|
|
@@ -143,79 +142,79 @@ const ne = { class: "zerov-widget" }, ae = _({ name: "zv-commons-three-loader" }
|
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
|
-
const m =
|
|
147
|
-
return
|
|
148
|
-
t.meshs && (m.value = new
|
|
145
|
+
const m = L();
|
|
146
|
+
return J(() => {
|
|
147
|
+
t.meshs && (m.value = new D(b.value, t, n).run(), te(b.value, (z) => {
|
|
149
148
|
m.value && m.value.engine.resize();
|
|
150
149
|
}));
|
|
151
|
-
}),
|
|
150
|
+
}), Z(() => {
|
|
152
151
|
m.value && (m.value.dispose(), m.value.meshe = []);
|
|
153
152
|
}), {
|
|
154
|
-
canvasRef:
|
|
153
|
+
canvasRef: b,
|
|
155
154
|
babylon: m,
|
|
156
|
-
Babylon:
|
|
157
|
-
babylonLoadingStatus:
|
|
158
|
-
babylonLoadingTitle:
|
|
155
|
+
Babylon: D,
|
|
156
|
+
babylonLoadingStatus: A,
|
|
157
|
+
babylonLoadingTitle: B
|
|
159
158
|
};
|
|
160
|
-
}, { canvasRef:
|
|
159
|
+
}, { canvasRef: w, babylon: o, Babylon: C, babylonLoadingStatus: F, babylonLoadingTitle: _ } = H(a.basicOption, a.basicEvents);
|
|
161
160
|
return u({
|
|
162
161
|
playAnimation: (t, n) => {
|
|
163
162
|
o.value.playAnimation(t, n);
|
|
164
163
|
}
|
|
165
|
-
}), r(() =>
|
|
166
|
-
!
|
|
164
|
+
}), r(() => d(a.basicOption.camera), (t, n) => {
|
|
165
|
+
!h(t, n) && o.value && o.value.updateCamera(t);
|
|
167
166
|
}, {
|
|
168
167
|
deep: !0
|
|
169
|
-
}), r(() =>
|
|
170
|
-
!
|
|
168
|
+
}), r(() => d(a.basicOption.scene), (t, n) => {
|
|
169
|
+
!h(t, n) && o.value && o.value.updateScene(t);
|
|
171
170
|
}, {
|
|
172
171
|
deep: !0
|
|
173
|
-
}), r(() =>
|
|
174
|
-
!
|
|
172
|
+
}), r(() => d(a.basicOption.lights), (t, n) => {
|
|
173
|
+
!h(t, n) && o.value && o.value.createLights(t, o.value.scene);
|
|
175
174
|
}, {
|
|
176
175
|
deep: !0
|
|
177
|
-
}), r(() =>
|
|
178
|
-
!
|
|
176
|
+
}), r(() => d(a.basicOption.meshs.url), (t, n) => {
|
|
177
|
+
!h(t, n) && o.value && (o.value.dispose(), o.value = new C(w.value, a.basicOption, a.basicEvents).run());
|
|
179
178
|
}, {
|
|
180
179
|
deep: !0
|
|
181
|
-
}), r(() =>
|
|
182
|
-
!
|
|
180
|
+
}), r(() => d(a.basicOption.meshs.position), (t, n) => {
|
|
181
|
+
!h(t, n) && o.value && o.value.meshe[0] && o.value.meshe[0].position.set(t[0], t[1], t[2]);
|
|
183
182
|
}, {
|
|
184
183
|
deep: !0
|
|
185
|
-
}), r(() =>
|
|
186
|
-
!
|
|
184
|
+
}), r(() => d(a.basicOption.meshs.scaling), (t, n) => {
|
|
185
|
+
!h(t, n) && o.value && o.value.meshe[0] && o.value.meshe[0].scaling.set(t[0], t[1], t[2]);
|
|
187
186
|
}, {
|
|
188
187
|
deep: !0
|
|
189
|
-
}), r(() =>
|
|
190
|
-
!
|
|
188
|
+
}), r(() => d(a.basicOption.meshs.rotation), (t, n) => {
|
|
189
|
+
!h(t, n) && o.value && o.value.meshe[0] && (o.value.meshe[0].rotation = new c(t[0], t[1], t[2]));
|
|
191
190
|
}, {
|
|
192
191
|
deep: !0
|
|
193
|
-
}), r(() =>
|
|
194
|
-
!
|
|
192
|
+
}), r(() => d(a.basicOption.meshs.autoSize), (t, n) => {
|
|
193
|
+
!h(t, n) && o.value && o.value.meshe[0] && o.value.setMeshSize(a.basicOption.meshs);
|
|
195
194
|
}, {
|
|
196
195
|
deep: !0
|
|
197
|
-
}), r(() =>
|
|
198
|
-
!
|
|
196
|
+
}), r(() => d(a.basicOption.defaultAnimation), (t, n) => {
|
|
197
|
+
!h(t, n) && o.value && (o.value.dispose(), o.value = new C(w.value, a.basicOption, a.basicEvents).run());
|
|
199
198
|
}, {
|
|
200
199
|
deep: !0
|
|
201
|
-
}), r(() =>
|
|
202
|
-
!
|
|
200
|
+
}), r(() => d(a.basicOption.pipelineOption), (t, n) => {
|
|
201
|
+
!h(t, n) && o.value && o.value.updateScenePipeline(t);
|
|
203
202
|
}, {
|
|
204
203
|
deep: !0
|
|
205
|
-
}), (t, n) => (
|
|
206
|
-
|
|
204
|
+
}), (t, n) => (M(), T("div", se, [
|
|
205
|
+
q("canvas", {
|
|
207
206
|
ref_key: "canvasRef",
|
|
208
|
-
ref:
|
|
209
|
-
class:
|
|
207
|
+
ref: w,
|
|
208
|
+
class: V(["widget", { show: !E(F) }])
|
|
210
209
|
}, null, 2),
|
|
211
|
-
|
|
210
|
+
E(F) ? (M(), T("div", {
|
|
212
211
|
key: 0,
|
|
213
212
|
ref: "babylonLoadingRef",
|
|
214
213
|
class: "babylon-loading"
|
|
215
|
-
}, " 正在加载模型...(" +
|
|
214
|
+
}, " 正在加载模型...(" + K(E(_)) + "%) ", 513)) : N("", !0)
|
|
216
215
|
]));
|
|
217
216
|
}
|
|
218
217
|
});
|
|
219
218
|
export {
|
|
220
|
-
|
|
219
|
+
ce as default
|
|
221
220
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a993de78"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|