gl-draw 0.12.21 → 0.12.23
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/core/Pencil.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/index.module.js +127 -124
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +212 -212
- package/package.json +2 -2
package/dist/index.module.js
CHANGED
|
@@ -12,27 +12,28 @@ var Ot = (g, t, e) => t in g ? Xt(g, t, { enumerable: !0, configurable: !0, writ
|
|
|
12
12
|
}, mt = (g, t) => Kt(g, qt(t));
|
|
13
13
|
import * as w from "three";
|
|
14
14
|
import { Vector3 as et, Quaternion as $t, Matrix4 as ct, UniformsUtils as Jt, RawShaderMaterial as te } from "three";
|
|
15
|
+
import { Timer as ee } from "three/examples/jsm/misc/Timer";
|
|
15
16
|
import * as vt from "@tweenjs/tween.js";
|
|
16
17
|
import { e as st } from "./events.module.js";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { C as
|
|
21
|
-
import { d as
|
|
18
|
+
import se from "deepmerge";
|
|
19
|
+
import ie from "stats-gl";
|
|
20
|
+
import re from "lil-gui";
|
|
21
|
+
import { C as oe } from "./colorCorrection.module.js";
|
|
22
|
+
import { d as ne } from "./parseVector.module.js";
|
|
22
23
|
import "idb-keyval";
|
|
23
24
|
import "esus-lite";
|
|
24
25
|
import "d3-geo";
|
|
25
26
|
import "d3-geo-projection";
|
|
26
|
-
import { RectAreaLightHelper as
|
|
27
|
-
import { ViewHelper as
|
|
28
|
-
import { TransformControls as
|
|
27
|
+
import { RectAreaLightHelper as ae } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
28
|
+
import { ViewHelper as he } from "three/examples/jsm/helpers/ViewHelper";
|
|
29
|
+
import { TransformControls as le } from "three/examples/jsm/controls/TransformControls";
|
|
29
30
|
import { EffectComposer as Tt } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
30
|
-
import { RenderPass as
|
|
31
|
-
import { SSAOPass as
|
|
32
|
-
import { FullScreenQuad as
|
|
33
|
-
import { OutputPass as
|
|
34
|
-
import { ShaderPass as
|
|
35
|
-
import { UnrealBloomPass as
|
|
31
|
+
import { RenderPass as ce } from "three/examples/jsm/postprocessing/RenderPass";
|
|
32
|
+
import { SSAOPass as de } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
33
|
+
import { FullScreenQuad as me } from "three/examples/jsm/postprocessing/Pass";
|
|
34
|
+
import { OutputPass as pe } from "three/examples/jsm/postprocessing/OutputPass";
|
|
35
|
+
import { ShaderPass as _e } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
36
|
+
import { UnrealBloomPass as ue } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
36
37
|
import "three/examples/jsm/renderers/CSS2DRenderer";
|
|
37
38
|
import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
38
39
|
import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
@@ -41,8 +42,8 @@ import { M as Bt } from "./index.module2.js";
|
|
|
41
42
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
42
43
|
import "three/examples/jsm/lines/LineMaterial";
|
|
43
44
|
import "three-bvh-csg";
|
|
44
|
-
import { i as
|
|
45
|
-
import { B as
|
|
45
|
+
import { i as fe } from "./isPlainObject.module.js";
|
|
46
|
+
import { B as bs } from "./BaseObject.module.js";
|
|
46
47
|
const U = {
|
|
47
48
|
LEFT: 1,
|
|
48
49
|
RIGHT: 2,
|
|
@@ -129,7 +130,7 @@ function pt(g, t) {
|
|
|
129
130
|
function _t(g, t) {
|
|
130
131
|
return k(g) ? (console.warn(`${t} is not supported in OrthographicCamera`), !0) : !1;
|
|
131
132
|
}
|
|
132
|
-
class
|
|
133
|
+
class ge {
|
|
133
134
|
constructor() {
|
|
134
135
|
this._listeners = {};
|
|
135
136
|
}
|
|
@@ -193,9 +194,9 @@ class fe {
|
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
|
-
const nt = 1 / 8,
|
|
197
|
+
const nt = 1 / 8, Ce = /Mac/.test(navigator.platform);
|
|
197
198
|
let T, Pt, at, ut, L, S, P, W, J, F, I, N, At, Dt, z, tt, G, bt, ft, Ut, gt, Ct, ht;
|
|
198
|
-
class q extends
|
|
199
|
+
class q extends ge {
|
|
199
200
|
/**
|
|
200
201
|
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
201
202
|
*
|
|
@@ -413,7 +414,7 @@ class q extends fe {
|
|
|
413
414
|
const O = performance.now();
|
|
414
415
|
d - O < 1e3 && this._getClientRect(this._elementRect), d = O;
|
|
415
416
|
}
|
|
416
|
-
const m =
|
|
417
|
+
const m = Ce ? -1 : -3, E = o.deltaMode === 1 ? o.deltaY / m : o.deltaY / (m * 10), f = this.dollyToCursor ? (o.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, x = this.dollyToCursor ? (o.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
417
418
|
switch (this.mouseButtons.wheel) {
|
|
418
419
|
case h.ROTATE: {
|
|
419
420
|
this._rotateInternal(o.deltaX, o.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -1718,20 +1719,20 @@ class q extends fe {
|
|
|
1718
1719
|
}), s.radius = Math.sqrt(r), s;
|
|
1719
1720
|
}
|
|
1720
1721
|
}
|
|
1721
|
-
const
|
|
1722
|
+
const ye = {
|
|
1722
1723
|
antialias: !1,
|
|
1723
1724
|
devicePixelRatio: window.devicePixelRatio,
|
|
1724
1725
|
powerPreference: "high-performance",
|
|
1725
1726
|
toneMappingExposure: 1,
|
|
1726
1727
|
alpha: !1,
|
|
1727
|
-
outputColorSpace:
|
|
1728
|
+
outputColorSpace: oe.sRGB,
|
|
1728
1729
|
logarithmicDepthBuffer: !1,
|
|
1729
1730
|
preserveDrawingBuffer: !1,
|
|
1730
1731
|
stencil: !1,
|
|
1731
1732
|
depth: !1,
|
|
1732
1733
|
physicallyCorrectLights: !1
|
|
1733
1734
|
};
|
|
1734
|
-
class
|
|
1735
|
+
class Ee {
|
|
1735
1736
|
constructor(t) {
|
|
1736
1737
|
this.options = t;
|
|
1737
1738
|
const { width: e, height: s, rendererParams: i } = t, {
|
|
@@ -1789,11 +1790,11 @@ class ye {
|
|
|
1789
1790
|
this.setSize(1, 1), (t = this.renderer) == null || t.clear(), (e = this.renderer) == null || e.dispose();
|
|
1790
1791
|
}
|
|
1791
1792
|
}
|
|
1792
|
-
const
|
|
1793
|
+
const Oe = {
|
|
1793
1794
|
antialias: !0,
|
|
1794
1795
|
devicePixelRatio: window.devicePixelRatio
|
|
1795
1796
|
};
|
|
1796
|
-
class
|
|
1797
|
+
class ve {
|
|
1797
1798
|
constructor(t) {
|
|
1798
1799
|
this.options = t;
|
|
1799
1800
|
const { width: e, height: s, rendererParams: i, renderer: r } = t, { devicePixelRatio: n, antialias: a } = i, l = new r({
|
|
@@ -1812,13 +1813,13 @@ class Oe {
|
|
|
1812
1813
|
this.setSize(1, 1), (t = this.renderer) == null || t.clear(), (e = this.renderer) == null || e.dispose();
|
|
1813
1814
|
}
|
|
1814
1815
|
}
|
|
1815
|
-
const
|
|
1816
|
+
const Te = {
|
|
1816
1817
|
fov: 45,
|
|
1817
1818
|
near: 1,
|
|
1818
1819
|
far: 1e3,
|
|
1819
1820
|
up: new w.Vector3(0, 1, 0)
|
|
1820
1821
|
};
|
|
1821
|
-
class
|
|
1822
|
+
class xe {
|
|
1822
1823
|
constructor(t) {
|
|
1823
1824
|
this.event = new st.EventEmitter(), this.cameraArr = [], this.cameraActiveIndex = 0, this.customCamera = !1, this.width = 0, this.height = 0, this.width = t.width, this.height = t.height;
|
|
1824
1825
|
}
|
|
@@ -1894,15 +1895,15 @@ class Te {
|
|
|
1894
1895
|
}
|
|
1895
1896
|
}
|
|
1896
1897
|
}
|
|
1897
|
-
const
|
|
1898
|
+
const we = {
|
|
1898
1899
|
background: null
|
|
1899
|
-
},
|
|
1900
|
-
class
|
|
1900
|
+
}, Se = new w.Scene();
|
|
1901
|
+
class Pe {
|
|
1901
1902
|
constructor(t) {
|
|
1902
1903
|
this.event = new st.EventEmitter(), this.sceneArr = [], this.sceneActiveIndex = 0, this.overrideMaterial = !1, this.options = t;
|
|
1903
1904
|
}
|
|
1904
1905
|
get scene() {
|
|
1905
|
-
return this.sceneActiveIndex == -1 ?
|
|
1906
|
+
return this.sceneActiveIndex == -1 ? Se : this.sceneArr[this.sceneActiveIndex];
|
|
1906
1907
|
}
|
|
1907
1908
|
addScene(t) {
|
|
1908
1909
|
const e = new w.Scene();
|
|
@@ -1917,12 +1918,12 @@ class Se {
|
|
|
1917
1918
|
dispose() {
|
|
1918
1919
|
this.sceneArr.forEach((t) => {
|
|
1919
1920
|
t.traverse((e) => {
|
|
1920
|
-
|
|
1921
|
+
ne(e);
|
|
1921
1922
|
});
|
|
1922
1923
|
});
|
|
1923
1924
|
}
|
|
1924
1925
|
}
|
|
1925
|
-
class
|
|
1926
|
+
class Ae {
|
|
1926
1927
|
constructor(t) {
|
|
1927
1928
|
this.helpers = {}, this.options = t;
|
|
1928
1929
|
}
|
|
@@ -1943,7 +1944,7 @@ class Pe {
|
|
|
1943
1944
|
else if (t.isHemisphereLight)
|
|
1944
1945
|
i = new w.HemisphereLightHelper(t, 10);
|
|
1945
1946
|
else if (t.isRectAreaLight)
|
|
1946
|
-
i = new
|
|
1947
|
+
i = new ae(t);
|
|
1947
1948
|
else {
|
|
1948
1949
|
const r = new w.Box3();
|
|
1949
1950
|
if (r.setFromObject(t, !0), r.isEmpty() === !1) {
|
|
@@ -1957,7 +1958,7 @@ class Pe {
|
|
|
1957
1958
|
}
|
|
1958
1959
|
}
|
|
1959
1960
|
addViewHelper() {
|
|
1960
|
-
const { cameraController: t, container: e } = this.options, s = new
|
|
1961
|
+
const { cameraController: t, container: e } = this.options, s = new he(t.camera, e);
|
|
1961
1962
|
e.addEventListener("pointerdown", (i) => {
|
|
1962
1963
|
i.preventDefault(), s.handleClick(i);
|
|
1963
1964
|
}), this.viewHelper = s;
|
|
@@ -2007,7 +2008,7 @@ class Pe {
|
|
|
2007
2008
|
this.helpers = {}, (t = this.viewHelper) == null || t.dispose();
|
|
2008
2009
|
}
|
|
2009
2010
|
}
|
|
2010
|
-
class
|
|
2011
|
+
class De {
|
|
2011
2012
|
constructor(t) {
|
|
2012
2013
|
this.event = new st.EventEmitter(), this.cameraControlsArr = [], this.cameraControlsActiveIndex = 0, this.autoRotateSpeed = 0, this.options = t, q.install({ THREE: w });
|
|
2013
2014
|
}
|
|
@@ -2054,10 +2055,10 @@ class Ae {
|
|
|
2054
2055
|
});
|
|
2055
2056
|
}
|
|
2056
2057
|
}
|
|
2057
|
-
class
|
|
2058
|
+
class be {
|
|
2058
2059
|
constructor(t) {
|
|
2059
2060
|
this.event = new st.EventEmitter();
|
|
2060
|
-
const { renderer: e, scene: s, camera: i } = t, r = new
|
|
2061
|
+
const { renderer: e, scene: s, camera: i } = t, r = new le(
|
|
2061
2062
|
i,
|
|
2062
2063
|
e.domElement
|
|
2063
2064
|
);
|
|
@@ -2123,8 +2124,8 @@ class De {
|
|
|
2123
2124
|
this.event.removeAllListeners(), (t = this.controls) == null || t.dispose();
|
|
2124
2125
|
}
|
|
2125
2126
|
}
|
|
2126
|
-
const Rt = new et(),
|
|
2127
|
-
class
|
|
2127
|
+
const Rt = new et(), Ue = new $t(), Lt = new et(), H = new ct(), Re = new ct();
|
|
2128
|
+
class Le {
|
|
2128
2129
|
constructor(t = {}) {
|
|
2129
2130
|
const e = this;
|
|
2130
2131
|
let s, i, r, n;
|
|
@@ -2177,7 +2178,7 @@ class Re {
|
|
|
2177
2178
|
if (x.style.display = f === !0 ? "" : "none", f === !0) {
|
|
2178
2179
|
_.onBeforeRender(e, o, m);
|
|
2179
2180
|
let O;
|
|
2180
|
-
_.isCSS3DSprite ? (H.copy(m.matrixWorldInverse), H.transpose(), _.rotation2D !== 0 && H.multiply(
|
|
2181
|
+
_.isCSS3DSprite ? (H.copy(m.matrixWorldInverse), H.transpose(), _.rotation2D !== 0 && H.multiply(Re.makeRotationZ(_.rotation2D)), _.matrixWorld.decompose(Rt, Ue, Lt), H.setPosition(Rt), H.scale(Lt), H.elements[3] = 0, H.elements[7] = 0, H.elements[11] = 0, H.elements[15] = 1, O = C(H)) : O = C(_.matrixWorld);
|
|
2181
2182
|
const D = a.objects.get(_);
|
|
2182
2183
|
if (D === void 0 || D.style !== O) {
|
|
2183
2184
|
x.style.transform = O;
|
|
@@ -2193,7 +2194,7 @@ class Re {
|
|
|
2193
2194
|
}
|
|
2194
2195
|
}
|
|
2195
2196
|
const X = new et(), zt = new ct(), Mt = new ct(), Ft = new et(), It = new et();
|
|
2196
|
-
class
|
|
2197
|
+
class ze {
|
|
2197
2198
|
constructor(t = {}) {
|
|
2198
2199
|
const e = this;
|
|
2199
2200
|
let s, i, r, n;
|
|
@@ -2256,12 +2257,12 @@ class Le {
|
|
|
2256
2257
|
const Ht = {
|
|
2257
2258
|
zIndex: "auto"
|
|
2258
2259
|
};
|
|
2259
|
-
class
|
|
2260
|
+
class Me {
|
|
2260
2261
|
constructor(t) {
|
|
2261
2262
|
this.container = t;
|
|
2262
2263
|
}
|
|
2263
2264
|
addRenderer(t, e) {
|
|
2264
|
-
const s = e.container || this.container, i = s.offsetWidth, r = s.offsetHeight, n = t === "css2d" ? new
|
|
2265
|
+
const s = e.container || this.container, i = s.offsetWidth, r = s.offsetHeight, n = t === "css2d" ? new ze() : new Le();
|
|
2265
2266
|
n.domElement.style.position = "absolute", n.domElement.style.top = "0", n.domElement.style.pointerEvents = "none", n.domElement.style.zIndex = e.zIndex, n.setSize(i, r), s.appendChild(n.domElement), t === "css2d" ? this.css2Drenderer = n : t === "css3d" && (this.css3Drenderer = n);
|
|
2266
2267
|
}
|
|
2267
2268
|
setSize(t, e) {
|
|
@@ -2334,7 +2335,7 @@ class kt {
|
|
|
2334
2335
|
});
|
|
2335
2336
|
}
|
|
2336
2337
|
}
|
|
2337
|
-
const
|
|
2338
|
+
const Fe = {
|
|
2338
2339
|
name: "OutputShader",
|
|
2339
2340
|
uniforms: {
|
|
2340
2341
|
tDiffuse: { value: null },
|
|
@@ -2424,20 +2425,20 @@ const Me = {
|
|
|
2424
2425
|
}`
|
|
2425
2426
|
)
|
|
2426
2427
|
};
|
|
2427
|
-
class
|
|
2428
|
+
class Ie extends pe {
|
|
2428
2429
|
constructor() {
|
|
2429
2430
|
super();
|
|
2430
|
-
const t =
|
|
2431
|
+
const t = Fe;
|
|
2431
2432
|
this.uniforms = Jt.clone(t.uniforms), this.material = new te({
|
|
2432
2433
|
name: t.name,
|
|
2433
2434
|
uniforms: this.uniforms,
|
|
2434
2435
|
vertexShader: t.vertexShader,
|
|
2435
2436
|
fragmentShader: t.fragmentShader
|
|
2436
|
-
}), this.fsQuad = new
|
|
2437
|
+
}), this.fsQuad = new me(this.material);
|
|
2437
2438
|
}
|
|
2438
2439
|
}
|
|
2439
|
-
const
|
|
2440
|
-
const t = new
|
|
2440
|
+
const He = (g) => {
|
|
2441
|
+
const t = new _e(
|
|
2441
2442
|
new w.ShaderMaterial({
|
|
2442
2443
|
uniforms: {
|
|
2443
2444
|
baseTexture: { value: null },
|
|
@@ -2472,36 +2473,36 @@ const Ie = (g) => {
|
|
|
2472
2473
|
"baseTexture"
|
|
2473
2474
|
);
|
|
2474
2475
|
return t.needsSwap = !0, t;
|
|
2475
|
-
}, yt = 1, K = !1,
|
|
2476
|
+
}, yt = 1, K = !1, ke = new w.MeshBasicMaterial({ color: "black" }), Ve = new w.PointsMaterial({
|
|
2476
2477
|
color: "black",
|
|
2477
2478
|
sizeAttenuation: !1
|
|
2478
|
-
}),
|
|
2479
|
+
}), Be = new w.PointsMaterial({
|
|
2479
2480
|
color: "black",
|
|
2480
2481
|
sizeAttenuation: !0
|
|
2481
|
-
}),
|
|
2482
|
+
}), Ne = new w.SpriteMaterial({
|
|
2482
2483
|
color: "black",
|
|
2483
2484
|
sizeAttenuation: !0
|
|
2484
|
-
}),
|
|
2485
|
+
}), Ye = new w.SpriteMaterial({
|
|
2485
2486
|
color: "black",
|
|
2486
2487
|
sizeAttenuation: !1
|
|
2487
|
-
}),
|
|
2488
|
+
}), Ze = new Bt({
|
|
2488
2489
|
color: "black",
|
|
2489
2490
|
sizeAttenuation: 0,
|
|
2490
2491
|
lineWidth: 0
|
|
2491
|
-
}),
|
|
2492
|
+
}), We = {
|
|
2492
2493
|
kernelRadius: 8,
|
|
2493
2494
|
minDistance: 5e-3,
|
|
2494
2495
|
maxDistance: 0.1
|
|
2495
|
-
},
|
|
2496
|
+
}, Ge = {
|
|
2496
2497
|
threshold: 0,
|
|
2497
2498
|
strength: 0.4,
|
|
2498
2499
|
radius: 0.1,
|
|
2499
2500
|
bloomAlphaType: 0
|
|
2500
|
-
},
|
|
2501
|
+
}, Xe = {
|
|
2501
2502
|
multisampling: 4,
|
|
2502
2503
|
premultiplieAlpha: !1
|
|
2503
2504
|
};
|
|
2504
|
-
class
|
|
2505
|
+
class Ke {
|
|
2505
2506
|
constructor(t) {
|
|
2506
2507
|
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new w.Layers(), this.bloomMaterials = {}, this.bloomVisible = {}, this.pipViewportState = null, this.options = t;
|
|
2507
2508
|
const {
|
|
@@ -2509,7 +2510,9 @@ class Xe {
|
|
|
2509
2510
|
sceneController: s,
|
|
2510
2511
|
cameraController: i,
|
|
2511
2512
|
composerParams: r
|
|
2512
|
-
} = t, { renderer: n } = e
|
|
2513
|
+
} = t, { renderer: n } = e;
|
|
2514
|
+
this.renderer = n;
|
|
2515
|
+
const { multisampling: a } = r, { maxSamples: l } = n.capabilities, d = n.getDrawingBufferSize(
|
|
2513
2516
|
new w.Vector2()
|
|
2514
2517
|
), y = new w.WebGLRenderTarget(
|
|
2515
2518
|
d.width,
|
|
@@ -2518,13 +2521,13 @@ class Xe {
|
|
|
2518
2521
|
samples: Math.min(a, l),
|
|
2519
2522
|
type: w.HalfFloatType
|
|
2520
2523
|
}
|
|
2521
|
-
), c = new
|
|
2524
|
+
), c = new Tt(n, y), v = this.getSize();
|
|
2525
|
+
c.setSize(v.width, v.height);
|
|
2526
|
+
const C = new ce(
|
|
2522
2527
|
s.scene,
|
|
2523
2528
|
i.camera
|
|
2524
|
-
)
|
|
2525
|
-
|
|
2526
|
-
const C = this.getSize();
|
|
2527
|
-
this.setSize(C.width, C.height), i.event.on("cameraChange", (u) => {
|
|
2529
|
+
);
|
|
2530
|
+
c.addPass(C), this.scene = s.scene, this.camera = i.camera, this.finalComposer = c, this.renderPass = C, i.event.on("cameraChange", (u) => {
|
|
2528
2531
|
this.changeCamera(u);
|
|
2529
2532
|
}), s.event.on("sceneChange", (u) => {
|
|
2530
2533
|
this.changeScene(u);
|
|
@@ -2537,14 +2540,14 @@ class Xe {
|
|
|
2537
2540
|
this.renderPass.scene = t, this.ssaoPass && (this.ssaoPass.scene = t), this.scene = t;
|
|
2538
2541
|
}
|
|
2539
2542
|
addOutputPass() {
|
|
2540
|
-
const { premultiplieAlpha: t } = this.options.composerParams, e = new
|
|
2543
|
+
const { premultiplieAlpha: t } = this.options.composerParams, e = new Ie();
|
|
2541
2544
|
this.outputPass = e, this.setPremultiplieAlpha(t), this.finalComposer.addPass(e);
|
|
2542
2545
|
}
|
|
2543
2546
|
setPremultiplieAlpha(t) {
|
|
2544
2547
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = t ? 1 : 0);
|
|
2545
2548
|
}
|
|
2546
2549
|
addSSAOPass(t) {
|
|
2547
|
-
const { scene: e, camera: s, renderer: i } = this, r = i.getSize(new w.Vector2()), n = r.width, a = r.height, l = new
|
|
2550
|
+
const { scene: e, camera: s, renderer: i } = this, r = i.getSize(new w.Vector2()), n = r.width, a = r.height, l = new de(e, s, n, a);
|
|
2548
2551
|
l.kernelRadius = t.kernelRadius, l.minDistance = t.minDistance, l.maxDistance = t.maxDistance, this.ssaoPass = l, this.finalComposer.addPass(l);
|
|
2549
2552
|
}
|
|
2550
2553
|
addSSAOGui(t) {
|
|
@@ -2570,7 +2573,7 @@ class Xe {
|
|
|
2570
2573
|
}).showGui(t);
|
|
2571
2574
|
}
|
|
2572
2575
|
addBloomPass(t) {
|
|
2573
|
-
const { renderer: e } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: n } = t, a = new
|
|
2576
|
+
const { renderer: e } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: n } = t, a = new ue(
|
|
2574
2577
|
new w.Vector2(window.innerWidth, window.innerHeight),
|
|
2575
2578
|
i,
|
|
2576
2579
|
r,
|
|
@@ -2579,7 +2582,7 @@ class Xe {
|
|
|
2579
2582
|
this.bloomPass = a;
|
|
2580
2583
|
const l = new Tt(e);
|
|
2581
2584
|
l.renderToScreen = !1, l.addPass(this.renderPass), l.addPass(a), this.bloomComposer = l;
|
|
2582
|
-
const d =
|
|
2585
|
+
const d = He(l);
|
|
2583
2586
|
d.uniforms.bloomAlphaType.value = n, this.bloomComposer = l, this.finalComposer.addPass(d), this.mixPass = d, this.bloomLayer.set(yt);
|
|
2584
2587
|
}
|
|
2585
2588
|
addBloomGui(t) {
|
|
@@ -2645,7 +2648,7 @@ class Xe {
|
|
|
2645
2648
|
}), e.forEach((s) => {
|
|
2646
2649
|
s.traverse((i) => {
|
|
2647
2650
|
const r = i, n = i, a = i;
|
|
2648
|
-
r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, n.isSprite ? n.material.sizeAttenuation ? n.material =
|
|
2651
|
+
r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, n.isSprite ? n.material.sizeAttenuation ? n.material = Ne : n.material = Ye : r.material instanceof Bt ? r.material = Ze : a.isPoints ? a.material.sizeAttenuation ? a.material = Be : a.material = Ve : r.material = ke);
|
|
2649
2652
|
});
|
|
2650
2653
|
});
|
|
2651
2654
|
}
|
|
@@ -2687,27 +2690,27 @@ class Xe {
|
|
|
2687
2690
|
}
|
|
2688
2691
|
}
|
|
2689
2692
|
const lt = class lt {
|
|
2690
|
-
constructor(t
|
|
2691
|
-
this.raycaster = new w.Raycaster(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new w.Vector3(), this._cameraTarget = new w.Vector3(), this.event = new st.EventEmitter(), this.
|
|
2692
|
-
isMergeableObject:
|
|
2693
|
-
}), this.
|
|
2693
|
+
constructor(t) {
|
|
2694
|
+
this.raycaster = new w.Raycaster(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new w.Vector3(), this._cameraTarget = new w.Vector3(), this.event = new st.EventEmitter(), this.timer = new ee(), this.userData = {}, this.pageActiveIndex = -1, this.userSetDprCache = 1, this.event.setMaxListeners(1 / 0), this.timer.connect(document), this.options = se(lt.options, t, {
|
|
2695
|
+
isMergeableObject: fe
|
|
2696
|
+
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
2694
2697
|
const {
|
|
2695
|
-
container:
|
|
2696
|
-
stats:
|
|
2697
|
-
gui:
|
|
2698
|
-
transformControls:
|
|
2698
|
+
container: e,
|
|
2699
|
+
stats: s,
|
|
2700
|
+
gui: i,
|
|
2701
|
+
transformControls: r
|
|
2699
2702
|
} = this.options;
|
|
2700
|
-
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(),
|
|
2701
|
-
const
|
|
2702
|
-
|
|
2703
|
+
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), r && this.initTransformControls(), s) {
|
|
2704
|
+
const n = new ie({
|
|
2705
|
+
horizontal: !1
|
|
2706
|
+
});
|
|
2707
|
+
n.init(this.renderer), e.appendChild(n.dom), this.stats = n;
|
|
2703
2708
|
}
|
|
2704
|
-
if (
|
|
2705
|
-
const
|
|
2706
|
-
|
|
2709
|
+
if (i) {
|
|
2710
|
+
const n = new re();
|
|
2711
|
+
n.open(!1), this.gui = n;
|
|
2707
2712
|
}
|
|
2708
|
-
this.initResizeObserver()
|
|
2709
|
-
Array.isArray(a) || (a = [a]), this.use(a[0], a[1]);
|
|
2710
|
-
}));
|
|
2713
|
+
this.initResizeObserver();
|
|
2711
2714
|
}
|
|
2712
2715
|
getPlugin(t) {
|
|
2713
2716
|
return this.installPlugins.get(t);
|
|
@@ -2763,21 +2766,21 @@ const lt = class lt {
|
|
|
2763
2766
|
viewHelper: i,
|
|
2764
2767
|
renderer: r,
|
|
2765
2768
|
controlsParams: n
|
|
2766
|
-
} = this.options, { width: a, height: l } = this.getSize(), d = e ? new
|
|
2769
|
+
} = this.options, { width: a, height: l } = this.getSize(), d = e ? new ve({
|
|
2767
2770
|
width: a,
|
|
2768
2771
|
height: l,
|
|
2769
2772
|
renderer: e.WebGPURenderer,
|
|
2770
|
-
rendererParams:
|
|
2771
|
-
}) : new
|
|
2773
|
+
rendererParams: Oe
|
|
2774
|
+
}) : new Ee({
|
|
2772
2775
|
width: a,
|
|
2773
2776
|
height: l,
|
|
2774
2777
|
rendererParams: mt(V({}, r), {
|
|
2775
2778
|
antialias: !1
|
|
2776
2779
|
})
|
|
2777
|
-
}), y = new
|
|
2780
|
+
}), y = new xe({
|
|
2778
2781
|
width: a,
|
|
2779
2782
|
height: l
|
|
2780
|
-
}), c = new
|
|
2783
|
+
}), c = new Pe({}), v = new De({
|
|
2781
2784
|
controlsParams: {
|
|
2782
2785
|
domElement: (n == null ? void 0 : n.domElement) || d.renderer.domElement
|
|
2783
2786
|
}
|
|
@@ -2788,7 +2791,7 @@ const lt = class lt {
|
|
|
2788
2791
|
cameraOptions: this.options.camera
|
|
2789
2792
|
});
|
|
2790
2793
|
if (this.pageActiveIndex = C, this.controls.setLookAt(0, 0, 400, 0, 0, 0, !1), s) {
|
|
2791
|
-
const u = new
|
|
2794
|
+
const u = new Ae({
|
|
2792
2795
|
container: t,
|
|
2793
2796
|
sceneController: c,
|
|
2794
2797
|
cameraController: y
|
|
@@ -2804,7 +2807,7 @@ const lt = class lt {
|
|
|
2804
2807
|
ssao: s,
|
|
2805
2808
|
ssaoParams: i,
|
|
2806
2809
|
composer: r
|
|
2807
|
-
} = this.options, n = new
|
|
2810
|
+
} = this.options, n = new Ke({
|
|
2808
2811
|
rendererController: this.rendererController,
|
|
2809
2812
|
sceneController: this.sceneController,
|
|
2810
2813
|
cameraController: this.cameraController,
|
|
@@ -2821,12 +2824,12 @@ const lt = class lt {
|
|
|
2821
2824
|
css3DRendererParams: r
|
|
2822
2825
|
} = this.options;
|
|
2823
2826
|
if (e || s) {
|
|
2824
|
-
const n = new
|
|
2827
|
+
const n = new Me(t);
|
|
2825
2828
|
e && n.addRenderer("css2d", i), s && n.addRenderer("css3d", r), this.cssRendererController = n;
|
|
2826
2829
|
}
|
|
2827
2830
|
}
|
|
2828
2831
|
initTransformControls() {
|
|
2829
|
-
const t = new
|
|
2832
|
+
const t = new be({
|
|
2830
2833
|
camera: this.camera,
|
|
2831
2834
|
renderer: this.renderer,
|
|
2832
2835
|
scene: this.scene
|
|
@@ -2852,24 +2855,11 @@ const lt = class lt {
|
|
|
2852
2855
|
const e = new ResizeObserver((s) => {
|
|
2853
2856
|
for (const i of s) {
|
|
2854
2857
|
const r = i.contentRect;
|
|
2855
|
-
this.handeleResize(r.width, r.height), this.
|
|
2858
|
+
this.handeleResize(r.width, r.height), this.setDevicePixelRatio(this.userSetDprCache);
|
|
2856
2859
|
}
|
|
2857
2860
|
});
|
|
2858
2861
|
e.observe(t), this.resizeObserver = e;
|
|
2859
2862
|
}
|
|
2860
|
-
checkBackufferArea(t = this.maxBackufferArea) {
|
|
2861
|
-
t > this.maxBackufferArea && (t = this.maxBackufferArea);
|
|
2862
|
-
const e = this.dprCache, { width: s, height: i } = this.getSize();
|
|
2863
|
-
let r = Math.sqrt(t / (s * i));
|
|
2864
|
-
r = (r * 100 | 0) / 100;
|
|
2865
|
-
const n = Math.min(e, r);
|
|
2866
|
-
this.setDevicePixelRatio(n), this.dprCache = e, n !== e && console.warn(
|
|
2867
|
-
"maxBackufferArea:",
|
|
2868
|
-
t,
|
|
2869
|
-
" the pixel ratio is set to",
|
|
2870
|
-
n
|
|
2871
|
-
);
|
|
2872
|
-
}
|
|
2873
2863
|
handeleResize(t, e, s = !0) {
|
|
2874
2864
|
const {
|
|
2875
2865
|
rendererController: i,
|
|
@@ -2883,9 +2873,20 @@ const lt = class lt {
|
|
|
2883
2873
|
}), this.render(), s && this.event.emit("resize", { width: t, height: e }));
|
|
2884
2874
|
}
|
|
2885
2875
|
setDevicePixelRatio(t) {
|
|
2886
|
-
var
|
|
2876
|
+
var a;
|
|
2877
|
+
this.userSetDprCache = t;
|
|
2887
2878
|
const e = this.renderer.getPixelRatio();
|
|
2888
|
-
|
|
2879
|
+
if (t === e) return;
|
|
2880
|
+
const { width: s, height: i } = this.getSize();
|
|
2881
|
+
let r = Math.sqrt(this.maxBackufferArea / (s * i));
|
|
2882
|
+
r = (r * 100 | 0) / 100;
|
|
2883
|
+
const n = Math.min(t, r);
|
|
2884
|
+
n !== t && console.warn(
|
|
2885
|
+
"maxBackufferArea:",
|
|
2886
|
+
this.maxBackufferArea,
|
|
2887
|
+
" the pixel ratio is set to",
|
|
2888
|
+
n
|
|
2889
|
+
), this.rendererController.setPixelRatio(n), (a = this.composerController) == null || a.setPixelRatio(n);
|
|
2889
2890
|
}
|
|
2890
2891
|
pick(t, e, s = !0) {
|
|
2891
2892
|
const { raycaster: i, options: r } = this, { container: n } = r, a = new w.Vector2(), l = n.getBoundingClientRect();
|
|
@@ -2905,8 +2906,10 @@ const lt = class lt {
|
|
|
2905
2906
|
}
|
|
2906
2907
|
render() {
|
|
2907
2908
|
var n, a, l, d, y, c, v;
|
|
2908
|
-
const { scene: t, camera: e,
|
|
2909
|
-
|
|
2909
|
+
const { scene: t, camera: e, timer: s } = this;
|
|
2910
|
+
s.update(), vt.update();
|
|
2911
|
+
const i = s.getDelta(), r = s.getElapsed();
|
|
2912
|
+
(n = this.controlsController) == null || n.update(i), this.installPlugins.forEach((C) => {
|
|
2910
2913
|
var u;
|
|
2911
2914
|
(u = C.update) == null || u.call(C, i, r);
|
|
2912
2915
|
}), (a = this.helperController) == null || a.update(
|
|
@@ -2963,7 +2966,7 @@ const lt = class lt {
|
|
|
2963
2966
|
}
|
|
2964
2967
|
dispose() {
|
|
2965
2968
|
var t, e, s, i, r, n, a, l, d, y, c;
|
|
2966
|
-
this.stop(), vt.removeAll(), this.event.removeAllListeners(), (t = this.resizeObserver) == null || t.unobserve(this.options.container), this.installPlugins.forEach((v) => {
|
|
2969
|
+
this.stop(), this.timer.dispose(), vt.removeAll(), this.event.removeAllListeners(), (t = this.resizeObserver) == null || t.unobserve(this.options.container), this.installPlugins.forEach((v) => {
|
|
2967
2970
|
var C;
|
|
2968
2971
|
(C = v.dispose) == null || C.call(v);
|
|
2969
2972
|
}), (e = this.controlsController) == null || e.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (l = this.rendererController) == null || l.dispose(), this.cssRendererController = void 0, (d = this.gui) == null || d.destroy(), this.installPlugins.clear(), (y = this.stats) == null || y.dom.remove(), (c = this.renderer) == null || c.domElement.remove();
|
|
@@ -2977,25 +2980,25 @@ lt.options = {
|
|
|
2977
2980
|
viewHelper: K,
|
|
2978
2981
|
controls: !0,
|
|
2979
2982
|
transformControls: K,
|
|
2980
|
-
renderer:
|
|
2981
|
-
composer:
|
|
2982
|
-
scene:
|
|
2983
|
-
camera:
|
|
2983
|
+
renderer: ye,
|
|
2984
|
+
composer: Xe,
|
|
2985
|
+
scene: we,
|
|
2986
|
+
camera: Te,
|
|
2984
2987
|
bloom: !1,
|
|
2985
|
-
bloomParams:
|
|
2988
|
+
bloomParams: Ge,
|
|
2986
2989
|
ssao: !1,
|
|
2987
|
-
ssaoParams:
|
|
2990
|
+
ssaoParams: We,
|
|
2988
2991
|
css2DRenderer: !1,
|
|
2989
2992
|
css2DRendererParams: V({}, Ht),
|
|
2990
2993
|
css3DRenderer: !1,
|
|
2991
2994
|
css3DRendererParams: V({}, Ht)
|
|
2992
2995
|
};
|
|
2993
2996
|
let Vt = lt;
|
|
2994
|
-
const
|
|
2997
|
+
const Ps = q.ACTION;
|
|
2995
2998
|
export {
|
|
2996
|
-
|
|
2999
|
+
bs as BaseObject,
|
|
2997
3000
|
kt as GUIObject,
|
|
2998
3001
|
Vt as Pencil,
|
|
2999
|
-
|
|
3002
|
+
Ps as cameraControlsAction,
|
|
3000
3003
|
Vt as default
|
|
3001
3004
|
};
|