gl-draw 0.9.0-beta.7 → 0.9.0-beta.71
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/BaseObject.js +1 -1
- package/dist/BaseObject.module.js +16 -11
- package/dist/colorCorrection.js +1 -0
- package/dist/colorCorrection.module.js +25 -0
- package/dist/core/BaseObject.d.ts +1 -0
- package/dist/core/Camera.d.ts +2 -0
- package/dist/core/Composer.d.ts +5 -1
- package/dist/core/Control.d.ts +5 -0
- package/dist/core/Pencil.d.ts +8 -2
- package/dist/core/Renderer.d.ts +10 -7
- package/dist/core/pass/CrossFadePass.d.ts +11 -0
- package/dist/effect/index.js +3 -3
- package/dist/effect/index.module.js +1 -1
- package/dist/events.js +1 -0
- package/dist/events.module.js +234 -0
- package/dist/geojson/china.json +1 -103310
- package/dist/index.js +18 -1
- package/dist/index.module.js +352 -493
- package/dist/objects/conicPolygon/geometry/index.d.ts +11 -12
- package/dist/objects/conicPolygon/index.d.ts +4 -3
- package/dist/objects/extrudePolygon/ExtrudeGeometry.d.ts +4 -1
- package/dist/objects/extrudePolygon/createGeometry.d.ts +17 -1
- package/dist/objects/extrudePolygon/getSplitTexture.d.ts +12 -0
- package/dist/objects/extrudePolygon/getWorkerGeometry.d.ts +17 -1
- package/dist/objects/extrudePolygon/index.d.ts +4 -0
- package/dist/objects/index.d.ts +3 -1
- package/dist/objects/index.js +120 -125
- package/dist/objects/index.module.js +1349 -1011
- package/dist/objects/line/createGeometry.d.ts +5 -5
- package/dist/objects/line/getWorkerGeometry.d.ts +2 -1
- package/dist/objects/line/index.d.ts +8 -25
- package/dist/objects/line/meshLine/MeshLineGeometry.d.ts +40 -0
- package/dist/objects/line/meshLine/MeshLineMaterial.d.ts +48 -0
- package/dist/objects/line/meshLine/index.d.ts +3 -89
- package/dist/objects/line/meshLine/raycast.d.ts +3 -0
- package/dist/plugins/CanvasStream.d.ts +15 -0
- package/dist/plugins/Data.d.ts +1 -0
- package/dist/plugins/Draw.d.ts +3 -0
- package/dist/plugins/Loader/VideoTextureLoader.d.ts +5 -0
- package/dist/plugins/Loader/index.d.ts +36 -0
- package/dist/plugins/Worker.d.ts +2 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +203 -87
- package/dist/utils/colorCorrection.d.ts +13 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.module.js +85 -135
- package/dist/utils/uvGenerator.d.ts +12 -0
- package/dist/uvGenerator.js +1 -1
- package/dist/uvGenerator.module.js +69 -62
- package/dist/worker/extrudePolygon.w.js +661 -400
- package/dist/worker/line.w.js +2 -2
- package/package.json +13 -10
- package/dist/makePromiseCreator.js +0 -1
- package/dist/makePromiseCreator.module.js +0 -24
- package/dist/objects/line/meshLine/shader/fragment.d.ts +0 -2
- package/dist/objects/line/meshLine/shader/vertex.d.ts +0 -2
- package/dist/utils/exception.d.ts +0 -26
- package/dist/utils/makePromiseCreator.d.ts +0 -6
- package/dist/utils/timer.d.ts +0 -9
- package/dist/utils/to.d.ts +0 -8
package/dist/index.module.js
CHANGED
|
@@ -1,306 +1,79 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var V = Object.defineProperty, I = Object.defineProperties;
|
|
2
|
+
var j = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var y = Object.getOwnPropertySymbols;
|
|
4
|
+
var k = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var R = (r, e, t) => e in r ? V(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, v = (r, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
import * as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
7
|
+
k.call(e, t) && R(r, t, e[t]);
|
|
8
|
+
if (y)
|
|
9
|
+
for (var t of y(e))
|
|
10
|
+
H.call(e, t) && R(r, t, e[t]);
|
|
11
|
+
return r;
|
|
12
|
+
}, S = (r, e) => I(r, j(e));
|
|
13
|
+
import * as l from "three";
|
|
14
|
+
import { ShaderMaterial as N, Uniform as z, REVISION as U } from "three";
|
|
15
|
+
import * as M from "@tweenjs/tween.js";
|
|
16
|
+
import { e as W } from "./events.module.js";
|
|
17
|
+
import _ from "deepmerge";
|
|
18
|
+
import X from "three/examples/jsm/libs/stats.module";
|
|
19
|
+
import q from "lil-gui";
|
|
20
|
+
import { T as Q, C as $ } from "./colorCorrection.module.js";
|
|
21
|
+
import { d as Y } from "./disposeMesh.module.js";
|
|
18
22
|
import "idb-keyval";
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import "./
|
|
26
|
-
|
|
27
|
-
get exports() {
|
|
28
|
-
return x;
|
|
29
|
-
},
|
|
30
|
-
set exports(n) {
|
|
31
|
-
x = n;
|
|
32
|
-
}
|
|
33
|
-
}, P = typeof Reflect == "object" ? Reflect : null, j = P && typeof P.apply == "function" ? P.apply : function(e, t, s) {
|
|
34
|
-
return Function.prototype.apply.call(e, t, s);
|
|
35
|
-
}, L;
|
|
36
|
-
P && typeof P.ownKeys == "function" ? L = P.ownKeys : Object.getOwnPropertySymbols ? L = function(e) {
|
|
37
|
-
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
38
|
-
} : L = function(e) {
|
|
39
|
-
return Object.getOwnPropertyNames(e);
|
|
40
|
-
};
|
|
41
|
-
function me(n) {
|
|
42
|
-
console && console.warn && console.warn(n);
|
|
43
|
-
}
|
|
44
|
-
var B = Number.isNaN || function(e) {
|
|
45
|
-
return e !== e;
|
|
46
|
-
};
|
|
47
|
-
function l() {
|
|
48
|
-
l.init.call(this);
|
|
49
|
-
}
|
|
50
|
-
ue.exports = l;
|
|
51
|
-
x.once = Ce;
|
|
52
|
-
l.EventEmitter = l;
|
|
53
|
-
l.prototype._events = void 0;
|
|
54
|
-
l.prototype._eventsCount = 0;
|
|
55
|
-
l.prototype._maxListeners = void 0;
|
|
56
|
-
var D = 10;
|
|
57
|
-
function R(n) {
|
|
58
|
-
if (typeof n != "function")
|
|
59
|
-
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof n);
|
|
60
|
-
}
|
|
61
|
-
Object.defineProperty(l, "defaultMaxListeners", {
|
|
62
|
-
enumerable: !0,
|
|
63
|
-
get: function() {
|
|
64
|
-
return D;
|
|
65
|
-
},
|
|
66
|
-
set: function(n) {
|
|
67
|
-
if (typeof n != "number" || n < 0 || B(n))
|
|
68
|
-
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + n + ".");
|
|
69
|
-
D = n;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
l.init = function() {
|
|
73
|
-
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
74
|
-
};
|
|
75
|
-
l.prototype.setMaxListeners = function(e) {
|
|
76
|
-
if (typeof e != "number" || e < 0 || B(e))
|
|
77
|
-
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
78
|
-
return this._maxListeners = e, this;
|
|
79
|
-
};
|
|
80
|
-
function G(n) {
|
|
81
|
-
return n._maxListeners === void 0 ? l.defaultMaxListeners : n._maxListeners;
|
|
82
|
-
}
|
|
83
|
-
l.prototype.getMaxListeners = function() {
|
|
84
|
-
return G(this);
|
|
85
|
-
};
|
|
86
|
-
l.prototype.emit = function(e) {
|
|
87
|
-
for (var t = [], s = 1; s < arguments.length; s++)
|
|
88
|
-
t.push(arguments[s]);
|
|
89
|
-
var r = e === "error", o = this._events;
|
|
90
|
-
if (o !== void 0)
|
|
91
|
-
r = r && o.error === void 0;
|
|
92
|
-
else if (!r)
|
|
93
|
-
return !1;
|
|
94
|
-
if (r) {
|
|
95
|
-
var i;
|
|
96
|
-
if (t.length > 0 && (i = t[0]), i instanceof Error)
|
|
97
|
-
throw i;
|
|
98
|
-
var a = new Error("Unhandled error." + (i ? " (" + i.message + ")" : ""));
|
|
99
|
-
throw a.context = i, a;
|
|
100
|
-
}
|
|
101
|
-
var c = o[e];
|
|
102
|
-
if (c === void 0)
|
|
103
|
-
return !1;
|
|
104
|
-
if (typeof c == "function")
|
|
105
|
-
j(c, this, t);
|
|
106
|
-
else
|
|
107
|
-
for (var h = c.length, d = H(c, h), s = 0; s < h; ++s)
|
|
108
|
-
j(d[s], this, t);
|
|
109
|
-
return !0;
|
|
110
|
-
};
|
|
111
|
-
function N(n, e, t, s) {
|
|
112
|
-
var r, o, i;
|
|
113
|
-
if (R(t), o = n._events, o === void 0 ? (o = n._events = /* @__PURE__ */ Object.create(null), n._eventsCount = 0) : (o.newListener !== void 0 && (n.emit(
|
|
114
|
-
"newListener",
|
|
115
|
-
e,
|
|
116
|
-
t.listener ? t.listener : t
|
|
117
|
-
), o = n._events), i = o[e]), i === void 0)
|
|
118
|
-
i = o[e] = t, ++n._eventsCount;
|
|
119
|
-
else if (typeof i == "function" ? i = o[e] = s ? [t, i] : [i, t] : s ? i.unshift(t) : i.push(t), r = G(n), r > 0 && i.length > r && !i.warned) {
|
|
120
|
-
i.warned = !0;
|
|
121
|
-
var a = new Error("Possible EventEmitter memory leak detected. " + i.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
122
|
-
a.name = "MaxListenersExceededWarning", a.emitter = n, a.type = e, a.count = i.length, me(a);
|
|
123
|
-
}
|
|
124
|
-
return n;
|
|
125
|
-
}
|
|
126
|
-
l.prototype.addListener = function(e, t) {
|
|
127
|
-
return N(this, e, t, !1);
|
|
128
|
-
};
|
|
129
|
-
l.prototype.on = l.prototype.addListener;
|
|
130
|
-
l.prototype.prependListener = function(e, t) {
|
|
131
|
-
return N(this, e, t, !0);
|
|
132
|
-
};
|
|
133
|
-
function pe() {
|
|
134
|
-
if (!this.fired)
|
|
135
|
-
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
136
|
-
}
|
|
137
|
-
function F(n, e, t) {
|
|
138
|
-
var s = { fired: !1, wrapFn: void 0, target: n, type: e, listener: t }, r = pe.bind(s);
|
|
139
|
-
return r.listener = t, s.wrapFn = r, r;
|
|
140
|
-
}
|
|
141
|
-
l.prototype.once = function(e, t) {
|
|
142
|
-
return R(t), this.on(e, F(this, e, t)), this;
|
|
143
|
-
};
|
|
144
|
-
l.prototype.prependOnceListener = function(e, t) {
|
|
145
|
-
return R(t), this.prependListener(e, F(this, e, t)), this;
|
|
146
|
-
};
|
|
147
|
-
l.prototype.removeListener = function(e, t) {
|
|
148
|
-
var s, r, o, i, a;
|
|
149
|
-
if (R(t), r = this._events, r === void 0)
|
|
150
|
-
return this;
|
|
151
|
-
if (s = r[e], s === void 0)
|
|
152
|
-
return this;
|
|
153
|
-
if (s === t || s.listener === t)
|
|
154
|
-
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, s.listener || t));
|
|
155
|
-
else if (typeof s != "function") {
|
|
156
|
-
for (o = -1, i = s.length - 1; i >= 0; i--)
|
|
157
|
-
if (s[i] === t || s[i].listener === t) {
|
|
158
|
-
a = s[i].listener, o = i;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
if (o < 0)
|
|
162
|
-
return this;
|
|
163
|
-
o === 0 ? s.shift() : ve(s, o), s.length === 1 && (r[e] = s[0]), r.removeListener !== void 0 && this.emit("removeListener", e, a || t);
|
|
164
|
-
}
|
|
165
|
-
return this;
|
|
166
|
-
};
|
|
167
|
-
l.prototype.off = l.prototype.removeListener;
|
|
168
|
-
l.prototype.removeAllListeners = function(e) {
|
|
169
|
-
var t, s, r;
|
|
170
|
-
if (s = this._events, s === void 0)
|
|
171
|
-
return this;
|
|
172
|
-
if (s.removeListener === void 0)
|
|
173
|
-
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : s[e] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete s[e]), this;
|
|
174
|
-
if (arguments.length === 0) {
|
|
175
|
-
var o = Object.keys(s), i;
|
|
176
|
-
for (r = 0; r < o.length; ++r)
|
|
177
|
-
i = o[r], i !== "removeListener" && this.removeAllListeners(i);
|
|
178
|
-
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
|
|
179
|
-
}
|
|
180
|
-
if (t = s[e], typeof t == "function")
|
|
181
|
-
this.removeListener(e, t);
|
|
182
|
-
else if (t !== void 0)
|
|
183
|
-
for (r = t.length - 1; r >= 0; r--)
|
|
184
|
-
this.removeListener(e, t[r]);
|
|
185
|
-
return this;
|
|
186
|
-
};
|
|
187
|
-
function V(n, e, t) {
|
|
188
|
-
var s = n._events;
|
|
189
|
-
if (s === void 0)
|
|
190
|
-
return [];
|
|
191
|
-
var r = s[e];
|
|
192
|
-
return r === void 0 ? [] : typeof r == "function" ? t ? [r.listener || r] : [r] : t ? ge(r) : H(r, r.length);
|
|
193
|
-
}
|
|
194
|
-
l.prototype.listeners = function(e) {
|
|
195
|
-
return V(this, e, !0);
|
|
196
|
-
};
|
|
197
|
-
l.prototype.rawListeners = function(e) {
|
|
198
|
-
return V(this, e, !1);
|
|
199
|
-
};
|
|
200
|
-
l.listenerCount = function(n, e) {
|
|
201
|
-
return typeof n.listenerCount == "function" ? n.listenerCount(e) : k.call(n, e);
|
|
202
|
-
};
|
|
203
|
-
l.prototype.listenerCount = k;
|
|
204
|
-
function k(n) {
|
|
205
|
-
var e = this._events;
|
|
206
|
-
if (e !== void 0) {
|
|
207
|
-
var t = e[n];
|
|
208
|
-
if (typeof t == "function")
|
|
209
|
-
return 1;
|
|
210
|
-
if (t !== void 0)
|
|
211
|
-
return t.length;
|
|
212
|
-
}
|
|
213
|
-
return 0;
|
|
214
|
-
}
|
|
215
|
-
l.prototype.eventNames = function() {
|
|
216
|
-
return this._eventsCount > 0 ? L(this._events) : [];
|
|
217
|
-
};
|
|
218
|
-
function H(n, e) {
|
|
219
|
-
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
220
|
-
t[s] = n[s];
|
|
221
|
-
return t;
|
|
222
|
-
}
|
|
223
|
-
function ve(n, e) {
|
|
224
|
-
for (; e + 1 < n.length; e++)
|
|
225
|
-
n[e] = n[e + 1];
|
|
226
|
-
n.pop();
|
|
227
|
-
}
|
|
228
|
-
function ge(n) {
|
|
229
|
-
for (var e = new Array(n.length), t = 0; t < e.length; ++t)
|
|
230
|
-
e[t] = n[t].listener || n[t];
|
|
231
|
-
return e;
|
|
232
|
-
}
|
|
233
|
-
function Ce(n, e) {
|
|
234
|
-
return new Promise(function(t, s) {
|
|
235
|
-
function r(i) {
|
|
236
|
-
n.removeListener(e, o), s(i);
|
|
237
|
-
}
|
|
238
|
-
function o() {
|
|
239
|
-
typeof n.removeListener == "function" && n.removeListener("error", r), t([].slice.call(arguments));
|
|
240
|
-
}
|
|
241
|
-
W(n, e, o, { once: !0 }), e !== "error" && be(n, r, { once: !0 });
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
function be(n, e, t) {
|
|
245
|
-
typeof n.on == "function" && W(n, "error", e, t);
|
|
246
|
-
}
|
|
247
|
-
function W(n, e, t, s) {
|
|
248
|
-
if (typeof n.on == "function")
|
|
249
|
-
s.once ? n.once(e, t) : n.on(e, t);
|
|
250
|
-
else if (typeof n.addEventListener == "function")
|
|
251
|
-
n.addEventListener(e, function r(o) {
|
|
252
|
-
s.once && n.removeEventListener(e, r), t(o);
|
|
253
|
-
});
|
|
254
|
-
else
|
|
255
|
-
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof n);
|
|
256
|
-
}
|
|
257
|
-
class M {
|
|
23
|
+
import "esus-lite";
|
|
24
|
+
import { OrbitControls as Z } from "three/examples/jsm/controls/OrbitControls";
|
|
25
|
+
import { CSS3DRenderer as J } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
26
|
+
import { CSS2DRenderer as K } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
27
|
+
import { Pass as ee, EffectComposer as te, RenderPass as se, CopyPass as re, FXAAEffect as oe, BlendFunction as ne, EffectPass as A, SelectiveBloomEffect as ie } from "postprocessing";
|
|
28
|
+
import { i as ae } from "./isPlainObject.module.js";
|
|
29
|
+
import { B as je } from "./BaseObject.module.js";
|
|
30
|
+
class x {
|
|
258
31
|
constructor(e) {
|
|
259
32
|
this.guiParams = {}, e && (this.guiParams = e);
|
|
260
33
|
}
|
|
261
34
|
showGui(e) {
|
|
262
35
|
e && Object.keys(this.guiParams).forEach((t) => {
|
|
263
|
-
const s = e.addFolder(t),
|
|
264
|
-
Object.keys(
|
|
36
|
+
const s = e.addFolder(t), n = this.guiParams[t];
|
|
37
|
+
Object.keys(n).forEach((i) => {
|
|
265
38
|
const {
|
|
266
|
-
min:
|
|
267
|
-
max:
|
|
268
|
-
step:
|
|
269
|
-
name:
|
|
270
|
-
paramMap:
|
|
271
|
-
items:
|
|
272
|
-
value:
|
|
273
|
-
target:
|
|
274
|
-
} =
|
|
275
|
-
let
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
this.setTargetValue(t,
|
|
279
|
-
}),
|
|
39
|
+
min: o,
|
|
40
|
+
max: c,
|
|
41
|
+
step: a,
|
|
42
|
+
name: d,
|
|
43
|
+
paramMap: m,
|
|
44
|
+
items: p,
|
|
45
|
+
value: f,
|
|
46
|
+
target: u
|
|
47
|
+
} = n[i], E = i.toLowerCase().indexOf("color") > -1;
|
|
48
|
+
let h;
|
|
49
|
+
const b = typeof f == "undefined" && u, C = b ? u() : n[i], P = b ? i : "value";
|
|
50
|
+
p ? h = s.add(C, P, p) : E ? h = s.addColor(C, P) : h = s.add(C, P), h = h.name(d || i), typeof o != "undefined" && (h = h.min(o)), typeof c != "undefined" && (h = h.max(c)), typeof a != "undefined" && (h = h.step(a)), h = h.onChange(() => {
|
|
51
|
+
this.setTargetValue(t, i, C[P], m);
|
|
52
|
+
}), b && h.listen();
|
|
280
53
|
});
|
|
281
54
|
});
|
|
282
55
|
}
|
|
283
|
-
setTargetValue(e, t, s,
|
|
56
|
+
setTargetValue(e, t, s, n) {
|
|
284
57
|
const {
|
|
285
|
-
onChange:
|
|
286
|
-
target:
|
|
287
|
-
value:
|
|
288
|
-
} = this.guiParams[e][t],
|
|
289
|
-
if (
|
|
290
|
-
let
|
|
291
|
-
Array.isArray(
|
|
292
|
-
if (
|
|
293
|
-
if (
|
|
58
|
+
onChange: i,
|
|
59
|
+
target: o,
|
|
60
|
+
value: c
|
|
61
|
+
} = this.guiParams[e][t], a = t.toLowerCase().indexOf("color") > -1;
|
|
62
|
+
if (o && !(typeof c == "undefined" && o)) {
|
|
63
|
+
let m = o();
|
|
64
|
+
Array.isArray(m) || (m = [m]), m.forEach((p) => {
|
|
65
|
+
if (p)
|
|
66
|
+
if (a)
|
|
294
67
|
try {
|
|
295
|
-
|
|
296
|
-
} catch (
|
|
297
|
-
t !== "color" && !
|
|
68
|
+
p[n || t].set(s);
|
|
69
|
+
} catch (f) {
|
|
70
|
+
t !== "color" && !n && console.warn(`${t} is not a color,set paramMap`);
|
|
298
71
|
}
|
|
299
72
|
else
|
|
300
|
-
|
|
73
|
+
p[n || t] = s;
|
|
301
74
|
});
|
|
302
75
|
}
|
|
303
|
-
|
|
76
|
+
i && i(s);
|
|
304
77
|
}
|
|
305
78
|
setTargetValueByParams() {
|
|
306
79
|
Object.keys(this.guiParams).forEach((e) => {
|
|
@@ -311,58 +84,60 @@ class M {
|
|
|
311
84
|
});
|
|
312
85
|
}
|
|
313
86
|
}
|
|
314
|
-
const
|
|
315
|
-
None:
|
|
316
|
-
Linear:
|
|
317
|
-
Reinhard:
|
|
318
|
-
Cineon:
|
|
319
|
-
ACESFilmic:
|
|
320
|
-
},
|
|
87
|
+
const D = {
|
|
88
|
+
None: l.NoToneMapping,
|
|
89
|
+
Linear: l.LinearToneMapping,
|
|
90
|
+
Reinhard: l.ReinhardToneMapping,
|
|
91
|
+
Cineon: l.CineonToneMapping,
|
|
92
|
+
ACESFilmic: l.ACESFilmicToneMapping
|
|
93
|
+
}, ce = {
|
|
321
94
|
antialias: !1,
|
|
322
95
|
devicePixelRatio: window.devicePixelRatio,
|
|
323
96
|
powerPreference: "high-performance",
|
|
324
97
|
toneMapping: "None",
|
|
325
98
|
toneMappingExposure: 1,
|
|
326
99
|
alpha: !1,
|
|
327
|
-
outputEncoding:
|
|
100
|
+
outputEncoding: Q.Linear,
|
|
101
|
+
outputColorSpace: $.sRGB,
|
|
328
102
|
logarithmicDepthBuffer: !1,
|
|
329
103
|
preserveDrawingBuffer: !1,
|
|
330
104
|
stencil: !1,
|
|
331
105
|
depth: !1,
|
|
332
106
|
physicallyCorrectLights: !1
|
|
333
107
|
};
|
|
334
|
-
class
|
|
108
|
+
class le {
|
|
335
109
|
constructor(e) {
|
|
336
110
|
this.options = e;
|
|
337
|
-
const { width: t, height: s, rendererParams:
|
|
338
|
-
canvas:
|
|
339
|
-
context:
|
|
340
|
-
alpha:
|
|
341
|
-
devicePixelRatio:
|
|
342
|
-
antialias:
|
|
343
|
-
powerPreference:
|
|
344
|
-
toneMapping:
|
|
345
|
-
toneMappingExposure:
|
|
346
|
-
outputEncoding:
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
111
|
+
const { width: t, height: s, rendererParams: n } = e, {
|
|
112
|
+
canvas: i,
|
|
113
|
+
context: o,
|
|
114
|
+
alpha: c,
|
|
115
|
+
devicePixelRatio: a,
|
|
116
|
+
antialias: d,
|
|
117
|
+
powerPreference: m,
|
|
118
|
+
toneMapping: p,
|
|
119
|
+
toneMappingExposure: f,
|
|
120
|
+
outputEncoding: u,
|
|
121
|
+
outputColorSpace: E,
|
|
122
|
+
logarithmicDepthBuffer: h,
|
|
123
|
+
preserveDrawingBuffer: b,
|
|
124
|
+
stencil: C,
|
|
125
|
+
depth: P,
|
|
126
|
+
physicallyCorrectLights: T
|
|
127
|
+
} = n, g = new l.WebGLRenderer({
|
|
128
|
+
canvas: i,
|
|
129
|
+
context: o,
|
|
130
|
+
alpha: c,
|
|
131
|
+
antialias: d,
|
|
132
|
+
powerPreference: m,
|
|
133
|
+
logarithmicDepthBuffer: h,
|
|
134
|
+
preserveDrawingBuffer: b,
|
|
135
|
+
stencil: C,
|
|
136
|
+
depth: P
|
|
362
137
|
});
|
|
363
|
-
g.setSize(t, s), g.setPixelRatio(
|
|
364
|
-
const
|
|
365
|
-
g[
|
|
138
|
+
g.setSize(t, s), g.setPixelRatio(a), g.toneMapping = D[p], g.toneMappingExposure = f, +l.REVISION < 152 ? g.outputEncoding = u : g.outputColorSpace = E;
|
|
139
|
+
const G = +l.REVISION < 150 ? "physicallyCorrectLights" : "useLegacyLights";
|
|
140
|
+
g[G] = T, this.renderer = g;
|
|
366
141
|
}
|
|
367
142
|
setSize(e, t) {
|
|
368
143
|
this.renderer.setSize(e, t);
|
|
@@ -372,11 +147,11 @@ class Pe {
|
|
|
372
147
|
this.renderer.render(e, t);
|
|
373
148
|
}
|
|
374
149
|
setGui(e) {
|
|
375
|
-
new
|
|
150
|
+
new x({
|
|
376
151
|
renderer: {
|
|
377
152
|
toneMapping: {
|
|
378
153
|
value: this.options.rendererParams.toneMapping,
|
|
379
|
-
items:
|
|
154
|
+
items: D,
|
|
380
155
|
target: () => this.renderer
|
|
381
156
|
},
|
|
382
157
|
toneMappingExposure: {
|
|
@@ -393,25 +168,26 @@ class Pe {
|
|
|
393
168
|
(e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose(), (s = this.renderer) == null || s.renderLists.dispose();
|
|
394
169
|
}
|
|
395
170
|
}
|
|
396
|
-
const
|
|
171
|
+
const de = {
|
|
397
172
|
fov: 45,
|
|
398
173
|
near: 1,
|
|
399
|
-
far: 1e3
|
|
174
|
+
far: 1e3,
|
|
175
|
+
up: new l.Vector3(0, 1, 0)
|
|
400
176
|
};
|
|
401
|
-
class
|
|
177
|
+
class me {
|
|
402
178
|
constructor(e) {
|
|
403
|
-
this.oldCameraPosition = new
|
|
404
|
-
const { width: t, height: s, cameraParams:
|
|
405
|
-
if (
|
|
406
|
-
this.camera =
|
|
179
|
+
this.oldCameraPosition = new l.Vector3(), this.oldCameraRotation = new l.Euler(), this.customCamera = !1, this.options = e;
|
|
180
|
+
const { width: t, height: s, cameraParams: n } = e;
|
|
181
|
+
if (n instanceof l.Camera)
|
|
182
|
+
this.camera = n, this.customCamera = !0;
|
|
407
183
|
else {
|
|
408
|
-
const { fov:
|
|
409
|
-
|
|
184
|
+
const { fov: i, far: o, near: c, up: a } = n, d = new l.PerspectiveCamera(
|
|
185
|
+
i,
|
|
410
186
|
t / s,
|
|
411
|
-
|
|
412
|
-
|
|
187
|
+
c,
|
|
188
|
+
o
|
|
413
189
|
);
|
|
414
|
-
|
|
190
|
+
d.position.set(0, 0, 400), d.lookAt(0, 0, 0), d.up = a, this.camera = d;
|
|
415
191
|
}
|
|
416
192
|
}
|
|
417
193
|
// 检查相机变化
|
|
@@ -420,10 +196,10 @@ class Ee {
|
|
|
420
196
|
return this.oldCameraPosition = e.position.clone(), this.oldCameraRotation = e.rotation.clone(), !t;
|
|
421
197
|
}
|
|
422
198
|
setSize(e, t) {
|
|
423
|
-
this.camera instanceof
|
|
199
|
+
this.camera instanceof l.PerspectiveCamera && (this.camera.aspect = e / t), this.camera.updateProjectionMatrix();
|
|
424
200
|
}
|
|
425
201
|
setGui(e) {
|
|
426
|
-
const t = new
|
|
202
|
+
const t = new x({
|
|
427
203
|
camera: {
|
|
428
204
|
x: {
|
|
429
205
|
min: -1e4,
|
|
@@ -463,7 +239,7 @@ class Ee {
|
|
|
463
239
|
}
|
|
464
240
|
}
|
|
465
241
|
});
|
|
466
|
-
this.camera instanceof
|
|
242
|
+
this.camera instanceof l.PerspectiveCamera && (t.guiParams.camera.fov = {
|
|
467
243
|
min: 0,
|
|
468
244
|
max: 90,
|
|
469
245
|
step: 1,
|
|
@@ -474,43 +250,64 @@ class Ee {
|
|
|
474
250
|
}), t.showGui(e);
|
|
475
251
|
}
|
|
476
252
|
}
|
|
477
|
-
const
|
|
253
|
+
const he = {
|
|
478
254
|
background: null
|
|
479
255
|
};
|
|
480
|
-
class
|
|
256
|
+
class pe {
|
|
481
257
|
constructor(e) {
|
|
482
258
|
this.options = e;
|
|
483
|
-
const { camera: t, sceneParams: s } = e, { background:
|
|
484
|
-
|
|
259
|
+
const { camera: t, sceneParams: s } = e, { background: n } = s, i = new l.Scene();
|
|
260
|
+
n && (i.background = n), i.add(t), this.scene = i;
|
|
485
261
|
}
|
|
486
262
|
addAxesHelper() {
|
|
487
263
|
var t;
|
|
488
|
-
const e = new
|
|
264
|
+
const e = new l.AxesHelper(100);
|
|
489
265
|
(t = this.scene) == null || t.add(e);
|
|
490
266
|
}
|
|
491
267
|
dispose() {
|
|
492
268
|
var e;
|
|
493
269
|
(e = this.scene) == null || e.traverse((t) => {
|
|
494
|
-
|
|
270
|
+
Y(t);
|
|
495
271
|
});
|
|
496
272
|
}
|
|
497
273
|
}
|
|
498
|
-
class
|
|
274
|
+
class fe {
|
|
499
275
|
constructor(e) {
|
|
500
276
|
this.options = e;
|
|
501
|
-
const { camera: t, controlParams: s, customControl:
|
|
502
|
-
|
|
277
|
+
const { camera: t, controlParams: s, customControl: n } = e, { domElement: i } = s, o = n ? new n(t, i) : new Z(t, i);
|
|
278
|
+
o.enableDamping = !0, o.dampingFactor = 0.063, o.autoRotate = !1, o.autoRotateSpeed = -60, o.enableZoom = !0, o.zoomSpeed = 0.2, this.control = o;
|
|
503
279
|
}
|
|
504
280
|
limitPan({
|
|
505
281
|
maxX: e = 1 / 0,
|
|
506
282
|
minX: t = -1 / 0,
|
|
507
283
|
maxZ: s = 1 / 0,
|
|
508
|
-
minZ:
|
|
509
|
-
maxY:
|
|
510
|
-
minY:
|
|
284
|
+
minZ: n = -1 / 0,
|
|
285
|
+
maxY: i = 1 / 0,
|
|
286
|
+
minY: o = -1 / 0
|
|
287
|
+
}) {
|
|
288
|
+
const c = this.limitPanV || new l.Vector3(), a = this.control, { camera: d } = this.options, m = new l.Vector3(t, o, n), p = new l.Vector3(e, i, s);
|
|
289
|
+
this.limitPanV = c, c.copy(a.target), a.target.clamp(m, p), c.sub(a.target), d.position.sub(c);
|
|
290
|
+
}
|
|
291
|
+
changeRotation({
|
|
292
|
+
vertical: e,
|
|
293
|
+
horizontal: t,
|
|
294
|
+
distance: s
|
|
511
295
|
}) {
|
|
512
|
-
const
|
|
513
|
-
|
|
296
|
+
const { camera: n } = this.options, i = this.control, o = t != null ? t : i.getAzimuthalAngle(), c = e != null ? e : i.getPolarAngle(), a = new l.Vector3();
|
|
297
|
+
a.setFromSphericalCoords(
|
|
298
|
+
s != null ? s : n.position.distanceTo(i.target),
|
|
299
|
+
c,
|
|
300
|
+
o
|
|
301
|
+
);
|
|
302
|
+
const d = new l.Quaternion().setFromUnitVectors(
|
|
303
|
+
new l.Vector3(0, 1, 0),
|
|
304
|
+
n.up
|
|
305
|
+
);
|
|
306
|
+
a.applyQuaternion(d), n.position.set(
|
|
307
|
+
a.x + i.target.x,
|
|
308
|
+
a.y + i.target.y,
|
|
309
|
+
a.z + i.target.z
|
|
310
|
+
), i.update();
|
|
514
311
|
}
|
|
515
312
|
update() {
|
|
516
313
|
this.control.update();
|
|
@@ -519,59 +316,107 @@ class Re {
|
|
|
519
316
|
this.control.dispose();
|
|
520
317
|
}
|
|
521
318
|
}
|
|
522
|
-
const
|
|
319
|
+
const O = {
|
|
523
320
|
zIndex: "auto"
|
|
524
321
|
};
|
|
525
|
-
class
|
|
322
|
+
class ue {
|
|
526
323
|
constructor(e) {
|
|
527
324
|
this.container = e;
|
|
528
325
|
}
|
|
529
326
|
addRenderer(e, t) {
|
|
530
|
-
const { container: s } = this,
|
|
531
|
-
|
|
327
|
+
const { container: s } = this, n = s.offsetWidth, i = s.offsetHeight, o = e === "css2d" ? new K() : new J();
|
|
328
|
+
o.domElement.style.position = "absolute", o.domElement.style.top = "0", o.domElement.style.pointerEvents = "none", o.domElement.style.zIndex = t.zIndex, o.setSize(n, i), s.appendChild(o.domElement), e === "css2d" ? this.css2Drenderer = o : e === "css3d" && (this.css3Drenderer = o);
|
|
532
329
|
}
|
|
533
330
|
setSize(e, t) {
|
|
534
|
-
var s,
|
|
535
|
-
(s = this.css2Drenderer) == null || s.setSize(e, t), (
|
|
331
|
+
var s, n;
|
|
332
|
+
(s = this.css2Drenderer) == null || s.setSize(e, t), (n = this.css3Drenderer) == null || n.setSize(e, t);
|
|
536
333
|
}
|
|
537
334
|
render(e, t) {
|
|
538
|
-
var s,
|
|
539
|
-
(s = this.css2Drenderer) == null || s.render(e, t), (
|
|
335
|
+
var s, n;
|
|
336
|
+
(s = this.css2Drenderer) == null || s.render(e, t), (n = this.css3Drenderer) == null || n.render(e, t);
|
|
540
337
|
}
|
|
541
338
|
dispose() {
|
|
542
339
|
this.css2Drenderer = void 0, this.css3Drenderer = void 0;
|
|
543
340
|
}
|
|
544
341
|
}
|
|
545
|
-
const
|
|
342
|
+
const B = ["encodings_fragment", "colorspace_fragment"];
|
|
343
|
+
class ge extends N {
|
|
344
|
+
constructor() {
|
|
345
|
+
super({
|
|
346
|
+
uniforms: {
|
|
347
|
+
inputBuffer: new z(null),
|
|
348
|
+
ratio: new z(1)
|
|
349
|
+
},
|
|
350
|
+
fragmentShader: `
|
|
351
|
+
uniform sampler2D inputBuffer;
|
|
352
|
+
uniform float ratio;
|
|
353
|
+
varying vec2 vUv;
|
|
354
|
+
void main() {
|
|
355
|
+
vec4 texel = texture2D(inputBuffer, vUv);
|
|
356
|
+
gl_FragColor = texel * ratio;
|
|
357
|
+
// Support automatic output encoding.
|
|
358
|
+
#include <${+U < 154 ? B[0] : B[1]}>
|
|
359
|
+
|
|
360
|
+
}
|
|
361
|
+
`,
|
|
362
|
+
vertexShader: `
|
|
363
|
+
varying vec2 vUv;
|
|
364
|
+
void main() {
|
|
365
|
+
vUv = position.xy * 0.5 + 0.5;
|
|
366
|
+
gl_Position = vec4(position.xy, 1.0, 1.0);
|
|
367
|
+
}
|
|
368
|
+
`,
|
|
369
|
+
toneMapped: !1,
|
|
370
|
+
depthWrite: !1,
|
|
371
|
+
depthTest: !1
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
class Ce extends ee {
|
|
376
|
+
constructor() {
|
|
377
|
+
super("CrossFadePass"), this.fullscreenMaterial = new ge();
|
|
378
|
+
}
|
|
379
|
+
render(e, t, s) {
|
|
380
|
+
const n = this.fullscreenMaterial;
|
|
381
|
+
n.uniforms.inputBuffer.value = t.texture, e.setRenderTarget(this.renderToScreen ? null : s), e.render(this.scene, this.camera);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
const Pe = {
|
|
546
385
|
luminanceThreshold: 0.1,
|
|
547
386
|
luminanceSmoothing: 0.3,
|
|
548
387
|
mipmapBlur: !0,
|
|
549
388
|
intensity: 4
|
|
550
389
|
};
|
|
551
|
-
class
|
|
390
|
+
class ve {
|
|
552
391
|
constructor(e) {
|
|
553
392
|
this.active = !0, this.options = e;
|
|
554
|
-
const { renderer: t, scene: s, camera:
|
|
555
|
-
multisampling: Math.min(
|
|
393
|
+
const { renderer: t, scene: s, camera: n, composerParams: i } = e, { multisampling: o } = i, { maxSamples: c } = t.capabilities, a = new te(t, {
|
|
394
|
+
multisampling: Math.min(o, c)
|
|
556
395
|
});
|
|
557
|
-
|
|
396
|
+
a.addPass(new se(s, n)), this.finalComposer = a, this.renderer = t, this.scene = s, this.camera = n;
|
|
558
397
|
}
|
|
559
398
|
addCopyPass() {
|
|
560
|
-
const e = new
|
|
399
|
+
const e = new re();
|
|
561
400
|
e.renderToScreen = !0, this.finalComposer.addPass(e), this.copyPass = e;
|
|
562
401
|
}
|
|
402
|
+
addCrossFadePass() {
|
|
403
|
+
const e = new Ce();
|
|
404
|
+
this.finalComposer.addPass(e), this.crossFadePass = e;
|
|
405
|
+
}
|
|
563
406
|
addFXAAPass() {
|
|
564
|
-
const { camera: e } = this, t = new
|
|
407
|
+
const { camera: e } = this, t = new oe({ blendFunction: ne.NORMAL }), s = new A(e, t);
|
|
565
408
|
this.finalComposer.addPass(s), this.fxaaPass = s;
|
|
566
409
|
}
|
|
567
410
|
addBloomPass(e) {
|
|
568
|
-
const { camera: t, scene: s } = this,
|
|
569
|
-
|
|
411
|
+
const { camera: t, scene: s } = this, n = new ie(s, t, v({}, e)), i = new A(t, n);
|
|
412
|
+
i.enabled = !1, this.finalComposer.addPass(i), this.bloomPass = i, this.bloomEffect = n;
|
|
413
|
+
}
|
|
414
|
+
aaa() {
|
|
570
415
|
}
|
|
571
416
|
addBloomGui(e) {
|
|
572
417
|
if (!this.bloomEffect)
|
|
573
418
|
return;
|
|
574
|
-
new
|
|
419
|
+
new x({
|
|
575
420
|
bloom: {
|
|
576
421
|
intensity: {
|
|
577
422
|
min: 0,
|
|
@@ -616,16 +461,16 @@ class Me {
|
|
|
616
461
|
}
|
|
617
462
|
}).showGui(e);
|
|
618
463
|
}
|
|
619
|
-
toggleBloomSelection(e) {
|
|
464
|
+
toggleBloomSelection(e, t) {
|
|
620
465
|
if (!this.bloomEffect || !this.bloomPass) {
|
|
621
466
|
console.warn("err:pencil.options.bloom");
|
|
622
467
|
return;
|
|
623
468
|
}
|
|
624
|
-
this.bloomEffect.selection.toggle(e), this.bloomPass.enabled = !!this.bloomEffect.selection.size;
|
|
469
|
+
e ? t === !0 ? this.bloomEffect.selection.add(e) : t === !1 ? this.bloomEffect.selection.delete(e) : this.bloomEffect.selection.toggle(e) : this.bloomEffect.selection.clear(), this.bloomPass.enabled = !!this.bloomEffect.selection.size;
|
|
625
470
|
}
|
|
626
471
|
getSize() {
|
|
627
472
|
const { renderer: e } = this.options;
|
|
628
|
-
return e.getSize(new
|
|
473
|
+
return e.getSize(new l.Vector2());
|
|
629
474
|
}
|
|
630
475
|
enable() {
|
|
631
476
|
this.active || (this.active = !0);
|
|
@@ -643,40 +488,40 @@ class Me {
|
|
|
643
488
|
this.finalComposer.dispose();
|
|
644
489
|
}
|
|
645
490
|
}
|
|
646
|
-
const
|
|
491
|
+
const be = () => {
|
|
647
492
|
try {
|
|
648
|
-
const
|
|
649
|
-
return !!(window.WebGL2RenderingContext &&
|
|
650
|
-
} catch (
|
|
493
|
+
const r = document.createElement("canvas");
|
|
494
|
+
return !!(window.WebGL2RenderingContext && r.getContext("webgl2"));
|
|
495
|
+
} catch (r) {
|
|
651
496
|
return !1;
|
|
652
497
|
}
|
|
653
|
-
},
|
|
654
|
-
constructor(
|
|
655
|
-
this.raycaster = new
|
|
656
|
-
isMergeableObject:
|
|
498
|
+
}, w = !1, F = be() !== !1, L = class {
|
|
499
|
+
constructor(r, e) {
|
|
500
|
+
this.raycaster = new l.Raycaster(), this.installPlugins = /* @__PURE__ */ new Map(), this.event = new W.EventEmitter(), this.clock = new l.Clock(), this.userData = {}, this.options = _(L.options, r, {
|
|
501
|
+
isMergeableObject: ae
|
|
657
502
|
});
|
|
658
503
|
const {
|
|
659
|
-
container:
|
|
660
|
-
stats:
|
|
661
|
-
gui:
|
|
662
|
-
resizeObserver:
|
|
504
|
+
container: t,
|
|
505
|
+
stats: s,
|
|
506
|
+
gui: n,
|
|
507
|
+
resizeObserver: i
|
|
663
508
|
} = this.options;
|
|
664
|
-
if (
|
|
665
|
-
const o = new
|
|
509
|
+
if (n) {
|
|
510
|
+
const o = new q();
|
|
666
511
|
o.open(!1), this.gui = o;
|
|
667
512
|
}
|
|
668
|
-
if (
|
|
669
|
-
const o = new
|
|
670
|
-
o.showPanel(0), o.dom.style.position = "absolute",
|
|
513
|
+
if (s) {
|
|
514
|
+
const o = new X();
|
|
515
|
+
o.showPanel(0), o.dom.style.position = "absolute", t.appendChild(o.dom), this.stats = o;
|
|
671
516
|
}
|
|
672
|
-
this.init(), this.initComposer(), this.initCSSRenderer(), this.initControl(),
|
|
517
|
+
this.init(), this.initComposer(), this.initCSSRenderer(), this.initControl(), i && this.initResizeObserver(), this.clock.getDelta(), this.clock.getElapsedTime(), e && (Array.isArray(e) ? e.forEach((o) => this.use(o)) : this.use(e));
|
|
673
518
|
}
|
|
674
519
|
get renderer() {
|
|
675
520
|
return this.rendererController.renderer;
|
|
676
521
|
}
|
|
677
522
|
get control() {
|
|
678
|
-
var
|
|
679
|
-
return (
|
|
523
|
+
var r;
|
|
524
|
+
return (r = this.controlController) == null ? void 0 : r.control;
|
|
680
525
|
}
|
|
681
526
|
get camera() {
|
|
682
527
|
return this.cameraController.camera;
|
|
@@ -684,147 +529,160 @@ const _e = () => {
|
|
|
684
529
|
get scene() {
|
|
685
530
|
return this.sceneController.scene;
|
|
686
531
|
}
|
|
687
|
-
use(
|
|
688
|
-
this.installPlugins.has(
|
|
532
|
+
use(r, ...e) {
|
|
533
|
+
this.installPlugins.has(r) ? console.log("plugin already installed") : typeof r.install == "function" && (r.install(this, ...e), this.installPlugins.set(r, !0));
|
|
689
534
|
}
|
|
690
535
|
init() {
|
|
691
536
|
const {
|
|
692
|
-
container:
|
|
537
|
+
container: r,
|
|
693
538
|
isdev: e,
|
|
694
539
|
axesHelper: t,
|
|
695
540
|
renderer: s,
|
|
696
|
-
scene:
|
|
697
|
-
camera:
|
|
698
|
-
} = this.options, { width:
|
|
541
|
+
scene: n,
|
|
542
|
+
camera: i
|
|
543
|
+
} = this.options, { width: o, height: c } = this.getSize(), a = new me({
|
|
699
544
|
isdev: e,
|
|
700
|
-
width:
|
|
701
|
-
height:
|
|
702
|
-
cameraParams:
|
|
545
|
+
width: o,
|
|
546
|
+
height: c,
|
|
547
|
+
cameraParams: i
|
|
703
548
|
});
|
|
704
|
-
this.gui &&
|
|
705
|
-
const
|
|
706
|
-
camera:
|
|
707
|
-
sceneParams:
|
|
708
|
-
}),
|
|
709
|
-
width:
|
|
710
|
-
height:
|
|
711
|
-
scene:
|
|
712
|
-
camera:
|
|
549
|
+
this.gui && a.setGui(this.gui);
|
|
550
|
+
const d = a.camera, m = new pe({
|
|
551
|
+
camera: d,
|
|
552
|
+
sceneParams: n
|
|
553
|
+
}), p = m.scene, f = new le({
|
|
554
|
+
width: o,
|
|
555
|
+
height: c,
|
|
556
|
+
scene: p,
|
|
557
|
+
camera: d,
|
|
713
558
|
isdev: e,
|
|
714
|
-
rendererParams:
|
|
559
|
+
rendererParams: S(v({}, s), {
|
|
715
560
|
antialias: !1
|
|
716
561
|
})
|
|
717
562
|
});
|
|
718
|
-
this.gui &&
|
|
719
|
-
const
|
|
720
|
-
t &&
|
|
563
|
+
this.gui && f.setGui(this.gui);
|
|
564
|
+
const u = f.renderer;
|
|
565
|
+
t && m.addAxesHelper(), this.sceneController = m, this.rendererController = f, this.cameraController = a, r.appendChild(u.domElement);
|
|
721
566
|
}
|
|
722
567
|
initComposer() {
|
|
723
568
|
const {
|
|
724
|
-
bloom:
|
|
569
|
+
bloom: r,
|
|
725
570
|
bloomParams: e,
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
571
|
+
crossOpacity: t,
|
|
572
|
+
renderer: s,
|
|
573
|
+
multisampling: n,
|
|
574
|
+
passes: i
|
|
729
575
|
} = this.options;
|
|
730
|
-
let { antialias: o } =
|
|
731
|
-
o === "msaa" && !
|
|
732
|
-
const
|
|
576
|
+
let { antialias: o } = s;
|
|
577
|
+
o === "msaa" && !F && (o = !1, console.warn("MSAA is not supported on this browser"));
|
|
578
|
+
const c = new ve({
|
|
733
579
|
renderer: this.renderer,
|
|
734
580
|
scene: this.scene,
|
|
735
581
|
camera: this.camera,
|
|
736
582
|
composerParams: {
|
|
737
|
-
multisampling: o === "msaa" ?
|
|
738
|
-
type:
|
|
739
|
-
encoding:
|
|
583
|
+
multisampling: o === "msaa" ? n : 0,
|
|
584
|
+
type: l.UnsignedByteType,
|
|
585
|
+
encoding: s.outputEncoding
|
|
740
586
|
}
|
|
741
587
|
});
|
|
742
|
-
this.composerController =
|
|
743
|
-
|
|
744
|
-
}),
|
|
588
|
+
this.composerController = c, r && (c.addBloomPass(e), this.gui && c.addBloomGui(this.gui)), o === "fxaa" && c.addFXAAPass(), t && c.addCrossFadePass(), i && i.forEach((a) => {
|
|
589
|
+
c.finalComposer.addPass(a);
|
|
590
|
+
}), c.addCopyPass();
|
|
591
|
+
}
|
|
592
|
+
get opacity() {
|
|
593
|
+
const { crossFadePass: r } = this.composerController;
|
|
594
|
+
return r ? r.fullscreenMaterial.uniforms.ratio.value : 1;
|
|
595
|
+
}
|
|
596
|
+
set opacity(r) {
|
|
597
|
+
const { crossFadePass: e } = this.composerController;
|
|
598
|
+
if (!e) {
|
|
599
|
+
console.warn("err:pencil.options.crossOpacity");
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
e.fullscreenMaterial.uniforms.ratio.value = r;
|
|
745
603
|
}
|
|
746
604
|
initCSSRenderer() {
|
|
747
605
|
const {
|
|
748
|
-
container:
|
|
606
|
+
container: r,
|
|
749
607
|
css2DRenderer: e,
|
|
750
608
|
css3DRenderer: t,
|
|
751
609
|
css2DRendererParams: s,
|
|
752
|
-
css3DRendererParams:
|
|
610
|
+
css3DRendererParams: n
|
|
753
611
|
} = this.options;
|
|
754
612
|
if (e || t) {
|
|
755
|
-
const
|
|
756
|
-
e &&
|
|
613
|
+
const i = new ue(r);
|
|
614
|
+
e && i.addRenderer("css2d", s), t && i.addRenderer("css3d", n), this.cssRendererController = i;
|
|
757
615
|
}
|
|
758
616
|
}
|
|
759
617
|
initControl() {
|
|
760
|
-
const { control:
|
|
761
|
-
if (
|
|
762
|
-
const t = new
|
|
618
|
+
const { control: r, controlParams: e } = this.options;
|
|
619
|
+
if (r) {
|
|
620
|
+
const t = new fe({
|
|
763
621
|
camera: this.camera,
|
|
764
622
|
controlParams: {
|
|
765
623
|
domElement: (e == null ? void 0 : e.domElement) || this.renderer.domElement
|
|
766
624
|
},
|
|
767
|
-
customControl: typeof
|
|
625
|
+
customControl: typeof r == "boolean" ? void 0 : r
|
|
768
626
|
});
|
|
769
627
|
this.controlController = t;
|
|
770
628
|
}
|
|
771
629
|
}
|
|
772
630
|
getSize() {
|
|
773
|
-
const { container:
|
|
631
|
+
const { container: r } = this.options;
|
|
774
632
|
return {
|
|
775
|
-
width:
|
|
776
|
-
height:
|
|
633
|
+
width: r.offsetWidth,
|
|
634
|
+
height: r.offsetHeight
|
|
777
635
|
};
|
|
778
636
|
}
|
|
779
637
|
initResizeObserver() {
|
|
780
|
-
const { container:
|
|
638
|
+
const { container: r } = this.options;
|
|
781
639
|
if (this.resizeObserver)
|
|
782
640
|
return;
|
|
783
641
|
const e = new ResizeObserver((t) => {
|
|
784
642
|
for (const s of t) {
|
|
785
|
-
const
|
|
786
|
-
this.handeleResize(
|
|
643
|
+
const n = s.contentRect;
|
|
644
|
+
this.handeleResize(n.width, n.height), this.render();
|
|
787
645
|
}
|
|
788
646
|
});
|
|
789
|
-
e.observe(
|
|
647
|
+
e.observe(r), this.resizeObserver = e;
|
|
790
648
|
}
|
|
791
|
-
handeleResize(
|
|
649
|
+
handeleResize(r, e, t = !0) {
|
|
792
650
|
const {
|
|
793
|
-
rendererController:
|
|
794
|
-
cameraController:
|
|
795
|
-
composerController:
|
|
651
|
+
rendererController: s,
|
|
652
|
+
cameraController: n,
|
|
653
|
+
composerController: i,
|
|
796
654
|
cssRendererController: o
|
|
797
655
|
} = this;
|
|
798
|
-
|
|
799
|
-
var
|
|
800
|
-
(
|
|
801
|
-
}), this.event.emit("resize", { width:
|
|
802
|
-
}
|
|
803
|
-
pick(
|
|
804
|
-
const { raycaster: s, options:
|
|
805
|
-
if (
|
|
806
|
-
s.setFromCamera(
|
|
807
|
-
const
|
|
656
|
+
n == null || n.setSize(r, e), s == null || s.setSize(r, e), i == null || i.setSize(r, e), o == null || o.setSize(r, e), this.installPlugins.forEach((c, a) => {
|
|
657
|
+
var d;
|
|
658
|
+
(d = a.setSize) == null || d.call(a, r, e);
|
|
659
|
+
}), t && this.event.emit("resize", { width: r, height: e });
|
|
660
|
+
}
|
|
661
|
+
pick(r, e, t = !1) {
|
|
662
|
+
const { raycaster: s, options: n } = this, { container: i } = n, o = new l.Vector2(), c = i.getBoundingClientRect();
|
|
663
|
+
if (o.x = (r.clientX - c.left) / (c.right - c.left) * 2 - 1, o.y = -((r.clientY - c.top) / (c.bottom - c.top)) * 2 + 1, this.camera && this.scene) {
|
|
664
|
+
s.setFromCamera(o, this.camera);
|
|
665
|
+
const a = s.intersectObjects(
|
|
808
666
|
e || this.scene.children,
|
|
809
667
|
t
|
|
810
668
|
);
|
|
811
|
-
if (
|
|
669
|
+
if (a.length)
|
|
812
670
|
return {
|
|
813
|
-
object:
|
|
814
|
-
intersects:
|
|
671
|
+
object: a[0].object,
|
|
672
|
+
intersects: a
|
|
815
673
|
};
|
|
816
674
|
}
|
|
817
675
|
}
|
|
818
676
|
render() {
|
|
819
|
-
var
|
|
820
|
-
const { renderer:
|
|
821
|
-
if (!
|
|
677
|
+
var o, c, a, d, m;
|
|
678
|
+
const { renderer: r, scene: e, camera: t, clock: s } = this;
|
|
679
|
+
if (!r || !e || !t || this.options.staticRender && !this.cameraController.checkCameraChange())
|
|
822
680
|
return;
|
|
823
|
-
const
|
|
824
|
-
(
|
|
825
|
-
var
|
|
826
|
-
(
|
|
827
|
-
}), (
|
|
681
|
+
const n = s.getDelta(), i = s.getElapsedTime();
|
|
682
|
+
M.update(), (o = this.controlController) == null || o.update(), this.installPlugins.forEach((p, f) => {
|
|
683
|
+
var u;
|
|
684
|
+
(u = f.update) == null || u.call(f, n, i);
|
|
685
|
+
}), (c = this.composerController) != null && c.active ? this.composerController.render() : (a = this.rendererController) == null || a.render(), (d = this.cssRendererController) == null || d.render(e, t), (m = this.stats) == null || m.update(), this.event.emit("render", { delta: n, elapsed: i });
|
|
828
686
|
}
|
|
829
687
|
start() {
|
|
830
688
|
this.renderer.setAnimationLoop(this.render.bind(this)), this.event.emit("start");
|
|
@@ -833,38 +691,39 @@ const _e = () => {
|
|
|
833
691
|
this.renderer.setAnimationLoop(null), this.event.emit("stop");
|
|
834
692
|
}
|
|
835
693
|
dispose() {
|
|
836
|
-
var
|
|
837
|
-
this.stop(), this.handeleResize(0, 0), (
|
|
838
|
-
var
|
|
839
|
-
(
|
|
840
|
-
}), (e = this.controlController) == null || e.dispose(), (t = this.cssRendererController) == null || t.dispose(), (s = this.sceneController) == null || s.dispose(), (
|
|
694
|
+
var r, e, t, s, n, i, o;
|
|
695
|
+
this.stop(), M.removeAll(), this.handeleResize(0, 0), (r = this.resizeObserver) == null || r.unobserve(this.options.container), this.installPlugins.forEach((c, a) => {
|
|
696
|
+
var d;
|
|
697
|
+
(d = a.dispose) == null || d.call(a);
|
|
698
|
+
}), (e = this.controlController) == null || e.dispose(), (t = this.cssRendererController) == null || t.dispose(), (s = this.sceneController) == null || s.dispose(), (n = this.composerController) == null || n.dispose(), (i = this.rendererController) == null || i.dispose(), this.controlController = void 0, this.cssRendererController = void 0, (o = this.gui) == null || o.destroy(), this.event.removeAllListeners(), this.installPlugins.clear();
|
|
841
699
|
}
|
|
842
700
|
};
|
|
843
|
-
let
|
|
844
|
-
|
|
845
|
-
isdev:
|
|
846
|
-
stats:
|
|
847
|
-
gui:
|
|
848
|
-
axesHelper:
|
|
849
|
-
control:
|
|
701
|
+
let we = L;
|
|
702
|
+
we.options = {
|
|
703
|
+
isdev: w,
|
|
704
|
+
stats: w,
|
|
705
|
+
gui: w,
|
|
706
|
+
axesHelper: w,
|
|
707
|
+
control: w,
|
|
850
708
|
resizeObserver: !0,
|
|
851
|
-
renderer:
|
|
852
|
-
antialias:
|
|
709
|
+
renderer: S(v({}, ce), {
|
|
710
|
+
antialias: F ? "msaa" : "fxaa"
|
|
853
711
|
}),
|
|
854
712
|
staticRender: !1,
|
|
855
713
|
multisampling: 4,
|
|
856
|
-
scene:
|
|
857
|
-
camera:
|
|
714
|
+
scene: he,
|
|
715
|
+
camera: de,
|
|
858
716
|
bloom: !1,
|
|
859
|
-
bloomParams:
|
|
717
|
+
bloomParams: Pe,
|
|
718
|
+
crossOpacity: !1,
|
|
860
719
|
css2DRenderer: !1,
|
|
861
|
-
css2DRendererParams:
|
|
720
|
+
css2DRendererParams: v({}, O),
|
|
862
721
|
css3DRenderer: !1,
|
|
863
|
-
css3DRendererParams:
|
|
722
|
+
css3DRendererParams: v({}, O)
|
|
864
723
|
};
|
|
865
724
|
export {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
725
|
+
je as BaseObject,
|
|
726
|
+
x as GUIObject,
|
|
727
|
+
we as Pencil,
|
|
728
|
+
we as default
|
|
870
729
|
};
|