@takram/three-geospatial 0.5.0 → 0.6.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/CHANGELOG.md +14 -0
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.js +359 -373
- package/build/index.js.map +1 -1
- package/build/r3f.cjs.map +1 -1
- package/build/r3f.js.map +1 -1
- package/build/shaders.cjs.map +1 -1
- package/build/shaders.js.map +1 -1
- package/build/shared.cjs.map +1 -1
- package/build/shared.js.map +1 -1
- package/build/shared2.cjs +1 -1
- package/build/shared2.cjs.map +1 -1
- package/build/shared2.js +55 -61
- package/build/shared2.js.map +1 -1
- package/build/shared3.cjs.map +1 -1
- package/build/shared3.js.map +1 -1
- package/build/webgpu.cjs +1 -1
- package/build/webgpu.cjs.map +1 -1
- package/build/webgpu.js +511 -630
- package/build/webgpu.js.map +1 -1
- package/package.json +1 -2
- package/src/EXR3DTextureLoader.ts +1 -1
- package/src/EXRTextureLoader.ts +1 -1
- package/src/webgpu/DownsampleThresholdNode.ts +3 -4
- package/src/webgpu/DualMipmapFilterNode.ts +1 -1
- package/src/webgpu/FnLayout.ts +5 -5
- package/src/webgpu/GaussianBlurNode.ts +3 -3
- package/src/webgpu/HighpVelocityNode.ts +8 -4
- package/src/webgpu/KawaseBlurNode.ts +3 -3
- package/src/webgpu/LensFlareNode.ts +10 -19
- package/src/webgpu/LensGlareNode.ts +8 -11
- package/src/webgpu/MipmapBlurNode.ts +7 -7
- package/src/webgpu/MipmapSurfaceBlurNode.ts +5 -6
- package/src/webgpu/OutputTexture3DNode.ts +1 -5
- package/src/webgpu/OutputTextureNode.ts +1 -4
- package/src/webgpu/RTTextureNode.ts +6 -8
- package/src/webgpu/TemporalAntialiasNode.ts +20 -23
- package/src/webgpu/accessors.ts +8 -10
- package/src/webgpu/generators.ts +7 -9
- package/src/webgpu/math.ts +13 -13
- package/src/webgpu/node.ts +3 -6
- package/src/webgpu/sampling.ts +3 -51
- package/src/webgpu/transformations.ts +30 -35
- package/src/webgpu/utils.ts +9 -9
- package/types/webgpu/DownsampleThresholdNode.d.ts +4 -4
- package/types/webgpu/DualMipmapFilterNode.d.ts +2 -2
- package/types/webgpu/FnLayout.d.ts +3 -3
- package/types/webgpu/GaussianBlurNode.d.ts +2 -2
- package/types/webgpu/HighpVelocityNode.d.ts +2 -3
- package/types/webgpu/KawaseBlurNode.d.ts +2 -2
- package/types/webgpu/LensFlareNode.d.ts +4 -4
- package/types/webgpu/LensGhostNode.d.ts +1 -1
- package/types/webgpu/LensGlareNode.d.ts +5 -5
- package/types/webgpu/LensHaloNode.d.ts +2 -2
- package/types/webgpu/MipmapBlurNode.d.ts +4 -4
- package/types/webgpu/MipmapSurfaceBlurNode.d.ts +3 -3
- package/types/webgpu/OutputTexture3DNode.d.ts +1 -2
- package/types/webgpu/OutputTextureNode.d.ts +1 -2
- package/types/webgpu/RTTextureNode.d.ts +2 -3
- package/types/webgpu/SeparableFilterNode.d.ts +2 -2
- package/types/webgpu/SingleFilterNode.d.ts +1 -1
- package/types/webgpu/TemporalAntialiasNode.d.ts +6 -6
- package/types/webgpu/accessors.d.ts +8 -8
- package/types/webgpu/generators.d.ts +4 -4
- package/types/webgpu/node.d.ts +4 -5
- package/types/webgpu/sampling.d.ts +0 -1
- package/types/webgpu/transformations.d.ts +8 -8
- package/types/webgpu/utils.d.ts +1 -2
package/build/webgpu.js
CHANGED
|
@@ -1,86 +1,85 @@
|
|
|
1
|
-
import { Vector3 as
|
|
2
|
-
import { reference as $, uniform as
|
|
3
|
-
import { NodeMaterial as
|
|
4
|
-
import { Q as
|
|
5
|
-
import { i as
|
|
6
|
-
import { hash as
|
|
7
|
-
let
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
let s =
|
|
11
|
-
return s == null && (s = {},
|
|
1
|
+
import { Vector3 as qe, Mesh as J, Scene as Ze, Camera as Qe, RenderTarget as Ne, RGBAFormat as Me, HalfFloatType as Re, LinearFilter as Z, Vector2 as V, Matrix4 as W, AdditiveBlending as Ke, PlaneGeometry as Je, PerspectiveCamera as Ye, SRGBColorSpace as _e, CanvasTexture as Xe, DepthTexture as et } from "three";
|
|
2
|
+
import { reference as $, uniform as v, vec4 as w, positionGeometry as be, texture as I, uv as B, vec2 as p, add as S, luminance as tt, smoothstep as Ve, Fn as C, screenCoordinate as ze, time as st, vec3 as y, equirectUV as ot, fwidth as rt, abs as Be, nodeImmutable as nt, positionLocal as it, positionPrevious as at, sub as k, instancedArray as ue, struct as oe, storage as ut, uvec2 as Ce, If as F, globalId as X, Return as lt, atomicAdd as ct, instanceIndex as ht, mat3 as Pe, min as dt, mul as pt, fract as mt, distance as gt, mix as te, dot as Q, sqrt as Y, color as xt, mat4 as ft, mat2 as vt, bvec4 as yt, uvec4 as wt, ivec4 as Tt, bvec3 as St, uvec3 as Nt, ivec3 as Mt, bvec2 as Rt, ivec2 as T, bool as bt, uint as Vt, int as H, float as re, textureSize as Ae, logarithmicDepthToViewZ as Fe, perspectiveDepthToViewZ as De, orthographicDepthToViewZ as zt, viewZToPerspectiveDepth as Bt, viewZToLogarithmicDepth as je, PI2 as Ct, PI as Pt, cos as le, sin as ce, screenUV as At, step as Ft, and as Dt, screenSize as jt, max as Ue, select as Ut } from "three/tsl";
|
|
3
|
+
import { NodeMaterial as P, TextureNode as se, TempNode as E, NodeUpdateType as A, RendererUtils as O, QuadMesh as q, Vector2 as It, RenderTarget as kt, RGBAFormat as $t, HalfFloatType as Et, LinearFilter as he, StorageBufferAttribute as Ot, MeshBasicNodeMaterial as Gt, NodeBuilder as Lt, Node as Wt, Texture3DNode as Ht } from "three/webgpu";
|
|
4
|
+
import { Q as ne } from "./shared3.js";
|
|
5
|
+
import { i as f } from "./shared.js";
|
|
6
|
+
import { hash as Ie } from "three/src/nodes/core/NodeUtils.js";
|
|
7
|
+
let ee;
|
|
8
|
+
function D(o, e, t) {
|
|
9
|
+
ee ??= /* @__PURE__ */ new WeakMap();
|
|
10
|
+
let s = ee.get(o);
|
|
11
|
+
return s == null && (s = {}, ee.set(o, s)), s[e] ??= t();
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const Os = (o) => D(
|
|
14
14
|
o,
|
|
15
15
|
"projectionMatrix",
|
|
16
16
|
() => $("projectionMatrix", "mat4", o).setName("projectionMatrix")
|
|
17
|
-
),
|
|
17
|
+
), Gs = (o) => D(
|
|
18
18
|
o,
|
|
19
19
|
"viewMatrix",
|
|
20
20
|
() => $("matrixWorldInverse", "mat4", o).setName("viewMatrix")
|
|
21
|
-
),
|
|
21
|
+
), Ls = (o) => D(
|
|
22
22
|
o,
|
|
23
23
|
"inverseProjectionMatrix",
|
|
24
24
|
() => $("projectionMatrixInverse", "mat4", o).setName(
|
|
25
25
|
"inverseProjectionMatrix"
|
|
26
26
|
)
|
|
27
|
-
),
|
|
27
|
+
), Ws = (o) => D(
|
|
28
28
|
o,
|
|
29
29
|
"inverseViewMatrix",
|
|
30
30
|
() => $("matrixWorld", "mat4", o).setName("inverseViewMatrix")
|
|
31
|
-
),
|
|
31
|
+
), Hs = (o) => D(
|
|
32
32
|
o,
|
|
33
33
|
"cameraPositionWorld",
|
|
34
|
-
() =>
|
|
34
|
+
() => v(new qe()).setName("cameraPositionWorld").onRenderUpdate((e, { value: t }) => {
|
|
35
35
|
t.setFromMatrixPosition(o.matrixWorld);
|
|
36
36
|
})
|
|
37
|
-
),
|
|
37
|
+
), de = (o) => D(
|
|
38
38
|
o,
|
|
39
39
|
"cameraNear",
|
|
40
40
|
() => $("near", "float", o).setName("cameraNear")
|
|
41
|
-
),
|
|
41
|
+
), pe = (o) => D(
|
|
42
42
|
o,
|
|
43
43
|
"cameraFar",
|
|
44
44
|
() => $("far", "float", o).setName("cameraFar")
|
|
45
45
|
);
|
|
46
|
-
async function
|
|
47
|
-
return await o.debug.getShaderAsync(new
|
|
46
|
+
async function ie(o, e) {
|
|
47
|
+
return await o.debug.getShaderAsync(new Ze(), new Qe(), e).then((t) => t).catch((t) => (console.error(t), { fragmentShader: null, vertexShader: null }));
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const t = new
|
|
51
|
-
|
|
49
|
+
function qs(o, e) {
|
|
50
|
+
const t = new J(new ne(), e);
|
|
51
|
+
ie(o, t).then((s) => {
|
|
52
52
|
console.log(s.fragmentShader);
|
|
53
53
|
}).finally(() => {
|
|
54
54
|
t.geometry.dispose();
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const t = new
|
|
59
|
-
|
|
57
|
+
function Zs(o, e) {
|
|
58
|
+
const t = new J(new ne(), e);
|
|
59
|
+
ie(o, t).then((s) => {
|
|
60
60
|
console.log(s.vertexShader);
|
|
61
61
|
}).finally(() => {
|
|
62
62
|
t.geometry.dispose();
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
const t = new
|
|
67
|
-
t.vertexNode =
|
|
68
|
-
const s = new
|
|
69
|
-
|
|
65
|
+
function Qs(o, e) {
|
|
66
|
+
const t = new P();
|
|
67
|
+
t.vertexNode = w(be.xy, 0, 1), t.fragmentNode = e;
|
|
68
|
+
const s = new J(new ne(), t);
|
|
69
|
+
ie(o, s).then((r) => {
|
|
70
70
|
console.log(r.fragmentShader);
|
|
71
71
|
}).finally(() => {
|
|
72
72
|
t.dispose(), s.geometry.dispose();
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Ks(o, e, t) {
|
|
76
76
|
const s = o[e];
|
|
77
77
|
return o[e] = ((...r) => (t(...r), s.apply(o, r))), o;
|
|
78
78
|
}
|
|
79
|
-
class qt extends
|
|
79
|
+
class qt extends se {
|
|
80
80
|
static get type() {
|
|
81
81
|
return "OutputTextureNode";
|
|
82
82
|
}
|
|
83
|
-
owner;
|
|
84
83
|
constructor(e, t) {
|
|
85
84
|
super(t), this.owner = e, this.setUpdateMatrix(!1);
|
|
86
85
|
}
|
|
@@ -91,30 +90,26 @@ class qt extends oe {
|
|
|
91
90
|
return new this.constructor(this.owner, this.value);
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
|
-
const
|
|
95
|
-
class
|
|
93
|
+
const ke = (...o) => new qt(...o);
|
|
94
|
+
class _ extends E {
|
|
95
|
+
constructor(e) {
|
|
96
|
+
super("vec4"), this.resolutionScale = 1, this.renderTargets = [], this.inputNode = e, this.updateBeforeType = A.FRAME;
|
|
97
|
+
}
|
|
96
98
|
static get type() {
|
|
97
99
|
return "FilterNode";
|
|
98
100
|
}
|
|
99
|
-
inputNode;
|
|
100
|
-
resolutionScale = 1;
|
|
101
|
-
textureNode;
|
|
102
|
-
renderTargets = [];
|
|
103
|
-
constructor(e) {
|
|
104
|
-
super("vec4"), this.inputNode = e, this.updateBeforeType = U.FRAME;
|
|
105
|
-
}
|
|
106
101
|
createRenderTarget(e) {
|
|
107
|
-
const t = new
|
|
102
|
+
const t = new Ne(1, 1, {
|
|
108
103
|
depthBuffer: !1,
|
|
109
104
|
type: Re,
|
|
110
|
-
format:
|
|
105
|
+
format: Me
|
|
111
106
|
}), s = t.texture;
|
|
112
|
-
s.minFilter =
|
|
107
|
+
s.minFilter = Z, s.magFilter = Z, s.generateMipmaps = !1;
|
|
113
108
|
const r = this.constructor.type;
|
|
114
109
|
return s.name = e != null ? `${r}.${e}` : r, this.renderTargets.push(t), t;
|
|
115
110
|
}
|
|
116
111
|
getTextureNode() {
|
|
117
|
-
return
|
|
112
|
+
return f(
|
|
118
113
|
this.textureNode != null,
|
|
119
114
|
"outputTexture must be specified before getTextureNode() is called."
|
|
120
115
|
), this.textureNode;
|
|
@@ -123,14 +118,14 @@ class X extends G {
|
|
|
123
118
|
return this.textureNode?.value ?? null;
|
|
124
119
|
}
|
|
125
120
|
set outputTexture(e) {
|
|
126
|
-
this.textureNode = e != null ?
|
|
121
|
+
this.textureNode = e != null ? ke(this, e) : void 0;
|
|
127
122
|
}
|
|
128
123
|
setup(e) {
|
|
129
124
|
const { inputNode: t, textureNode: s } = this;
|
|
130
|
-
return
|
|
125
|
+
return f(
|
|
131
126
|
t != null,
|
|
132
127
|
"inputNode must be specified before being setup."
|
|
133
|
-
),
|
|
128
|
+
), f(
|
|
134
129
|
s != null,
|
|
135
130
|
"outputTexture must be specified before being setup."
|
|
136
131
|
), s.uvNode = t.uvNode, s;
|
|
@@ -141,18 +136,10 @@ class X extends G {
|
|
|
141
136
|
super.dispose();
|
|
142
137
|
}
|
|
143
138
|
}
|
|
144
|
-
const { resetRendererState: Zt, restoreRendererState: Qt } =
|
|
145
|
-
class
|
|
146
|
-
downsampleRTs = [];
|
|
147
|
-
upsampleRTs = [];
|
|
148
|
-
downsampleMaterial = new j();
|
|
149
|
-
upsampleMaterial = new j();
|
|
150
|
-
mesh = new Z();
|
|
151
|
-
rendererState;
|
|
152
|
-
inputTexelSize = y(new B());
|
|
153
|
-
downsampleNode = q(null);
|
|
139
|
+
const { resetRendererState: Zt, restoreRendererState: Qt } = O;
|
|
140
|
+
class ae extends _ {
|
|
154
141
|
constructor(e, t) {
|
|
155
|
-
super(e);
|
|
142
|
+
super(e), this.downsampleRTs = [], this.upsampleRTs = [], this.downsampleMaterial = new P(), this.upsampleMaterial = new P(), this.mesh = new q(), this.inputTexelSize = v(new V()), this.downsampleNode = I();
|
|
156
143
|
for (let s = 0; s < t; ++s)
|
|
157
144
|
this.downsampleRTs[s] = this.createRenderTarget(`Downsample${s}`), s < t - 1 && (this.upsampleRTs[s] = this.createRenderTarget(`Upsample${s}`));
|
|
158
145
|
this.outputTexture = this.upsampleRTs[0].texture;
|
|
@@ -176,25 +163,25 @@ class ue extends X {
|
|
|
176
163
|
inputTexelSize: i,
|
|
177
164
|
downsampleNode: u
|
|
178
165
|
} = this;
|
|
179
|
-
|
|
180
|
-
const { width: a, height:
|
|
181
|
-
this.setSize(a,
|
|
182
|
-
const
|
|
166
|
+
f(n != null);
|
|
167
|
+
const { width: a, height: h } = n.value;
|
|
168
|
+
this.setSize(a, h);
|
|
169
|
+
const c = n.value;
|
|
183
170
|
this.rendererState = Zt(e, this.rendererState), r.material = this.downsampleMaterial;
|
|
184
|
-
for (const
|
|
185
|
-
const { width:
|
|
186
|
-
i.value.set(1 /
|
|
171
|
+
for (const l of t) {
|
|
172
|
+
const { width: d, height: m } = n.value;
|
|
173
|
+
i.value.set(1 / d, 1 / m), e.setRenderTarget(l), r.render(e), n.value = l.texture;
|
|
187
174
|
}
|
|
188
175
|
r.material = this.upsampleMaterial;
|
|
189
|
-
for (let
|
|
190
|
-
const
|
|
191
|
-
i.value.set(1 / m, 1 / g), u.value = t[
|
|
176
|
+
for (let l = s.length - 1; l >= 0; --l) {
|
|
177
|
+
const d = s[l], { width: m, height: g } = n.value;
|
|
178
|
+
i.value.set(1 / m, 1 / g), u.value = t[l].texture, e.setRenderTarget(d), r.render(e), n.value = d.texture;
|
|
192
179
|
}
|
|
193
|
-
Qt(e, this.rendererState), n.value =
|
|
180
|
+
Qt(e, this.rendererState), n.value = c;
|
|
194
181
|
}
|
|
195
182
|
setup(e) {
|
|
196
183
|
const { inputNode: t } = this;
|
|
197
|
-
|
|
184
|
+
f(t != null);
|
|
198
185
|
const { downsampleMaterial: s, upsampleMaterial: r } = this;
|
|
199
186
|
return s.fragmentNode = this.setupDownsampleNode(e), r.fragmentNode = this.setupUpsampleNode(e), s.needsUpdate = !0, r.needsUpdate = !0, super.setup(e);
|
|
200
187
|
}
|
|
@@ -206,48 +193,48 @@ class ue extends X {
|
|
|
206
193
|
this.downsampleMaterial.dispose(), this.upsampleMaterial.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
207
194
|
}
|
|
208
195
|
}
|
|
209
|
-
const
|
|
210
|
-
const t =
|
|
211
|
-
return
|
|
212
|
-
|
|
196
|
+
const $e = (o, e) => {
|
|
197
|
+
const t = B(), s = w(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy), r = w(2, 2, -2, -2).mul(e.xyxy).add(t.xyxy), n = s.zy.toVertexStage(), i = s.xy.toVertexStage(), u = s.zw.toVertexStage(), a = s.xw.toVertexStage(), h = p(t.x, r.y).toVertexStage(), c = p(r.z, t.y).toVertexStage(), l = p(r.x, t.y).toVertexStage(), d = p(t.x, r.w).toVertexStage(), m = r.zy.toVertexStage(), g = r.xy.toVertexStage(), x = r.zw.toVertexStage(), R = r.xw.toVertexStage();
|
|
198
|
+
return S(
|
|
199
|
+
S(
|
|
213
200
|
o.sample(t),
|
|
214
201
|
o.sample(n),
|
|
215
202
|
o.sample(i),
|
|
216
203
|
o.sample(u),
|
|
217
204
|
o.sample(a)
|
|
218
205
|
).mul(1 / 8),
|
|
219
|
-
|
|
220
|
-
o.sample(
|
|
221
|
-
o.sample(l),
|
|
206
|
+
S(
|
|
207
|
+
o.sample(h),
|
|
222
208
|
o.sample(c),
|
|
223
|
-
o.sample(
|
|
209
|
+
o.sample(l),
|
|
210
|
+
o.sample(d)
|
|
224
211
|
).mul(1 / 16),
|
|
225
|
-
|
|
212
|
+
S(
|
|
226
213
|
o.sample(m),
|
|
227
214
|
o.sample(g),
|
|
228
215
|
o.sample(x),
|
|
229
|
-
o.sample(
|
|
216
|
+
o.sample(R)
|
|
230
217
|
).mul(1 / 32)
|
|
231
218
|
);
|
|
232
219
|
}, Kt = (o, e) => {
|
|
233
|
-
const t =
|
|
234
|
-
return
|
|
220
|
+
const t = B(), s = w(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy), r = p(t.x, s.y).toVertexStage(), n = p(s.z, t.y).toVertexStage(), i = p(s.x, t.y).toVertexStage(), u = p(t.x, s.w).toVertexStage(), a = s.zy.toVertexStage(), h = s.xy.toVertexStage(), c = s.zw.toVertexStage(), l = s.xw.toVertexStage();
|
|
221
|
+
return S(
|
|
235
222
|
o.sample(t).mul(0.25),
|
|
236
|
-
|
|
223
|
+
S(
|
|
237
224
|
o.sample(r),
|
|
238
225
|
o.sample(n),
|
|
239
226
|
o.sample(i),
|
|
240
227
|
o.sample(u)
|
|
241
228
|
).mul(0.125),
|
|
242
|
-
|
|
229
|
+
S(
|
|
243
230
|
o.sample(a),
|
|
244
|
-
o.sample(
|
|
245
|
-
o.sample(
|
|
246
|
-
o.sample(
|
|
231
|
+
o.sample(h),
|
|
232
|
+
o.sample(c),
|
|
233
|
+
o.sample(l)
|
|
247
234
|
).mul(0.0625)
|
|
248
235
|
);
|
|
249
236
|
};
|
|
250
|
-
class Jt extends
|
|
237
|
+
class Jt extends ae {
|
|
251
238
|
static get type() {
|
|
252
239
|
return "MipmapBlurNode";
|
|
253
240
|
}
|
|
@@ -255,21 +242,16 @@ class Jt extends ue {
|
|
|
255
242
|
super(e, t), this.resolutionScale = 0.5;
|
|
256
243
|
}
|
|
257
244
|
setupDownsampleNode(e) {
|
|
258
|
-
return
|
|
245
|
+
return f(this.inputNode != null), $e(this.inputNode, this.inputTexelSize);
|
|
259
246
|
}
|
|
260
247
|
setupUpsampleNode(e) {
|
|
261
|
-
return
|
|
248
|
+
return f(this.inputNode != null), Kt(this.inputNode, this.inputTexelSize);
|
|
262
249
|
}
|
|
263
250
|
}
|
|
264
|
-
const
|
|
265
|
-
class Xt extends
|
|
266
|
-
renderTarget;
|
|
267
|
-
material = new j();
|
|
268
|
-
mesh = new Z(this.material);
|
|
269
|
-
rendererState;
|
|
270
|
-
inputTexelSize = y(new B());
|
|
251
|
+
const Js = (...o) => new Jt(...o), { resetRendererState: Yt, restoreRendererState: _t } = O;
|
|
252
|
+
class Xt extends _ {
|
|
271
253
|
constructor(e) {
|
|
272
|
-
super(e), this.renderTarget = this.createRenderTarget(), this.outputTexture = this.renderTarget.texture;
|
|
254
|
+
super(e), this.material = new P(), this.mesh = new q(this.material), this.inputTexelSize = v(new V()), this.renderTarget = this.createRenderTarget(), this.outputTexture = this.renderTarget.texture;
|
|
273
255
|
}
|
|
274
256
|
setSize(e, t) {
|
|
275
257
|
const { resolutionScale: s } = this, r = Math.max(Math.round(e * s), 1), n = Math.max(Math.round(t * s), 1);
|
|
@@ -279,13 +261,13 @@ class Xt extends X {
|
|
|
279
261
|
if (e == null)
|
|
280
262
|
return;
|
|
281
263
|
const { inputNode: t } = this;
|
|
282
|
-
|
|
264
|
+
f(t != null);
|
|
283
265
|
const { width: s, height: r } = t.value;
|
|
284
266
|
this.setSize(s, r), this.inputTexelSize.value.set(1 / s, 1 / r), this.rendererState = Yt(e, this.rendererState), e.setRenderTarget(this.renderTarget), this.mesh.render(e), _t(e, this.rendererState);
|
|
285
267
|
}
|
|
286
268
|
setup(e) {
|
|
287
269
|
const { inputNode: t } = this;
|
|
288
|
-
|
|
270
|
+
f(t != null);
|
|
289
271
|
const { material: s } = this;
|
|
290
272
|
return s.fragmentNode = this.setupOutputNode(e), s.needsUpdate = !0, super.setup(e);
|
|
291
273
|
}
|
|
@@ -293,65 +275,55 @@ class Xt extends X {
|
|
|
293
275
|
this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
294
276
|
}
|
|
295
277
|
}
|
|
296
|
-
class
|
|
278
|
+
class Ee extends Xt {
|
|
279
|
+
constructor(e) {
|
|
280
|
+
super(e), this.thresholdLevel = v(5), this.thresholdRange = v(1), this.resolutionScale = 0.5;
|
|
281
|
+
}
|
|
297
282
|
static get type() {
|
|
298
283
|
return "DownsampleThresholdNode";
|
|
299
284
|
}
|
|
300
|
-
thresholdLevel = y(5);
|
|
301
|
-
thresholdRange = y(1);
|
|
302
|
-
constructor(e) {
|
|
303
|
-
super(e), this.resolutionScale = 0.5;
|
|
304
|
-
}
|
|
305
285
|
setupOutputNode() {
|
|
306
286
|
const { inputNode: e, thresholdLevel: t, thresholdRange: s, inputTexelSize: r } = this;
|
|
307
|
-
|
|
308
|
-
const n =
|
|
287
|
+
f(e != null);
|
|
288
|
+
const n = $e(e, r), i = tt(n.rgb), u = Ve(
|
|
309
289
|
t,
|
|
310
290
|
t.add(s),
|
|
311
291
|
i
|
|
312
292
|
);
|
|
313
|
-
return
|
|
293
|
+
return w(n.rgb, i).mul(u);
|
|
314
294
|
}
|
|
315
295
|
}
|
|
316
|
-
const
|
|
317
|
-
function
|
|
296
|
+
const Ys = (...o) => new Ee(...o);
|
|
297
|
+
function me(o) {
|
|
318
298
|
if (typeof o == "string")
|
|
319
299
|
return o;
|
|
320
300
|
if (o.layout.name == null)
|
|
321
301
|
throw new Error("Struct name is required.");
|
|
322
302
|
return o.layout.name;
|
|
323
303
|
}
|
|
324
|
-
function
|
|
304
|
+
function K({
|
|
325
305
|
typeOnly: o = !1,
|
|
326
306
|
...e
|
|
327
307
|
}) {
|
|
328
|
-
return o ? (t) =>
|
|
308
|
+
return o ? (t) => C(t) : (t) => C(t).setLayout({
|
|
329
309
|
...e,
|
|
330
|
-
type:
|
|
310
|
+
type: me(e.type),
|
|
331
311
|
inputs: e.inputs?.map((s) => ({
|
|
332
312
|
...s,
|
|
333
|
-
type:
|
|
313
|
+
type: me(s.type)
|
|
334
314
|
})) ?? []
|
|
335
315
|
});
|
|
336
316
|
}
|
|
337
|
-
function
|
|
338
|
-
return
|
|
317
|
+
function G(o) {
|
|
318
|
+
return C((e, t) => {
|
|
339
319
|
const s = o(...e);
|
|
340
320
|
return typeof s == "function" ? s(t) : s;
|
|
341
321
|
});
|
|
342
322
|
}
|
|
343
|
-
const { resetRendererState: es, restoreRendererState: ts } =
|
|
344
|
-
class ss extends
|
|
345
|
-
iterations = 1;
|
|
346
|
-
horizontalRT;
|
|
347
|
-
verticalRT;
|
|
348
|
-
material = new j();
|
|
349
|
-
mesh = new Z(this.material);
|
|
350
|
-
rendererState;
|
|
351
|
-
inputTexelSize = y(new B());
|
|
352
|
-
direction = y(new B());
|
|
323
|
+
const { resetRendererState: es, restoreRendererState: ts } = O;
|
|
324
|
+
class ss extends _ {
|
|
353
325
|
constructor(e) {
|
|
354
|
-
super(e), this.horizontalRT = this.createRenderTarget("Horizontal"), this.verticalRT = this.createRenderTarget("Vertical"), this.outputTexture = this.verticalRT.texture;
|
|
326
|
+
super(e), this.iterations = 1, this.material = new P(), this.mesh = new q(this.material), this.inputTexelSize = v(new V()), this.direction = v(new V()), this.horizontalRT = this.createRenderTarget("Horizontal"), this.verticalRT = this.createRenderTarget("Vertical"), this.outputTexture = this.verticalRT.texture;
|
|
355
327
|
}
|
|
356
328
|
setSize(e, t) {
|
|
357
329
|
const { resolutionScale: s } = this, r = Math.max(Math.round(e * s), 1), n = Math.max(Math.round(t * s), 1);
|
|
@@ -361,18 +333,18 @@ class ss extends X {
|
|
|
361
333
|
if (e == null)
|
|
362
334
|
return;
|
|
363
335
|
const { horizontalRT: t, verticalRT: s, mesh: r, inputNode: n, direction: i } = this;
|
|
364
|
-
|
|
336
|
+
f(n != null);
|
|
365
337
|
const { width: u, height: a } = n.value;
|
|
366
338
|
this.setSize(u, a), this.inputTexelSize.value.set(1 / u, 1 / a);
|
|
367
|
-
const
|
|
339
|
+
const h = n.value;
|
|
368
340
|
this.rendererState = es(e, this.rendererState);
|
|
369
|
-
for (let
|
|
341
|
+
for (let c = 0; c < this.iterations; ++c)
|
|
370
342
|
i.value.set(1, 0), e.setRenderTarget(t), r.render(e), n.value = t.texture, i.value.set(0, 1), e.setRenderTarget(s), r.render(e), n.value = s.texture;
|
|
371
|
-
ts(e, this.rendererState), n.value =
|
|
343
|
+
ts(e, this.rendererState), n.value = h;
|
|
372
344
|
}
|
|
373
345
|
setup(e) {
|
|
374
346
|
const { inputNode: t } = this;
|
|
375
|
-
|
|
347
|
+
f(t != null);
|
|
376
348
|
const { material: s } = this;
|
|
377
349
|
return s.fragmentNode = this.setupOutputNode(e), s.needsUpdate = !0, super.setup(e);
|
|
378
350
|
}
|
|
@@ -380,8 +352,8 @@ class ss extends X {
|
|
|
380
352
|
this.horizontalRT.dispose(), this.verticalRT.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
381
353
|
}
|
|
382
354
|
}
|
|
383
|
-
function
|
|
384
|
-
if (
|
|
355
|
+
function ge(o) {
|
|
356
|
+
if (f(o >= 0), o === 0)
|
|
385
357
|
return new Float64Array(0);
|
|
386
358
|
if (o === 1)
|
|
387
359
|
return new Float64Array([1]);
|
|
@@ -394,71 +366,64 @@ function xe(o) {
|
|
|
394
366
|
return s;
|
|
395
367
|
}
|
|
396
368
|
function os(o, e = 2) {
|
|
397
|
-
|
|
398
|
-
const t = o + e * 2, s = e > 0 ?
|
|
369
|
+
f(o >= 3);
|
|
370
|
+
const t = o + e * 2, s = e > 0 ? ge(t).slice(e, -e) : ge(t), r = Math.floor((s.length - 1) / 2), n = s.reduce((l, d) => l + d, 0), i = s.slice(r), u = [...Array(r + 1).keys()], a = new Float64Array(Math.floor(u.length / 2)), h = new Float64Array(a.length);
|
|
399
371
|
a[0] = i[0] / n;
|
|
400
|
-
for (let
|
|
401
|
-
const m = u[
|
|
402
|
-
a[
|
|
372
|
+
for (let l = 1, d = 1; l < u.length - 1; l += 2, ++d) {
|
|
373
|
+
const m = u[l], g = u[l + 1], x = i[l], R = i[l + 1], N = x + R, z = (m * x + g * R) / N;
|
|
374
|
+
a[d] = N / n, h[d] = z;
|
|
403
375
|
}
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
const
|
|
407
|
-
for (let
|
|
408
|
-
a[
|
|
376
|
+
const c = (a.reduce((l, d) => l + d, 0) - a[0] * 0.5) * 2;
|
|
377
|
+
if (c !== 0) {
|
|
378
|
+
const l = 1 / c;
|
|
379
|
+
for (let d = 0; d < a.length; ++d)
|
|
380
|
+
a[d] *= l;
|
|
409
381
|
}
|
|
410
382
|
return {
|
|
411
|
-
offsets:
|
|
383
|
+
offsets: h,
|
|
412
384
|
weights: a
|
|
413
385
|
};
|
|
414
386
|
}
|
|
415
|
-
class
|
|
387
|
+
class Oe extends ss {
|
|
416
388
|
static get type() {
|
|
417
389
|
return "GaussianBlurNode";
|
|
418
390
|
}
|
|
419
|
-
kernelSize;
|
|
420
391
|
constructor(e, t = 35) {
|
|
421
392
|
super(e), this.kernelSize = t;
|
|
422
393
|
}
|
|
423
394
|
setupOutputNode(e) {
|
|
424
395
|
const { inputNode: t, inputTexelSize: s, direction: r } = this;
|
|
425
|
-
|
|
396
|
+
f(t != null);
|
|
426
397
|
const { offsets: n, weights: i } = os(this.kernelSize);
|
|
427
|
-
return
|
|
428
|
-
const u =
|
|
429
|
-
for (let
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
t.sample(u.add(
|
|
434
|
-
t.sample(u.sub(
|
|
435
|
-
).mul(i[
|
|
398
|
+
return C(() => {
|
|
399
|
+
const u = B(), a = r.mul(s).toVertexStage(), h = t.sample(u).mul(i[0]);
|
|
400
|
+
for (let c = 1; c < n.length; ++c) {
|
|
401
|
+
const l = a.mul(n[c]);
|
|
402
|
+
h.addAssign(
|
|
403
|
+
S(
|
|
404
|
+
t.sample(u.add(l)),
|
|
405
|
+
t.sample(u.sub(l))
|
|
406
|
+
).mul(i[c])
|
|
436
407
|
);
|
|
437
408
|
}
|
|
438
|
-
return
|
|
409
|
+
return h;
|
|
439
410
|
})();
|
|
440
411
|
}
|
|
441
412
|
}
|
|
442
|
-
const
|
|
443
|
-
const o =
|
|
444
|
-
return
|
|
445
|
-
}).once()(),
|
|
446
|
-
const s =
|
|
413
|
+
const _s = (...o) => new Oe(...o), rs = (o) => o.dot(p(0.06711056, 583715e-8)).fract().mul(52.9829189).fract(), Xs = /* @__PURE__ */ C(() => {
|
|
414
|
+
const o = p(ze.xy).add(st.fract().mul(1337)), e = rs(o);
|
|
415
|
+
return y(e, e.oneMinus(), e).sub(0.5).div(255);
|
|
416
|
+
}).once()(), eo = (o, e, t = p(90, 45)) => {
|
|
417
|
+
const s = ot(o), r = rt(s), n = e.mul(r).mul(0.5), i = Be(s.mul(t).fract().sub(0.5)).div(t), u = Ve(n, n.add(r), i).oneMinus();
|
|
447
418
|
return u.x.add(u.y).clamp(0, 1);
|
|
448
419
|
};
|
|
449
|
-
class ns extends
|
|
420
|
+
class ns extends E {
|
|
421
|
+
constructor() {
|
|
422
|
+
super("vec3"), this.currentProjectionMatrix = v(new W()), this.previousProjectionMatrix = v("mat4"), this.currentModelViewMatrix = v(new W()), this.previousModelViewMatrix = v("mat4"), this.objectModelViewMatrices = /* @__PURE__ */ new WeakMap(), this.updateType = A.FRAME, this.updateBeforeType = A.OBJECT, this.updateAfterType = A.OBJECT;
|
|
423
|
+
}
|
|
450
424
|
static get type() {
|
|
451
425
|
return "HighpVelocityNode";
|
|
452
426
|
}
|
|
453
|
-
projectionMatrix;
|
|
454
|
-
currentProjectionMatrix = y(new W());
|
|
455
|
-
previousProjectionMatrix = y("mat4");
|
|
456
|
-
currentModelViewMatrix = y(new W());
|
|
457
|
-
previousModelViewMatrix = y("mat4");
|
|
458
|
-
objectModelViewMatrices = /* @__PURE__ */ new WeakMap();
|
|
459
|
-
constructor() {
|
|
460
|
-
super("vec3"), this.updateType = U.FRAME, this.updateBeforeType = U.OBJECT, this.updateAfterType = U.OBJECT;
|
|
461
|
-
}
|
|
462
427
|
// Executed once per frame:
|
|
463
428
|
update({ camera: e }) {
|
|
464
429
|
if (e == null)
|
|
@@ -495,12 +460,12 @@ class ns extends G {
|
|
|
495
460
|
r == null && (r = new W(), s.set(e, r)), r.copy(t.value);
|
|
496
461
|
}
|
|
497
462
|
setup(e) {
|
|
498
|
-
const t = this.currentProjectionMatrix.mul(this.currentModelViewMatrix).mul(
|
|
499
|
-
return
|
|
463
|
+
const t = this.currentProjectionMatrix.mul(this.currentModelViewMatrix).mul(it).toVertexStage(), s = this.previousProjectionMatrix.mul(this.previousModelViewMatrix).mul(at).toVertexStage(), r = t.xyz.div(t.w), n = s.xyz.div(s.w);
|
|
464
|
+
return k(r, n);
|
|
500
465
|
}
|
|
501
466
|
}
|
|
502
|
-
const
|
|
503
|
-
class is extends
|
|
467
|
+
const to = /* @__PURE__ */ nt(ns);
|
|
468
|
+
class is extends ae {
|
|
504
469
|
static get type() {
|
|
505
470
|
return "KawaseBlurNode";
|
|
506
471
|
}
|
|
@@ -509,50 +474,48 @@ class is extends ue {
|
|
|
509
474
|
}
|
|
510
475
|
setupDownsampleNode(e) {
|
|
511
476
|
const { inputNode: t, inputTexelSize: s } = this;
|
|
512
|
-
|
|
513
|
-
const r =
|
|
514
|
-
return
|
|
477
|
+
f(t != null);
|
|
478
|
+
const r = B(), n = w(1, 1, -1, -1).mul(s.xyxy.mul(0.5)).add(r.xyxy), i = n.zy.toVertexStage(), u = n.xy.toVertexStage(), a = n.xw.toVertexStage(), h = n.zw.toVertexStage();
|
|
479
|
+
return S(
|
|
515
480
|
t.sample(r).mul(4),
|
|
516
481
|
t.sample(i),
|
|
517
482
|
t.sample(u),
|
|
518
483
|
t.sample(a),
|
|
519
|
-
t.sample(
|
|
484
|
+
t.sample(h)
|
|
520
485
|
).mul(1 / 8);
|
|
521
486
|
}
|
|
522
487
|
setupUpsampleNode(e) {
|
|
523
488
|
const { inputNode: t, inputTexelSize: s } = this;
|
|
524
|
-
|
|
525
|
-
const r =
|
|
526
|
-
return
|
|
527
|
-
|
|
489
|
+
f(t != null);
|
|
490
|
+
const r = B(), n = w(1, 1, -1, -1).mul(s.xyxy.mul(0.5)).add(r.xyxy), i = n.zy.toVertexStage(), u = n.xy.toVertexStage(), a = n.xw.toVertexStage(), h = n.zw.toVertexStage(), c = p(n.z, r.y).toVertexStage(), l = p(n.x, r.y).toVertexStage(), d = p(r.x, n.y).toVertexStage(), m = p(r.x, n.w).toVertexStage();
|
|
491
|
+
return S(
|
|
492
|
+
S(
|
|
528
493
|
t.sample(i),
|
|
529
494
|
t.sample(u),
|
|
530
495
|
t.sample(a),
|
|
531
|
-
t.sample(
|
|
496
|
+
t.sample(h)
|
|
532
497
|
).mul(1 / 12),
|
|
533
|
-
|
|
534
|
-
t.sample(l),
|
|
498
|
+
S(
|
|
535
499
|
t.sample(c),
|
|
536
|
-
t.sample(
|
|
500
|
+
t.sample(l),
|
|
501
|
+
t.sample(d),
|
|
537
502
|
t.sample(m)
|
|
538
503
|
).mul(1 / 6)
|
|
539
504
|
);
|
|
540
505
|
}
|
|
541
506
|
}
|
|
542
|
-
const
|
|
543
|
-
class as extends
|
|
507
|
+
const so = (...o) => new is(...o);
|
|
508
|
+
class as extends E {
|
|
509
|
+
constructor(e) {
|
|
510
|
+
super("vec3"), this.intensity = v(1e-5), this.inputNode = e;
|
|
511
|
+
}
|
|
544
512
|
static get type() {
|
|
545
513
|
return "LensGhostNode";
|
|
546
514
|
}
|
|
547
|
-
inputNode;
|
|
548
|
-
intensity = y(1e-5);
|
|
549
|
-
constructor(e) {
|
|
550
|
-
super("vec3"), this.inputNode = e;
|
|
551
|
-
}
|
|
552
515
|
setup(e) {
|
|
553
516
|
const { inputNode: t, intensity: s } = this;
|
|
554
|
-
|
|
555
|
-
const r =
|
|
517
|
+
f(t != null);
|
|
518
|
+
const r = K({
|
|
556
519
|
name: "sampleGhost",
|
|
557
520
|
type: "vec3",
|
|
558
521
|
inputs: [
|
|
@@ -561,46 +524,40 @@ class as extends G {
|
|
|
561
524
|
{ name: "color", type: "vec3" },
|
|
562
525
|
{ name: "offset", type: "float" }
|
|
563
526
|
]
|
|
564
|
-
})(([a,
|
|
565
|
-
const
|
|
527
|
+
})(([a, h, c, l]) => {
|
|
528
|
+
const d = h.mul(l).add(a.oneMinus()).saturate(), m = t.sample(d).rgb.mul(c), g = k(0.5, d).length().mul(1 / (Math.SQRT2 / 4)).saturate();
|
|
566
529
|
return m.mulAssign(g.oneMinus().pow(3)), m;
|
|
567
|
-
}), n =
|
|
568
|
-
return
|
|
569
|
-
r(n, i,
|
|
570
|
-
r(n, i,
|
|
571
|
-
r(n, i,
|
|
572
|
-
r(n, i,
|
|
573
|
-
r(n, i,
|
|
574
|
-
r(n, i,
|
|
575
|
-
r(n, i,
|
|
576
|
-
r(n, i,
|
|
577
|
-
r(n, i,
|
|
530
|
+
}), n = B(), i = n.sub(0.5);
|
|
531
|
+
return S(
|
|
532
|
+
r(n, i, y(0.8, 0.8, 1), -5),
|
|
533
|
+
r(n, i, y(1, 0.8, 0.4), -1.5),
|
|
534
|
+
r(n, i, y(0.9, 1, 0.8), -0.4),
|
|
535
|
+
r(n, i, y(1, 0.8, 0.4), -0.2),
|
|
536
|
+
r(n, i, y(0.9, 0.7, 0.7), -0.1),
|
|
537
|
+
r(n, i, y(0.5, 1, 0.4), 0.7),
|
|
538
|
+
r(n, i, y(0.5, 0.5, 0.5), 1),
|
|
539
|
+
r(n, i, y(1, 1, 0.6), 2.5),
|
|
540
|
+
r(n, i, y(0.5, 0.8, 1), 10)
|
|
578
541
|
).mul(s);
|
|
579
542
|
}
|
|
580
543
|
}
|
|
581
|
-
const { resetRendererState: us, restoreRendererState: ls } =
|
|
544
|
+
const { resetRendererState: us, restoreRendererState: ls } = O;
|
|
582
545
|
function cs() {
|
|
583
|
-
const o = new
|
|
546
|
+
const o = new kt(1, 1, {
|
|
584
547
|
depthBuffer: !1,
|
|
585
|
-
type:
|
|
586
|
-
format:
|
|
548
|
+
type: Et,
|
|
549
|
+
format: $t
|
|
587
550
|
}), e = o.texture;
|
|
588
|
-
return e.minFilter =
|
|
551
|
+
return e.minFilter = he, e.magFilter = he, e.generateMipmaps = !1, o;
|
|
589
552
|
}
|
|
590
|
-
const
|
|
591
|
-
class
|
|
592
|
-
static get type() {
|
|
593
|
-
return "RTTextureNode";
|
|
594
|
-
}
|
|
595
|
-
node;
|
|
596
|
-
resolutionScale = 1;
|
|
597
|
-
renderTarget;
|
|
598
|
-
material = new j();
|
|
599
|
-
mesh = new Z(this.material);
|
|
600
|
-
rendererState;
|
|
553
|
+
const hs = /* @__PURE__ */ new It();
|
|
554
|
+
class Ge extends se {
|
|
601
555
|
constructor(e, t) {
|
|
602
556
|
const s = cs();
|
|
603
|
-
super(s.texture, t
|
|
557
|
+
super(s.texture, t ?? B()), this.resolutionScale = 1, this.material = new P(), this.mesh = new q(this.material), this.node = e, this.renderTarget = s, this.updateBeforeType = A.FRAME;
|
|
558
|
+
}
|
|
559
|
+
static get type() {
|
|
560
|
+
return "RTTextureNode";
|
|
604
561
|
}
|
|
605
562
|
setSize(e, t) {
|
|
606
563
|
const { resolutionScale: s } = this, r = Math.max(Math.round(e * s), 1), n = Math.max(Math.round(t * s), 1);
|
|
@@ -609,35 +566,35 @@ class Le extends oe {
|
|
|
609
566
|
updateBefore({ renderer: e }) {
|
|
610
567
|
if (e == null)
|
|
611
568
|
return;
|
|
612
|
-
const t = e.getDrawingBufferSize(
|
|
569
|
+
const t = e.getDrawingBufferSize(hs);
|
|
613
570
|
this.setSize(t.x, t.y), this.rendererState = us(e, this.rendererState), e.setRenderTarget(this.renderTarget), this.mesh.render(e), ls(e, this.rendererState);
|
|
614
571
|
}
|
|
615
572
|
setup(e) {
|
|
616
573
|
const { material: t } = this;
|
|
617
|
-
return t.fragmentNode =
|
|
574
|
+
return t.fragmentNode = this.node.context(e.getContext()), t.needsUpdate = !0, super.setup(e);
|
|
618
575
|
}
|
|
619
576
|
dispose() {
|
|
620
577
|
this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
621
578
|
}
|
|
622
579
|
// @ts-expect-error Ignore
|
|
623
580
|
clone() {
|
|
624
|
-
const e = new
|
|
581
|
+
const e = new se(this.value, this.uvNode, this.levelNode);
|
|
625
582
|
return e.sampler = this.sampler, e.referenceNode = this, e;
|
|
626
583
|
}
|
|
627
584
|
}
|
|
628
|
-
const
|
|
585
|
+
const ds = (...o) => new Ge(...o), Le = (o, e) => {
|
|
629
586
|
let t;
|
|
630
|
-
return o.isTextureNode === !0 || o.isSampleNode === !0 ? t = o : o.getTextureNode != null ? t = o.getTextureNode() : (t = new
|
|
631
|
-
}, { resetRendererState:
|
|
587
|
+
return o.isTextureNode === !0 || o.isSampleNode === !0 ? t = o : o.getTextureNode != null ? t = o.getTextureNode() : (t = new Ge(o), e != null && (t.value.name = e)), t;
|
|
588
|
+
}, { resetRendererState: ps, restoreRendererState: ms } = O;
|
|
632
589
|
function gs() {
|
|
633
590
|
const s = document.createElement("canvas");
|
|
634
591
|
s.width = 256, s.height = 32;
|
|
635
592
|
const r = s.getContext("2d");
|
|
636
|
-
|
|
593
|
+
f(r != null), r.beginPath(), r.moveTo(0, 32 / 2), r.lineTo(256 / 2, 5), r.lineTo(256, 32 / 2), r.lineTo(256 / 2, 27), r.closePath();
|
|
637
594
|
const n = r.createLinearGradient(0, 0, 256, 0);
|
|
638
|
-
return n.addColorStop(0, "#000000"), n.addColorStop(0.5, "#ffffff"), n.addColorStop(1, "#000000"), r.fillStyle = n, r.fill(), new
|
|
595
|
+
return n.addColorStop(0, "#000000"), n.addColorStop(0.5, "#ffffff"), n.addColorStop(1, "#000000"), r.fillStyle = n, r.fill(), new Xe(s);
|
|
639
596
|
}
|
|
640
|
-
const
|
|
597
|
+
const xe = /* @__PURE__ */ oe({
|
|
641
598
|
color: "vec3",
|
|
642
599
|
luminance: "float",
|
|
643
600
|
position: "vec2",
|
|
@@ -645,58 +602,41 @@ const fe = /* @__PURE__ */ re({
|
|
|
645
602
|
sin: "float",
|
|
646
603
|
cos: "float"
|
|
647
604
|
});
|
|
648
|
-
class xs extends
|
|
649
|
-
spikeNode;
|
|
650
|
-
spikePairCount = 6;
|
|
651
|
-
wireframe = !1;
|
|
652
|
-
intensity = y(1e-5);
|
|
653
|
-
sizeScale = y(new B(1.5, 0.01));
|
|
654
|
-
luminanceThreshold = y(100);
|
|
655
|
-
computeNode;
|
|
656
|
-
counterBuffer = new Gt(1, 1);
|
|
657
|
-
instanceBuffer = le(1, fe);
|
|
658
|
-
renderTarget = this.createRenderTarget();
|
|
659
|
-
material = new Lt({
|
|
660
|
-
depthTest: !1,
|
|
661
|
-
depthWrite: !1,
|
|
662
|
-
transparent: !0,
|
|
663
|
-
blending: Je
|
|
664
|
-
});
|
|
665
|
-
mesh = new Y(new Ye(1, 1), this.material);
|
|
666
|
-
camera = new _e();
|
|
667
|
-
rendererState;
|
|
668
|
-
inputTexelSize = y(new B());
|
|
669
|
-
outputTexelSize = y(new B());
|
|
670
|
-
geometryRatio = y(new B());
|
|
605
|
+
class xs extends _ {
|
|
671
606
|
constructor(e) {
|
|
672
|
-
super(e), this.
|
|
607
|
+
super(e), this.spikePairCount = 6, this.wireframe = !1, this.intensity = v(1e-5), this.sizeScale = v(new V(1.5, 0.01)), this.luminanceThreshold = v(100), this.counterBuffer = new Ot(1, 1), this.instanceBuffer = ue(1, xe), this.renderTarget = this.createRenderTarget(), this.material = new Gt({
|
|
608
|
+
depthTest: !1,
|
|
609
|
+
depthWrite: !1,
|
|
610
|
+
transparent: !0,
|
|
611
|
+
blending: Ke
|
|
612
|
+
}), this.mesh = new J(new Je(1, 1), this.material), this.camera = new Ye(), this.inputTexelSize = v(new V()), this.outputTexelSize = v(new V()), this.geometryRatio = v(new V()), this.inputNode = e, this.resolutionScale = 0.5, this.outputTexture = this.renderTarget.texture;
|
|
673
613
|
}
|
|
674
614
|
customCacheKey() {
|
|
675
|
-
return
|
|
615
|
+
return Ie(this.spikePairCount, +this.wireframe);
|
|
676
616
|
}
|
|
677
617
|
setSize(e, t) {
|
|
678
618
|
const { resolutionScale: s } = this, r = Math.max(Math.round(e * s), 1), n = Math.max(Math.round(t * s), 1);
|
|
679
619
|
this.renderTarget.setSize(r, n);
|
|
680
620
|
const i = Math.floor(r / 2), u = Math.floor(n / 2), a = i * u;
|
|
681
|
-
return this.instanceBuffer.bufferCount < a && (this.instanceBuffer.dispose(), this.instanceBuffer =
|
|
621
|
+
return this.instanceBuffer.bufferCount < a && (this.instanceBuffer.dispose(), this.instanceBuffer = ue(a, xe), this.setupCompute(i, u), this.setupMaterial()), this;
|
|
682
622
|
}
|
|
683
623
|
updateBefore({ renderer: e }) {
|
|
684
624
|
if (e == null)
|
|
685
625
|
return;
|
|
686
626
|
const { inputNode: t } = this;
|
|
687
|
-
|
|
627
|
+
f(t != null);
|
|
688
628
|
const { width: s, height: r } = t.value;
|
|
689
629
|
this.setSize(s, r);
|
|
690
630
|
const { computeNode: n, counterBuffer: i, renderTarget: u } = this;
|
|
691
|
-
|
|
631
|
+
f(n != null), this.inputTexelSize.value.set(1 / s, 1 / r);
|
|
692
632
|
const a = s / r;
|
|
693
633
|
a > 1 ? this.geometryRatio.value.set(1 / a, 1) : this.geometryRatio.value.set(1, a);
|
|
694
|
-
const { width:
|
|
695
|
-
this.outputTexelSize.value.set(1 /
|
|
696
|
-
this.mesh.count = new Uint32Array(
|
|
697
|
-
}).catch((
|
|
698
|
-
console.error(
|
|
699
|
-
}), this.rendererState =
|
|
634
|
+
const { width: h, height: c } = u;
|
|
635
|
+
this.outputTexelSize.value.set(1 / h, 1 / c), i.array[0] = 0, i.needsUpdate = !0, e.compute(n), e.getArrayBufferAsync(i).then((l) => {
|
|
636
|
+
this.mesh.count = new Uint32Array(l)[0];
|
|
637
|
+
}).catch((l) => {
|
|
638
|
+
console.error(l);
|
|
639
|
+
}), this.rendererState = ps(e, this.rendererState), e.setRenderTarget(u), e.render(this.mesh, this.camera), ms(e, this.rendererState);
|
|
700
640
|
}
|
|
701
641
|
setupCompute(e, t) {
|
|
702
642
|
const {
|
|
@@ -706,25 +646,25 @@ class xs extends X {
|
|
|
706
646
|
instanceBuffer: i,
|
|
707
647
|
outputTexelSize: u
|
|
708
648
|
} = this;
|
|
709
|
-
|
|
710
|
-
const a =
|
|
649
|
+
f(r != null);
|
|
650
|
+
const a = ut(
|
|
711
651
|
n,
|
|
712
652
|
"uint",
|
|
713
653
|
n.count
|
|
714
654
|
).toAtomic();
|
|
715
|
-
this.computeNode =
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
655
|
+
this.computeNode = C(() => {
|
|
656
|
+
const h = Ce(e, t);
|
|
657
|
+
F(X.xy.greaterThanEqual(h).any(), () => {
|
|
658
|
+
lt();
|
|
719
659
|
});
|
|
720
|
-
const
|
|
721
|
-
|
|
722
|
-
const m =
|
|
660
|
+
const c = p(X.xy).mul(u).mul(2), l = r.sample(c), d = l.a;
|
|
661
|
+
F(d.greaterThan(0.1), () => {
|
|
662
|
+
const m = ct(a.element(0), s);
|
|
723
663
|
for (let g = 0; g < s; ++g) {
|
|
724
664
|
const x = i.element(m.add(g));
|
|
725
|
-
x.get("color").assign(
|
|
726
|
-
const
|
|
727
|
-
x.get("sin").assign(Math.sin(
|
|
665
|
+
x.get("color").assign(l.rgb), x.get("luminance").assign(d), x.get("position").assign(X.xy), x.get("scale").assign(g % 2 === 0 ? 1 : 0.5);
|
|
666
|
+
const R = Math.PI * (3 - Math.sqrt(5)), N = Math.PI / s * g + R;
|
|
667
|
+
x.get("sin").assign(Math.sin(N)), x.get("cos").assign(Math.cos(N));
|
|
728
668
|
}
|
|
729
669
|
});
|
|
730
670
|
})().compute(
|
|
@@ -744,22 +684,22 @@ class xs extends X {
|
|
|
744
684
|
outputTexelSize: u,
|
|
745
685
|
geometryRatio: a
|
|
746
686
|
} = this;
|
|
747
|
-
|
|
748
|
-
const
|
|
749
|
-
this.material.colorNode = this.wireframe ?
|
|
750
|
-
const
|
|
751
|
-
|
|
687
|
+
f(e != null), f(t != null);
|
|
688
|
+
const h = s.element(ht);
|
|
689
|
+
this.material.colorNode = this.wireframe ? w(1) : t.mul(h.get("color").mul(n)), this.material.vertexNode = C(() => {
|
|
690
|
+
const c = h.get("sin"), l = h.get("cos"), d = Pe(l, c, 0, c.negate(), l, 0, 0, 0, 1), g = h.get("position").mul(u).mul(2), x = g.flipY().mul(2).sub(1), N = h.get("luminance").div(r).saturate(), z = p(N, 1).mul(
|
|
691
|
+
h.get("scale"),
|
|
752
692
|
i,
|
|
753
693
|
// Make the spike to shrink at screen borders:
|
|
754
694
|
g.sub(0.5).length().mul(2).oneMinus().mul(0.5).add(0.5)
|
|
755
|
-
),
|
|
756
|
-
return
|
|
695
|
+
), L = d.mul(be.mul(w(z, 1, 1))).mul(a).add(y(x, 0));
|
|
696
|
+
return w(L, 1);
|
|
757
697
|
})(), this.material.wireframe = this.wireframe, this.material.needsUpdate = !0;
|
|
758
698
|
}
|
|
759
699
|
setup(e) {
|
|
760
700
|
if (this.spikeNode == null) {
|
|
761
701
|
const t = gs();
|
|
762
|
-
t.colorSpace =
|
|
702
|
+
t.colorSpace = _e, this.spikeNode = I(t);
|
|
763
703
|
}
|
|
764
704
|
return this.setupMaterial(), super.setup(e);
|
|
765
705
|
}
|
|
@@ -767,18 +707,14 @@ class xs extends X {
|
|
|
767
707
|
this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
768
708
|
}
|
|
769
709
|
}
|
|
770
|
-
const fs = /* @__PURE__ */ new
|
|
771
|
-
class vs extends
|
|
710
|
+
const fs = /* @__PURE__ */ new V();
|
|
711
|
+
class vs extends E {
|
|
712
|
+
constructor(e) {
|
|
713
|
+
super("vec3"), this.intensity = v(1e-5), this.chromaticAberration = v(5e-3), this.aspectRatio = v(0), this.inputNode = e, this.updateBeforeType = A.FRAME;
|
|
714
|
+
}
|
|
772
715
|
static get type() {
|
|
773
716
|
return "LensHaloNode";
|
|
774
717
|
}
|
|
775
|
-
inputNode;
|
|
776
|
-
intensity = y(1e-5);
|
|
777
|
-
chromaticAberration = y(5e-3);
|
|
778
|
-
aspectRatio = y(0);
|
|
779
|
-
constructor(e) {
|
|
780
|
-
super("vec3"), this.inputNode = e, this.updateBeforeType = U.FRAME;
|
|
781
|
-
}
|
|
782
718
|
updateBefore({ renderer: e }) {
|
|
783
719
|
if (e == null)
|
|
784
720
|
return;
|
|
@@ -787,8 +723,8 @@ class vs extends G {
|
|
|
787
723
|
}
|
|
788
724
|
setup(e) {
|
|
789
725
|
const { inputNode: t, intensity: s, chromaticAberration: r, aspectRatio: n } = this;
|
|
790
|
-
|
|
791
|
-
const i =
|
|
726
|
+
f(t != null);
|
|
727
|
+
const i = K({
|
|
792
728
|
name: "cubicRingMask",
|
|
793
729
|
type: "float",
|
|
794
730
|
inputs: [
|
|
@@ -796,116 +732,105 @@ class vs extends G {
|
|
|
796
732
|
{ name: "radius", type: "float" },
|
|
797
733
|
{ name: "thickness", type: "float" }
|
|
798
734
|
]
|
|
799
|
-
})(([
|
|
800
|
-
const m =
|
|
801
|
-
return
|
|
802
|
-
}), u =
|
|
735
|
+
})(([c, l, d]) => {
|
|
736
|
+
const m = dt(Be(c.sub(l)).div(d), 1);
|
|
737
|
+
return pt(m, m, k(3, m.mul(2))).oneMinus();
|
|
738
|
+
}), u = K({
|
|
803
739
|
name: "sampleHalo",
|
|
804
740
|
type: "vec3",
|
|
805
741
|
inputs: [
|
|
806
742
|
{ name: "uv", type: "vec2" },
|
|
807
743
|
{ name: "radius", type: "float" }
|
|
808
744
|
]
|
|
809
|
-
})(([
|
|
810
|
-
const
|
|
745
|
+
})(([c, l]) => {
|
|
746
|
+
const d = p(n, 1), m = c.sub(0.5).mul(d).normalize().div(d), g = y(r).mul(y(-1, 0, 1)), x = mt(m.mul(l).add(c.oneMinus())), R = y(
|
|
811
747
|
t.sample(m.mul(g.r).add(x)).r,
|
|
812
748
|
t.sample(m.mul(g.g).add(x)).g,
|
|
813
749
|
t.sample(m.mul(g.b).add(x)).b
|
|
814
|
-
),
|
|
815
|
-
return
|
|
816
|
-
}), a =
|
|
750
|
+
), N = c.sub(p(0.5, 0)).mul(d).add(p(0.5, 0)), z = gt(N, p(0.5)).saturate();
|
|
751
|
+
return R.mulAssign(i(z, 0.45, 0.25)), R;
|
|
752
|
+
}), a = B();
|
|
817
753
|
return u(a, 0.3).mul(s);
|
|
818
754
|
}
|
|
819
755
|
}
|
|
820
|
-
const
|
|
821
|
-
class
|
|
756
|
+
const b = (o) => o.greaterThanEqual(0).all().and(o.lessThanEqual(1).all()).toFloat();
|
|
757
|
+
class We extends ae {
|
|
758
|
+
constructor(e, t = 4) {
|
|
759
|
+
super(e, t), this.blendAmount = v(0.85), this.resolutionScale = 0.5;
|
|
760
|
+
}
|
|
822
761
|
static get type() {
|
|
823
762
|
return "MipmapSurfaceBlurNode";
|
|
824
763
|
}
|
|
825
|
-
blendAmount = y(0.85);
|
|
826
|
-
constructor(e, t = 4) {
|
|
827
|
-
super(e, t), this.resolutionScale = 0.5;
|
|
828
|
-
}
|
|
829
764
|
setupDownsampleNode(e) {
|
|
830
765
|
const { inputNode: t, inputTexelSize: s } = this;
|
|
831
|
-
return
|
|
832
|
-
const r =
|
|
833
|
-
let
|
|
834
|
-
return
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
).mul(
|
|
840
|
-
t.sample(u).mul(
|
|
841
|
-
t.sample(a).mul(
|
|
842
|
-
t.sample(
|
|
843
|
-
t.sample(
|
|
844
|
-
),
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
).mul(
|
|
850
|
-
t.sample(
|
|
851
|
-
t.sample(
|
|
852
|
-
t.sample(m).mul(
|
|
853
|
-
t.sample(g).mul(
|
|
854
|
-
),
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
z
|
|
859
|
-
).mul(
|
|
860
|
-
t.sample(x).mul(
|
|
861
|
-
t.sample(
|
|
862
|
-
t.sample(
|
|
863
|
-
t.sample(
|
|
864
|
-
),
|
|
766
|
+
return f(t != null), C(() => {
|
|
767
|
+
const r = B(), n = w(1, 1, -1, -1).mul(s.xyxy).add(r.xyxy), i = w(2, 2, -2, -2).mul(s.xyxy).add(r.xyxy), u = n.zy.toVertexStage(), a = n.xy.toVertexStage(), h = n.zw.toVertexStage(), c = n.xw.toVertexStage(), l = i.zy.toVertexStage(), d = i.xy.toVertexStage(), m = i.zw.toVertexStage(), g = i.xw.toVertexStage(), x = p(r.x, i.y).toVertexStage(), R = p(i.z, r.y).toVertexStage(), N = p(i.x, r.y).toVertexStage(), z = p(r.x, i.w).toVertexStage(), L = 1 / 4 / 2, j = 1 / 9 / 2, U = t.sample(r).mul(j);
|
|
768
|
+
let M;
|
|
769
|
+
return M = w(
|
|
770
|
+
b(u),
|
|
771
|
+
b(a),
|
|
772
|
+
b(h),
|
|
773
|
+
b(c)
|
|
774
|
+
).mul(L), U.addAssign(
|
|
775
|
+
t.sample(u).mul(M.x),
|
|
776
|
+
t.sample(a).mul(M.y),
|
|
777
|
+
t.sample(h).mul(M.z),
|
|
778
|
+
t.sample(c).mul(M.w)
|
|
779
|
+
), M = w(
|
|
780
|
+
b(l),
|
|
781
|
+
b(d),
|
|
782
|
+
b(m),
|
|
783
|
+
b(g)
|
|
784
|
+
).mul(j), U.addAssign(
|
|
785
|
+
t.sample(l).mul(M.x),
|
|
786
|
+
t.sample(d).mul(M.y),
|
|
787
|
+
t.sample(m).mul(M.z),
|
|
788
|
+
t.sample(g).mul(M.w)
|
|
789
|
+
), M = w(
|
|
790
|
+
b(x),
|
|
791
|
+
b(R),
|
|
792
|
+
b(N),
|
|
793
|
+
b(z)
|
|
794
|
+
).mul(j), U.addAssign(
|
|
795
|
+
t.sample(x).mul(M.x),
|
|
796
|
+
t.sample(R).mul(M.y),
|
|
797
|
+
t.sample(N).mul(M.z),
|
|
798
|
+
t.sample(z).mul(M.w)
|
|
799
|
+
), U;
|
|
865
800
|
})();
|
|
866
801
|
}
|
|
867
802
|
setupUpsampleNode(e) {
|
|
868
803
|
const { inputNode: t, inputTexelSize: s, downsampleNode: r } = this;
|
|
869
|
-
|
|
870
|
-
const n =
|
|
804
|
+
f(t != null);
|
|
805
|
+
const n = B(), i = w(1, 1, -1, -1).mul(s.xyxy).add(n.xyxy), u = p(n.x, i.y).toVertexStage(), a = p(i.z, n.y).toVertexStage(), h = p(i.x, n.y).toVertexStage(), c = p(n.x, i.w).toVertexStage(), l = i.zy.toVertexStage(), d = i.xy.toVertexStage(), m = i.zw.toVertexStage(), g = i.xw.toVertexStage(), x = S(
|
|
871
806
|
t.sample(n).mul(1 / 4),
|
|
872
|
-
|
|
807
|
+
S(
|
|
873
808
|
t.sample(u),
|
|
874
809
|
t.sample(a),
|
|
875
|
-
t.sample(
|
|
876
|
-
t.sample(
|
|
810
|
+
t.sample(h),
|
|
811
|
+
t.sample(c)
|
|
877
812
|
).mul(1 / 8),
|
|
878
|
-
|
|
879
|
-
t.sample(
|
|
880
|
-
t.sample(
|
|
813
|
+
S(
|
|
814
|
+
t.sample(l),
|
|
815
|
+
t.sample(d),
|
|
881
816
|
t.sample(m),
|
|
882
817
|
t.sample(g)
|
|
883
818
|
).mul(1 / 16)
|
|
884
819
|
);
|
|
885
|
-
return
|
|
820
|
+
return te(r.sample(n), x, this.blendAmount);
|
|
886
821
|
}
|
|
887
822
|
}
|
|
888
|
-
const
|
|
889
|
-
function
|
|
890
|
-
|
|
891
|
-
return ("backend" in e ? e.backend : o).isWebGPUBackend === !0;
|
|
823
|
+
const oo = (...o) => new We(...o);
|
|
824
|
+
function He(o) {
|
|
825
|
+
return (o instanceof Lt ? o.renderer.backend : "backend" in o ? o.backend : o).isWebGPUBackend === !0;
|
|
892
826
|
}
|
|
893
|
-
class ys extends
|
|
827
|
+
class ys extends E {
|
|
828
|
+
constructor(e) {
|
|
829
|
+
super("vec4"), this.bloomIntensity = v(0.05), this.inputNode = e, this.thresholdNode = new Ee(), this.blurNode = new Oe(), this.ghostNode = new as(), this.haloNode = new vs(), this.bloomNode = new We(null, 8), this.glareNode = new xs(), this.featuresNode = ds(S(this.ghostNode, this.haloNode)), this.featuresNode.value.name = "LensFlareNode.Features", this.featuresNode.resolutionScale = 0.5, this.blurNode.resolutionScale = 1, this.bloomNode.resolutionScale = 1, this.glareNode.resolutionScale = 1;
|
|
830
|
+
}
|
|
894
831
|
static get type() {
|
|
895
832
|
return "LensFlareNode";
|
|
896
833
|
}
|
|
897
|
-
inputNode;
|
|
898
|
-
thresholdNode;
|
|
899
|
-
blurNode;
|
|
900
|
-
ghostNode;
|
|
901
|
-
haloNode;
|
|
902
|
-
bloomNode;
|
|
903
|
-
glareNode;
|
|
904
|
-
bloomIntensity = y(0.05);
|
|
905
|
-
featuresNode;
|
|
906
|
-
constructor(e) {
|
|
907
|
-
super("vec4"), this.inputNode = e, this.thresholdNode = new $e(), this.blurNode = new Ge(), this.ghostNode = new as(), this.haloNode = new vs(), this.bloomNode = new He(null, 8), this.glareNode = new xs(), this.featuresNode = ps(M(this.ghostNode, this.haloNode)), this.featuresNode.value.name = "LensFlareNode.Features", this.featuresNode.resolutionScale = 0.5, this.blurNode.resolutionScale = 1, this.bloomNode.resolutionScale = 1, this.glareNode.resolutionScale = 1;
|
|
908
|
-
}
|
|
909
834
|
setup(e) {
|
|
910
835
|
const {
|
|
911
836
|
inputNode: t,
|
|
@@ -915,76 +840,72 @@ class ys extends G {
|
|
|
915
840
|
haloNode: i,
|
|
916
841
|
bloomNode: u,
|
|
917
842
|
featuresNode: a,
|
|
918
|
-
glareNode:
|
|
843
|
+
glareNode: h
|
|
919
844
|
} = this;
|
|
920
|
-
|
|
921
|
-
const
|
|
922
|
-
s.inputNode = t, r.inputNode =
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
const g = b(t);
|
|
928
|
-
return g.addAssign(p), qe(e) && g.addAssign(m), g.add(a);
|
|
845
|
+
f(t != null);
|
|
846
|
+
const c = s.getTextureNode(), l = r.getTextureNode();
|
|
847
|
+
s.inputNode = t, r.inputNode = c, n.inputNode = l, i.inputNode = l, u.inputNode = c, h.inputNode = c;
|
|
848
|
+
const d = u.getTextureNode().mul(this.bloomIntensity), m = h.getTextureNode();
|
|
849
|
+
return C(() => {
|
|
850
|
+
const g = t;
|
|
851
|
+
return g.addAssign(d), He(e) && g.addAssign(m), g.add(a);
|
|
929
852
|
})();
|
|
930
853
|
}
|
|
931
854
|
dispose() {
|
|
932
855
|
this.thresholdNode.dispose(), this.blurNode.dispose(), this.ghostNode.dispose(), this.haloNode.dispose(), this.bloomNode.dispose(), this.glareNode.dispose(), this.featuresNode.dispose(), super.dispose();
|
|
933
856
|
}
|
|
934
857
|
}
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
)
|
|
939
|
-
), io = /* @__PURE__ */ O(
|
|
858
|
+
const ro = (o) => new ys(
|
|
859
|
+
o != null ? Le(o, "LensFlareNode.Input") : null
|
|
860
|
+
), no = /* @__PURE__ */ G(
|
|
940
861
|
(o, e, t, s) => {
|
|
941
|
-
const r = o.sub(t), n =
|
|
942
|
-
return
|
|
943
|
-
const
|
|
944
|
-
a.assign(
|
|
862
|
+
const r = o.sub(t), n = Q(e, r), i = Q(r, r).sub(s.pow2()), u = n.pow2().sub(i).toVar(), a = p(-1);
|
|
863
|
+
return F(u.greaterThanEqual(0), () => {
|
|
864
|
+
const h = Y(u);
|
|
865
|
+
a.assign(p(n.negate().sub(h), n.negate().add(h)));
|
|
945
866
|
}), a;
|
|
946
867
|
}
|
|
947
|
-
), ws = /* @__PURE__ */
|
|
868
|
+
), ws = /* @__PURE__ */ oe(
|
|
948
869
|
{ near: "vec4", far: "vec4" },
|
|
949
870
|
"raySpheresIntersections"
|
|
950
|
-
),
|
|
871
|
+
), io = /* @__PURE__ */ G(
|
|
951
872
|
(o, e, t, s) => {
|
|
952
|
-
const r = o.sub(t), n =
|
|
953
|
-
return
|
|
954
|
-
const
|
|
955
|
-
a.assign(n.negate().sub(
|
|
956
|
-
}), ws(a,
|
|
873
|
+
const r = o.sub(t), n = Q(e, r), i = Q(r, r).sub(s.pow2()), u = n.pow2().sub(i).toVar(), a = w(-1), h = w(-1);
|
|
874
|
+
return F(u.greaterThanEqual(0), () => {
|
|
875
|
+
const c = Y(u);
|
|
876
|
+
a.assign(n.negate().sub(c)), h.assign(n.negate().add(c));
|
|
877
|
+
}), ws(a, h);
|
|
957
878
|
}
|
|
958
|
-
),
|
|
879
|
+
), ao = /* @__PURE__ */ G(
|
|
959
880
|
(o, e, t) => {
|
|
960
|
-
const s = o.div(t), r = e.div(t), n = r.dot(r), i = s.dot(r), u = s.dot(s), a = i.pow2().sub(n.mul(u.sub(1))).toVar(),
|
|
961
|
-
return
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
}),
|
|
881
|
+
const s = o.div(t), r = e.div(t), n = r.dot(r), i = s.dot(r), u = s.dot(s), a = i.pow2().sub(n.mul(u.sub(1))).toVar(), h = p(-1);
|
|
882
|
+
return F(a.greaterThanEqual(0), () => {
|
|
883
|
+
const c = Y(a);
|
|
884
|
+
h.assign(p(i.negate().sub(c), i.negate().add(c)).div(n));
|
|
885
|
+
}), h;
|
|
965
886
|
}
|
|
966
887
|
), Ts = {
|
|
967
|
-
float:
|
|
888
|
+
float: re,
|
|
968
889
|
int: H,
|
|
969
|
-
uint:
|
|
970
|
-
bool:
|
|
971
|
-
vec2:
|
|
972
|
-
ivec2:
|
|
973
|
-
uvec2:
|
|
890
|
+
uint: Vt,
|
|
891
|
+
bool: bt,
|
|
892
|
+
vec2: p,
|
|
893
|
+
ivec2: T,
|
|
894
|
+
uvec2: Ce,
|
|
974
895
|
bvec2: Rt,
|
|
975
|
-
vec3:
|
|
976
|
-
ivec3:
|
|
977
|
-
uvec3:
|
|
978
|
-
bvec3:
|
|
979
|
-
vec4:
|
|
980
|
-
ivec4:
|
|
981
|
-
uvec4:
|
|
982
|
-
bvec4:
|
|
983
|
-
mat2:
|
|
984
|
-
mat3:
|
|
985
|
-
mat4:
|
|
986
|
-
color:
|
|
987
|
-
};
|
|
896
|
+
vec3: y,
|
|
897
|
+
ivec3: Mt,
|
|
898
|
+
uvec3: Nt,
|
|
899
|
+
bvec3: St,
|
|
900
|
+
vec4: w,
|
|
901
|
+
ivec4: Tt,
|
|
902
|
+
uvec4: wt,
|
|
903
|
+
bvec4: yt,
|
|
904
|
+
mat2: vt,
|
|
905
|
+
mat3: Pe,
|
|
906
|
+
mat4: ft,
|
|
907
|
+
color: xt
|
|
908
|
+
}, uo = Wt;
|
|
988
909
|
function lo(o) {
|
|
989
910
|
return Ts[o];
|
|
990
911
|
}
|
|
@@ -992,7 +913,6 @@ class Ss extends Ht {
|
|
|
992
913
|
static get type() {
|
|
993
914
|
return "OutputTexture3DNode";
|
|
994
915
|
}
|
|
995
|
-
owner;
|
|
996
916
|
constructor(e, t) {
|
|
997
917
|
super(t), this.owner = e, this.setUpdateMatrix(!1);
|
|
998
918
|
}
|
|
@@ -1003,69 +923,58 @@ class Ss extends Ht {
|
|
|
1003
923
|
return new this.constructor(this.owner, this.value);
|
|
1004
924
|
}
|
|
1005
925
|
}
|
|
1006
|
-
const co = (...o) =>
|
|
1007
|
-
(o, e, t = 0.4) => {
|
|
1008
|
-
const s = h(Fe(o)), r = s.reciprocal(), n = s.mul(e), i = n.sub(0.5).floor().add(0.5), u = n.sub(i), a = u.mul(u), d = u.mul(a), l = b(t), c = l.mul(u), p = l.negate().mul(d).add(l.mul(2).mul(a).sub(c)), m = C(2, l).mul(d).sub(C(3, l).mul(a)).add(1), g = C(2, l).negate().mul(d).add(C(3, l.mul(2)).mul(a)).add(c), x = l.mul(d).sub(l.mul(a)), T = m.add(g), S = r.mul(i.add(g.div(T))), V = o.sample(S).rgb, D = r.mul(i.sub(1)), F = r.mul(i.add(2));
|
|
1009
|
-
return M(
|
|
1010
|
-
f(o.sample(h(S.x, D.y)).rgb, 1).mul(T.x.mul(p.y)),
|
|
1011
|
-
f(o.sample(h(D.x, S.y)).rgb, 1).mul(p.x.mul(T.y)),
|
|
1012
|
-
f(V, 1).mul(T.x.mul(T.y)),
|
|
1013
|
-
f(o.sample(h(F.x, S.y)).rgb, 1).mul(x.x.mul(T.y)),
|
|
1014
|
-
f(o.sample(h(S.x, F.y)).rgb, 1).mul(T.x.mul(x.y))
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
), po = /* @__PURE__ */ O(
|
|
926
|
+
const co = (...o) => new Ss(...o), ho = /* @__PURE__ */ G(
|
|
1018
927
|
(o, e) => {
|
|
1019
|
-
const t =
|
|
1020
|
-
return
|
|
1021
|
-
o.sample(
|
|
1022
|
-
o.sample(
|
|
1023
|
-
o.sample(
|
|
1024
|
-
o.sample(
|
|
1025
|
-
o.sample(
|
|
1026
|
-
o.sample(
|
|
1027
|
-
o.sample(
|
|
1028
|
-
o.sample(
|
|
1029
|
-
o.sample(
|
|
928
|
+
const t = p(Ae(o)), s = t.reciprocal(), r = e.mul(t), n = r.sub(0.5).floor().add(0.5), i = r.sub(n), u = i.mul(i.mul(i.mul(0.5).oneMinus()).sub(0.5)), a = i.mul(i).mul(i.mul(1.5).sub(2.5)).add(1), h = i.mul(i.mul(k(2, i.mul(1.5))).add(0.5)), c = i.mul(i).mul(i.mul(0.5).sub(0.5)), l = a.add(h), d = h.div(a.add(h)), m = n.sub(1).mul(s), g = n.add(2).mul(s), x = n.add(d).mul(s);
|
|
929
|
+
return S(
|
|
930
|
+
o.sample(p(m.x, m.y)).mul(u.x).mul(u.y),
|
|
931
|
+
o.sample(p(x.x, m.y)).mul(l.x).mul(u.y),
|
|
932
|
+
o.sample(p(g.x, m.y)).mul(c.x).mul(u.y),
|
|
933
|
+
o.sample(p(m.x, x.y)).mul(u.x).mul(l.y),
|
|
934
|
+
o.sample(p(x.x, x.y)).mul(l.x).mul(l.y),
|
|
935
|
+
o.sample(p(g.x, x.y)).mul(c.x).mul(l.y),
|
|
936
|
+
o.sample(p(m.x, g.y)).mul(u.x).mul(c.y),
|
|
937
|
+
o.sample(p(x.x, g.y)).mul(l.x).mul(c.y),
|
|
938
|
+
o.sample(p(g.x, g.y)).mul(c.x).mul(c.y)
|
|
1030
939
|
);
|
|
1031
940
|
}
|
|
1032
941
|
);
|
|
1033
|
-
function
|
|
942
|
+
function fe(o, e) {
|
|
1034
943
|
let t = 1, s = 0;
|
|
1035
944
|
for (; o > 0; )
|
|
1036
945
|
t /= e, s += t * (o % e), o = Math.floor(o / e);
|
|
1037
946
|
return s;
|
|
1038
947
|
}
|
|
1039
|
-
const
|
|
948
|
+
const ve = /* @__PURE__ */ Array.from(
|
|
1040
949
|
{ length: 16 },
|
|
1041
|
-
(o, e) => new
|
|
1042
|
-
),
|
|
950
|
+
(o, e) => new V(fe(e + 1, 2), fe(e + 1, 3))
|
|
951
|
+
), Ns = (o, e, t, { perspective: s = !0, logarithmic: r = !1 } = {}) => r ? Fe(o, e, t) : s ? De(o, e, t) : zt(o, e, t), ye = (o, e, t) => {
|
|
952
|
+
const s = Fe(o, e, t);
|
|
953
|
+
return Bt(s, e, t);
|
|
954
|
+
}, po = (o, e, t) => {
|
|
1043
955
|
const s = De(o, e, t);
|
|
1044
|
-
return
|
|
1045
|
-
}, ho = (o, e, t) => {
|
|
1046
|
-
const s = b(je(o, e, t));
|
|
1047
|
-
return Ue(s, e, t);
|
|
956
|
+
return je(s, e, t);
|
|
1048
957
|
}, mo = (o, e, t, s, r) => {
|
|
1049
|
-
const n = s.element(H(2)).element(H(3)), i = s.element(H(3)).element(H(3)), a =
|
|
958
|
+
const n = s.element(H(2)).element(H(3)), i = s.element(H(3)).element(H(3)), a = w(y(o.flipY(), e).mul(2).sub(1), 1).mul(t.mul(n).add(i));
|
|
1050
959
|
return r.mul(a).xyz;
|
|
1051
|
-
},
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */
|
|
1055
|
-
/* @__PURE__ */
|
|
1056
|
-
/* @__PURE__ */
|
|
1057
|
-
/* @__PURE__ */
|
|
1058
|
-
],
|
|
1059
|
-
const r =
|
|
1060
|
-
return
|
|
960
|
+
}, we = [
|
|
961
|
+
/* @__PURE__ */ y(58.1375, 2.7747, 26.8183),
|
|
962
|
+
/* @__PURE__ */ y(-150.5666, 4.2109, -88.5066),
|
|
963
|
+
/* @__PURE__ */ y(130.5887, -14.0195, 109.0745),
|
|
964
|
+
/* @__PURE__ */ y(-42.3277, 4.8052, -60.1097),
|
|
965
|
+
/* @__PURE__ */ y(4.5974, 2.1856, 12.5925),
|
|
966
|
+
/* @__PURE__ */ y(0.1357, 0.0914, 0.1067)
|
|
967
|
+
], Ms = (o) => we.slice(1).reduce((e, t) => t.add(o.mul(e)), we[0]), go = (o, e, t, s) => {
|
|
968
|
+
const r = Ns(o, e, t, s);
|
|
969
|
+
return Ms(je(r, e, t));
|
|
1061
970
|
}, xo = (o) => {
|
|
1062
|
-
const e =
|
|
1063
|
-
return
|
|
1064
|
-
}, { resetRendererState: Rs, restoreRendererState:
|
|
1065
|
-
function
|
|
971
|
+
const e = k(0.5, o.x).mul(Ct), t = k(o.y, 0.5).mul(Pt), s = le(t);
|
|
972
|
+
return y(s.mul(le(e)), ce(t), s.mul(ce(e)));
|
|
973
|
+
}, { resetRendererState: Rs, restoreRendererState: bs } = O;
|
|
974
|
+
function Vs(o) {
|
|
1066
975
|
return o.isPerspectiveCamera === !0 || o.isOrthographicCamera === !0 || "updateProjectionMatrix" in o && "setViewOffset" in o && "clearViewOffset" in o;
|
|
1067
976
|
}
|
|
1068
|
-
const
|
|
977
|
+
const zs = /* @__PURE__ */ K({
|
|
1069
978
|
name: "clipAABB",
|
|
1070
979
|
type: "vec4",
|
|
1071
980
|
inputs: [
|
|
@@ -1075,101 +984,75 @@ const Bs = /* @__PURE__ */ J({
|
|
|
1075
984
|
{ name: "maxColor", type: "vec4" }
|
|
1076
985
|
]
|
|
1077
986
|
})(([o, e, t, s]) => {
|
|
1078
|
-
const r = s.rgb.add(t.rgb).mul(0.5), n = s.rgb.sub(t.rgb).mul(0.5).add(1e-7), i = e.sub(
|
|
1079
|
-
return
|
|
1080
|
-
|
|
1081
|
-
|
|
987
|
+
const r = s.rgb.add(t.rgb).mul(0.5), n = s.rgb.sub(t.rgb).mul(0.5).add(1e-7), i = e.sub(w(r, o.a)), a = i.xyz.div(n).abs(), h = Ue(a.x, a.y, a.z);
|
|
988
|
+
return Ut(
|
|
989
|
+
h.greaterThan(1),
|
|
990
|
+
w(r, o.a).add(i.div(h)),
|
|
1082
991
|
e
|
|
1083
992
|
);
|
|
1084
|
-
}),
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1087
|
-
/* @__PURE__ */
|
|
1088
|
-
/* @__PURE__ */
|
|
1089
|
-
/* @__PURE__ */
|
|
1090
|
-
/* @__PURE__ */
|
|
1091
|
-
/* @__PURE__ */
|
|
1092
|
-
/* @__PURE__ */
|
|
1093
|
-
],
|
|
993
|
+
}), Te = [
|
|
994
|
+
/* @__PURE__ */ T(-1, -1),
|
|
995
|
+
/* @__PURE__ */ T(-1, 1),
|
|
996
|
+
/* @__PURE__ */ T(1, -1),
|
|
997
|
+
/* @__PURE__ */ T(1, 1),
|
|
998
|
+
/* @__PURE__ */ T(1, 0),
|
|
999
|
+
/* @__PURE__ */ T(0, -1),
|
|
1000
|
+
/* @__PURE__ */ T(0, 1),
|
|
1001
|
+
/* @__PURE__ */ T(-1, 0)
|
|
1002
|
+
], Bs = /* @__PURE__ */ G(
|
|
1094
1003
|
(o, e, t, s, r) => {
|
|
1095
1004
|
const n = t.toVar(), i = t.pow2().toVar();
|
|
1096
|
-
for (const
|
|
1097
|
-
const m = o.load(e.add(
|
|
1005
|
+
for (const d of Te) {
|
|
1006
|
+
const m = o.load(e.add(d));
|
|
1098
1007
|
n.addAssign(m), i.addAssign(m.pow2());
|
|
1099
1008
|
}
|
|
1100
|
-
const u =
|
|
1101
|
-
return
|
|
1102
|
-
}
|
|
1103
|
-
),
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
/* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
],
|
|
1009
|
+
const u = re(Te.length + 1), a = n.div(u), h = Y(i.div(u).sub(a.pow2()).max(0)).mul(r), c = a.sub(h), l = a.add(h);
|
|
1010
|
+
return zs(a.clamp(c, l), s, c, l);
|
|
1011
|
+
}
|
|
1012
|
+
), Cs = [
|
|
1013
|
+
/* @__PURE__ */ T(-1, -1),
|
|
1014
|
+
/* @__PURE__ */ T(-1, 0),
|
|
1015
|
+
/* @__PURE__ */ T(-1, 1),
|
|
1016
|
+
/* @__PURE__ */ T(0, -1),
|
|
1017
|
+
/* @__PURE__ */ T(0, 0),
|
|
1018
|
+
/* @__PURE__ */ T(0, 1),
|
|
1019
|
+
/* @__PURE__ */ T(1, -1),
|
|
1020
|
+
/* @__PURE__ */ T(1, 0),
|
|
1021
|
+
/* @__PURE__ */ T(1, 1)
|
|
1022
|
+
], Ps = /* @__PURE__ */ oe({
|
|
1114
1023
|
coord: "ivec2",
|
|
1115
1024
|
depth: "float"
|
|
1116
|
-
}),
|
|
1025
|
+
}), As = /* @__PURE__ */ G(
|
|
1117
1026
|
(o, e) => {
|
|
1118
|
-
const t =
|
|
1119
|
-
for (const r of
|
|
1027
|
+
const t = re(1), s = T(0);
|
|
1028
|
+
for (const r of Cs) {
|
|
1120
1029
|
const n = e.add(r).toVar(), i = o.load(n).toVar();
|
|
1121
|
-
|
|
1030
|
+
F(i.r.lessThan(t), () => {
|
|
1122
1031
|
s.assign(n), t.assign(i.r);
|
|
1123
1032
|
});
|
|
1124
1033
|
}
|
|
1125
|
-
return
|
|
1034
|
+
return Ps(s, t);
|
|
1126
1035
|
}
|
|
1127
|
-
),
|
|
1128
|
-
class
|
|
1129
|
-
static get type() {
|
|
1130
|
-
return "TemporalAntialiasNode";
|
|
1131
|
-
}
|
|
1132
|
-
velocityNodeImmutable;
|
|
1133
|
-
inputNode;
|
|
1134
|
-
depthNode;
|
|
1135
|
-
velocityNode;
|
|
1136
|
-
camera;
|
|
1137
|
-
temporalAlpha = y(0.05);
|
|
1138
|
-
varianceGamma = y(1);
|
|
1139
|
-
velocityThreshold = y(0.1);
|
|
1140
|
-
depthError = y(1e-3);
|
|
1141
|
-
// Static options:
|
|
1142
|
-
debugShowRejection = !1;
|
|
1143
|
-
textureNode;
|
|
1144
|
-
resolveRT = this.createRenderTarget("Resolve");
|
|
1145
|
-
historyRT = this.createRenderTarget("History");
|
|
1146
|
-
previousDepthTexture;
|
|
1147
|
-
resolveMaterial = new j();
|
|
1148
|
-
copyMaterial = new j();
|
|
1149
|
-
mesh = new Z();
|
|
1150
|
-
rendererState;
|
|
1151
|
-
needsSyncPostProcessing = !1;
|
|
1152
|
-
needsClearHistory = !1;
|
|
1153
|
-
resolveNode = q(this.resolveRT.texture);
|
|
1154
|
-
historyNode = q(this.historyRT.texture);
|
|
1155
|
-
previousDepthNode = q(Ds);
|
|
1156
|
-
originalProjectionMatrix = new W();
|
|
1157
|
-
jitterIndex = 0;
|
|
1036
|
+
), Se = /* @__PURE__ */ new V(), Fs = /* @__PURE__ */ new et(1, 1);
|
|
1037
|
+
class Ds extends E {
|
|
1158
1038
|
constructor(e, t, s, r, n) {
|
|
1159
|
-
if (super("vec4"), this.velocityNodeImmutable = e, this.inputNode = t, this.depthNode = s, this.velocityNode = r, !
|
|
1039
|
+
if (super("vec4"), this.temporalAlpha = v(0.05), this.varianceGamma = v(1), this.velocityThreshold = v(0.1), this.depthError = v(1e-3), this.debugShowRejection = !1, this.resolveRT = this.createRenderTarget("Resolve"), this.historyRT = this.createRenderTarget("History"), this.resolveMaterial = new P(), this.copyMaterial = new P(), this.mesh = new q(), this.needsSyncPostProcessing = !1, this.needsClearHistory = !1, this.resolveNode = I(this.resolveRT.texture), this.historyNode = I(this.historyRT.texture), this.previousDepthNode = I(Fs), this.originalProjectionMatrix = new W(), this.jitterIndex = 0, this.velocityNodeImmutable = e, this.inputNode = t, this.depthNode = s, this.velocityNode = r, !Vs(n))
|
|
1160
1040
|
throw new Error("The provided camera is not supported.");
|
|
1161
|
-
this.camera = n, this.textureNode =
|
|
1041
|
+
this.camera = n, this.textureNode = ke(this, this.resolveRT.texture), this.updateBeforeType = A.FRAME;
|
|
1042
|
+
}
|
|
1043
|
+
static get type() {
|
|
1044
|
+
return "TemporalAntialiasNode";
|
|
1162
1045
|
}
|
|
1163
1046
|
customCacheKey() {
|
|
1164
|
-
return
|
|
1047
|
+
return Ie(this.camera.id, +this.debugShowRejection);
|
|
1165
1048
|
}
|
|
1166
1049
|
createRenderTarget(e) {
|
|
1167
|
-
const t = new
|
|
1050
|
+
const t = new Ne(1, 1, {
|
|
1168
1051
|
depthBuffer: !1,
|
|
1169
1052
|
type: Re,
|
|
1170
|
-
format:
|
|
1053
|
+
format: Me
|
|
1171
1054
|
}), s = t.texture;
|
|
1172
|
-
s.minFilter =
|
|
1055
|
+
s.minFilter = Z, s.magFilter = Z, s.generateMipmaps = !1;
|
|
1173
1056
|
const r = this.constructor.type;
|
|
1174
1057
|
return s.name = e != null ? `${r}.${e}` : r, t;
|
|
1175
1058
|
}
|
|
@@ -1190,11 +1073,11 @@ class js extends G {
|
|
|
1190
1073
|
setViewOffset(e, t) {
|
|
1191
1074
|
const { camera: s } = this;
|
|
1192
1075
|
s.updateProjectionMatrix(), this.originalProjectionMatrix.copy(s.projectionMatrix), this.setProjectionMatrix(this.originalProjectionMatrix);
|
|
1193
|
-
const r =
|
|
1076
|
+
const r = ve[this.jitterIndex], n = r.x - 0.5, i = r.y - 0.5;
|
|
1194
1077
|
s.setViewOffset(e, t, n, i, e, t);
|
|
1195
1078
|
}
|
|
1196
1079
|
clearViewOffset() {
|
|
1197
|
-
this.camera.clearViewOffset(), this.setProjectionMatrix(null), this.jitterIndex = (this.jitterIndex + 1) %
|
|
1080
|
+
this.camera.clearViewOffset(), this.setProjectionMatrix(null), this.jitterIndex = (this.jitterIndex + 1) % ve.length;
|
|
1198
1081
|
}
|
|
1199
1082
|
copyDepthTexture(e) {
|
|
1200
1083
|
const t = this.depthNode.value, s = this.previousDepthTexture ??= t.clone();
|
|
@@ -1207,46 +1090,46 @@ class js extends G {
|
|
|
1207
1090
|
updateBefore({ renderer: e }) {
|
|
1208
1091
|
if (e == null)
|
|
1209
1092
|
return;
|
|
1210
|
-
const t = e.getDrawingBufferSize(
|
|
1211
|
-
this.setSize(t.x, t.y), this.rendererState = Rs(e, this.rendererState), this.needsClearHistory && this.clearHistory(e), e.setRenderTarget(this.resolveRT), this.mesh.material = this.resolveMaterial, this.mesh.render(e),
|
|
1093
|
+
const t = e.getDrawingBufferSize(Se);
|
|
1094
|
+
this.setSize(t.x, t.y), this.rendererState = Rs(e, this.rendererState), this.needsClearHistory && this.clearHistory(e), e.setRenderTarget(this.resolveRT), this.mesh.material = this.resolveMaterial, this.mesh.render(e), bs(e, this.rendererState), He(e) && this.copyDepthTexture(e), this.swapBuffers(), this.needsSyncPostProcessing && this.clearViewOffset();
|
|
1212
1095
|
}
|
|
1213
1096
|
setupResolveNode({ renderer: e }) {
|
|
1214
1097
|
const t = (s) => {
|
|
1215
|
-
const { previousDepthNode: r } = this, n = r.load(
|
|
1216
|
-
return e.logarithmicDepthBuffer ?
|
|
1098
|
+
const { previousDepthNode: r } = this, n = r.load(T(s.mul(Ae(r)).sub(0.5))).toVar();
|
|
1099
|
+
return e.logarithmicDepthBuffer ? ye(
|
|
1217
1100
|
n,
|
|
1218
|
-
|
|
1219
|
-
|
|
1101
|
+
de(this.camera),
|
|
1102
|
+
pe(this.camera)
|
|
1220
1103
|
) : n;
|
|
1221
1104
|
};
|
|
1222
|
-
return
|
|
1223
|
-
const s =
|
|
1105
|
+
return C(() => {
|
|
1106
|
+
const s = T(ze), r = At, n = this.inputNode.load(s), i = As(this.depthNode, s), u = i.get("coord"), a = this.velocityNode.load(u).xyz.mul(y(0.5, -0.5, 0.5)).toVar(), h = a.xy.length().div(this.velocityThreshold).oneMinus().saturate(), c = r.sub(a.xy).toVar(), l = t(c), d = e.logarithmicDepthBuffer ? ye(
|
|
1224
1107
|
i.get("depth"),
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
) : i.get("depth"), m =
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
), g =
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
).toFloat(),
|
|
1234
|
-
return
|
|
1235
|
-
const
|
|
1108
|
+
de(this.camera),
|
|
1109
|
+
pe(this.camera)
|
|
1110
|
+
) : i.get("depth"), m = Ft(
|
|
1111
|
+
d.add(a.z),
|
|
1112
|
+
l.add(this.depthError)
|
|
1113
|
+
), g = h.mul(m), x = Dt(
|
|
1114
|
+
c.greaterThanEqual(0).all(),
|
|
1115
|
+
c.lessThanEqual(1).all()
|
|
1116
|
+
).toFloat(), R = i.get("depth").notEqual(1).toFloat(), N = w(0).toVar();
|
|
1117
|
+
return F(x.mul(R).mul(g).greaterThan(0), () => {
|
|
1118
|
+
const z = I(this.historyNode, c), L = Bs(
|
|
1236
1119
|
this.inputNode,
|
|
1237
1120
|
s,
|
|
1238
1121
|
n,
|
|
1239
|
-
|
|
1122
|
+
z,
|
|
1240
1123
|
this.varianceGamma
|
|
1241
|
-
),
|
|
1124
|
+
), j = a.xy.abs().mul(jt), U = Ue(j.x, j.y).fract().mul(0.5), M = te(
|
|
1242
1125
|
this.temporalAlpha,
|
|
1243
1126
|
0.8,
|
|
1244
|
-
|
|
1127
|
+
U
|
|
1245
1128
|
).saturate();
|
|
1246
|
-
|
|
1129
|
+
N.assign(te(L, n, M));
|
|
1247
1130
|
}).Else(() => {
|
|
1248
|
-
|
|
1249
|
-
}),
|
|
1131
|
+
N.assign(n), this.debugShowRejection && N.assign(y(1, 0, 0));
|
|
1132
|
+
}), N;
|
|
1250
1133
|
})();
|
|
1251
1134
|
}
|
|
1252
1135
|
setup(e) {
|
|
@@ -1255,7 +1138,7 @@ class js extends G {
|
|
|
1255
1138
|
const { onBeforePostProcessing: n } = t;
|
|
1256
1139
|
t.onBeforePostProcessing = () => {
|
|
1257
1140
|
n?.();
|
|
1258
|
-
const i = e.renderer.getDrawingBufferSize(
|
|
1141
|
+
const i = e.renderer.getDrawingBufferSize(Se);
|
|
1259
1142
|
this.setViewOffset(i.width, i.height);
|
|
1260
1143
|
}, this.needsSyncPostProcessing = !0;
|
|
1261
1144
|
}
|
|
@@ -1266,71 +1149,69 @@ class js extends G {
|
|
|
1266
1149
|
this.resolveRT.dispose(), this.historyRT.dispose(), this.previousDepthTexture?.dispose(), this.resolveMaterial.dispose(), this.copyMaterial.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
1267
1150
|
}
|
|
1268
1151
|
}
|
|
1269
|
-
const fo = (o) => (e, t, s, r) =>
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
r
|
|
1276
|
-
)
|
|
1152
|
+
const fo = (o) => (e, t, s, r) => new Ds(
|
|
1153
|
+
o,
|
|
1154
|
+
Le(e, "TemporalAntialiasNode.Input"),
|
|
1155
|
+
t,
|
|
1156
|
+
s,
|
|
1157
|
+
r
|
|
1277
1158
|
);
|
|
1278
1159
|
export {
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1160
|
+
Ee as DownsampleThresholdNode,
|
|
1161
|
+
K as FnLayout,
|
|
1162
|
+
G as FnVar,
|
|
1163
|
+
Oe as GaussianBlurNode,
|
|
1283
1164
|
ns as HighpVelocityNode,
|
|
1284
1165
|
is as KawaseBlurNode,
|
|
1285
1166
|
ys as LensFlareNode,
|
|
1286
1167
|
Jt as MipmapBlurNode,
|
|
1287
|
-
|
|
1168
|
+
We as MipmapSurfaceBlurNode,
|
|
1169
|
+
uo as Node,
|
|
1288
1170
|
Ss as OutputTexture3DNode,
|
|
1289
1171
|
qt as OutputTextureNode,
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1172
|
+
Ge as RTTextureNode,
|
|
1173
|
+
Ds as TemporalAntialiasNode,
|
|
1174
|
+
pe as cameraFar,
|
|
1175
|
+
de as cameraNear,
|
|
1176
|
+
Hs as cameraPositionWorld,
|
|
1177
|
+
Le as convertToTexture,
|
|
1178
|
+
qs as debugFragmentNode,
|
|
1179
|
+
Qs as debugNode,
|
|
1180
|
+
Zs as debugVertexNode,
|
|
1299
1181
|
go as depthToColor,
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1182
|
+
Ns as depthToViewZ,
|
|
1183
|
+
Xs as dithering,
|
|
1184
|
+
Ys as downsampleThreshold,
|
|
1185
|
+
eo as equirectGrid,
|
|
1304
1186
|
xo as equirectToDirectionWorld,
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1187
|
+
_s as gaussianBlur,
|
|
1188
|
+
to as highpVelocity,
|
|
1189
|
+
Ks as hookFunction,
|
|
1308
1190
|
rs as interleavedGradientNoise,
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1191
|
+
Ls as inverseProjectionMatrix,
|
|
1192
|
+
Ws as inverseViewMatrix,
|
|
1193
|
+
He as isWebGPU,
|
|
1194
|
+
so as kawaseBlur,
|
|
1195
|
+
ro as lensFlare,
|
|
1196
|
+
ye as logarithmicToPerspectiveDepth,
|
|
1197
|
+
Js as mipmapBlur,
|
|
1198
|
+
$e as mipmapBlurDownsample,
|
|
1317
1199
|
Kt as mipmapBlurUpsample,
|
|
1318
|
-
|
|
1200
|
+
oo as mipmapSurfaceBlur,
|
|
1319
1201
|
lo as node,
|
|
1320
|
-
|
|
1202
|
+
ke as outputTexture,
|
|
1321
1203
|
co as outputTexture3D,
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1204
|
+
po as perspectiveToLogarithmicDepth,
|
|
1205
|
+
Os as projectionMatrix,
|
|
1206
|
+
ao as rayEllipsoidIntersection,
|
|
1207
|
+
no as raySphereIntersection,
|
|
1208
|
+
io as raySpheresIntersections,
|
|
1327
1209
|
ws as raySpheresIntersectionsStruct,
|
|
1328
|
-
|
|
1210
|
+
ds as rtTexture,
|
|
1329
1211
|
mo as screenToPositionView,
|
|
1330
1212
|
fo as temporalAntialias,
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
Ls as viewMatrix
|
|
1213
|
+
ho as textureCatmullRom,
|
|
1214
|
+
Ms as turbo,
|
|
1215
|
+
Gs as viewMatrix
|
|
1335
1216
|
};
|
|
1336
1217
|
//# sourceMappingURL=webgpu.js.map
|