rayzee 5.10.1 → 5.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rayzee.es.js +153 -147
- package/dist/rayzee.es.js.map +1 -1
- package/dist/rayzee.umd.js +17 -17
- package/dist/rayzee.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/TSL/PathTracerCore.js +24 -3
package/dist/rayzee.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MeshBasicNodeMaterial as e, QuadMesh as t, ReadbackBuffer as n, RectAreaLightNode as r, RenderTarget as i, SRGBColorSpace as a, StorageInstancedBufferAttribute as o, StorageTexture as s, TextureNode as c, WebGPUBackend as l, WebGPURenderer as u } from "three/webgpu";
|
|
2
2
|
import { Break as d, Continue as f, Fn as p, If as m, Loop as h, TWO_PI as g, abs as _, acos as v, array as y, atan as b, atomicAdd as x, atomicLoad as S, atomicStore as C, attributeArray as w, bool as T, clamp as E, cos as D, cross as O, cubeTexture as k, dot as A, exp as j, float as M, floor as ee, fract as te, int as N, ivec2 as P, length as ne, lessThan as re, localId as F, log as ie, mat3 as ae, max as I, min as oe, mix as L, mod as se, normalize as R, notEqual as ce, pow as le, reflect as ue, refract as de, sampler as fe, select as z, sign as pe, sin as me, smoothstep as he, sqrt as ge, step as _e, storage as ve, struct as ye, texture as be, textureLoad as B, textureStore as xe, uint as V, uniform as H, uniformArray as Se, uv as Ce, uvec2 as we, vec2 as U, vec3 as W, vec4 as G, wgslFn as K, workgroupArray as Te, workgroupBarrier as Ee, workgroupId as De } from "three/tsl";
|
|
3
|
-
import { ACESFilmicToneMapping as Oe, AdditiveBlending as ke, AgXToneMapping as Ae, AnimationMixer as je, BackSide as Me, Box2 as Ne, Box3 as Pe, CineonToneMapping as Fe, CircleGeometry as Ie, ClampToEdgeWrapping as Le, Color as Re, DataArrayTexture as ze, DataTexture as Be, DataUtils as Ve, DirectionalLight as He, DirectionalLightHelper as Ue, DoubleSide as We, EquirectangularReflectionMapping as Ge, EventDispatcher as Ke, FloatType as qe, FrontSide as Je, HalfFloatType as Ye, LinearFilter as
|
|
3
|
+
import { ACESFilmicToneMapping as Oe, AdditiveBlending as ke, AgXToneMapping as Ae, AnimationMixer as je, BackSide as Me, Box2 as Ne, Box3 as Pe, CineonToneMapping as Fe, CircleGeometry as Ie, ClampToEdgeWrapping as Le, Color as Re, DataArrayTexture as ze, DataTexture as Be, DataUtils as Ve, DirectionalLight as He, DirectionalLightHelper as Ue, DoubleSide as We, EquirectangularReflectionMapping as Ge, EventDispatcher as Ke, FloatType as qe, FrontSide as Je, HalfFloatType as Ye, LinearFilter as Xe, LinearSRGBColorSpace as Ze, LinearToneMapping as Qe, LoadingManager as $e, LoopOnce as et, LoopRepeat as tt, MathUtils as nt, Matrix3 as rt, Matrix4 as it, Mesh as at, MeshBasicMaterial as ot, MeshPhysicalMaterial as st, MeshStandardMaterial as ct, NearestFilter as q, NeutralToneMapping as lt, NoBlending as ut, NoToneMapping as dt, Object3D as ft, PerspectiveCamera as pt, PointLight as mt, PointLightHelper as ht, Points as gt, PointsMaterial as _t, Quaternion as vt, RGBAFormat as yt, Raycaster as bt, RectAreaLight as xt, ReinhardToneMapping as St, RepeatWrapping as Ct, SRGBColorSpace as wt, Scene as Tt, SphereGeometry as Et, SpotLight as Dt, SpotLightHelper as Ot, TextureLoader as kt, Timer as At, TimestampQuery as jt, UnsignedByteType as Mt, Vector2 as Nt, Vector3 as Pt } from "three";
|
|
4
4
|
import { RectAreaLightTexturesLib as Ft } from "three/addons/lights/RectAreaLightTexturesLib.js";
|
|
5
5
|
import { RectAreaLightHelper as It } from "three/addons/helpers/RectAreaLightHelper.js";
|
|
6
6
|
import Lt from "stats-gl";
|
|
@@ -593,7 +593,7 @@ function zn() {
|
|
|
593
593
|
//#region src/Processor/StorageTexturePool.js
|
|
594
594
|
function Bn(e, t) {
|
|
595
595
|
let n = new s(e, t);
|
|
596
|
-
return n.type = qe, n.format = yt, n.minFilter =
|
|
596
|
+
return n.type = qe, n.format = yt, n.minFilter = Xe, n.magFilter = Xe, n;
|
|
597
597
|
}
|
|
598
598
|
var Vn = class {
|
|
599
599
|
constructor(e, t) {
|
|
@@ -603,8 +603,8 @@ var Vn = class {
|
|
|
603
603
|
this.dispose(), this.renderWidth = e, this.renderHeight = t, this.writeColor = Bn(e, t), this.writeNormalDepth = Bn(e, t), this.writeAlbedo = Bn(e, t), this.readTarget = new i(e, t, {
|
|
604
604
|
type: qe,
|
|
605
605
|
format: yt,
|
|
606
|
-
minFilter:
|
|
607
|
-
magFilter:
|
|
606
|
+
minFilter: q,
|
|
607
|
+
magFilter: q,
|
|
608
608
|
depthBuffer: !1,
|
|
609
609
|
stencilBuffer: !1,
|
|
610
610
|
count: 3
|
|
@@ -1116,12 +1116,12 @@ var Vn = class {
|
|
|
1116
1116
|
let r = H(t, n);
|
|
1117
1117
|
return this._uniforms.set(e, r), r;
|
|
1118
1118
|
}, r = (e, t) => (this._booleans.add(e), n(e, +!!t, "int"));
|
|
1119
|
-
n("frame", 0, "uint"), n("maxBounces", X.bounces, "int"), n("samplesPerPixel", X.samplesPerPixel, "int"), n("maxSamples", X.maxSamples, "int"), n("transmissiveBounces", X.transmissiveBounces, "int"), n("visMode", X.debugMode, "int"), n("debugVisScale", X.debugVisScale, "float"), r("enableAccumulation", !0), n("accumulationAlpha", 0, "float"), r("cameraIsMoving", !1), r("hasPreviousAccumulated", !1), n("environmentIntensity", X.environmentIntensity, "float"), n("backgroundIntensity", X.backgroundIntensity, "float"), r("showBackground", X.showBackground), r("transparentBackground", X.transparentBackground), r("enableEnvironment", X.enableEnvironment), n("environmentMatrix", new
|
|
1119
|
+
n("frame", 0, "uint"), n("maxBounces", X.bounces, "int"), n("samplesPerPixel", X.samplesPerPixel, "int"), n("maxSamples", X.maxSamples, "int"), n("transmissiveBounces", X.transmissiveBounces, "int"), n("visMode", X.debugMode, "int"), n("debugVisScale", X.debugVisScale, "float"), r("enableAccumulation", !0), n("accumulationAlpha", 0, "float"), r("cameraIsMoving", !1), r("hasPreviousAccumulated", !1), n("environmentIntensity", X.environmentIntensity, "float"), n("backgroundIntensity", X.backgroundIntensity, "float"), r("showBackground", X.showBackground), r("transparentBackground", X.transparentBackground), r("enableEnvironment", X.enableEnvironment), n("environmentMatrix", new it(), "mat4"), r("useEnvMapIS", X.useImportanceSampledEnvironment), n("envTotalSum", 0, "float"), n("envCompensationDelta", 0, "float"), n("envResolution", new Nt(1, 1), "vec2"), n("sunDirection", new Pt(0, 1, 0), "vec3"), n("sunAngularSize", .0087, "float"), r("hasSun", !1), n("globalIlluminationIntensity", X.globalIlluminationIntensity, "float"), n("exposure", X.exposure, "float"), n("numDirectionalLights", 0, "int"), n("numAreaLights", 0, "int"), n("numPointLights", 0, "int"), n("numSpotLights", 0, "int"), this._lightBuffers = {
|
|
1120
1120
|
directional: Se(new Float32Array(128), "float"),
|
|
1121
1121
|
area: Se(new Float32Array(208), "float"),
|
|
1122
1122
|
point: Se(new Float32Array(144), "float"),
|
|
1123
1123
|
spot: Se(new Float32Array(224), "float")
|
|
1124
|
-
}, n("cameraWorldMatrix", new
|
|
1124
|
+
}, n("cameraWorldMatrix", new it(), "mat4"), n("cameraProjectionMatrixInverse", new it(), "mat4"), n("cameraViewMatrix", new it(), "mat4"), n("cameraProjectionMatrix", new it(), "mat4"), r("enableDOF", X.enableDOF), n("focusDistance", X.focusDistance, "float"), n("focalLength", X.focalLength, "float"), n("aperture", X.aperture, "float"), n("apertureScale", 1, "float"), n("anamorphicRatio", X.anamorphicRatio ?? 1, "float"), n("sceneScale", 1, "float"), this._uniforms.set("samplingTechnique", tn), tn.value = X.samplingTechnique, r("useAdaptiveSampling", X.adaptiveSampling), n("adaptiveSamplingMin", X.adaptiveSamplingMin ?? 1, "int"), n("adaptiveSamplingMax", X.adaptiveSamplingMax, "int"), n("fireflyThreshold", X.fireflyThreshold, "float"), r("enableEmissiveTriangleSampling", X.enableEmissiveTriangleSampling), n("emissiveBoost", X.emissiveBoost, "float"), n("emissiveTriangleCount", 0, "int"), n("emissiveTotalPower", 0, "float"), n("lightBVHNodeCount", 0, "int"), n("emissiveVec4Offset", 0, "int"), n("renderMode", X.renderMode, "int"), r("enableAlphaShadows", X.enableAlphaShadows), n("resolution", new Nt(e, t), "vec2"), n("totalTriangleCount", 0, "int");
|
|
1125
1125
|
}
|
|
1126
1126
|
_nameAll() {
|
|
1127
1127
|
for (let [e, t] of this._uniforms) t.name = er[e] || e;
|
|
@@ -1666,7 +1666,7 @@ function Fr(e, t, n) {
|
|
|
1666
1666
|
}
|
|
1667
1667
|
var Ir = class {
|
|
1668
1668
|
constructor(e = 512, t = 256) {
|
|
1669
|
-
this.width = e, this.height = t, this.lastRenderTime = 0, this._pixels = new Float32Array(e * t * 4), this._texture = new Be(this._pixels, e, t, yt, qe), this._texture.mapping = Ge, this._texture.colorSpace =
|
|
1669
|
+
this.width = e, this.height = t, this.lastRenderTime = 0, this._pixels = new Float32Array(e * t * 4), this._texture = new Be(this._pixels, e, t, yt, qe), this._texture.mapping = Ge, this._texture.colorSpace = Ze, this._texture.minFilter = Xe, this._texture.magFilter = Xe, this._texture.wrapS = Ct, this._texture.wrapT = Le, this._texture.generateMipmaps = !1;
|
|
1670
1670
|
}
|
|
1671
1671
|
render(e) {
|
|
1672
1672
|
let t = performance.now(), n = [
|
|
@@ -1684,7 +1684,7 @@ var Ir = class {
|
|
|
1684
1684
|
return this._texture.needsUpdate = !0, this.lastRenderTime = performance.now() - t, this._texture;
|
|
1685
1685
|
}
|
|
1686
1686
|
setResolution(e, t) {
|
|
1687
|
-
this.width === e && this.height === t || (this.width = e, this.height = t, this._pixels = new Float32Array(e * t * 4), this._texture.dispose(), this._texture = new Be(this._pixels, e, t, yt, qe), this._texture.mapping = Ge, this._texture.colorSpace =
|
|
1687
|
+
this.width === e && this.height === t || (this.width = e, this.height = t, this._pixels = new Float32Array(e * t * 4), this._texture.dispose(), this._texture = new Be(this._pixels, e, t, yt, qe), this._texture.mapping = Ge, this._texture.colorSpace = Ze, this._texture.minFilter = Xe, this._texture.magFilter = Xe, this._texture.wrapS = Ct, this._texture.wrapT = Le, this._texture.generateMipmaps = !1);
|
|
1688
1688
|
}
|
|
1689
1689
|
getLastRenderTime() {
|
|
1690
1690
|
return this.lastRenderTime;
|
|
@@ -1694,7 +1694,7 @@ var Ir = class {
|
|
|
1694
1694
|
}
|
|
1695
1695
|
}, Lr = class {
|
|
1696
1696
|
constructor(e = 512, t = 256) {
|
|
1697
|
-
this.width = e, this.height = t, this.lastRenderTime = 0, this._pixels = new Float32Array(e * t * 4), this._texture = new Be(this._pixels, e, t, yt, qe), this._texture.mapping = Ge, this._texture.colorSpace =
|
|
1697
|
+
this.width = e, this.height = t, this.lastRenderTime = 0, this._pixels = new Float32Array(e * t * 4), this._texture = new Be(this._pixels, e, t, yt, qe), this._texture.mapping = Ge, this._texture.colorSpace = Ze, this._texture.minFilter = Xe, this._texture.magFilter = Xe, this._texture.wrapS = Ct, this._texture.wrapT = Le, this._texture.generateMipmaps = !1;
|
|
1698
1698
|
}
|
|
1699
1699
|
renderGradient(e) {
|
|
1700
1700
|
let t = performance.now(), { width: n, height: r } = this, i = this._pixels, a = e.zenithColor.r, o = e.zenithColor.g, s = e.zenithColor.b, c = e.horizonColor.r, l = e.horizonColor.g, u = e.horizonColor.b, d = e.groundColor.r, f = e.groundColor.g, p = e.groundColor.b;
|
|
@@ -1723,7 +1723,7 @@ var Ir = class {
|
|
|
1723
1723
|
return this._texture.needsUpdate = !0, this.lastRenderTime = performance.now() - t, this._texture;
|
|
1724
1724
|
}
|
|
1725
1725
|
setResolution(e, t) {
|
|
1726
|
-
this.width === e && this.height === t || (this.width = e, this.height = t, this._pixels = new Float32Array(e * t * 4), this._texture.dispose(), this._texture = new Be(this._pixels, e, t, yt, qe), this._texture.mapping = Ge, this._texture.colorSpace =
|
|
1726
|
+
this.width === e && this.height === t || (this.width = e, this.height = t, this._pixels = new Float32Array(e * t * 4), this._texture.dispose(), this._texture = new Be(this._pixels, e, t, yt, qe), this._texture.mapping = Ge, this._texture.colorSpace = Ze, this._texture.minFilter = Xe, this._texture.magFilter = Xe, this._texture.wrapS = Ct, this._texture.wrapT = Le, this._texture.generateMipmaps = !1);
|
|
1727
1727
|
}
|
|
1728
1728
|
getLastRenderTime() {
|
|
1729
1729
|
return this.lastRenderTime;
|
|
@@ -1738,7 +1738,7 @@ var Ir = class {
|
|
|
1738
1738
|
0,
|
|
1739
1739
|
0,
|
|
1740
1740
|
1
|
|
1741
|
-
]), 1, 1, yt, qe), this._envPlaceholder.needsUpdate = !0, this.environmentTexture = this._envPlaceholder, this.envTexSize = new Nt(), this.envCDFStorageAttr = null, this.envCDFStorageNode = null, this._initCDFStorageBuffers(), this.environmentRotationMatrix = new
|
|
1741
|
+
]), 1, 1, yt, qe), this._envPlaceholder.needsUpdate = !0, this.environmentTexture = this._envPlaceholder, this.envTexSize = new Nt(), this.envCDFStorageAttr = null, this.envCDFStorageNode = null, this._initCDFStorageBuffers(), this.environmentRotationMatrix = new it(), this.cdfBuildTime = 0, this.envParams = {
|
|
1742
1742
|
mode: "hdri",
|
|
1743
1743
|
gradientZenithColor: new Re(X.gradientZenithColor),
|
|
1744
1744
|
gradientHorizonColor: new Re(X.gradientHorizonColor),
|
|
@@ -4435,9 +4435,9 @@ var qo = 8, Jo = 2, Yo = Qt({
|
|
|
4435
4435
|
});
|
|
4436
4436
|
}), c;
|
|
4437
4437
|
}), gs = /* @__PURE__ */ K("\n fn regularizePathContribution( contribution: vec3f, pathLength: f32, fireflyThreshold: f32, frame: i32 ) -> vec3f {\n let threshold = calculateFireflyThreshold( fireflyThreshold, i32( pathLength ), frame );\n return applySoftSuppressionRGB( contribution, threshold, 0.5f );\n }\n", [yi, xi]), _s = p(([e, t, n, r, i, a, o, s, c, l, u, g, _, v, y, b, x, S, C, w, D, O, k, j, ee, te, P, re, F, ie, ae, oe, L, se, ce, le, ue, de, fe, pe, me, he, ge, _e, ve, ye, be, B, xe, V]) => {
|
|
4438
|
-
let H = W(0).toVar(), Se = W(1).toVar(), Ce = M(1).toVar(), we = T(!1).toVar(), U = M(0).toVar(), K = W(0).toVar(), Te = W(0).toVar(), Ee = M(-1e3).toVar(), De = e.origin.toVar(), Oe = M(1e10).toVar(), ke =
|
|
4438
|
+
let H = W(0).toVar(), Se = W(1).toVar(), Ce = M(1).toVar(), we = T(!1).toVar(), U = M(0).toVar(), K = W(0).toVar(), Te = W(0).toVar(), Ee = M(-1e3).toVar(), De = e.origin.toVar(), Oe = M(1e10).toVar(), ke = T(!1).toVar(), Ae = N(0).toVar(), je = M(1).toVar(), Me = M(1).toVar(), Ne = M(1).toVar(), Pe = oe.toVar(), Fe = L.toVar(), Ie = N(os).toVar(), Le = T(!0).toVar(), Re = T(!1).toVar(), ze = T(!1).toVar(), Be = T(!1).toVar();
|
|
4439
4439
|
T(!1).toVar();
|
|
4440
|
-
let
|
|
4440
|
+
let Ve = M(0).toVar(), He = N(-1).toVar(), Ue = Jr({
|
|
4441
4441
|
isMetallic: !1,
|
|
4442
4442
|
isRough: !1,
|
|
4443
4443
|
isSmooth: !1,
|
|
@@ -4445,14 +4445,14 @@ var qo = 8, Jo = 2, Yo = Qt({
|
|
|
4445
4445
|
hasClearcoat: !1,
|
|
4446
4446
|
isEmissive: !1,
|
|
4447
4447
|
complexityScore: M(0)
|
|
4448
|
-
}).toVar(),
|
|
4448
|
+
}).toVar(), We = Wr({
|
|
4449
4449
|
specular: M(.5),
|
|
4450
4450
|
diffuse: M(.5),
|
|
4451
4451
|
sheen: M(0),
|
|
4452
4452
|
clearcoat: M(0),
|
|
4453
4453
|
transmission: M(0),
|
|
4454
4454
|
iridescence: M(0)
|
|
4455
|
-
}).toVar(),
|
|
4455
|
+
}).toVar(), Ge = Xr({
|
|
4456
4456
|
F0: W(.04),
|
|
4457
4457
|
NoV: M(1),
|
|
4458
4458
|
diffuseColor: W(0),
|
|
@@ -4464,24 +4464,24 @@ var qo = 8, Jo = 2, Yo = Qt({
|
|
|
4464
4464
|
metalFactor: M(.5),
|
|
4465
4465
|
iorFactor: M(1),
|
|
4466
4466
|
maxSheenColor: M(0)
|
|
4467
|
-
}).toVar(),
|
|
4467
|
+
}).toVar(), Ke = N(0).toVar(), qe = e.origin.toVar(), Je = e.direction.toVar();
|
|
4468
4468
|
return h({
|
|
4469
4469
|
start: N(0),
|
|
4470
4470
|
end: oe.add(L).add(1),
|
|
4471
4471
|
type: "int",
|
|
4472
4472
|
condition: "<"
|
|
4473
4473
|
}, ({ i: e }) => {
|
|
4474
|
-
|
|
4474
|
+
Pe.assign(oe.sub(Ke)), Le.assign(e.equal(N(0))), m(Ke.greaterThan(oe), () => {
|
|
4475
4475
|
d();
|
|
4476
4476
|
});
|
|
4477
4477
|
let r = z(e.greaterThan(N(0)), de, M(1)), h = zr({
|
|
4478
|
-
origin:
|
|
4479
|
-
direction:
|
|
4478
|
+
origin: qe,
|
|
4479
|
+
direction: Je
|
|
4480
4480
|
}), L = Hr.wrap(Ii(h, i, a, o)).toVar();
|
|
4481
4481
|
m(L.didHit.not(), () => {
|
|
4482
|
-
let t = hs(
|
|
4482
|
+
let t = hs(Le, Je, k, ee, j, ie, ce, se), n = M(1).toVar();
|
|
4483
4483
|
m(U.greaterThan(0).and(ie).and(ae), () => {
|
|
4484
|
-
let e = Hi(k,
|
|
4484
|
+
let e = Hi(k, Je, ee, P, re, F).w.toVar();
|
|
4485
4485
|
m(e.greaterThan(0), () => {
|
|
4486
4486
|
n.assign(gi({
|
|
4487
4487
|
pdf1: U,
|
|
@@ -4499,102 +4499,102 @@ var qo = 8, Jo = 2, Yo = Qt({
|
|
|
4499
4499
|
Ce.mulAssign(t.a);
|
|
4500
4500
|
}), d();
|
|
4501
4501
|
});
|
|
4502
|
-
let G = Br.wrap(Ti(L.materialIndex, o)).toVar(),
|
|
4502
|
+
let G = Br.wrap(Ti(L.materialIndex, o)).toVar(), Ye = L.uv.toVar(), Xe = L.normal.toVar();
|
|
4503
4503
|
m(G.displacementMapIndex.greaterThanEqual(N(0)).and(G.displacementScale.greaterThan(0)), () => {
|
|
4504
4504
|
let t = sa.wrap(ca(h, L, a, v, G, e)).toVar();
|
|
4505
|
-
|
|
4505
|
+
Ye.assign(t.uv), Xe.assign(t.normal), L.hitPoint.assign(t.hitPoint);
|
|
4506
4506
|
});
|
|
4507
|
-
let
|
|
4508
|
-
G.color.assign(
|
|
4509
|
-
let
|
|
4507
|
+
let Ze = qr.wrap(ea(s, c, l, u, g, _, G, Ye, L.normal)).toVar();
|
|
4508
|
+
G.color.assign(Ze.albedo), G.metalness.assign(E(Ze.metalness, 0, 1)), G.roughness.assign(E(Ze.roughness, ii, 1));
|
|
4509
|
+
let Qe = Ze.normal.toVar();
|
|
4510
4510
|
m(G.displacementMapIndex.greaterThanEqual(N(0)).and(G.displacementScale.greaterThan(0)), () => {
|
|
4511
|
-
|
|
4512
|
-
});
|
|
4513
|
-
let
|
|
4514
|
-
m(
|
|
4515
|
-
|
|
4516
|
-
}).ElseIf(
|
|
4517
|
-
|
|
4518
|
-
}).ElseIf(
|
|
4519
|
-
|
|
4520
|
-
});
|
|
4521
|
-
let
|
|
4522
|
-
m(
|
|
4511
|
+
Qe.assign(R(Xe.add(Ze.normal.sub(L.normal))));
|
|
4512
|
+
});
|
|
4513
|
+
let $e = M(1).toVar(), et = M(1).toVar();
|
|
4514
|
+
m(Ae.equal(N(1)), () => {
|
|
4515
|
+
$e.assign(je);
|
|
4516
|
+
}).ElseIf(Ae.equal(N(2)), () => {
|
|
4517
|
+
$e.assign(Me), et.assign(je);
|
|
4518
|
+
}).ElseIf(Ae.equal(N(3)), () => {
|
|
4519
|
+
$e.assign(Ne), et.assign(Me);
|
|
4520
|
+
});
|
|
4521
|
+
let tt = Ia.wrap(Wa(h, L.hitPoint, Qe, G, t, Fe, $e, et)).toVar();
|
|
4522
|
+
m(tt.continueRay, () => {
|
|
4523
4523
|
let e = T(!1).toVar();
|
|
4524
|
-
m(
|
|
4525
|
-
|
|
4526
|
-
m(
|
|
4527
|
-
m(
|
|
4528
|
-
|
|
4529
|
-
Ae.assign(G.ior);
|
|
4530
|
-
}).ElseIf(ke.equal(N(2)), () => {
|
|
4524
|
+
m(tt.isTransmissive.and(Fe.greaterThan(N(0))), () => {
|
|
4525
|
+
Fe.subAssign(1), Ie.assign(N(cs)), e.assign(T(!0)), m(tt.didReflect.not(), () => {
|
|
4526
|
+
m(tt.entering, () => {
|
|
4527
|
+
m(Ae.lessThan(N(3)), () => {
|
|
4528
|
+
Ae.addAssign(1), m(Ae.equal(N(1)), () => {
|
|
4531
4529
|
je.assign(G.ior);
|
|
4532
|
-
}).ElseIf(
|
|
4530
|
+
}).ElseIf(Ae.equal(N(2)), () => {
|
|
4533
4531
|
Me.assign(G.ior);
|
|
4532
|
+
}).ElseIf(Ae.equal(N(3)), () => {
|
|
4533
|
+
Ne.assign(G.ior);
|
|
4534
4534
|
});
|
|
4535
4535
|
});
|
|
4536
4536
|
}).Else(() => {
|
|
4537
|
-
m(
|
|
4538
|
-
|
|
4537
|
+
m(Ae.greaterThan(N(0)), () => {
|
|
4538
|
+
Ae.subAssign(1);
|
|
4539
4539
|
});
|
|
4540
4540
|
});
|
|
4541
4541
|
});
|
|
4542
|
-
}).ElseIf(
|
|
4542
|
+
}).ElseIf(tt.isAlphaSkip, () => {
|
|
4543
4543
|
e.assign(T(!0));
|
|
4544
|
-
}), Se.mulAssign(
|
|
4545
|
-
Ce.mulAssign(
|
|
4544
|
+
}), Se.mulAssign(tt.throughput), m(le.not(), () => {
|
|
4545
|
+
Ce.mulAssign(tt.alpha);
|
|
4546
4546
|
});
|
|
4547
|
-
let t = z(
|
|
4548
|
-
|
|
4549
|
-
|
|
4547
|
+
let t = z(tt.entering, Qe, Qe.negate()), n = z(tt.didReflect, t, Je);
|
|
4548
|
+
qe.assign(L.hitPoint.add(n.mul(.001))), Je.assign(tt.direction), Le.assign(T(!1)), Re.assign(T(!1)), Be.assign(T(!1)), m(e.not(), () => {
|
|
4549
|
+
Ke.addAssign(1);
|
|
4550
4550
|
}), f();
|
|
4551
4551
|
}), m(le.not(), () => {
|
|
4552
|
-
Ce.mulAssign(
|
|
4552
|
+
Ce.mulAssign(tt.alpha);
|
|
4553
4553
|
}), we.assign(T(!0));
|
|
4554
|
-
let
|
|
4555
|
-
G.sheenRoughness.assign(E(G.sheenRoughness, ii, 1)), m(
|
|
4556
|
-
|
|
4554
|
+
let nt = bn(B, n, e, t, N(-1), xe, V).toVar(), rt = Je.negate().toVar();
|
|
4555
|
+
G.sheenRoughness.assign(E(G.sheenRoughness, ii, 1)), m(Be.not(), () => {
|
|
4556
|
+
Ge.assign(Oa(Qe, rt, G, Ze, Ue)), Be.assign(T(!0));
|
|
4557
4557
|
});
|
|
4558
|
-
let
|
|
4558
|
+
let it = W(0).toVar(), at = W(0).toVar(), ot = M(0).toVar();
|
|
4559
4559
|
m(G.clearcoat.greaterThan(0), () => {
|
|
4560
|
-
let e = qa.wrap(Ja(h, L, G,
|
|
4561
|
-
|
|
4560
|
+
let e = qa.wrap(Ja(h, L, G, nt, t));
|
|
4561
|
+
it.assign(e.L), at.assign(e.brdf), ot.assign(e.pdf);
|
|
4562
4562
|
}).Else(() => {
|
|
4563
|
-
let e = Ur.wrap(fs(
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
}),
|
|
4567
|
-
}), m(ne(
|
|
4563
|
+
let e = Ur.wrap(fs(rt, Qe, G, L.materialIndex, nt, t, ze, He, Ue, Re, We, Be, Ge));
|
|
4564
|
+
it.assign(e.direction), at.assign(e.value), ot.assign(e.pdf), m(He.notEqual(L.materialIndex).or(ze.not()), () => {
|
|
4565
|
+
Ue.assign(Si(G.metalness, G.roughness, G.transmission, G.clearcoat, G.emissive));
|
|
4566
|
+
}), ze.assign(T(!0)), He.assign(L.materialIndex), Re.assign(T(!0));
|
|
4567
|
+
}), m(ne(Ze.emissive).greaterThan(0), () => {
|
|
4568
4568
|
let t = M(1).toVar();
|
|
4569
4569
|
m(pe.equal(N(1)).and(ge.greaterThan(N(0))).and(U.greaterThan(0)), () => {
|
|
4570
|
-
let e = Zo(L.triangleIndex, L.dst,
|
|
4570
|
+
let e = Zo(L.triangleIndex, L.dst, Je, qe, a, o, _e);
|
|
4571
4571
|
t.assign(hi({
|
|
4572
4572
|
pdf1: U,
|
|
4573
4573
|
pdf2: e
|
|
4574
4574
|
}));
|
|
4575
4575
|
}), H.addAssign(gs({
|
|
4576
|
-
contribution:
|
|
4576
|
+
contribution: Ze.emissive.mul(Se).mul(r).mul(t),
|
|
4577
4577
|
pathLength: M(e),
|
|
4578
4578
|
fireflyThreshold: ue,
|
|
4579
4579
|
frame: N(V)
|
|
4580
4580
|
}));
|
|
4581
4581
|
});
|
|
4582
|
-
let
|
|
4582
|
+
let st = Oo(L.hitPoint, Qe, G, rt, it, ot, at, n, e, t, y, b, x, S, C, w, D, O, i, a, o, k, j, ee, te, P, re, F, ie);
|
|
4583
4583
|
H.addAssign(gs({
|
|
4584
|
-
contribution:
|
|
4584
|
+
contribution: st.mul(Se).mul(r),
|
|
4585
4585
|
pathLength: M(e),
|
|
4586
4586
|
fireflyThreshold: ue,
|
|
4587
4587
|
frame: N(V)
|
|
4588
4588
|
})), m(pe.equal(N(1)).and(ge.greaterThan(N(0))), () => {
|
|
4589
4589
|
let n = p(([e, t, n, r]) => ho(e, t, n, r, Li, i, a, o));
|
|
4590
4590
|
m(be.greaterThan(N(0)), () => {
|
|
4591
|
-
let i = Fo.wrap(as(L.hitPoint,
|
|
4591
|
+
let i = Fo.wrap(as(L.hitPoint, Qe, t, ye, me, he, a));
|
|
4592
4592
|
m(e.greaterThan(N(1)).and(G.roughness.greaterThan(.9)).and(G.metalness.lessThan(.1)).not().and(i.valid).and(i.pdf.greaterThan(0)), () => {
|
|
4593
|
-
let a = I(M(0), A(
|
|
4593
|
+
let a = I(M(0), A(Qe, i.direction));
|
|
4594
4594
|
m(a.greaterThan(0), () => {
|
|
4595
|
-
let o = go(L.hitPoint,
|
|
4595
|
+
let o = go(L.hitPoint, Qe, G), s = L.hitPoint.add(o), c = i.distance.sub(.001), l = n(s, i.direction, c, t);
|
|
4596
4596
|
m(l.greaterThan(0), () => {
|
|
4597
|
-
let t = Ga(
|
|
4597
|
+
let t = Ga(rt, i.direction, Qe, G), n = Do(rt, i.direction, Qe, G), o = z(n.greaterThan(0), hi({
|
|
4598
4598
|
pdf1: i.pdf,
|
|
4599
4599
|
pdf2: n
|
|
4600
4600
|
}), M(1)), s = i.emission.mul(t).mul(a).div(i.pdf).mul(l).mul(ve).mul(o);
|
|
@@ -4608,7 +4608,7 @@ var qo = 8, Jo = 2, Yo = Qt({
|
|
|
4608
4608
|
});
|
|
4609
4609
|
});
|
|
4610
4610
|
}).Else(() => {
|
|
4611
|
-
let i = ts(L.hitPoint,
|
|
4611
|
+
let i = ts(L.hitPoint, Qe, rt, G, fe, e, t, ve, me, he, ge, _e, a, n, Ga, go);
|
|
4612
4612
|
H.addAssign(gs({
|
|
4613
4613
|
contribution: i.mul(Se).mul(r),
|
|
4614
4614
|
pathLength: M(e),
|
|
@@ -4616,23 +4616,29 @@ var qo = 8, Jo = 2, Yo = Qt({
|
|
|
4616
4616
|
frame: N(V)
|
|
4617
4617
|
}));
|
|
4618
4618
|
});
|
|
4619
|
-
}), m(
|
|
4620
|
-
|
|
4619
|
+
}), m(Re.not().or(e.equal(N(0))), () => {
|
|
4620
|
+
Ue.assign(Jr.wrap(ds(G, L.materialIndex, ze, He, Ue))), ze.assign(T(!0)), He.assign(L.materialIndex);
|
|
4621
4621
|
});
|
|
4622
|
-
let
|
|
4623
|
-
Se.mulAssign(
|
|
4624
|
-
|
|
4622
|
+
let ct = Gr.wrap(Da(G, e, Ue, j, ae, ie)), q = eo.wrap(Po(rt, Qe, G, it, ot, at, n, e, t, ct, k, j, ee, P, re, F, ie, ae));
|
|
4623
|
+
Se.mulAssign(q.throughput), qe.assign(L.hitPoint.add(Qe.mul(.001))), Je.assign(q.direction), U.assign(q.combinedPdf), Le.assign(T(!1)), m(G.metalness.greaterThan(.7).and(G.roughness.lessThan(.3)), () => {
|
|
4624
|
+
Ie.assign(N(ss));
|
|
4625
4625
|
}).ElseIf(G.transmission.greaterThan(.5), () => {
|
|
4626
|
-
|
|
4626
|
+
Ie.assign(N(cs));
|
|
4627
4627
|
}).Else(() => {
|
|
4628
|
-
|
|
4628
|
+
Ie.assign(N(ls));
|
|
4629
4629
|
}), m(e.equal(N(0)).and(L.didHit), () => {
|
|
4630
|
-
|
|
4630
|
+
De.assign(L.hitPoint), Oe.assign(L.dst);
|
|
4631
|
+
}), m(ke.not().and(L.didHit), () => {
|
|
4632
|
+
K.assign(Qe), Te.assign(G.color.xyz), Ee.assign(M(L.materialIndex));
|
|
4633
|
+
let e = G.metalness.greaterThan(.7).and(G.roughness.lessThan(.3)), t = G.transmission.greaterThan(.5);
|
|
4634
|
+
m(e.or(t).not(), () => {
|
|
4635
|
+
ke.assign(T(!0));
|
|
4636
|
+
});
|
|
4631
4637
|
});
|
|
4632
|
-
let
|
|
4633
|
-
m(
|
|
4638
|
+
let lt = ms(e, Se, G, L.materialIndex, Je, t, ze, He, Ue, Re, Ve, ie, ae);
|
|
4639
|
+
m(lt.lessThanEqual(0), () => {
|
|
4634
4640
|
d();
|
|
4635
|
-
}), Se.divAssign(
|
|
4641
|
+
}), Se.divAssign(lt), Ke.addAssign(1), Re.assign(T(!1)), Be.assign(T(!1));
|
|
4636
4642
|
}), us({
|
|
4637
4643
|
radiance: G(H, Ce),
|
|
4638
4644
|
objectNormal: K,
|
|
@@ -4804,56 +4810,56 @@ var Ss = /* @__PURE__ */ K("\n fn computeNDCDepth( worldPos: vec3f, cameraProjec
|
|
|
4804
4810
|
pixelCoord: t,
|
|
4805
4811
|
rayIndex: N(0),
|
|
4806
4812
|
frame: o
|
|
4807
|
-
}).toVar(), Ye = N(t.y).mul(N(a.x)).add(N(t.x)).toVar(),
|
|
4813
|
+
}).toVar(), Ye = N(t.y).mul(N(a.x)).add(N(t.x)).toVar(), Xe = W(0, 0, 1).toVar(), Ze = M(1).toVar(), Qe = M(0).toVar(), $e = N(s).toVar();
|
|
4808
4814
|
m(o.greaterThan(V(2)).and(Me), () => {
|
|
4809
4815
|
let e = Cs(t, a, Ne, Pe, Fe);
|
|
4810
|
-
|
|
4816
|
+
$e.assign(e), m($e.equal(N(0)), () => {
|
|
4811
4817
|
m(Te.and(Ee), () => {
|
|
4812
4818
|
let e = be(De, We, 0);
|
|
4813
|
-
Ke.assign(e),
|
|
4819
|
+
Ke.assign(e), Qe.assign(e.w);
|
|
4814
4820
|
let t = be(Oe, We, 0);
|
|
4815
|
-
|
|
4821
|
+
Xe.assign(t.xyz.mul(2).sub(1)), Ze.assign(t.w);
|
|
4816
4822
|
}).Else(() => {
|
|
4817
|
-
|
|
4823
|
+
$e.assign(1);
|
|
4818
4824
|
});
|
|
4819
4825
|
});
|
|
4820
4826
|
});
|
|
4821
|
-
let
|
|
4827
|
+
let et = W(0).toVar(), tt = W(0).toVar(), nt = M(-1e3).toVar(), rt = U(2).div(a).toVar();
|
|
4822
4828
|
h({
|
|
4823
4829
|
start: N(0),
|
|
4824
|
-
end:
|
|
4830
|
+
end: $e,
|
|
4825
4831
|
type: "int",
|
|
4826
4832
|
condition: "<"
|
|
4827
4833
|
}, ({ i: e }) => {
|
|
4828
|
-
let n = dn({ state: Je.add(V(e)) }).toVar(), r = xn(t, e,
|
|
4834
|
+
let n = dn({ state: Je.add(V(e)) }).toVar(), r = xn(t, e, $e, n, a, o).toVar();
|
|
4829
4835
|
m(c.equal(N(9)), () => {
|
|
4830
4836
|
Ke.assign(G(r, 1, 1)), qe.assign(1), d();
|
|
4831
4837
|
});
|
|
4832
|
-
let i = r.sub(.5).mul(
|
|
4838
|
+
let i = r.sub(.5).mul(rt), s = Ge.add(i), h = zr.wrap(Ri(s, n, l, u, Ie, Le, Re, ze, Be, Ve, He)), M = G(0).toVar();
|
|
4833
4839
|
m(c.greaterThan(N(0)), () => {
|
|
4834
4840
|
M.assign(xs(h.origin, h.direction, g, _, v, P, re, ne, oe, c, K, t, a, y, b, x, S, C, w, p, f, o));
|
|
4835
4841
|
}).Else(() => {
|
|
4836
4842
|
let r = us.wrap(_s(h, n, e, Ye, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A, j, ee, te, P, ne, re, F, ie, ae, I, oe, se, ce, le, fe, ue, de, pe, me, he, ge, _e, ve, ye, B, H, Se, Ce, t, a, o));
|
|
4837
4843
|
M.assign(r.radiance), m(e.equal(N(0)), () => {
|
|
4838
|
-
|
|
4839
|
-
|
|
4844
|
+
et.assign(r.objectNormal), tt.assign(r.objectColor), nt.assign(r.objectID), m(r.firstHitDistance.lessThan(1e9), () => {
|
|
4845
|
+
Xe.assign(R(r.objectNormal)), Ze.assign(Ss({
|
|
4840
4846
|
worldPos: r.firstHitPoint,
|
|
4841
4847
|
cameraProjectionMatrix: p,
|
|
4842
4848
|
cameraViewMatrix: f
|
|
4843
4849
|
}));
|
|
4844
4850
|
});
|
|
4845
4851
|
});
|
|
4846
|
-
}), Ke.addAssign(M),
|
|
4852
|
+
}), Ke.addAssign(M), Qe.addAssign(M.w), qe.addAssign(1);
|
|
4847
4853
|
}), m(qe.greaterThan(N(0)), () => {
|
|
4848
|
-
Ke.divAssign(M(qe)),
|
|
4854
|
+
Ke.divAssign(M(qe)), Qe.divAssign(M(qe));
|
|
4849
4855
|
});
|
|
4850
|
-
let
|
|
4856
|
+
let it = Ke.xyz.toVar(), at = G(Xe.mul(.5).add(.5), Ze).toVar(), ot = W(tt).toVar(), st = z(de, Qe, M(1)).toVar();
|
|
4851
4857
|
m(Te.and(je.not()).and(o.greaterThan(V(0))).and(Ee), () => {
|
|
4852
4858
|
let e = be(De, We, 0).toVar();
|
|
4853
|
-
|
|
4854
|
-
|
|
4859
|
+
it.assign(L(e.xyz, Ke.xyz, Ae)), at.assign(L(be(Oe, We, 0), at, Ae)), ot.assign(L(be(ke, We, 0).xyz, ot, Ae)), m(de, () => {
|
|
4860
|
+
st.assign(L(e.w, Qe, Ae));
|
|
4855
4861
|
});
|
|
4856
|
-
}), xe(n, Ue, G(
|
|
4862
|
+
}), xe(n, Ue, G(it.xyz, st)).toWriteOnly(), xe(r, Ue, at).toWriteOnly(), xe(i, Ue, G(ot, 1)).toWriteOnly();
|
|
4857
4863
|
}, Ts = class {
|
|
4858
4864
|
constructor(e = "Build") {
|
|
4859
4865
|
this.label = e, this.entries = /* @__PURE__ */ new Map(), this.order = [], this.totalStart = performance.now();
|
|
@@ -4934,7 +4940,7 @@ var Ss = /* @__PURE__ */ K("\n fn computeNDCDepth( worldPos: vec3f, cameraProjec
|
|
|
4934
4940
|
255,
|
|
4935
4941
|
255
|
|
4936
4942
|
]), 1, 1, 1);
|
|
4937
|
-
return e.minFilter =
|
|
4943
|
+
return e.minFilter = Xe, e.magFilter = Xe, e.generateMipmaps = !1, e.needsUpdate = !0, be(e);
|
|
4938
4944
|
}, f = e.materialData, p = f.albedoMaps ? be(f.albedoMaps) : d(), m = f.normalMaps ? be(f.normalMaps) : d(), h = f.bumpMaps ? be(f.bumpMaps) : d(), g = f.metalnessMaps ? be(f.metalnessMaps) : d(), _ = f.roughnessMaps ? be(f.roughnessMaps) : d(), v = f.emissiveMaps ? be(f.emissiveMaps) : d(), y = f.displacementMaps ? be(f.displacementMaps) : d();
|
|
4939
4945
|
po(p);
|
|
4940
4946
|
let b = {
|
|
@@ -7054,7 +7060,7 @@ var Xs = 16, Zs = class {
|
|
|
7054
7060
|
}
|
|
7055
7061
|
createDataArrayTextureFromBuffer(e, t, n, r) {
|
|
7056
7062
|
let i = new ze(e, t, n, r);
|
|
7057
|
-
i.minFilter =
|
|
7063
|
+
i.minFilter = Xe, i.magFilter = Xe, i.format = yt, i.type = Mt, i.needsUpdate = !0, i.generateMipmaps = !1, i.userData = {
|
|
7058
7064
|
buffer: e,
|
|
7059
7065
|
bufferType: Uint8Array
|
|
7060
7066
|
};
|
|
@@ -7119,7 +7125,7 @@ var Xs = 16, Zs = class {
|
|
|
7119
7125
|
255,
|
|
7120
7126
|
255
|
|
7121
7127
|
]), 1, 1, 1);
|
|
7122
|
-
return e.minFilter =
|
|
7128
|
+
return e.minFilter = Xe, e.magFilter = Xe, e.format = yt, e.type = Mt, e.needsUpdate = !0, e.generateMipmaps = !1, e;
|
|
7123
7129
|
}
|
|
7124
7130
|
combineTextureResults(e) {
|
|
7125
7131
|
return e[0];
|
|
@@ -7147,8 +7153,8 @@ var oc = 128, sc = class {
|
|
|
7147
7153
|
,
|
|
7148
7154
|
].fill().map(() => new Nt())
|
|
7149
7155
|
}, this._matrixPool = {
|
|
7150
|
-
mat3: new
|
|
7151
|
-
mat4: new
|
|
7156
|
+
mat3: new rt(),
|
|
7157
|
+
mat4: new it()
|
|
7152
7158
|
}, this.resetArrays(), this.triangleCount = 0, this.currentTriangleIndex = 0;
|
|
7153
7159
|
}
|
|
7154
7160
|
_getVec3(e = 0) {
|
|
@@ -7332,7 +7338,7 @@ var oc = 128, sc = class {
|
|
|
7332
7338
|
};
|
|
7333
7339
|
}
|
|
7334
7340
|
getTextureMatrix(e) {
|
|
7335
|
-
return e ? (e.updateMatrix(), e.matrix.elements) : new
|
|
7341
|
+
return e ? (e.updateMatrix(), e.matrix.elements) : new rt().elements;
|
|
7336
7342
|
}
|
|
7337
7343
|
getMaterialSide(e) {
|
|
7338
7344
|
if (e.transmission > 0) return 2;
|
|
@@ -7587,7 +7593,7 @@ var oc = 128, sc = class {
|
|
|
7587
7593
|
let t = Math.ceil(Math.sqrt(this.emissiveCount)), n = Math.ceil(this.emissiveCount / t), r = t * n * 4, i = new Float32Array(r);
|
|
7588
7594
|
i.set(e);
|
|
7589
7595
|
let a = new Be(i, t, n, yt, qe);
|
|
7590
|
-
return a.needsUpdate = !0, a.generateMipmaps = !1, a.minFilter =
|
|
7596
|
+
return a.needsUpdate = !0, a.generateMipmaps = !1, a.minFilter = q, a.magFilter = q, console.log(`[EmissiveTriangleBuilder] Created ${t}x${n} emissive texture (${this.emissiveCount} emissives)`), a;
|
|
7591
7597
|
}
|
|
7592
7598
|
createEmissiveRawData() {
|
|
7593
7599
|
if (this.emissiveCount === 0) return new Float32Array(8);
|
|
@@ -8442,7 +8448,7 @@ var oc = 128, sc = class {
|
|
|
8442
8448
|
count: this.triangleCount
|
|
8443
8449
|
}), this.materialData.callbacks.onTriangleDataChanged = () => {
|
|
8444
8450
|
this.triangleStorageAttr && (this.triangleStorageAttr.needsUpdate = !0);
|
|
8445
|
-
}, this.environment = new Rr(this.scene, this.uniforms), this.environment.callbacks.onReset = () => this.reset(), this.environment.callbacks.getSceneTextureNodes = () => this.shaderBuilder.getSceneTextureNodes(), this.shaderBuilder = new Ds(), this._initRenderingState(), this.setupBlueNoise(), this.tempVector2 = new Nt(), this.lastCameraMatrix = new
|
|
8451
|
+
}, this.environment = new Rr(this.scene, this.uniforms), this.environment.callbacks.onReset = () => this.reset(), this.environment.callbacks.getSceneTextureNodes = () => this.shaderBuilder.getSceneTextureNodes(), this.shaderBuilder = new Ds(), this._initRenderingState(), this.setupBlueNoise(), this.tempVector2 = new Nt(), this.lastCameraMatrix = new it(), this.lastProjectionMatrix = new it(), this.lastRenderMode = -1, this.tileCompletionFrame = 0, this.renderModeChangeTimeout = null, this.renderModeChangeDelay = 50, this.pendingRenderMode = null, this.adaptiveSamplingFrameToggle = !1, this.lastInteractionModeState = !1, this.cameraChanged = !1, this.tileChanged = !1, this.updateCompletionThreshold();
|
|
8446
8452
|
}
|
|
8447
8453
|
_initDataTextures() {
|
|
8448
8454
|
this.triangleStorageAttr = null, this.triangleStorageNode = null, this.triangleCount = 0, this.bvhStorageAttr = null, this.bvhStorageNode = null, this.bvhNodeCount = 0, this.directionalLightsData = null, this.pointLightsData = null, this.spotLightsData = null, this.areaLightsData = null, this.stbnScalarTexture = null, this.stbnVec2Texture = null, this.lightStorageAttr = new o(new Float32Array(16), 4), this.lightStorageNode = ve(this.lightStorageAttr, "vec4", 1).toReadOnly(), this._lbvhDataCache = null, this._emissiveDataCache = null, this._instanceTable = null, this.adaptiveSamplingTexture = null, this.spheres = [];
|
|
@@ -8539,7 +8545,7 @@ var oc = 128, sc = class {
|
|
|
8539
8545
|
setupBlueNoise() {
|
|
8540
8546
|
let e = new kt();
|
|
8541
8547
|
e.setCrossOrigin("anonymous");
|
|
8542
|
-
let t = (e) => (e.minFilter =
|
|
8548
|
+
let t = (e) => (e.minFilter = q, e.magFilter = q, e.wrapS = Ct, e.wrapT = Ct, e.generateMipmaps = !1, e);
|
|
8543
8549
|
e.load(pc, (e) => {
|
|
8544
8550
|
this.stbnScalarTexture = t(e), on.value = e, console.log(`PathTracer: STBN scalar atlas loaded ${e.image.width}x${e.image.height}`);
|
|
8545
8551
|
}), e.load(mc, (e) => {
|
|
@@ -8829,13 +8835,13 @@ var oc = 128, sc = class {
|
|
|
8829
8835
|
super("NormalDepth", {
|
|
8830
8836
|
...t,
|
|
8831
8837
|
executionMode: Cn.ALWAYS
|
|
8832
|
-
}), this.renderer = e, this.pathTracer = t.pathTracer, this._dirty = !0, this.cameraWorldMatrix = H(new
|
|
8838
|
+
}), this.renderer = e, this.pathTracer = t.pathTracer, this._dirty = !0, this.cameraWorldMatrix = H(new it(), "mat4"), this.cameraProjectionMatrixInverse = H(new it(), "mat4"), this.resolutionWidth = H(t.width || 1), this.resolutionHeight = H(t.height || 1);
|
|
8833
8839
|
let n = t.width || 1, r = t.height || 1;
|
|
8834
|
-
this._outputStorageTex = new s(n, r), this._outputStorageTex.type = Ye, this._outputStorageTex.format = yt, this._outputStorageTex.minFilter =
|
|
8840
|
+
this._outputStorageTex = new s(n, r), this._outputStorageTex.type = Ye, this._outputStorageTex.format = yt, this._outputStorageTex.minFilter = q, this._outputStorageTex.magFilter = q, this.renderTarget = new i(n, r, {
|
|
8835
8841
|
type: Ye,
|
|
8836
8842
|
format: yt,
|
|
8837
|
-
minFilter:
|
|
8838
|
-
magFilter:
|
|
8843
|
+
minFilter: q,
|
|
8844
|
+
magFilter: q,
|
|
8839
8845
|
depthBuffer: !1,
|
|
8840
8846
|
stencilBuffer: !1
|
|
8841
8847
|
}), this._dispatchX = Math.ceil(n / 8), this._dispatchY = Math.ceil(r / 8), this._triStorageNode = null, this._bvhStorageNode = null, this._matStorageNode = null, this._lastTriAttr = null, this._lastBvhAttr = null, this._lastMatAttr = null, this._computeNode = null, this._computeBuilt = !1;
|
|
@@ -8909,12 +8915,12 @@ var oc = 128, sc = class {
|
|
|
8909
8915
|
executionMode: Cn.ALWAYS
|
|
8910
8916
|
}), this.renderer = e, this.camera = t, this.pathTracer = n.pathTracer || null;
|
|
8911
8917
|
let r = n.width || 1, a = n.height || 1;
|
|
8912
|
-
this.prevViewProjectionMatrix = new
|
|
8918
|
+
this.prevViewProjectionMatrix = new it(), this.currentViewProjectionMatrix = new it(), this.matricesInitialized = !1, this.isFirstFrame = !0, this.frameCount = 0, this.cameraWorldMatrix = H(new it(), "mat4"), this.cameraProjectionMatrixInverse = H(new it(), "mat4"), this.prevVP = H(new it(), "mat4"), this.isFirstFrameU = H(1), this.deltaTime = H(1 / 60), this.velocityScale = H(1), this.resolutionWidth = H(r), this.resolutionHeight = H(a), this._normalDepthTexNode = new c(), this._screenSpaceStorageTex = new s(r, a), this._screenSpaceStorageTex.type = Ye, this._screenSpaceStorageTex.format = yt, this._screenSpaceStorageTex.minFilter = q, this._screenSpaceStorageTex.magFilter = q, this._worldSpaceStorageTex = new s(r, a), this._worldSpaceStorageTex.type = Ye, this._worldSpaceStorageTex.format = yt, this._worldSpaceStorageTex.minFilter = q, this._worldSpaceStorageTex.magFilter = q;
|
|
8913
8919
|
let o = {
|
|
8914
8920
|
type: Ye,
|
|
8915
8921
|
format: yt,
|
|
8916
|
-
minFilter:
|
|
8917
|
-
magFilter:
|
|
8922
|
+
minFilter: q,
|
|
8923
|
+
magFilter: q,
|
|
8918
8924
|
depthBuffer: !1,
|
|
8919
8925
|
stencilBuffer: !1
|
|
8920
8926
|
};
|
|
@@ -9179,11 +9185,11 @@ var bc = class extends wn {
|
|
|
9179
9185
|
executionMode: Cn.PER_CYCLE
|
|
9180
9186
|
}), this.renderer = e, this.debugContainer = t.debugContainer || null, this.temporalAlpha = H(t.temporalAlpha ?? .1), this.phiColor = H(t.phiColor ?? 10), this.maxAccumFrames = H(t.maxAccumFrames ?? 32), this.varianceClip = H(t.varianceClip ?? 1), this.resW = H(t.width || 1), this.resH = H(t.height || 1), this.temporalEnabled = !0, this.temporalEnabledU = H(1), this._colorTexNode = new c(), this._motionTexNode = new c(), this._readTemporalTexNode = new c();
|
|
9181
9187
|
let n = t.width || 1, r = t.height || 1;
|
|
9182
|
-
this._temporalTexA = new s(n, r), this._temporalTexA.type = Ye, this._temporalTexA.format = yt, this._temporalTexA.minFilter =
|
|
9188
|
+
this._temporalTexA = new s(n, r), this._temporalTexA.type = Ye, this._temporalTexA.format = yt, this._temporalTexA.minFilter = Xe, this._temporalTexA.magFilter = Xe, this._temporalTexB = new s(n, r), this._temporalTexB.type = Ye, this._temporalTexB.format = yt, this._temporalTexB.minFilter = Xe, this._temporalTexB.magFilter = Xe, this._gradientStorageTex = new s(n, r), this._gradientStorageTex.type = Ye, this._gradientStorageTex.format = yt, this._gradientStorageTex.minFilter = Xe, this._gradientStorageTex.magFilter = Xe, this.currentMoments = 0, this._compiled = !1, this._dispatchX = Math.ceil(n / 8), this._dispatchY = Math.ceil(r / 8), this._buildGradientCompute(), this._buildTemporalCompute(), this.showHeatmap = !1, this.debugMode = H(0, "int"), this._heatmapStorageTex = new s(n, r), this._heatmapStorageTex.type = qe, this._heatmapStorageTex.format = yt, this._heatmapStorageTex.minFilter = q, this._heatmapStorageTex.magFilter = q, this.heatmapTarget = new i(n, r, {
|
|
9183
9189
|
type: qe,
|
|
9184
9190
|
format: yt,
|
|
9185
|
-
minFilter:
|
|
9186
|
-
magFilter:
|
|
9191
|
+
minFilter: q,
|
|
9192
|
+
magFilter: q,
|
|
9187
9193
|
depthBuffer: !1,
|
|
9188
9194
|
stencilBuffer: !1
|
|
9189
9195
|
}), this._heatmapRawColorTexNode = new c(), this._heatmapColorTexNode = new c(), this._heatmapTemporalTexNode = new c(), this._heatmapNDTexNode = new c(), this._heatmapMotionTexNode = new c(), this._heatmapGradientTexNode = new c(), this._buildHeatmapCompute(), this.heatmapHelper = yc(this.renderer, this.heatmapTarget, {
|
|
@@ -9360,7 +9366,7 @@ var bc = class extends wn {
|
|
|
9360
9366
|
executionMode: Cn.ALWAYS
|
|
9361
9367
|
}), this.renderer = e, this.inputTextureName = t.inputTextureName || "pathtracer:color", this.varianceBoost = H(t.varianceBoost ?? 1), this.temporalAlpha = H(t.temporalAlpha ?? .1), this.resW = H(t.width || 1), this.resH = H(t.height || 1), this._colorTexNode = new c();
|
|
9362
9368
|
let n = t.width || 1, r = t.height || 1;
|
|
9363
|
-
this._storageTexA = new s(n, r), this._storageTexA.type = qe, this._storageTexA.format = yt, this._storageTexA.minFilter =
|
|
9369
|
+
this._storageTexA = new s(n, r), this._storageTexA.type = qe, this._storageTexA.format = yt, this._storageTexA.minFilter = Xe, this._storageTexA.magFilter = Xe, this._storageTexB = new s(n, r), this._storageTexB.type = qe, this._storageTexB.format = yt, this._storageTexB.minFilter = Xe, this._storageTexB.magFilter = Xe, this.currentMoments = 0, this._compiled = !1, this._needsWarmReset = !1, this._dispatchX = Math.ceil(n / 8), this._dispatchY = Math.ceil(r / 8), this._buildCompute();
|
|
9364
9370
|
}
|
|
9365
9371
|
setupEventListeners() {
|
|
9366
9372
|
this.on("pathtracer:viewpointChanged", () => this.reset());
|
|
@@ -9435,7 +9441,7 @@ var bc = class extends wn {
|
|
|
9435
9441
|
executionMode: Cn.ALWAYS
|
|
9436
9442
|
}), this.renderer = e, this.inputTextureName = t.inputTextureName || "asvgf:output", this.normalDepthTextureName = t.normalDepthTextureName || "pathtracer:normalDepth", this.iterations = t.iterations ?? 4, this.phiColor = H(t.phiColor ?? 10), this.phiNormal = H(t.phiNormal ?? 128), this.phiDepth = H(t.phiDepth ?? 1), this.phiLuminance = H(t.phiLuminance ?? 4), this.stepSizeU = H(1, "int"), this.resW = H(t.width || 1), this.resH = H(t.height || 1), this._readTexNode = new c(), this._normalDepthTexNode = new c();
|
|
9437
9443
|
let n = t.width || 1, r = t.height || 1;
|
|
9438
|
-
this._storageTexA = new s(n, r), this._storageTexA.type = Ye, this._storageTexA.format = yt, this._storageTexA.minFilter =
|
|
9444
|
+
this._storageTexA = new s(n, r), this._storageTexA.type = Ye, this._storageTexA.format = yt, this._storageTexA.minFilter = Xe, this._storageTexA.magFilter = Xe, this._storageTexB = new s(n, r), this._storageTexB.type = Ye, this._storageTexB.format = yt, this._storageTexB.minFilter = Xe, this._storageTexB.magFilter = Xe, this._compiled = !1, this._dispatchX = Math.ceil(n / 8), this._dispatchY = Math.ceil(r / 8), this._buildCompute();
|
|
9439
9445
|
}
|
|
9440
9446
|
_buildCompute() {
|
|
9441
9447
|
this._computeNodeA = this._buildComputeForDirection(this._storageTexA), this._computeNodeB = this._buildComputeForDirection(this._storageTexB);
|
|
@@ -9525,11 +9531,11 @@ var bc = class extends wn {
|
|
|
9525
9531
|
executionMode: Cn.PER_CYCLE
|
|
9526
9532
|
}), this.renderer = e, this.debugContainer = t.debugContainer || null, this.frameNumber = 0, this.delayByFrames = t.delayByFrames ?? 2, this.showAdaptiveSamplingHelper = !1, this.adaptiveSamplingMax = H(t.adaptiveSamplingMax ?? X.adaptiveSamplingMax ?? 32, "int"), this.varianceThreshold = H(t.varianceThreshold ?? X.adaptiveSamplingVarianceThreshold ?? .01), this.materialBias = H(t.materialBias ?? X.adaptiveSamplingMaterialBias ?? 1.2), this.edgeBias = H(t.edgeBias ?? X.adaptiveSamplingEdgeBias ?? 1.5), this.convergenceSpeed = H(t.convergenceSpeed ?? X.adaptiveSamplingConvergenceSpeed ?? 2), this.frameNumberUniform = H(0, "int"), this.resolutionWidth = H(t.width || 1024), this.resolutionHeight = H(t.height || 1024), this.minConvergenceFrames = H(10), this.convergenceThreshold = H(.01);
|
|
9527
9533
|
let n = t.width || 1, r = t.height || 1;
|
|
9528
|
-
this._outputStorageTex = new s(n, r), this._outputStorageTex.type = Ye, this._outputStorageTex.format = yt, this._outputStorageTex.minFilter =
|
|
9534
|
+
this._outputStorageTex = new s(n, r), this._outputStorageTex.type = Ye, this._outputStorageTex.format = yt, this._outputStorageTex.minFilter = Xe, this._outputStorageTex.magFilter = Xe, this._heatmapStorageTex = new s(n, r), this._heatmapStorageTex.type = qe, this._heatmapStorageTex.format = yt, this._heatmapStorageTex.minFilter = q, this._heatmapStorageTex.magFilter = q, this.heatmapTarget = new i(n, r, {
|
|
9529
9535
|
format: yt,
|
|
9530
9536
|
type: qe,
|
|
9531
|
-
minFilter:
|
|
9532
|
-
magFilter:
|
|
9537
|
+
minFilter: q,
|
|
9538
|
+
magFilter: q,
|
|
9533
9539
|
depthBuffer: !1,
|
|
9534
9540
|
stencilBuffer: !1
|
|
9535
9541
|
}), this._dispatchX = Math.ceil(n / 16), this._dispatchY = Math.ceil(r / 16), this._varianceTexNode = new c(), this._buildCompute(), this._buildHeatmapCompute(), this.helper = yc(this.renderer, this.heatmapTarget, {
|
|
@@ -9633,11 +9639,11 @@ var bc = class extends wn {
|
|
|
9633
9639
|
executionMode: Cn.PER_CYCLE
|
|
9634
9640
|
}), this.renderer = e, this.filterStrength = H(t.filterStrength ?? .75), this.strengthDecaySpeed = H(t.strengthDecaySpeed ?? .05), this.edgeThreshold = H(t.edgeThreshold ?? 1), this.phiNormal = H(t.phiNormal ?? 128), this.phiDepth = H(t.phiDepth ?? 1), this.iterationCount = H(0), this.resW = H(t.width || 1), this.resH = H(t.height || 1), this._iterations = 0, this._inputTexNode = new c(), this._ndTexNode = new c();
|
|
9635
9641
|
let n = 2048, r = t.width || 1, a = t.height || 1;
|
|
9636
|
-
this._outputStorageTex = new s(n, n), this._outputStorageTex.type = Ye, this._outputStorageTex.format = yt, this._outputStorageTex.minFilter =
|
|
9642
|
+
this._outputStorageTex = new s(n, n), this._outputStorageTex.type = Ye, this._outputStorageTex.format = yt, this._outputStorageTex.minFilter = q, this._outputStorageTex.magFilter = q, this._srcRegion = new Ne(new Nt(0, 0), new Nt(0, 0)), this.outputTarget = new i(r, a, {
|
|
9637
9643
|
type: Ye,
|
|
9638
9644
|
format: yt,
|
|
9639
|
-
minFilter:
|
|
9640
|
-
magFilter:
|
|
9645
|
+
minFilter: q,
|
|
9646
|
+
magFilter: q,
|
|
9641
9647
|
depthBuffer: !1,
|
|
9642
9648
|
stencilBuffer: !1
|
|
9643
9649
|
}), this._dispatchX = Math.ceil(r / 16), this._dispatchY = Math.ceil(a / 16), this._buildCompute();
|
|
@@ -9720,12 +9726,12 @@ var bc = class extends wn {
|
|
|
9720
9726
|
let e = {
|
|
9721
9727
|
type: qe,
|
|
9722
9728
|
format: yt,
|
|
9723
|
-
minFilter:
|
|
9724
|
-
magFilter:
|
|
9729
|
+
minFilter: q,
|
|
9730
|
+
magFilter: q,
|
|
9725
9731
|
depthBuffer: !1,
|
|
9726
9732
|
stencilBuffer: !1
|
|
9727
9733
|
};
|
|
9728
|
-
this._downsampleTarget = new i(this.REDUCTION_SIZE, this.REDUCTION_SIZE, e), this._downsampleStorageTex = new s(this.REDUCTION_SIZE, this.REDUCTION_SIZE), this._downsampleStorageTex.type = qe, this._downsampleStorageTex.format = yt, this._downsampleStorageTex.minFilter =
|
|
9734
|
+
this._downsampleTarget = new i(this.REDUCTION_SIZE, this.REDUCTION_SIZE, e), this._downsampleStorageTex = new s(this.REDUCTION_SIZE, this.REDUCTION_SIZE), this._downsampleStorageTex.type = qe, this._downsampleStorageTex.format = yt, this._downsampleStorageTex.minFilter = q, this._downsampleStorageTex.magFilter = q, this._reductionStorageTex = new s(1, 1), this._reductionStorageTex.type = qe, this._reductionStorageTex.format = yt, this._reductionStorageTex.minFilter = q, this._reductionStorageTex.magFilter = q, this._reductionReadTarget = new i(1, 1, e), this._adaptationResult = w(1, "vec4"), this._readbackBuffer = new n(16), this._readbackBuffer.name = "AutoExposureAdaptation", this._histogramBuffer = w(kc, "uint").toAtomic();
|
|
9729
9735
|
}
|
|
9730
9736
|
_buildCompute() {
|
|
9731
9737
|
this._buildDownsampleCompute(), this._buildHistogramCompute(), this._buildHistogramAnalyzeCompute(), this._buildAdaptationCompute();
|
|
@@ -9919,7 +9925,7 @@ var Rc = class extends wn {
|
|
|
9919
9925
|
super("SSRC", {
|
|
9920
9926
|
...t,
|
|
9921
9927
|
executionMode: Cn.PER_CYCLE
|
|
9922
|
-
}), this.renderer = e, this.resW = H(1), this.resH = H(1), this.temporalAlpha = H(t.temporalAlpha ?? .1), this.phiNormal = H(t.phiNormal ?? 128), this.phiDepth = H(t.phiDepth ?? .5), this.maxHistory = H(t.maxHistory ?? 128), this.spatialRadius = H(t.spatialRadius ?? 4, "int"), this.spatialWeight = H(t.spatialWeight ?? .4), this._framesSinceReset = H(0, "int"), this._colorTexNode = new c(), this._ndTexNode = new c(), this._motionTexNode = new c(), this._readCacheTexNode = new c(), this._readPrevNDTexNode = new c(), this._readPass1CacheTexNode = new c(), this._cacheTexA = this._createStorageTex(1, 1,
|
|
9928
|
+
}), this.renderer = e, this.resW = H(1), this.resH = H(1), this.temporalAlpha = H(t.temporalAlpha ?? .1), this.phiNormal = H(t.phiNormal ?? 128), this.phiDepth = H(t.phiDepth ?? .5), this.maxHistory = H(t.maxHistory ?? 128), this.spatialRadius = H(t.spatialRadius ?? 4, "int"), this.spatialWeight = H(t.spatialWeight ?? .4), this._framesSinceReset = H(0, "int"), this._colorTexNode = new c(), this._ndTexNode = new c(), this._motionTexNode = new c(), this._readCacheTexNode = new c(), this._readPrevNDTexNode = new c(), this._readPass1CacheTexNode = new c(), this._cacheTexA = this._createStorageTex(1, 1, q), this._cacheTexB = this._createStorageTex(1, 1, q), this._prevNDTexA = this._createStorageTex(1, 1, q), this._prevNDTexB = this._createStorageTex(1, 1, q), this._outputTex = this._createStorageTex(1, 1, Xe), this._currentPingPong = 0, this._dispatchX = 1, this._dispatchY = 1, this._buildComputeNodes();
|
|
9923
9929
|
}
|
|
9924
9930
|
setupEventListeners() {
|
|
9925
9931
|
this.on("pipeline:reset", () => this._resetCache()), this.on("camera:moved", () => this._resetCache());
|
|
@@ -10407,7 +10413,7 @@ var Rc = class extends wn {
|
|
|
10407
10413
|
}
|
|
10408
10414
|
}
|
|
10409
10415
|
showFocusPoint(e) {
|
|
10410
|
-
this.focusPointIndicator && this.scene.remove(this.focusPointIndicator), this.focusPointIndicator = new
|
|
10416
|
+
this.focusPointIndicator && this.scene.remove(this.focusPointIndicator), this.focusPointIndicator = new at(new Et(this.assetLoader.getSceneScale() * .02, 16, 16), new ot({
|
|
10411
10417
|
color: 65280,
|
|
10412
10418
|
transparent: !0,
|
|
10413
10419
|
opacity: .8,
|
|
@@ -10787,7 +10793,7 @@ var Rc = class extends wn {
|
|
|
10787
10793
|
}
|
|
10788
10794
|
async loadEnvironmentByExtension(e, t) {
|
|
10789
10795
|
let n;
|
|
10790
|
-
return t === "hdr" || t === "exr" ? n = await (t === "hdr" ? this.loaderCache.hdr || (this.loaderCache.hdr = new zt().setDataType(qe)) : this.loaderCache.exr || (this.loaderCache.exr = new Ht().setDataType(qe))).loadAsync(e) : (this.loaderCache.texture || (this.loaderCache.texture = new kt()), n = await this.loaderCache.texture.loadAsync(e)), n.mapping = Ge, n.minFilter =
|
|
10796
|
+
return t === "hdr" || t === "exr" ? n = await (t === "hdr" ? this.loaderCache.hdr || (this.loaderCache.hdr = new zt().setDataType(qe)) : this.loaderCache.exr || (this.loaderCache.exr = new Ht().setDataType(qe))).loadAsync(e) : (this.loaderCache.texture || (this.loaderCache.texture = new kt()), n = await this.loaderCache.texture.loadAsync(e)), n.mapping = Ge, n.minFilter = Xe, n.magFilter = Xe, n;
|
|
10791
10797
|
}
|
|
10792
10798
|
applyEnvironmentToScene(e) {
|
|
10793
10799
|
this.scene.background = e, this.scene.environment = e;
|
|
@@ -10912,7 +10918,7 @@ var Rc = class extends wn {
|
|
|
10912
10918
|
}
|
|
10913
10919
|
async handleGltfFromZip(e, t, n, r) {
|
|
10914
10920
|
if (e === "gltf") {
|
|
10915
|
-
let e = Gt(t), i = new
|
|
10921
|
+
let e = Gt(t), i = new $e(), a = n.split("/").slice(0, -1).join("/");
|
|
10916
10922
|
i.setURLModifier((e) => this.resolveZipResource(e, a, r));
|
|
10917
10923
|
let o = await this.createGLTFLoader();
|
|
10918
10924
|
o.manager = i;
|
|
@@ -10942,7 +10948,7 @@ var Rc = class extends wn {
|
|
|
10942
10948
|
e.split("/").pop()
|
|
10943
10949
|
];
|
|
10944
10950
|
for (let e of i) if (n[e]) {
|
|
10945
|
-
let { MTLLoader: t } = await import("three/examples/jsm/loaders/MTLLoader.js"), i = Gt(n[e]), a = new
|
|
10951
|
+
let { MTLLoader: t } = await import("three/examples/jsm/loaders/MTLLoader.js"), i = Gt(n[e]), a = new $e();
|
|
10946
10952
|
a.setURLModifier((e) => this.resolveZipResource(e, r, n));
|
|
10947
10953
|
let o = new t(a).parse(i, r);
|
|
10948
10954
|
return o.preload(), o;
|
|
@@ -10962,7 +10968,7 @@ var Rc = class extends wn {
|
|
|
10962
10968
|
return console.warn(`Resource not found in ZIP: ${e}`), e;
|
|
10963
10969
|
}
|
|
10964
10970
|
async loadOBJMTLPairFromZip(e, t, n, r) {
|
|
10965
|
-
let { MTLLoader: i } = await import("three/examples/jsm/loaders/MTLLoader.js"), { OBJLoader: a } = await import("three/examples/jsm/loaders/OBJLoader.js"), o = [], s = new
|
|
10971
|
+
let { MTLLoader: i } = await import("three/examples/jsm/loaders/MTLLoader.js"), { OBJLoader: a } = await import("three/examples/jsm/loaders/OBJLoader.js"), o = [], s = new $e(), c = e.path.split("/").slice(0, -1).join("/"), l = t.path.split("/").slice(0, -1).join("/");
|
|
10966
10972
|
s.setURLModifier((e) => this.resolveTextureInZip(e, c, l, t, n, o));
|
|
10967
10973
|
let u = this.prepareFixedMtlContent(t), d = new i(s).parse(u, l);
|
|
10968
10974
|
d.preload();
|
|
@@ -11154,7 +11160,7 @@ var Rc = class extends wn {
|
|
|
11154
11160
|
let { STLLoader: e } = await import("three/examples/jsm/loaders/STLLoader.js");
|
|
11155
11161
|
this.loaderCache.stl = new e();
|
|
11156
11162
|
}
|
|
11157
|
-
let n = new
|
|
11163
|
+
let n = new at(this.loaderCache.stl.parse(e), new ct());
|
|
11158
11164
|
return n.name = t, this.releaseTargetModel(), this.targetModel = n, An({
|
|
11159
11165
|
isLoading: !0,
|
|
11160
11166
|
status: "Processing Data...",
|
|
@@ -11183,7 +11189,7 @@ var Rc = class extends wn {
|
|
|
11183
11189
|
this.loaderCache.ply = new e();
|
|
11184
11190
|
}
|
|
11185
11191
|
let n = this.loaderCache.ply.parse(e), r;
|
|
11186
|
-
if (n.index !== null) r = new
|
|
11192
|
+
if (n.index !== null) r = new at(n, new ct());
|
|
11187
11193
|
else {
|
|
11188
11194
|
let e = new _t({ size: .01 });
|
|
11189
11195
|
e.vertexColors = n.hasAttribute("color"), r = new gt(n, e);
|
|
@@ -11359,7 +11365,7 @@ var Rc = class extends wn {
|
|
|
11359
11365
|
this.sceneScale = t;
|
|
11360
11366
|
}
|
|
11361
11367
|
createFloorPlane() {
|
|
11362
|
-
this.floorPlane = new
|
|
11368
|
+
this.floorPlane = new at(new Ie(), new st({
|
|
11363
11369
|
transparent: !1,
|
|
11364
11370
|
color: 3158064,
|
|
11365
11371
|
roughness: 1,
|
|
@@ -11762,7 +11768,7 @@ var Rc = class extends wn {
|
|
|
11762
11768
|
if (e === "DirectionalLight") n = new He(t.color, t.intensity), n.position.fromArray(t.position);
|
|
11763
11769
|
else if (e === "PointLight") n = new mt(t.color, t.intensity), n.position.fromArray(t.position);
|
|
11764
11770
|
else if (e === "SpotLight") {
|
|
11765
|
-
n = new Dt(t.color, t.intensity), n.position.fromArray(t.position), n.angle =
|
|
11771
|
+
n = new Dt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = nt.degToRad(t.angle);
|
|
11766
11772
|
let e = new ft();
|
|
11767
11773
|
this.scene.add(e), n.target = e;
|
|
11768
11774
|
} else e === "RectAreaLight" && (n = new xt(t.color, t.intensity, t.width, t.height), n.position.fromArray(t.position), n.lookAt(0, 0, 0));
|
|
@@ -11835,7 +11841,7 @@ var Rc = class extends wn {
|
|
|
11835
11841
|
}
|
|
11836
11842
|
_buildDescriptor(e) {
|
|
11837
11843
|
let t = 0;
|
|
11838
|
-
e.type === "SpotLight" && e.angle !== void 0 && (t =
|
|
11844
|
+
e.type === "SpotLight" && e.angle !== void 0 && (t = nt.radToDeg(e.angle));
|
|
11839
11845
|
let n = {
|
|
11840
11846
|
uuid: e.uuid,
|
|
11841
11847
|
name: e.name,
|
|
@@ -11913,7 +11919,7 @@ function al(e, t, n, r, i) {
|
|
|
11913
11919
|
}
|
|
11914
11920
|
var ol = new Map([
|
|
11915
11921
|
[dt, $c],
|
|
11916
|
-
[
|
|
11922
|
+
[Qe, el],
|
|
11917
11923
|
[St, tl],
|
|
11918
11924
|
[Fe, nl],
|
|
11919
11925
|
[Oe, rl],
|
|
@@ -13017,7 +13023,7 @@ var _l = new Float32Array(3), vl = {
|
|
|
13017
13023
|
this._savedTimeScale = e, this.mixer && this.isPlaying && (this.mixer.timeScale = e);
|
|
13018
13024
|
}
|
|
13019
13025
|
setLoop(e) {
|
|
13020
|
-
let t = e ?
|
|
13026
|
+
let t = e ? tt : et;
|
|
13021
13027
|
for (let n of this.actions) n.setLoop(t), n.clampWhenFinished = !e;
|
|
13022
13028
|
}
|
|
13023
13029
|
seekTo(e, t = 0) {
|
|
@@ -13071,7 +13077,7 @@ var _l = new Float32Array(3), vl = {
|
|
|
13071
13077
|
}
|
|
13072
13078
|
}, kl = class {
|
|
13073
13079
|
constructor({ camera: e, canvas: t, orbitControls: n, app: r }) {
|
|
13074
|
-
this._app = r, this._orbitControls = n, this._camera = e, this._controls = new Yt(e, t), this._gizmoScene = new Tt(), this._gizmoScene.add(this._controls.getHelper()), this._attached = null, this._isDragging = !1, this._meshes = null, this._meshTriRanges = null, this._posBuffer = null, this._normalBuffer = null, this._skinnedCache = null, this._normalCache = null, this._tempVec = new Pt(), this._normalMatrix = new
|
|
13080
|
+
this._app = r, this._orbitControls = n, this._camera = e, this._controls = new Yt(e, t), this._gizmoScene = new Tt(), this._gizmoScene.add(this._controls.getHelper()), this._attached = null, this._isDragging = !1, this._meshes = null, this._meshTriRanges = null, this._posBuffer = null, this._normalBuffer = null, this._skinnedCache = null, this._normalCache = null, this._tempVec = new Pt(), this._normalMatrix = new rt(), this._refitInFlight = !1, this._baselineComputed = !1, this._onDraggingChanged = this._onDraggingChanged.bind(this), this._onObjectChange = this._onObjectChange.bind(this), this._controls.addEventListener("dragging-changed", this._onDraggingChanged), this._controls.addEventListener("objectChange", this._onObjectChange);
|
|
13075
13081
|
}
|
|
13076
13082
|
setMeshData(e, t) {
|
|
13077
13083
|
this._meshes = e, this._meshTriRanges = [], this._skinnedCache = [], this._normalCache = [];
|