softbox 4.5.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/{ThreePathTracingService-rw6SCxcL.cjs → ThreePathTracingService-CL_k3WTj.cjs} +13 -13
- package/dist/{ThreePathTracingService-DDmobGTv.js → ThreePathTracingService-DbqedkL2.js} +87 -87
- package/dist/index-BtN2xOzS.cjs +11 -0
- package/dist/{index-CC3LzFRV.js → index-DXbG9xpu.js} +1071 -1009
- package/dist/simple-viewer.cjs +1 -1
- package/dist/simple-viewer.es.js +1 -1
- package/package.json +1 -1
- package/dist/index-CadyonSB.cjs +0 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { UnsignedIntType as re, DataTexture as M, NearestFilter as T, IntType as we, FloatType as R, UnsignedByteType as Me, UnsignedShortType as Ct, ByteType as Be, ShortType as Ft, RGBAFormat as I, RGBAIntegerFormat as Ae, RGIntegerFormat as ft, RedIntegerFormat as Dt, RGFormat as dt, RedFormat as me, BufferAttribute as P, BufferGeometry as
|
|
3
|
-
import { g as Yt, a as Xt, B as Le, I as Qt, C as Kt, O as Zt, S as Jt, b as er, L as tr, c as rr, M as ar, T as ir, D as sr, d as or, R as
|
|
1
|
+
import * as J from "three";
|
|
2
|
+
import { UnsignedIntType as re, DataTexture as M, NearestFilter as T, IntType as we, FloatType as R, UnsignedByteType as Me, UnsignedShortType as Ct, ByteType as Be, ShortType as Ft, RGBAFormat as I, RGBAIntegerFormat as Ae, RGIntegerFormat as ft, RedIntegerFormat as Dt, RGFormat as dt, RedFormat as me, BufferAttribute as P, BufferGeometry as q, Matrix4 as O, Matrix3 as Pt, Vector3 as F, Vector4 as K, MeshBasicMaterial as Et, Mesh as mt, OrthographicCamera as kt, Float32BufferAttribute as We, ShaderMaterial as ge, NoBlending as ie, WebGLRenderTarget as ae, Vector2 as $, PerspectiveCamera as pt, DataUtils as k, HalfFloatType as D, LinearFilter as C, RepeatWrapping as z, ClampToEdgeWrapping as N, Source as Ot, Quaternion as zt, DataArrayTexture as Nt, DoubleSide as Ht, BackSide as Bt, FrontSide as Wt, WebGLArrayRenderTarget as Lt, Color as se, NoToneMapping as Ut, NormalBlending as gt, EquirectangularReflectionMapping as vt, Spherical as Vt, LinearMipMapLinearFilter as Gt, Clock as qt, Scene as $t, AdditiveBlending as jt } from "three";
|
|
3
|
+
import { g as Yt, a as Xt, B as Le, I as Qt, C as Kt, O as Zt, S as Jt, b as er, L as tr, c as rr, M as ar, T as ir, D as sr, d as or, R as _, e as B, E as W } from "./index-DXbG9xpu.js";
|
|
4
4
|
function nr(s) {
|
|
5
5
|
switch (s) {
|
|
6
6
|
case 1:
|
|
@@ -493,7 +493,7 @@ function te(s, e = null) {
|
|
|
493
493
|
const t = s.array.constructor, r = s.normalized, i = s.itemSize, o = e === null ? s.count : e;
|
|
494
494
|
return new P(new t(i * o), i, r);
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function Q(s, e) {
|
|
497
497
|
if (!s && !e)
|
|
498
498
|
return !0;
|
|
499
499
|
if (!!s != !!e)
|
|
@@ -537,7 +537,7 @@ function xr(s, e, t) {
|
|
|
537
537
|
for (const i in r)
|
|
538
538
|
r[i].count !== t && s.deleteAttribute(i);
|
|
539
539
|
}
|
|
540
|
-
function br(s, e = {}, t = new
|
|
540
|
+
function br(s, e = {}, t = new q()) {
|
|
541
541
|
const {
|
|
542
542
|
useGroups: r = !1,
|
|
543
543
|
forceUpdate: i = !1,
|
|
@@ -668,7 +668,7 @@ class wr {
|
|
|
668
668
|
return !(this.matrixWorld.equals(e.matrixWorld) && this.geometryHash === Ve(t) && this.skeletonHash === Ge(e) && this.primitiveCount === r);
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
|
-
const
|
|
671
|
+
const L = /* @__PURE__ */ new F(), U = /* @__PURE__ */ new F(), V = /* @__PURE__ */ new F(), qe = /* @__PURE__ */ new K(), le = /* @__PURE__ */ new F(), Ie = /* @__PURE__ */ new F(), $e = /* @__PURE__ */ new K(), je = /* @__PURE__ */ new K(), ce = /* @__PURE__ */ new O(), Ye = /* @__PURE__ */ new O();
|
|
672
672
|
function Xe(s, e, t) {
|
|
673
673
|
const r = s.skeleton, i = s.geometry, o = r.bones, a = r.boneInverses;
|
|
674
674
|
$e.fromBufferAttribute(i.attributes.skinIndex, e), je.fromBufferAttribute(i.attributes.skinWeight, e), ce.elements.fill(0);
|
|
@@ -712,7 +712,7 @@ function Rr(s) {
|
|
|
712
712
|
}
|
|
713
713
|
return s;
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function _r(s, e = {}, t = new q()) {
|
|
716
716
|
e = {
|
|
717
717
|
applyWorldTransforms: !0,
|
|
718
718
|
attributes: [],
|
|
@@ -721,18 +721,18 @@ function Sr(s, e = {}, t = new $()) {
|
|
|
721
721
|
const r = s.geometry, i = e.applyWorldTransforms, o = e.attributes.includes("normal"), a = e.attributes.includes("tangent"), l = r.attributes, h = t.attributes;
|
|
722
722
|
for (const v in t.attributes)
|
|
723
723
|
(!e.attributes.includes(v) || !(v in r.attributes)) && t.deleteAttribute(v);
|
|
724
|
-
!t.index && r.index && (t.index = r.index.clone()), h.position || t.setAttribute("position", te(l.position)), o && !h.normal && l.normal && t.setAttribute("normal", te(l.normal)), a && !h.tangent && l.tangent && t.setAttribute("tangent", te(l.tangent)),
|
|
724
|
+
!t.index && r.index && (t.index = r.index.clone()), h.position || t.setAttribute("position", te(l.position)), o && !h.normal && l.normal && t.setAttribute("normal", te(l.normal)), a && !h.tangent && l.tangent && t.setAttribute("tangent", te(l.tangent)), Q(r.index, t.index), Q(l.position, h.position), o && Q(l.normal, h.normal), a && Q(l.tangent, h.tangent);
|
|
725
725
|
const d = l.position, f = o ? l.normal : null, u = a ? l.tangent : null, n = r.morphAttributes.position, x = r.morphAttributes.normal, m = r.morphAttributes.tangent, g = r.morphTargetsRelative, c = s.morphTargetInfluences, p = new Pt();
|
|
726
726
|
p.getNormalMatrix(s.matrixWorld), r.index && t.index.array.set(r.index.array);
|
|
727
727
|
for (let v = 0, b = l.position.count; v < b; v++)
|
|
728
|
-
|
|
728
|
+
L.fromBufferAttribute(d, v), f && U.fromBufferAttribute(f, v), u && (qe.fromBufferAttribute(u, v), V.fromBufferAttribute(u, v)), c && (n && Re(n, c, g, v, L), x && Re(x, c, g, v, U), m && Re(m, c, g, v, V)), s.isSkinnedMesh && (s.applyBoneTransform(v, L), f && Xe(s, v, U), u && Xe(s, v, V)), i && L.applyMatrix4(s.matrixWorld), h.position.setXYZ(v, L.x, L.y, L.z), f && (i && U.applyNormalMatrix(p), h.normal.setXYZ(v, U.x, U.y, U.z)), u && (i && V.transformDirection(s.matrixWorld), h.tangent.setXYZW(v, V.x, V.y, V.z, qe.w));
|
|
729
729
|
for (const v in e.attributes) {
|
|
730
730
|
const b = e.attributes[v];
|
|
731
|
-
b === "position" || b === "tangent" || b === "normal" || !(b in l) || (h[b] || t.setAttribute(b, te(l[b])),
|
|
731
|
+
b === "position" || b === "tangent" || b === "normal" || !(b in l) || (h[b] || t.setAttribute(b, te(l[b])), Q(l[b], h[b]), Tt(l[b], h[b]));
|
|
732
732
|
}
|
|
733
733
|
return s.matrixWorld.determinant() < 0 && Rr(t), t;
|
|
734
734
|
}
|
|
735
|
-
class
|
|
735
|
+
class Sr extends q {
|
|
736
736
|
constructor() {
|
|
737
737
|
super(), this.version = 0, this.hash = null, this._diff = new wr();
|
|
738
738
|
}
|
|
@@ -742,14 +742,14 @@ class _r extends $ {
|
|
|
742
742
|
const r = e.geometry;
|
|
743
743
|
for (let i = 0; i < t.length; i++) {
|
|
744
744
|
const o = t[i], a = r.attributes[o], l = this.attributes[o];
|
|
745
|
-
if (a && !
|
|
745
|
+
if (a && !Q(a, l))
|
|
746
746
|
return !1;
|
|
747
747
|
}
|
|
748
748
|
return !0;
|
|
749
749
|
}
|
|
750
750
|
updateFrom(e, t) {
|
|
751
751
|
const r = this._diff;
|
|
752
|
-
return r.didChange(e) ? (
|
|
752
|
+
return r.didChange(e) ? (_r(e, t, this), r.updateFrom(e), this.version++, this.hash = `${this.uuid}_${this.version}`, !0) : !1;
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
755
|
const Ce = 0, wt = 1, It = 2;
|
|
@@ -786,7 +786,7 @@ class Fr {
|
|
|
786
786
|
}
|
|
787
787
|
_getDummyMesh() {
|
|
788
788
|
if (!this._dummyMesh) {
|
|
789
|
-
const e = new Et(), t = new
|
|
789
|
+
const e = new Et(), t = new q();
|
|
790
790
|
t.setAttribute("position", new P(new Float32Array(9), 3)), this._dummyMesh = new mt(t, e);
|
|
791
791
|
}
|
|
792
792
|
return this._dummyMesh;
|
|
@@ -806,7 +806,7 @@ class Fr {
|
|
|
806
806
|
const l = t[o], h = l.uuid;
|
|
807
807
|
r.delete(h);
|
|
808
808
|
let d = e.get(h);
|
|
809
|
-
(!d || !d.isCompatible(l, this.attributes)) && (d && d.dispose(), d = new
|
|
809
|
+
(!d || !d.isCompatible(l, this.attributes)) && (d && d.dispose(), d = new Sr(), e.set(h, d)), d.updateFrom(l, i) && this.generateMissingAttributes && Tr(d, this.attributes);
|
|
810
810
|
}
|
|
811
811
|
r.forEach((o) => {
|
|
812
812
|
e.delete(o);
|
|
@@ -815,7 +815,7 @@ class Fr {
|
|
|
815
815
|
setObjects(e) {
|
|
816
816
|
Array.isArray(e) ? this.objects = [...e] : this.objects = [e];
|
|
817
817
|
}
|
|
818
|
-
generate(e = new
|
|
818
|
+
generate(e = new q()) {
|
|
819
819
|
const { useGroups: t, overwriteIndex: r, _intermediateGeometry: i, _geometryMergeSets: o } = this, a = this._getMeshes(), l = [], h = [], d = o.get(e) || [];
|
|
820
820
|
this._updateIntermediateGeometries();
|
|
821
821
|
let f = !1;
|
|
@@ -863,7 +863,7 @@ class Er {
|
|
|
863
863
|
return !!this.bvh;
|
|
864
864
|
}
|
|
865
865
|
constructor(e) {
|
|
866
|
-
this.bvhOptions = {}, this.attributes = ["position", "normal", "tangent", "color", "uv", "uv2"], this.generateBVH = !0, this.bvh = null, this.geometry = new
|
|
866
|
+
this.bvhOptions = {}, this.attributes = ["position", "normal", "tangent", "color", "uv", "uv2"], this.generateBVH = !0, this.bvh = null, this.geometry = new q(), this.staticGeometryGenerator = new Fr(e), this._bvhWorker = null, this._pendingGenerate = null, this._buildAsync = !1;
|
|
867
867
|
}
|
|
868
868
|
setObjects(e) {
|
|
869
869
|
this.staticGeometryGenerator.setObjects(e);
|
|
@@ -917,13 +917,13 @@ class Er {
|
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
const kr = new kt(-1, 1, 1, -1, 0, 1);
|
|
920
|
-
class Or extends
|
|
920
|
+
class Or extends q {
|
|
921
921
|
constructor() {
|
|
922
922
|
super(), this.setAttribute("position", new We([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new We([0, 2, 0, 0, 2, 0], 2));
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
925
|
const zr = new Or();
|
|
926
|
-
class
|
|
926
|
+
class Z {
|
|
927
927
|
/**
|
|
928
928
|
* Constructs a new full screen quad.
|
|
929
929
|
*
|
|
@@ -1266,7 +1266,7 @@ class Wr extends Pe {
|
|
|
1266
1266
|
super({
|
|
1267
1267
|
blending: ie,
|
|
1268
1268
|
uniforms: {
|
|
1269
|
-
resolution: { value: new
|
|
1269
|
+
resolution: { value: new $() }
|
|
1270
1270
|
},
|
|
1271
1271
|
vertexShader: (
|
|
1272
1272
|
/* glsl */
|
|
@@ -1311,7 +1311,7 @@ class Lr {
|
|
|
1311
1311
|
generateMipmaps: !1
|
|
1312
1312
|
}), i = e.getRenderTarget();
|
|
1313
1313
|
e.setRenderTarget(r);
|
|
1314
|
-
const o = new
|
|
1314
|
+
const o = new Z(new Wr());
|
|
1315
1315
|
return o.material.resolution.set(t, t), o.render(e), e.setRenderTarget(i), o.dispose(), r;
|
|
1316
1316
|
}
|
|
1317
1317
|
}
|
|
@@ -1337,7 +1337,7 @@ class Vr {
|
|
|
1337
1337
|
e instanceof Ur ? (this.bokehSize = e.bokehSize, this.apertureBlades = e.apertureBlades, this.apertureRotation = e.apertureRotation, this.focusDistance = e.focusDistance, this.anamorphicRatio = e.anamorphicRatio) : (this.bokehSize = 0, this.apertureRotation = 0, this.apertureBlades = 0, this.focusDistance = 10, this.anamorphicRatio = 1);
|
|
1338
1338
|
}
|
|
1339
1339
|
}
|
|
1340
|
-
function
|
|
1340
|
+
function _e(s) {
|
|
1341
1341
|
const e = new Uint16Array(s.length);
|
|
1342
1342
|
for (let t = 0, r = s.length; t < r; ++t)
|
|
1343
1343
|
e[t] = k.toHalfFloat(s[t]);
|
|
@@ -1383,11 +1383,11 @@ function qr(s, e = D) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
class $r {
|
|
1385
1385
|
constructor() {
|
|
1386
|
-
const e = new M(
|
|
1386
|
+
const e = new M(_e(new Float32Array([0, 0, 0, 0])), 1, 1);
|
|
1387
1387
|
e.type = D, e.format = I, e.minFilter = C, e.magFilter = C, e.wrapS = z, e.wrapT = z, e.generateMipmaps = !1, e.needsUpdate = !0;
|
|
1388
|
-
const t = new M(
|
|
1388
|
+
const t = new M(_e(new Float32Array([0, 1])), 1, 2);
|
|
1389
1389
|
t.type = D, t.format = me, t.minFilter = C, t.magFilter = C, t.generateMipmaps = !1, t.needsUpdate = !0;
|
|
1390
|
-
const r = new M(
|
|
1390
|
+
const r = new M(_e(new Float32Array([0, 0, 1, 1])), 2, 2);
|
|
1391
1391
|
r.type = D, r.format = me, r.minFilter = C, r.magFilter = C, r.generateMipmaps = !1, r.needsUpdate = !0, this.map = e, this.marginalWeights = t, this.conditionalWeights = r, this.totalSum = 0;
|
|
1392
1392
|
}
|
|
1393
1393
|
dispose() {
|
|
@@ -1427,34 +1427,34 @@ class $r {
|
|
|
1427
1427
|
m.image = { width: i, height: 1, data: n }, m.needsUpdate = !0, g.image = { width: r, height: i, data: x }, g.needsUpdate = !0, this.totalSum = f, this.map = t;
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
1430
|
-
const
|
|
1430
|
+
const Se = 6, jr = 0, Yr = 1, Xr = 2, Qr = 3, Kr = 4, A = new F(), S = new F(), Ke = new O(), j = new zt(), Ze = new F(), Y = new F(), Zr = new F(0, 1, 0);
|
|
1431
1431
|
class Jr {
|
|
1432
1432
|
constructor() {
|
|
1433
1433
|
const e = new M(new Float32Array(4), 1, 1);
|
|
1434
1434
|
e.format = I, e.type = R, e.wrapS = N, e.wrapT = N, e.generateMipmaps = !1, e.minFilter = T, e.magFilter = T, this.tex = e, this.count = 0;
|
|
1435
1435
|
}
|
|
1436
1436
|
updateFrom(e, t = []) {
|
|
1437
|
-
const r = this.tex, i = Math.max(e.length *
|
|
1437
|
+
const r = this.tex, i = Math.max(e.length * Se, 1), o = Math.ceil(Math.sqrt(i));
|
|
1438
1438
|
r.image.width !== o && (r.dispose(), r.image.data = new Float32Array(o * o * 4), r.image.width = o, r.image.height = o);
|
|
1439
1439
|
const a = r.image.data;
|
|
1440
1440
|
for (let h = 0, d = e.length; h < d; h++) {
|
|
1441
|
-
const f = e[h], u = h *
|
|
1441
|
+
const f = e[h], u = h * Se * 4;
|
|
1442
1442
|
let n = 0;
|
|
1443
|
-
for (let m = 0; m <
|
|
1443
|
+
for (let m = 0; m < Se * 4; m++)
|
|
1444
1444
|
a[u + m] = 0;
|
|
1445
|
-
f.getWorldPosition(
|
|
1445
|
+
f.getWorldPosition(S), a[u + n++] = S.x, a[u + n++] = S.y, a[u + n++] = S.z;
|
|
1446
1446
|
let x = jr;
|
|
1447
|
-
if (f.isRectAreaLight && f.isCircular ? x = Yr : f.isSpotLight ? x = Xr : f.isDirectionalLight ? x = Qr : f.isPointLight && (x = Kr), a[u + n++] = x, a[u + n++] = f.color.r, a[u + n++] = f.color.g, a[u + n++] = f.color.b, a[u + n++] = f.intensity, f.getWorldQuaternion(
|
|
1448
|
-
A.set(f.width, 0, 0).applyQuaternion(
|
|
1447
|
+
if (f.isRectAreaLight && f.isCircular ? x = Yr : f.isSpotLight ? x = Xr : f.isDirectionalLight ? x = Qr : f.isPointLight && (x = Kr), a[u + n++] = x, a[u + n++] = f.color.r, a[u + n++] = f.color.g, a[u + n++] = f.color.b, a[u + n++] = f.intensity, f.getWorldQuaternion(j), f.isRectAreaLight)
|
|
1448
|
+
A.set(f.width, 0, 0).applyQuaternion(j), a[u + n++] = A.x, a[u + n++] = A.y, a[u + n++] = A.z, n++, S.set(0, f.height, 0).applyQuaternion(j), a[u + n++] = S.x, a[u + n++] = S.y, a[u + n++] = S.z, a[u + n++] = A.cross(S).length() * (f.isCircular ? Math.PI / 4 : 1);
|
|
1449
1449
|
else if (f.isSpotLight) {
|
|
1450
1450
|
const m = f.radius || 0;
|
|
1451
|
-
Ze.setFromMatrixPosition(f.matrixWorld),
|
|
1451
|
+
Ze.setFromMatrixPosition(f.matrixWorld), Y.setFromMatrixPosition(f.target.matrixWorld), Ke.lookAt(Ze, Y, Zr), j.setFromRotationMatrix(Ke), A.set(1, 0, 0).applyQuaternion(j), a[u + n++] = A.x, a[u + n++] = A.y, a[u + n++] = A.z, n++, S.set(0, 1, 0).applyQuaternion(j), a[u + n++] = S.x, a[u + n++] = S.y, a[u + n++] = S.z, a[u + n++] = Math.PI * m * m, a[u + n++] = m, a[u + n++] = f.decay, a[u + n++] = f.distance, a[u + n++] = Math.cos(f.angle), a[u + n++] = Math.cos(f.angle * (1 - f.penumbra)), a[u + n++] = f.iesMap ? t.indexOf(f.iesMap) : -1;
|
|
1452
1452
|
} else if (f.isPointLight) {
|
|
1453
1453
|
const m = A.setFromMatrixPosition(f.matrixWorld);
|
|
1454
1454
|
a[u + n++] = m.x, a[u + n++] = m.y, a[u + n++] = m.z, n++, n += 4, n += 1, a[u + n++] = f.decay, a[u + n++] = f.distance;
|
|
1455
1455
|
} else if (f.isDirectionalLight) {
|
|
1456
|
-
const m = A.setFromMatrixPosition(f.matrixWorld), g =
|
|
1457
|
-
|
|
1456
|
+
const m = A.setFromMatrixPosition(f.matrixWorld), g = S.setFromMatrixPosition(f.target.matrixWorld);
|
|
1457
|
+
Y.subVectors(m, g).normalize(), a[u + n++] = Y.x, a[u + n++] = Y.y, a[u + n++] = Y.z;
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
1460
|
this.count = e.length;
|
|
@@ -1577,7 +1577,7 @@ function sa(s) {
|
|
|
1577
1577
|
t.visible && (t.isRectAreaLight || t.isSpotLight || t.isPointLight || t.isDirectionalLight) && e.push(t);
|
|
1578
1578
|
}), e.sort(Ee);
|
|
1579
1579
|
}
|
|
1580
|
-
const
|
|
1580
|
+
const _t = 45, et = _t * 4;
|
|
1581
1581
|
class oa {
|
|
1582
1582
|
constructor() {
|
|
1583
1583
|
this._features = {};
|
|
@@ -1618,7 +1618,7 @@ class na extends M {
|
|
|
1618
1618
|
return 8;
|
|
1619
1619
|
}
|
|
1620
1620
|
let a = 0;
|
|
1621
|
-
const l = e.length *
|
|
1621
|
+
const l = e.length * _t, h = Math.ceil(Math.sqrt(l)) || 1, { image: d, features: f } = this, u = {};
|
|
1622
1622
|
for (let m = 0, g = t.length; m < g; m++)
|
|
1623
1623
|
u[Fe(t[m])] = m;
|
|
1624
1624
|
d.width !== h && (this.dispose(), d.data = new Float32Array(h * h * 4), d.width = h, d.height = h);
|
|
@@ -1680,7 +1680,7 @@ class rt extends Lt {
|
|
|
1680
1680
|
super(e, t, 1, i), ca(this.texture, i), this.texture.setTextures = (...a) => {
|
|
1681
1681
|
this.setTextures(...a);
|
|
1682
1682
|
}, this.hashes = [null];
|
|
1683
|
-
const o = new
|
|
1683
|
+
const o = new Z(new ua());
|
|
1684
1684
|
this.fsQuad = o;
|
|
1685
1685
|
}
|
|
1686
1686
|
setTextures(e, t, r = this.width, i = this.height) {
|
|
@@ -2107,7 +2107,7 @@ const wa = (
|
|
|
2107
2107
|
}
|
|
2108
2108
|
|
|
2109
2109
|
`
|
|
2110
|
-
),
|
|
2110
|
+
), _a = (
|
|
2111
2111
|
/* glsl */
|
|
2112
2112
|
`
|
|
2113
2113
|
|
|
@@ -2317,7 +2317,7 @@ const wa = (
|
|
|
2317
2317
|
}
|
|
2318
2318
|
|
|
2319
2319
|
`
|
|
2320
|
-
),
|
|
2320
|
+
), Sa = (
|
|
2321
2321
|
/* glsl */
|
|
2322
2322
|
`
|
|
2323
2323
|
|
|
@@ -3037,7 +3037,7 @@ const wa = (
|
|
|
3037
3037
|
}
|
|
3038
3038
|
|
|
3039
3039
|
`
|
|
3040
|
-
),
|
|
3040
|
+
), St = (
|
|
3041
3041
|
/* glsl */
|
|
3042
3042
|
`
|
|
3043
3043
|
|
|
@@ -4959,7 +4959,7 @@ class ja extends Pe {
|
|
|
4959
4959
|
},
|
|
4960
4960
|
uniforms: {
|
|
4961
4961
|
// path trace uniforms
|
|
4962
|
-
resolution: { value: new
|
|
4962
|
+
resolution: { value: new $() },
|
|
4963
4963
|
opacity: { value: 1 },
|
|
4964
4964
|
bounces: { value: 10 },
|
|
4965
4965
|
transmissiveBounces: { value: 10 },
|
|
@@ -5034,8 +5034,8 @@ class ja extends Pe {
|
|
|
5034
5034
|
${wa}
|
|
5035
5035
|
${Ra}
|
|
5036
5036
|
${Ia}
|
|
5037
|
-
${Sa}
|
|
5038
5037
|
${_a}
|
|
5038
|
+
${Sa}
|
|
5039
5039
|
|
|
5040
5040
|
// random
|
|
5041
5041
|
#if RANDOM_TYPE == 2 // Stratified List
|
|
@@ -5073,7 +5073,7 @@ class ja extends Pe {
|
|
|
5073
5073
|
// common
|
|
5074
5074
|
${Ea}
|
|
5075
5075
|
${Fa}
|
|
5076
|
-
${
|
|
5076
|
+
${St}
|
|
5077
5077
|
${Da}
|
|
5078
5078
|
${Pa}
|
|
5079
5079
|
|
|
@@ -5485,7 +5485,7 @@ function* Ya() {
|
|
|
5485
5485
|
_subframe: a,
|
|
5486
5486
|
alpha: l,
|
|
5487
5487
|
material: h
|
|
5488
|
-
} = this, d = new
|
|
5488
|
+
} = this, d = new K(), f = new K(), u = t.material;
|
|
5489
5489
|
let [n, x] = i;
|
|
5490
5490
|
for (; ; ) {
|
|
5491
5491
|
l ? (u.opacity = this._opacityFactor / (this.samples + 1), h.blending = ie, h.opacity = 1) : (h.opacity = this._opacityFactor / (this.samples + 1), h.blending = gt);
|
|
@@ -5538,7 +5538,7 @@ class ot {
|
|
|
5538
5538
|
return !!this._compilePromise;
|
|
5539
5539
|
}
|
|
5540
5540
|
constructor(e) {
|
|
5541
|
-
this.camera = null, this.tiles = new
|
|
5541
|
+
this.camera = null, this.tiles = new $(3, 3), this.stableNoise = !1, this.stableTiles = !0, this.samples = 0, this._subframe = new K(0, 0, 1, 1), this._opacityFactor = 1, this._renderer = e, this._alpha = !1, this._fsQuad = new Z(new ja()), this._blendQuad = new Z(new Nr()), this._task = null, this._currentTile = 0, this._compilePromise = null, this._sobolTarget = new Lr().generate(e), this._primaryTarget = new ae(1, 1, {
|
|
5542
5542
|
format: I,
|
|
5543
5543
|
type: R,
|
|
5544
5544
|
magFilter: T,
|
|
@@ -5589,7 +5589,7 @@ class ot {
|
|
|
5589
5589
|
this.material.onBeforeRender(), !this.isCompiling && (this._task || (this._task = Ya.call(this)), this._task.next());
|
|
5590
5590
|
}
|
|
5591
5591
|
}
|
|
5592
|
-
const
|
|
5592
|
+
const G = new $(), nt = new $(), fe = new Vt(), de = new se();
|
|
5593
5593
|
class Xa extends M {
|
|
5594
5594
|
constructor(e = 512, t = 512) {
|
|
5595
5595
|
super(
|
|
@@ -5610,7 +5610,7 @@ class Xa extends M {
|
|
|
5610
5610
|
const { data: e, width: t, height: r } = this.image;
|
|
5611
5611
|
for (let i = 0; i < t; i++)
|
|
5612
5612
|
for (let o = 0; o < r; o++) {
|
|
5613
|
-
nt.set(t, r),
|
|
5613
|
+
nt.set(t, r), G.set(i / t, o / r), G.x -= 0.5, G.y = 1 - G.y, fe.theta = G.x * 2 * Math.PI, fe.phi = G.y * Math.PI, fe.radius = 1, this.generationCallback(fe, G, nt, de);
|
|
5614
5614
|
const l = 4 * (o * t + i);
|
|
5615
5615
|
e[l + 0] = de.r, e[l + 1] = de.g, e[l + 2] = de.b, e[l + 3] = 1;
|
|
5616
5616
|
}
|
|
@@ -5749,7 +5749,7 @@ class Za extends ge {
|
|
|
5749
5749
|
#include <common>
|
|
5750
5750
|
#include <cube_uv_reflection_fragment>
|
|
5751
5751
|
|
|
5752
|
-
${
|
|
5752
|
+
${St}
|
|
5753
5753
|
|
|
5754
5754
|
void main() {
|
|
5755
5755
|
|
|
@@ -5764,7 +5764,7 @@ class Za extends ge {
|
|
|
5764
5764
|
}
|
|
5765
5765
|
class ct {
|
|
5766
5766
|
constructor(e) {
|
|
5767
|
-
this._renderer = e, this._quad = new
|
|
5767
|
+
this._renderer = e, this._quad = new Z(new Za());
|
|
5768
5768
|
}
|
|
5769
5769
|
generate(e, t = null, r = null) {
|
|
5770
5770
|
if (!e.isCubeTexture)
|
|
@@ -5792,7 +5792,7 @@ class ct {
|
|
|
5792
5792
|
function Ja(s) {
|
|
5793
5793
|
return s.extensions.get("EXT_float_blend");
|
|
5794
5794
|
}
|
|
5795
|
-
const
|
|
5795
|
+
const X = new $();
|
|
5796
5796
|
class ei {
|
|
5797
5797
|
get multipleImportanceSampling() {
|
|
5798
5798
|
return !!this._pathTracer.material.defines.FEATURE_MIS;
|
|
@@ -5837,12 +5837,12 @@ class ei {
|
|
|
5837
5837
|
return !!this._pathTracer.isCompiling;
|
|
5838
5838
|
}
|
|
5839
5839
|
constructor(e) {
|
|
5840
|
-
this._renderer = e, this._generator = new Er(), this._pathTracer = new ot(e), this._queueReset = !1, this._clock = new qt(), this._compilePromise = null, this._lowResPathTracer = new ot(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new
|
|
5840
|
+
this._renderer = e, this._generator = new Er(), this._pathTracer = new ot(e), this._queueReset = !1, this._clock = new qt(), this._compilePromise = null, this._lowResPathTracer = new ot(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new Z(new Ka({
|
|
5841
5841
|
map: null,
|
|
5842
5842
|
transparent: !0,
|
|
5843
5843
|
blending: ie,
|
|
5844
5844
|
premultipliedAlpha: e.getContextAttributes().premultipliedAlpha
|
|
5845
|
-
})), this._materials = null, this._previousEnvironment = null, this._previousBackground = null, this._internalBackground = null, this.renderDelay = 100, this.minSamples = 5, this.fadeDuration = 500, this.enablePathTracing = !0, this.pausePathTracing = !1, this.dynamicLowRes = !1, this.lowResScale = 0.25, this.renderScale = 1, this.synchronizeRenderSize = !0, this.rasterizeScene = !0, this.renderToCanvas = !0, this.textureSize = new
|
|
5845
|
+
})), this._materials = null, this._previousEnvironment = null, this._previousBackground = null, this._internalBackground = null, this.renderDelay = 100, this.minSamples = 5, this.fadeDuration = 500, this.enablePathTracing = !0, this.pausePathTracing = !1, this.dynamicLowRes = !1, this.lowResScale = 0.25, this.renderScale = 1, this.synchronizeRenderSize = !0, this.rasterizeScene = !0, this.renderToCanvas = !0, this.textureSize = new $(1024, 1024), this.rasterizeSceneCallback = (t, r) => {
|
|
5846
5846
|
this._renderer.render(t, r);
|
|
5847
5847
|
}, this.renderToCanvasCallback = (t, r, i) => {
|
|
5848
5848
|
const o = r.autoClear;
|
|
@@ -5949,9 +5949,9 @@ class ei {
|
|
|
5949
5949
|
}
|
|
5950
5950
|
_updateScale() {
|
|
5951
5951
|
if (this.synchronizeRenderSize) {
|
|
5952
|
-
this._renderer.getDrawingBufferSize(
|
|
5953
|
-
const e = Math.floor(this.renderScale *
|
|
5954
|
-
if (this._pathTracer.getSize(
|
|
5952
|
+
this._renderer.getDrawingBufferSize(X);
|
|
5953
|
+
const e = Math.floor(this.renderScale * X.x), t = Math.floor(this.renderScale * X.y);
|
|
5954
|
+
if (this._pathTracer.getSize(X), X.x !== e || X.y !== t) {
|
|
5955
5955
|
const r = this.lowResScale;
|
|
5956
5956
|
this._pathTracer.setSize(e, t), this._lowResPathTracer.setSize(Math.floor(e * r), Math.floor(t * r));
|
|
5957
5957
|
}
|
|
@@ -6015,29 +6015,29 @@ const pe = class pe {
|
|
|
6015
6015
|
const o = i.getImageData(0, 0, r.width, r.height), a = new Float32Array(o.data.length);
|
|
6016
6016
|
for (let h = 0; h < o.data.length; h++)
|
|
6017
6017
|
a[h] = o.data[h] / 255;
|
|
6018
|
-
const l = new
|
|
6018
|
+
const l = new J.DataTexture(
|
|
6019
6019
|
a,
|
|
6020
6020
|
r.width,
|
|
6021
6021
|
r.height,
|
|
6022
|
-
|
|
6023
|
-
|
|
6022
|
+
J.RGBAFormat,
|
|
6023
|
+
J.FloatType
|
|
6024
6024
|
);
|
|
6025
6025
|
return l.mapping = e.mapping, l.wrapS = e.wrapS, l.wrapT = e.wrapT, l.magFilter = e.magFilter, l.minFilter = e.minFilter, l.anisotropy = e.anisotropy, l.needsUpdate = !0, l;
|
|
6026
6026
|
}
|
|
6027
6027
|
async initialize(e) {
|
|
6028
6028
|
try {
|
|
6029
|
-
return this.renderer = e.renderer, this.enabled = e.enabled, this.isSupported() ?
|
|
6030
|
-
new
|
|
6029
|
+
return this.renderer = e.renderer, this.enabled = e.enabled, this.isSupported() ? _.ok(void 0) : _.err(
|
|
6030
|
+
new B(
|
|
6031
6031
|
"Path tracing is not supported in this environment",
|
|
6032
|
-
|
|
6032
|
+
W.PATH_TRACING_INIT_FAILED,
|
|
6033
6033
|
{ reason: "WebGL2 or required extensions not available" }
|
|
6034
6034
|
)
|
|
6035
6035
|
);
|
|
6036
6036
|
} catch (t) {
|
|
6037
|
-
return
|
|
6038
|
-
new
|
|
6037
|
+
return _.err(
|
|
6038
|
+
new B(
|
|
6039
6039
|
"Failed to initialize path tracing",
|
|
6040
|
-
|
|
6040
|
+
W.PATH_TRACING_INIT_FAILED,
|
|
6041
6041
|
{ originalError: t }
|
|
6042
6042
|
)
|
|
6043
6043
|
);
|
|
@@ -6045,25 +6045,25 @@ const pe = class pe {
|
|
|
6045
6045
|
}
|
|
6046
6046
|
createPathTracer() {
|
|
6047
6047
|
if (this.disposed)
|
|
6048
|
-
return
|
|
6049
|
-
new
|
|
6048
|
+
return _.err(
|
|
6049
|
+
new B(
|
|
6050
6050
|
"Instance is disposed",
|
|
6051
|
-
|
|
6051
|
+
W.INVALID_STATE
|
|
6052
6052
|
)
|
|
6053
6053
|
);
|
|
6054
6054
|
try {
|
|
6055
6055
|
const e = ee(this.renderer) ? this.renderer.getInternalRenderer() : null;
|
|
6056
|
-
return e ? (this.pathTracer = new ei(e), this.pathTracer.tiles && "set" in this.pathTracer.tiles && this.pathTracer.tiles.set(1, 1), this.pathTracer.bounces = this.settings.bounces, this.settings.transmissiveBounces !== void 0 && (this.pathTracer.transmissiveBounces = this.settings.transmissiveBounces), this.pathTracer.renderScale = this.settings.renderScale, this.pathTracer.dynamicLowRes = this.settings.dynamicLowRes, this.pathTracer.lowResScale = this.settings.lowResScale,
|
|
6057
|
-
new
|
|
6056
|
+
return e ? (this.pathTracer = new ei(e), this.pathTracer.tiles && "set" in this.pathTracer.tiles && this.pathTracer.tiles.set(1, 1), this.pathTracer.bounces = this.settings.bounces, this.settings.transmissiveBounces !== void 0 && (this.pathTracer.transmissiveBounces = this.settings.transmissiveBounces), this.pathTracer.renderScale = this.settings.renderScale, this.pathTracer.dynamicLowRes = this.settings.dynamicLowRes, this.pathTracer.lowResScale = this.settings.lowResScale, e.setRenderTarget(null), _.ok(void 0)) : _.err(
|
|
6057
|
+
new B(
|
|
6058
6058
|
"Renderer not ready, will retry",
|
|
6059
|
-
|
|
6059
|
+
W.RENDERER_NOT_INITIALIZED
|
|
6060
6060
|
)
|
|
6061
6061
|
);
|
|
6062
6062
|
} catch (e) {
|
|
6063
|
-
return
|
|
6064
|
-
new
|
|
6063
|
+
return _.err(
|
|
6064
|
+
new B(
|
|
6065
6065
|
"Failed to create path tracer",
|
|
6066
|
-
|
|
6066
|
+
W.PATH_TRACING_INIT_FAILED,
|
|
6067
6067
|
{ originalError: e }
|
|
6068
6068
|
)
|
|
6069
6069
|
);
|
|
@@ -6093,10 +6093,10 @@ const pe = class pe {
|
|
|
6093
6093
|
}
|
|
6094
6094
|
async render(e, t) {
|
|
6095
6095
|
if (this.disposed)
|
|
6096
|
-
return
|
|
6096
|
+
return _.ok(void 0);
|
|
6097
6097
|
const r = this.renderer;
|
|
6098
6098
|
if (!r)
|
|
6099
|
-
return
|
|
6099
|
+
return _.ok(void 0);
|
|
6100
6100
|
if (!this.enabled)
|
|
6101
6101
|
return this.renderWhileDisabled(e, t);
|
|
6102
6102
|
if (!this.pathTracer) {
|
|
@@ -6107,10 +6107,10 @@ const pe = class pe {
|
|
|
6107
6107
|
try {
|
|
6108
6108
|
const i = this.extractThreeObjects(e, t);
|
|
6109
6109
|
if (!i)
|
|
6110
|
-
return
|
|
6111
|
-
new
|
|
6110
|
+
return _.err(
|
|
6111
|
+
new B(
|
|
6112
6112
|
"Could not extract Three.js scene or camera",
|
|
6113
|
-
|
|
6113
|
+
W.INVALID_PARAMETER
|
|
6114
6114
|
)
|
|
6115
6115
|
);
|
|
6116
6116
|
const { threeScene: o, threeCamera: a } = i;
|
|
@@ -6127,10 +6127,10 @@ const pe = class pe {
|
|
|
6127
6127
|
}
|
|
6128
6128
|
return this.sceneInitialized ? this.accumulateSample(r, e, t) : r.render(e, t);
|
|
6129
6129
|
} catch (i) {
|
|
6130
|
-
return
|
|
6131
|
-
new
|
|
6130
|
+
return _.err(
|
|
6131
|
+
new B(
|
|
6132
6132
|
"Failed to render with path tracing",
|
|
6133
|
-
|
|
6133
|
+
W.RENDER_FAILED,
|
|
6134
6134
|
{ originalError: i }
|
|
6135
6135
|
)
|
|
6136
6136
|
);
|
|
@@ -6176,7 +6176,7 @@ const pe = class pe {
|
|
|
6176
6176
|
} finally {
|
|
6177
6177
|
i.environment = h;
|
|
6178
6178
|
}
|
|
6179
|
-
} else if (l && l.mapping ===
|
|
6179
|
+
} else if (l && l.mapping === J.EquirectangularReflectionMapping) {
|
|
6180
6180
|
let h = l;
|
|
6181
6181
|
if (l.image instanceof HTMLImageElement)
|
|
6182
6182
|
if (this.convertedEnvTexture)
|
|
@@ -6201,7 +6201,7 @@ const pe = class pe {
|
|
|
6201
6201
|
} catch (f) {
|
|
6202
6202
|
throw i.environment = d, f;
|
|
6203
6203
|
}
|
|
6204
|
-
} else if (((a = i.environment) == null ? void 0 : a.mapping) ===
|
|
6204
|
+
} else if (((a = i.environment) == null ? void 0 : a.mapping) === J.EquirectangularReflectionMapping)
|
|
6205
6205
|
this.ingestSceneWithoutShadowHelpers(i, o), this.sceneInitialized = !0;
|
|
6206
6206
|
else
|
|
6207
6207
|
return this.disableAfterSelfPause("gave-up"), e.render(t, r);
|
|
@@ -6224,14 +6224,14 @@ const pe = class pe {
|
|
|
6224
6224
|
console.warn("Failed to update lights for path tracing:", l);
|
|
6225
6225
|
}
|
|
6226
6226
|
const i = e.render(t, r);
|
|
6227
|
-
return i.ok ? performance.now() - this.lastCameraMoveTime < pe.CAMERA_SETTLE_MS ?
|
|
6227
|
+
return i.ok ? performance.now() - this.lastCameraMoveTime < pe.CAMERA_SETTLE_MS ? _.ok(void 0) : (this.cameraDirty && (this.cameraDirty = !1, (a = this.pathTracer) == null || a.updateCamera()), this.accumulateOneSample(), this.sampleCount++, this.sampleCount === this.settings.samples ? this.captureCompletedFrame() : _.ok(void 0)) : i;
|
|
6228
6228
|
}
|
|
6229
6229
|
/**
|
|
6230
6230
|
* Render while path tracing is disabled: keep the final accumulated image on
|
|
6231
6231
|
* screen if we just completed, otherwise delegate to the standard renderer.
|
|
6232
6232
|
*/
|
|
6233
6233
|
renderWhileDisabled(e, t) {
|
|
6234
|
-
return this.renderer ? this.sampleCount >= this.settings.samples && this.sampleCount > 0 ? (this.pathTracer && ee(this.renderer) && this.renderer.getInternalRenderer().setRenderTarget(null),
|
|
6234
|
+
return this.renderer ? this.sampleCount >= this.settings.samples && this.sampleCount > 0 ? (this.pathTracer && ee(this.renderer) && this.renderer.getInternalRenderer().setRenderTarget(null), _.ok(void 0)) : this.renderer.render(e, t) : _.ok(void 0);
|
|
6235
6235
|
}
|
|
6236
6236
|
/**
|
|
6237
6237
|
* Render a single path-tracing sample into the internal buffer, preserving the
|
|
@@ -6262,7 +6262,7 @@ const pe = class pe {
|
|
|
6262
6262
|
} catch (t) {
|
|
6263
6263
|
console.warn("Failed to present path traced result:", t);
|
|
6264
6264
|
}
|
|
6265
|
-
return this.disableAfterSelfPause("completed"),
|
|
6265
|
+
return this.disableAfterSelfPause("completed"), _.ok(void 0);
|
|
6266
6266
|
}
|
|
6267
6267
|
getSampleCount() {
|
|
6268
6268
|
return this.sampleCount;
|