@takram/three-geospatial 0.6.0 → 0.7.1
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 +15 -1
- package/README.md +2 -0
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.js +318 -312
- 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 +13 -3
- package/build/shaders.cjs.map +1 -1
- package/build/shaders.js +15 -5
- package/build/shaders.js.map +1 -1
- package/build/webgpu.cjs +1 -1
- package/build/webgpu.cjs.map +1 -1
- package/build/webgpu.js +300 -300
- package/build/webgpu.js.map +1 -1
- package/package.json +2 -2
- package/src/decorators.ts +30 -10
- package/src/r3f/EastNorthUpFrame.tsx +2 -1
- package/src/r3f/EllipsoidMesh.tsx +4 -2
- package/src/shaders/depth.glsl +10 -0
- package/src/webgpu/KawaseBlurNode.ts +14 -12
- package/src/webgpu/MipmapBlurNode.ts +32 -23
- package/src/webgpu/MipmapSurfaceBlurNode.ts +26 -21
- package/types/decorators.d.ts +2 -2
package/build/webgpu.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Vector3 as qe, Mesh as J, Scene as Ze, Camera as Qe, RenderTarget as
|
|
2
|
-
import { reference as $, uniform as v, vec4 as w, positionGeometry as be, texture as I, uv as
|
|
1
|
+
import { Vector3 as qe, Mesh as J, Scene as Ze, Camera as Qe, RenderTarget as Se, RGBAFormat as Me, HalfFloatType as Re, LinearFilter as Z, Vector2 as z, 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 V, vec2 as p, add as N, luminance as tt, smoothstep as ze, Fn as C, screenCoordinate as Be, time as st, vec3 as y, equirectUV as ot, fwidth as nt, abs as Ve, positionLocal as rt, positionPrevious as it, sub as k, nodeImmutable as at, instancedArray as ue, storage as ut, uvec2 as Ce, If as F, globalId as X, Return as lt, atomicAdd as ct, instanceIndex as ht, mat3 as Pe, struct as oe, min as dt, mul as pt, fract as mt, distance as ft, mix as te, sqrt as Y, dot as Q, color as gt, mat4 as xt, mat2 as vt, bvec4 as yt, uvec4 as wt, ivec4 as Tt, bvec3 as Nt, uvec3 as St, ivec3 as Mt, bvec2 as Rt, ivec2 as T, bool as bt, uint as zt, int as H, float as ne, textureSize as Ae, viewZToLogarithmicDepth as Fe, logarithmicDepthToViewZ as De, perspectiveDepthToViewZ as je, orthographicDepthToViewZ as Bt, PI2 as Vt, PI as Ct, cos as le, sin as ce, viewZToPerspectiveDepth as Pt, screenUV as At, step as Ft, and as Dt, screenSize as jt, max as Ue, select as Ut } from "three/tsl";
|
|
3
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
|
|
5
|
-
import { i as
|
|
4
|
+
import { Q as re } from "./shared3.js";
|
|
5
|
+
import { i as x } from "./shared.js";
|
|
6
6
|
import { hash as Ie } from "three/src/nodes/core/NodeUtils.js";
|
|
7
7
|
let ee;
|
|
8
8
|
function D(o, e, t) {
|
|
@@ -47,7 +47,7 @@ async function ie(o, e) {
|
|
|
47
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
49
|
function qs(o, e) {
|
|
50
|
-
const t = new J(new
|
|
50
|
+
const t = new J(new re(), e);
|
|
51
51
|
ie(o, t).then((s) => {
|
|
52
52
|
console.log(s.fragmentShader);
|
|
53
53
|
}).finally(() => {
|
|
@@ -55,7 +55,7 @@ function qs(o, e) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
function Zs(o, e) {
|
|
58
|
-
const t = new J(new
|
|
58
|
+
const t = new J(new re(), e);
|
|
59
59
|
ie(o, t).then((s) => {
|
|
60
60
|
console.log(s.vertexShader);
|
|
61
61
|
}).finally(() => {
|
|
@@ -65,16 +65,16 @@ function Zs(o, e) {
|
|
|
65
65
|
function Qs(o, e) {
|
|
66
66
|
const t = new P();
|
|
67
67
|
t.vertexNode = w(be.xy, 0, 1), t.fragmentNode = e;
|
|
68
|
-
const s = new J(new
|
|
69
|
-
ie(o, s).then((
|
|
70
|
-
console.log(
|
|
68
|
+
const s = new J(new re(), t);
|
|
69
|
+
ie(o, s).then((n) => {
|
|
70
|
+
console.log(n.fragmentShader);
|
|
71
71
|
}).finally(() => {
|
|
72
72
|
t.dispose(), s.geometry.dispose();
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
function Ks(o, e, t) {
|
|
76
76
|
const s = o[e];
|
|
77
|
-
return o[e] = ((...
|
|
77
|
+
return o[e] = ((...n) => (t(...n), s.apply(o, n))), o;
|
|
78
78
|
}
|
|
79
79
|
class qt extends se {
|
|
80
80
|
static get type() {
|
|
@@ -99,17 +99,17 @@ class _ extends E {
|
|
|
99
99
|
return "FilterNode";
|
|
100
100
|
}
|
|
101
101
|
createRenderTarget(e) {
|
|
102
|
-
const t = new
|
|
102
|
+
const t = new Se(1, 1, {
|
|
103
103
|
depthBuffer: !1,
|
|
104
104
|
type: Re,
|
|
105
105
|
format: Me
|
|
106
106
|
}), s = t.texture;
|
|
107
107
|
s.minFilter = Z, s.magFilter = Z, s.generateMipmaps = !1;
|
|
108
|
-
const
|
|
109
|
-
return s.name = e != null ? `${
|
|
108
|
+
const n = this.constructor.type;
|
|
109
|
+
return s.name = e != null ? `${n}.${e}` : n, this.renderTargets.push(t), t;
|
|
110
110
|
}
|
|
111
111
|
getTextureNode() {
|
|
112
|
-
return
|
|
112
|
+
return x(
|
|
113
113
|
this.textureNode != null,
|
|
114
114
|
"outputTexture must be specified before getTextureNode() is called."
|
|
115
115
|
), this.textureNode;
|
|
@@ -122,10 +122,10 @@ class _ extends E {
|
|
|
122
122
|
}
|
|
123
123
|
setup(e) {
|
|
124
124
|
const { inputNode: t, textureNode: s } = this;
|
|
125
|
-
return
|
|
125
|
+
return x(
|
|
126
126
|
t != null,
|
|
127
127
|
"inputNode must be specified before being setup."
|
|
128
|
-
),
|
|
128
|
+
), x(
|
|
129
129
|
s != null,
|
|
130
130
|
"outputTexture must be specified before being setup."
|
|
131
131
|
), s.uvNode = t.uvNode, s;
|
|
@@ -139,17 +139,17 @@ class _ extends E {
|
|
|
139
139
|
const { resetRendererState: Zt, restoreRendererState: Qt } = O;
|
|
140
140
|
class ae extends _ {
|
|
141
141
|
constructor(e, t) {
|
|
142
|
-
super(e), this.downsampleRTs = [], this.upsampleRTs = [], this.downsampleMaterial = new P(), this.upsampleMaterial = new P(), this.mesh = new q(), this.inputTexelSize = v(new
|
|
142
|
+
super(e), this.downsampleRTs = [], this.upsampleRTs = [], this.downsampleMaterial = new P(), this.upsampleMaterial = new P(), this.mesh = new q(), this.inputTexelSize = v(new z()), this.downsampleNode = I();
|
|
143
143
|
for (let s = 0; s < t; ++s)
|
|
144
144
|
this.downsampleRTs[s] = this.createRenderTarget(`Downsample${s}`), s < t - 1 && (this.upsampleRTs[s] = this.createRenderTarget(`Upsample${s}`));
|
|
145
145
|
this.outputTexture = this.upsampleRTs[0].texture;
|
|
146
146
|
}
|
|
147
147
|
setSize(e, t) {
|
|
148
148
|
const { resolutionScale: s } = this;
|
|
149
|
-
let
|
|
149
|
+
let n = Math.max(Math.round(e * s), 1), r = Math.max(Math.round(t * s), 1);
|
|
150
150
|
const { downsampleRTs: i, upsampleRTs: u } = this;
|
|
151
151
|
for (let a = 0; a < i.length; ++a)
|
|
152
|
-
|
|
152
|
+
n = Math.max(Math.round(n / 2), 1), r = Math.max(Math.round(r / 2), 1), i[a].setSize(n, r), a < u.length && u[a].setSize(n, r);
|
|
153
153
|
return this;
|
|
154
154
|
}
|
|
155
155
|
updateBefore({ renderer: e }) {
|
|
@@ -158,32 +158,32 @@ class ae extends _ {
|
|
|
158
158
|
const {
|
|
159
159
|
downsampleRTs: t,
|
|
160
160
|
upsampleRTs: s,
|
|
161
|
-
mesh:
|
|
162
|
-
inputNode:
|
|
161
|
+
mesh: n,
|
|
162
|
+
inputNode: r,
|
|
163
163
|
inputTexelSize: i,
|
|
164
164
|
downsampleNode: u
|
|
165
165
|
} = this;
|
|
166
|
-
|
|
167
|
-
const { width: a, height: h } =
|
|
166
|
+
x(r != null);
|
|
167
|
+
const { width: a, height: h } = r.value;
|
|
168
168
|
this.setSize(a, h);
|
|
169
|
-
const c =
|
|
170
|
-
this.rendererState = Zt(e, this.rendererState),
|
|
169
|
+
const c = r.value;
|
|
170
|
+
this.rendererState = Zt(e, this.rendererState), n.material = this.downsampleMaterial;
|
|
171
171
|
for (const l of t) {
|
|
172
|
-
const { width: d, height: m } =
|
|
173
|
-
i.value.set(1 / d, 1 / m), e.setRenderTarget(l),
|
|
172
|
+
const { width: d, height: m } = r.value;
|
|
173
|
+
i.value.set(1 / d, 1 / m), e.setRenderTarget(l), n.render(e), r.value = l.texture;
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
n.material = this.upsampleMaterial;
|
|
176
176
|
for (let l = s.length - 1; l >= 0; --l) {
|
|
177
|
-
const d = s[l], { width: m, height:
|
|
178
|
-
i.value.set(1 / m, 1 /
|
|
177
|
+
const d = s[l], { width: m, height: f } = r.value;
|
|
178
|
+
i.value.set(1 / m, 1 / f), u.value = t[l].texture, e.setRenderTarget(d), n.render(e), r.value = d.texture;
|
|
179
179
|
}
|
|
180
|
-
Qt(e, this.rendererState),
|
|
180
|
+
Qt(e, this.rendererState), r.value = c;
|
|
181
181
|
}
|
|
182
182
|
setup(e) {
|
|
183
183
|
const { inputNode: t } = this;
|
|
184
|
-
|
|
185
|
-
const { downsampleMaterial: s, upsampleMaterial:
|
|
186
|
-
return s.fragmentNode = this.setupDownsampleNode(e),
|
|
184
|
+
x(t != null);
|
|
185
|
+
const { downsampleMaterial: s, upsampleMaterial: n } = this;
|
|
186
|
+
return s.fragmentNode = this.setupDownsampleNode(e), n.fragmentNode = this.setupUpsampleNode(e), s.needsUpdate = !0, n.needsUpdate = !0, super.setup(e);
|
|
187
187
|
}
|
|
188
188
|
dispose() {
|
|
189
189
|
for (const e of this.downsampleRTs)
|
|
@@ -194,39 +194,39 @@ class ae extends _ {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
const $e = (o, e) => {
|
|
197
|
-
const t =
|
|
198
|
-
return
|
|
199
|
-
|
|
197
|
+
const t = V(), s = w(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy).toVertexStage(), n = w(2, 2, -2, -2).mul(e.xyxy).add(t.xyxy).toVertexStage(), r = s.zy, i = s.xy, u = s.zw, a = s.xw, h = p(t.x, n.y), c = p(n.z, t.y), l = p(n.x, t.y), d = p(t.x, n.w), m = n.zy, f = n.xy, g = n.zw, R = n.xw;
|
|
198
|
+
return N(
|
|
199
|
+
N(
|
|
200
200
|
o.sample(t),
|
|
201
|
-
o.sample(
|
|
201
|
+
o.sample(r),
|
|
202
202
|
o.sample(i),
|
|
203
203
|
o.sample(u),
|
|
204
204
|
o.sample(a)
|
|
205
205
|
).mul(1 / 8),
|
|
206
|
-
|
|
206
|
+
N(
|
|
207
207
|
o.sample(h),
|
|
208
208
|
o.sample(c),
|
|
209
209
|
o.sample(l),
|
|
210
210
|
o.sample(d)
|
|
211
211
|
).mul(1 / 16),
|
|
212
|
-
|
|
212
|
+
N(
|
|
213
213
|
o.sample(m),
|
|
214
|
+
o.sample(f),
|
|
214
215
|
o.sample(g),
|
|
215
|
-
o.sample(x),
|
|
216
216
|
o.sample(R)
|
|
217
217
|
).mul(1 / 32)
|
|
218
218
|
);
|
|
219
219
|
}, Kt = (o, e) => {
|
|
220
|
-
const t =
|
|
221
|
-
return
|
|
220
|
+
const t = V(), s = w(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy).toVertexStage(), n = p(t.x, s.y), r = p(s.z, t.y), i = p(s.x, t.y), u = p(t.x, s.w), a = s.zy, h = s.xy, c = s.zw, l = s.xw;
|
|
221
|
+
return N(
|
|
222
222
|
o.sample(t).mul(0.25),
|
|
223
|
-
|
|
224
|
-
o.sample(r),
|
|
223
|
+
N(
|
|
225
224
|
o.sample(n),
|
|
225
|
+
o.sample(r),
|
|
226
226
|
o.sample(i),
|
|
227
227
|
o.sample(u)
|
|
228
228
|
).mul(0.125),
|
|
229
|
-
|
|
229
|
+
N(
|
|
230
230
|
o.sample(a),
|
|
231
231
|
o.sample(h),
|
|
232
232
|
o.sample(c),
|
|
@@ -242,32 +242,32 @@ class Jt extends ae {
|
|
|
242
242
|
super(e, t), this.resolutionScale = 0.5;
|
|
243
243
|
}
|
|
244
244
|
setupDownsampleNode(e) {
|
|
245
|
-
return
|
|
245
|
+
return x(this.inputNode != null), $e(this.inputNode, this.inputTexelSize);
|
|
246
246
|
}
|
|
247
247
|
setupUpsampleNode(e) {
|
|
248
|
-
return
|
|
248
|
+
return x(this.inputNode != null), Kt(this.inputNode, this.inputTexelSize);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
const Js = (...o) => new Jt(...o), { resetRendererState: Yt, restoreRendererState: _t } = O;
|
|
252
252
|
class Xt extends _ {
|
|
253
253
|
constructor(e) {
|
|
254
|
-
super(e), this.material = new P(), this.mesh = new q(this.material), this.inputTexelSize = v(new
|
|
254
|
+
super(e), this.material = new P(), this.mesh = new q(this.material), this.inputTexelSize = v(new z()), this.renderTarget = this.createRenderTarget(), this.outputTexture = this.renderTarget.texture;
|
|
255
255
|
}
|
|
256
256
|
setSize(e, t) {
|
|
257
|
-
const { resolutionScale: s } = this,
|
|
258
|
-
return this.renderTarget.setSize(
|
|
257
|
+
const { resolutionScale: s } = this, n = Math.max(Math.round(e * s), 1), r = Math.max(Math.round(t * s), 1);
|
|
258
|
+
return this.renderTarget.setSize(n, r), this;
|
|
259
259
|
}
|
|
260
260
|
updateBefore({ renderer: e }) {
|
|
261
261
|
if (e == null)
|
|
262
262
|
return;
|
|
263
263
|
const { inputNode: t } = this;
|
|
264
|
-
|
|
265
|
-
const { width: s, height:
|
|
266
|
-
this.setSize(s,
|
|
264
|
+
x(t != null);
|
|
265
|
+
const { width: s, height: n } = t.value;
|
|
266
|
+
this.setSize(s, n), this.inputTexelSize.value.set(1 / s, 1 / n), this.rendererState = Yt(e, this.rendererState), e.setRenderTarget(this.renderTarget), this.mesh.render(e), _t(e, this.rendererState);
|
|
267
267
|
}
|
|
268
268
|
setup(e) {
|
|
269
269
|
const { inputNode: t } = this;
|
|
270
|
-
|
|
270
|
+
x(t != null);
|
|
271
271
|
const { material: s } = this;
|
|
272
272
|
return s.fragmentNode = this.setupOutputNode(e), s.needsUpdate = !0, super.setup(e);
|
|
273
273
|
}
|
|
@@ -283,14 +283,14 @@ class Ee extends Xt {
|
|
|
283
283
|
return "DownsampleThresholdNode";
|
|
284
284
|
}
|
|
285
285
|
setupOutputNode() {
|
|
286
|
-
const { inputNode: e, thresholdLevel: t, thresholdRange: s, inputTexelSize:
|
|
287
|
-
|
|
288
|
-
const
|
|
286
|
+
const { inputNode: e, thresholdLevel: t, thresholdRange: s, inputTexelSize: n } = this;
|
|
287
|
+
x(e != null);
|
|
288
|
+
const r = $e(e, n), i = tt(r.rgb), u = ze(
|
|
289
289
|
t,
|
|
290
290
|
t.add(s),
|
|
291
291
|
i
|
|
292
292
|
);
|
|
293
|
-
return w(
|
|
293
|
+
return w(r.rgb, i).mul(u);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
const Ys = (...o) => new Ee(...o);
|
|
@@ -323,28 +323,28 @@ function G(o) {
|
|
|
323
323
|
const { resetRendererState: es, restoreRendererState: ts } = O;
|
|
324
324
|
class ss extends _ {
|
|
325
325
|
constructor(e) {
|
|
326
|
-
super(e), this.iterations = 1, this.material = new P(), this.mesh = new q(this.material), this.inputTexelSize = v(new
|
|
326
|
+
super(e), this.iterations = 1, this.material = new P(), this.mesh = new q(this.material), this.inputTexelSize = v(new z()), this.direction = v(new z()), this.horizontalRT = this.createRenderTarget("Horizontal"), this.verticalRT = this.createRenderTarget("Vertical"), this.outputTexture = this.verticalRT.texture;
|
|
327
327
|
}
|
|
328
328
|
setSize(e, t) {
|
|
329
|
-
const { resolutionScale: s } = this,
|
|
330
|
-
return this.horizontalRT.setSize(
|
|
329
|
+
const { resolutionScale: s } = this, n = Math.max(Math.round(e * s), 1), r = Math.max(Math.round(t * s), 1);
|
|
330
|
+
return this.horizontalRT.setSize(n, r), this.verticalRT.setSize(n, r), this;
|
|
331
331
|
}
|
|
332
332
|
updateBefore({ renderer: e }) {
|
|
333
333
|
if (e == null)
|
|
334
334
|
return;
|
|
335
|
-
const { horizontalRT: t, verticalRT: s, mesh:
|
|
336
|
-
|
|
337
|
-
const { width: u, height: a } =
|
|
335
|
+
const { horizontalRT: t, verticalRT: s, mesh: n, inputNode: r, direction: i } = this;
|
|
336
|
+
x(r != null);
|
|
337
|
+
const { width: u, height: a } = r.value;
|
|
338
338
|
this.setSize(u, a), this.inputTexelSize.value.set(1 / u, 1 / a);
|
|
339
|
-
const h =
|
|
339
|
+
const h = r.value;
|
|
340
340
|
this.rendererState = es(e, this.rendererState);
|
|
341
341
|
for (let c = 0; c < this.iterations; ++c)
|
|
342
|
-
i.value.set(1, 0), e.setRenderTarget(t),
|
|
343
|
-
ts(e, this.rendererState),
|
|
342
|
+
i.value.set(1, 0), e.setRenderTarget(t), n.render(e), r.value = t.texture, i.value.set(0, 1), e.setRenderTarget(s), n.render(e), r.value = s.texture;
|
|
343
|
+
ts(e, this.rendererState), r.value = h;
|
|
344
344
|
}
|
|
345
345
|
setup(e) {
|
|
346
346
|
const { inputNode: t } = this;
|
|
347
|
-
|
|
347
|
+
x(t != null);
|
|
348
348
|
const { material: s } = this;
|
|
349
349
|
return s.fragmentNode = this.setupOutputNode(e), s.needsUpdate = !0, super.setup(e);
|
|
350
350
|
}
|
|
@@ -352,26 +352,26 @@ class ss extends _ {
|
|
|
352
352
|
this.horizontalRT.dispose(), this.verticalRT.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
function
|
|
356
|
-
if (
|
|
355
|
+
function fe(o) {
|
|
356
|
+
if (x(o >= 0), o === 0)
|
|
357
357
|
return new Float64Array(0);
|
|
358
358
|
if (o === 1)
|
|
359
359
|
return new Float64Array([1]);
|
|
360
360
|
let e = new Float64Array(o), t = new Float64Array(o), s = t;
|
|
361
|
-
for (let
|
|
362
|
-
for (let
|
|
363
|
-
t[
|
|
361
|
+
for (let n = 1; n <= o; ++n) {
|
|
362
|
+
for (let r = 0; r < n; ++r)
|
|
363
|
+
t[r] = r === 0 || r === n - 1 ? 1 : e[r - 1] + e[r];
|
|
364
364
|
s = t, t = e, e = s;
|
|
365
365
|
}
|
|
366
366
|
return s;
|
|
367
367
|
}
|
|
368
368
|
function os(o, e = 2) {
|
|
369
|
-
|
|
370
|
-
const t = o + e * 2, s = e > 0 ?
|
|
371
|
-
a[0] = i[0] /
|
|
369
|
+
x(o >= 3);
|
|
370
|
+
const t = o + e * 2, s = e > 0 ? fe(t).slice(e, -e) : fe(t), n = Math.floor((s.length - 1) / 2), r = s.reduce((l, d) => l + d, 0), i = s.slice(n), u = [...Array(n + 1).keys()], a = new Float64Array(Math.floor(u.length / 2)), h = new Float64Array(a.length);
|
|
371
|
+
a[0] = i[0] / r;
|
|
372
372
|
for (let l = 1, d = 1; l < u.length - 1; l += 2, ++d) {
|
|
373
|
-
const m = u[l],
|
|
374
|
-
a[d] =
|
|
373
|
+
const m = u[l], f = u[l + 1], g = i[l], R = i[l + 1], S = g + R, B = (m * g + f * R) / S;
|
|
374
|
+
a[d] = S / r, h[d] = B;
|
|
375
375
|
}
|
|
376
376
|
const c = (a.reduce((l, d) => l + d, 0) - a[0] * 0.5) * 2;
|
|
377
377
|
if (c !== 0) {
|
|
@@ -392,15 +392,15 @@ class Oe extends ss {
|
|
|
392
392
|
super(e), this.kernelSize = t;
|
|
393
393
|
}
|
|
394
394
|
setupOutputNode(e) {
|
|
395
|
-
const { inputNode: t, inputTexelSize: s, direction:
|
|
396
|
-
|
|
397
|
-
const { offsets:
|
|
395
|
+
const { inputNode: t, inputTexelSize: s, direction: n } = this;
|
|
396
|
+
x(t != null);
|
|
397
|
+
const { offsets: r, weights: i } = os(this.kernelSize);
|
|
398
398
|
return C(() => {
|
|
399
|
-
const u =
|
|
400
|
-
for (let c = 1; c <
|
|
401
|
-
const l = a.mul(
|
|
399
|
+
const u = V(), a = n.mul(s).toVertexStage(), h = t.sample(u).mul(i[0]);
|
|
400
|
+
for (let c = 1; c < r.length; ++c) {
|
|
401
|
+
const l = a.mul(r[c]);
|
|
402
402
|
h.addAssign(
|
|
403
|
-
|
|
403
|
+
N(
|
|
404
404
|
t.sample(u.add(l)),
|
|
405
405
|
t.sample(u.sub(l))
|
|
406
406
|
).mul(i[c])
|
|
@@ -410,14 +410,14 @@ class Oe extends ss {
|
|
|
410
410
|
})();
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
const _s = (...o) => new Oe(...o),
|
|
414
|
-
const o = p(
|
|
413
|
+
const _s = (...o) => new Oe(...o), ns = (o) => o.dot(p(0.06711056, 583715e-8)).fract().mul(52.9829189).fract(), Xs = /* @__PURE__ */ C(() => {
|
|
414
|
+
const o = p(Be.xy).add(st.fract().mul(1337)), e = ns(o);
|
|
415
415
|
return y(e, e.oneMinus(), e).sub(0.5).div(255);
|
|
416
416
|
}).once()(), eo = (o, e, t = p(90, 45)) => {
|
|
417
|
-
const s = ot(o),
|
|
417
|
+
const s = ot(o), n = nt(s), r = e.mul(n).mul(0.5), i = Ve(s.mul(t).fract().sub(0.5)).div(t), u = ze(r, r.add(n), i).oneMinus();
|
|
418
418
|
return u.x.add(u.y).clamp(0, 1);
|
|
419
419
|
};
|
|
420
|
-
class
|
|
420
|
+
class rs extends E {
|
|
421
421
|
constructor() {
|
|
422
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
423
|
}
|
|
@@ -431,8 +431,8 @@ class ns extends E {
|
|
|
431
431
|
const {
|
|
432
432
|
currentProjectionMatrix: t,
|
|
433
433
|
previousProjectionMatrix: s
|
|
434
|
-
} = this,
|
|
435
|
-
s.value == null ? s.value = new W().copy(
|
|
434
|
+
} = this, n = this.projectionMatrix ?? e.projectionMatrix;
|
|
435
|
+
s.value == null ? s.value = new W().copy(n) : s.value.copy(t.value), t.value.copy(n);
|
|
436
436
|
}
|
|
437
437
|
// Executed once per object before rendering:
|
|
438
438
|
updateBefore({ object: e, camera: t }) {
|
|
@@ -440,13 +440,13 @@ class ns extends E {
|
|
|
440
440
|
return;
|
|
441
441
|
const {
|
|
442
442
|
currentModelViewMatrix: s,
|
|
443
|
-
previousModelViewMatrix:
|
|
444
|
-
objectModelViewMatrices:
|
|
443
|
+
previousModelViewMatrix: n,
|
|
444
|
+
objectModelViewMatrices: r
|
|
445
445
|
} = this;
|
|
446
446
|
s.value.multiplyMatrices(
|
|
447
447
|
t.matrixWorldInverse,
|
|
448
448
|
e.matrixWorld
|
|
449
|
-
),
|
|
449
|
+
), n.value = r.get(e) ?? s.value;
|
|
450
450
|
}
|
|
451
451
|
// Executed once per object after rendering:
|
|
452
452
|
updateAfter({ object: e }) {
|
|
@@ -456,15 +456,15 @@ class ns extends E {
|
|
|
456
456
|
currentModelViewMatrix: t,
|
|
457
457
|
objectModelViewMatrices: s
|
|
458
458
|
} = this;
|
|
459
|
-
let
|
|
460
|
-
|
|
459
|
+
let n = s.get(e);
|
|
460
|
+
n == null && (n = new W(), s.set(e, n)), n.copy(t.value);
|
|
461
461
|
}
|
|
462
462
|
setup(e) {
|
|
463
|
-
const t = this.currentProjectionMatrix.mul(this.currentModelViewMatrix).mul(
|
|
464
|
-
return k(
|
|
463
|
+
const t = this.currentProjectionMatrix.mul(this.currentModelViewMatrix).mul(rt).toVertexStage(), s = this.previousProjectionMatrix.mul(this.previousModelViewMatrix).mul(it).toVertexStage(), n = t.xyz.div(t.w), r = s.xyz.div(s.w);
|
|
464
|
+
return k(n, r);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
const to = /* @__PURE__ */
|
|
467
|
+
const to = /* @__PURE__ */ at(rs);
|
|
468
468
|
class is extends ae {
|
|
469
469
|
static get type() {
|
|
470
470
|
return "KawaseBlurNode";
|
|
@@ -474,10 +474,10 @@ class is extends ae {
|
|
|
474
474
|
}
|
|
475
475
|
setupDownsampleNode(e) {
|
|
476
476
|
const { inputNode: t, inputTexelSize: s } = this;
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
return
|
|
480
|
-
t.sample(
|
|
477
|
+
x(t != null);
|
|
478
|
+
const n = V(), r = w(1, 1, -1, -1).mul(s.xyxy.mul(0.5)).add(n.xyxy).toVertexStage(), i = r.zy, u = r.xy, a = r.xw, h = r.zw;
|
|
479
|
+
return N(
|
|
480
|
+
t.sample(n).mul(4),
|
|
481
481
|
t.sample(i),
|
|
482
482
|
t.sample(u),
|
|
483
483
|
t.sample(a),
|
|
@@ -486,16 +486,16 @@ class is extends ae {
|
|
|
486
486
|
}
|
|
487
487
|
setupUpsampleNode(e) {
|
|
488
488
|
const { inputNode: t, inputTexelSize: s } = this;
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
return
|
|
492
|
-
|
|
489
|
+
x(t != null);
|
|
490
|
+
const n = V(), r = w(1, 1, -1, -1).mul(s.xyxy.mul(0.5)).add(n.xyxy).toVertexStage(), i = r.zy, u = r.xy, a = r.xw, h = r.zw, c = p(r.z, n.y), l = p(r.x, n.y), d = p(n.x, r.y), m = p(n.x, r.w);
|
|
491
|
+
return N(
|
|
492
|
+
N(
|
|
493
493
|
t.sample(i),
|
|
494
494
|
t.sample(u),
|
|
495
495
|
t.sample(a),
|
|
496
496
|
t.sample(h)
|
|
497
497
|
).mul(1 / 12),
|
|
498
|
-
|
|
498
|
+
N(
|
|
499
499
|
t.sample(c),
|
|
500
500
|
t.sample(l),
|
|
501
501
|
t.sample(d),
|
|
@@ -514,8 +514,8 @@ class as extends E {
|
|
|
514
514
|
}
|
|
515
515
|
setup(e) {
|
|
516
516
|
const { inputNode: t, intensity: s } = this;
|
|
517
|
-
|
|
518
|
-
const
|
|
517
|
+
x(t != null);
|
|
518
|
+
const n = K({
|
|
519
519
|
name: "sampleGhost",
|
|
520
520
|
type: "vec3",
|
|
521
521
|
inputs: [
|
|
@@ -525,19 +525,19 @@ class as extends E {
|
|
|
525
525
|
{ name: "offset", type: "float" }
|
|
526
526
|
]
|
|
527
527
|
})(([a, h, c, l]) => {
|
|
528
|
-
const d = h.mul(l).add(a.oneMinus()).saturate(), m = t.sample(d).rgb.mul(c),
|
|
529
|
-
return m.mulAssign(
|
|
530
|
-
}),
|
|
531
|
-
return
|
|
532
|
-
r
|
|
533
|
-
r
|
|
534
|
-
r
|
|
535
|
-
r
|
|
536
|
-
r
|
|
537
|
-
r
|
|
538
|
-
r
|
|
539
|
-
r
|
|
540
|
-
r
|
|
528
|
+
const d = h.mul(l).add(a.oneMinus()).saturate(), m = t.sample(d).rgb.mul(c), f = k(0.5, d).length().mul(1 / (Math.SQRT2 / 4)).saturate();
|
|
529
|
+
return m.mulAssign(f.oneMinus().pow(3)), m;
|
|
530
|
+
}), r = V(), i = r.sub(0.5);
|
|
531
|
+
return N(
|
|
532
|
+
n(r, i, y(0.8, 0.8, 1), -5),
|
|
533
|
+
n(r, i, y(1, 0.8, 0.4), -1.5),
|
|
534
|
+
n(r, i, y(0.9, 1, 0.8), -0.4),
|
|
535
|
+
n(r, i, y(1, 0.8, 0.4), -0.2),
|
|
536
|
+
n(r, i, y(0.9, 0.7, 0.7), -0.1),
|
|
537
|
+
n(r, i, y(0.5, 1, 0.4), 0.7),
|
|
538
|
+
n(r, i, y(0.5, 0.5, 0.5), 1),
|
|
539
|
+
n(r, i, y(1, 1, 0.6), 2.5),
|
|
540
|
+
n(r, i, y(0.5, 0.8, 1), 10)
|
|
541
541
|
).mul(s);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
@@ -554,14 +554,14 @@ const hs = /* @__PURE__ */ new It();
|
|
|
554
554
|
class Ge extends se {
|
|
555
555
|
constructor(e, t) {
|
|
556
556
|
const s = cs();
|
|
557
|
-
super(s.texture, t ??
|
|
557
|
+
super(s.texture, t ?? V()), this.resolutionScale = 1, this.material = new P(), this.mesh = new q(this.material), this.node = e, this.renderTarget = s, this.updateBeforeType = A.FRAME;
|
|
558
558
|
}
|
|
559
559
|
static get type() {
|
|
560
560
|
return "RTTextureNode";
|
|
561
561
|
}
|
|
562
562
|
setSize(e, t) {
|
|
563
|
-
const { resolutionScale: s } = this,
|
|
564
|
-
return this.renderTarget.setSize(
|
|
563
|
+
const { resolutionScale: s } = this, n = Math.max(Math.round(e * s), 1), r = Math.max(Math.round(t * s), 1);
|
|
564
|
+
return this.renderTarget.setSize(n, r), this;
|
|
565
565
|
}
|
|
566
566
|
updateBefore({ renderer: e }) {
|
|
567
567
|
if (e == null)
|
|
@@ -586,15 +586,15 @@ const ds = (...o) => new Ge(...o), Le = (o, e) => {
|
|
|
586
586
|
let t;
|
|
587
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
588
|
}, { resetRendererState: ps, restoreRendererState: ms } = O;
|
|
589
|
-
function
|
|
589
|
+
function fs() {
|
|
590
590
|
const s = document.createElement("canvas");
|
|
591
591
|
s.width = 256, s.height = 32;
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
const
|
|
595
|
-
return
|
|
592
|
+
const n = s.getContext("2d");
|
|
593
|
+
x(n != null), n.beginPath(), n.moveTo(0, 32 / 2), n.lineTo(256 / 2, 5), n.lineTo(256, 32 / 2), n.lineTo(256 / 2, 27), n.closePath();
|
|
594
|
+
const r = n.createLinearGradient(0, 0, 256, 0);
|
|
595
|
+
return r.addColorStop(0, "#000000"), r.addColorStop(0.5, "#ffffff"), r.addColorStop(1, "#000000"), n.fillStyle = r, n.fill(), new Xe(s);
|
|
596
596
|
}
|
|
597
|
-
const
|
|
597
|
+
const ge = /* @__PURE__ */ oe({
|
|
598
598
|
color: "vec3",
|
|
599
599
|
luminance: "float",
|
|
600
600
|
position: "vec2",
|
|
@@ -602,37 +602,37 @@ const xe = /* @__PURE__ */ oe({
|
|
|
602
602
|
sin: "float",
|
|
603
603
|
cos: "float"
|
|
604
604
|
});
|
|
605
|
-
class
|
|
605
|
+
class gs extends _ {
|
|
606
606
|
constructor(e) {
|
|
607
|
-
super(e), this.spikePairCount = 6, this.wireframe = !1, this.intensity = v(1e-5), this.sizeScale = v(new
|
|
607
|
+
super(e), this.spikePairCount = 6, this.wireframe = !1, this.intensity = v(1e-5), this.sizeScale = v(new z(1.5, 0.01)), this.luminanceThreshold = v(100), this.counterBuffer = new Ot(1, 1), this.instanceBuffer = ue(1, ge), this.renderTarget = this.createRenderTarget(), this.material = new Gt({
|
|
608
608
|
depthTest: !1,
|
|
609
609
|
depthWrite: !1,
|
|
610
610
|
transparent: !0,
|
|
611
611
|
blending: Ke
|
|
612
|
-
}), this.mesh = new J(new Je(1, 1), this.material), this.camera = new Ye(), this.inputTexelSize = v(new
|
|
612
|
+
}), this.mesh = new J(new Je(1, 1), this.material), this.camera = new Ye(), this.inputTexelSize = v(new z()), this.outputTexelSize = v(new z()), this.geometryRatio = v(new z()), this.inputNode = e, this.resolutionScale = 0.5, this.outputTexture = this.renderTarget.texture;
|
|
613
613
|
}
|
|
614
614
|
customCacheKey() {
|
|
615
615
|
return Ie(this.spikePairCount, +this.wireframe);
|
|
616
616
|
}
|
|
617
617
|
setSize(e, t) {
|
|
618
|
-
const { resolutionScale: s } = this,
|
|
619
|
-
this.renderTarget.setSize(
|
|
620
|
-
const i = Math.floor(
|
|
621
|
-
return this.instanceBuffer.bufferCount < a && (this.instanceBuffer.dispose(), this.instanceBuffer = ue(a,
|
|
618
|
+
const { resolutionScale: s } = this, n = Math.max(Math.round(e * s), 1), r = Math.max(Math.round(t * s), 1);
|
|
619
|
+
this.renderTarget.setSize(n, r);
|
|
620
|
+
const i = Math.floor(n / 2), u = Math.floor(r / 2), a = i * u;
|
|
621
|
+
return this.instanceBuffer.bufferCount < a && (this.instanceBuffer.dispose(), this.instanceBuffer = ue(a, ge), this.setupCompute(i, u), this.setupMaterial()), this;
|
|
622
622
|
}
|
|
623
623
|
updateBefore({ renderer: e }) {
|
|
624
624
|
if (e == null)
|
|
625
625
|
return;
|
|
626
626
|
const { inputNode: t } = this;
|
|
627
|
-
|
|
628
|
-
const { width: s, height:
|
|
629
|
-
this.setSize(s,
|
|
630
|
-
const { computeNode:
|
|
631
|
-
|
|
632
|
-
const a = s /
|
|
627
|
+
x(t != null);
|
|
628
|
+
const { width: s, height: n } = t.value;
|
|
629
|
+
this.setSize(s, n);
|
|
630
|
+
const { computeNode: r, counterBuffer: i, renderTarget: u } = this;
|
|
631
|
+
x(r != null), this.inputTexelSize.value.set(1 / s, 1 / n);
|
|
632
|
+
const a = s / n;
|
|
633
633
|
a > 1 ? this.geometryRatio.value.set(1 / a, 1) : this.geometryRatio.value.set(1, a);
|
|
634
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(
|
|
635
|
+
this.outputTexelSize.value.set(1 / h, 1 / c), i.array[0] = 0, i.needsUpdate = !0, e.compute(r), e.getArrayBufferAsync(i).then((l) => {
|
|
636
636
|
this.mesh.count = new Uint32Array(l)[0];
|
|
637
637
|
}).catch((l) => {
|
|
638
638
|
console.error(l);
|
|
@@ -641,30 +641,30 @@ class xs extends _ {
|
|
|
641
641
|
setupCompute(e, t) {
|
|
642
642
|
const {
|
|
643
643
|
spikePairCount: s,
|
|
644
|
-
inputNode:
|
|
645
|
-
counterBuffer:
|
|
644
|
+
inputNode: n,
|
|
645
|
+
counterBuffer: r,
|
|
646
646
|
instanceBuffer: i,
|
|
647
647
|
outputTexelSize: u
|
|
648
648
|
} = this;
|
|
649
|
-
|
|
649
|
+
x(n != null);
|
|
650
650
|
const a = ut(
|
|
651
|
-
|
|
651
|
+
r,
|
|
652
652
|
"uint",
|
|
653
|
-
|
|
653
|
+
r.count
|
|
654
654
|
).toAtomic();
|
|
655
655
|
this.computeNode = C(() => {
|
|
656
656
|
const h = Ce(e, t);
|
|
657
657
|
F(X.xy.greaterThanEqual(h).any(), () => {
|
|
658
658
|
lt();
|
|
659
659
|
});
|
|
660
|
-
const c = p(X.xy).mul(u).mul(2), l =
|
|
660
|
+
const c = p(X.xy).mul(u).mul(2), l = n.sample(c), d = l.a;
|
|
661
661
|
F(d.greaterThan(0.1), () => {
|
|
662
662
|
const m = ct(a.element(0), s);
|
|
663
|
-
for (let
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
const R = Math.PI * (3 - Math.sqrt(5)),
|
|
667
|
-
|
|
663
|
+
for (let f = 0; f < s; ++f) {
|
|
664
|
+
const g = i.element(m.add(f));
|
|
665
|
+
g.get("color").assign(l.rgb), g.get("luminance").assign(d), g.get("position").assign(X.xy), g.get("scale").assign(f % 2 === 0 ? 1 : 0.5);
|
|
666
|
+
const R = Math.PI * (3 - Math.sqrt(5)), S = Math.PI / s * f + R;
|
|
667
|
+
g.get("sin").assign(Math.sin(S)), g.get("cos").assign(Math.cos(S));
|
|
668
668
|
}
|
|
669
669
|
});
|
|
670
670
|
})().compute(
|
|
@@ -678,27 +678,27 @@ class xs extends _ {
|
|
|
678
678
|
inputNode: e,
|
|
679
679
|
spikeNode: t,
|
|
680
680
|
instanceBuffer: s,
|
|
681
|
-
luminanceThreshold:
|
|
682
|
-
intensity:
|
|
681
|
+
luminanceThreshold: n,
|
|
682
|
+
intensity: r,
|
|
683
683
|
sizeScale: i,
|
|
684
684
|
outputTexelSize: u,
|
|
685
685
|
geometryRatio: a
|
|
686
686
|
} = this;
|
|
687
|
-
|
|
687
|
+
x(e != null), x(t != null);
|
|
688
688
|
const h = s.element(ht);
|
|
689
|
-
this.material.colorNode = this.wireframe ? w(1) : t.mul(h.get("color").mul(
|
|
690
|
-
const c = h.get("sin"), l = h.get("cos"), d = Pe(l, c, 0, c.negate(), l, 0, 0, 0, 1),
|
|
689
|
+
this.material.colorNode = this.wireframe ? w(1) : t.mul(h.get("color").mul(r)), 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), f = h.get("position").mul(u).mul(2), g = f.flipY().mul(2).sub(1), S = h.get("luminance").div(n).saturate(), B = p(S, 1).mul(
|
|
691
691
|
h.get("scale"),
|
|
692
692
|
i,
|
|
693
693
|
// Make the spike to shrink at screen borders:
|
|
694
|
-
|
|
695
|
-
), L = d.mul(be.mul(w(
|
|
694
|
+
f.sub(0.5).length().mul(2).oneMinus().mul(0.5).add(0.5)
|
|
695
|
+
), L = d.mul(be.mul(w(B, 1, 1))).mul(a).add(y(g, 0));
|
|
696
696
|
return w(L, 1);
|
|
697
697
|
})(), this.material.wireframe = this.wireframe, this.material.needsUpdate = !0;
|
|
698
698
|
}
|
|
699
699
|
setup(e) {
|
|
700
700
|
if (this.spikeNode == null) {
|
|
701
|
-
const t =
|
|
701
|
+
const t = fs();
|
|
702
702
|
t.colorSpace = _e, this.spikeNode = I(t);
|
|
703
703
|
}
|
|
704
704
|
return this.setupMaterial(), super.setup(e);
|
|
@@ -707,7 +707,7 @@ class xs extends _ {
|
|
|
707
707
|
this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
|
-
const
|
|
710
|
+
const xs = /* @__PURE__ */ new z();
|
|
711
711
|
class vs extends E {
|
|
712
712
|
constructor(e) {
|
|
713
713
|
super("vec3"), this.intensity = v(1e-5), this.chromaticAberration = v(5e-3), this.aspectRatio = v(0), this.inputNode = e, this.updateBeforeType = A.FRAME;
|
|
@@ -718,12 +718,12 @@ class vs extends E {
|
|
|
718
718
|
updateBefore({ renderer: e }) {
|
|
719
719
|
if (e == null)
|
|
720
720
|
return;
|
|
721
|
-
const { width: t, height: s } = e.getDrawingBufferSize(
|
|
721
|
+
const { width: t, height: s } = e.getDrawingBufferSize(xs);
|
|
722
722
|
this.aspectRatio.value = t / s;
|
|
723
723
|
}
|
|
724
724
|
setup(e) {
|
|
725
|
-
const { inputNode: t, intensity: s, chromaticAberration:
|
|
726
|
-
|
|
725
|
+
const { inputNode: t, intensity: s, chromaticAberration: n, aspectRatio: r } = this;
|
|
726
|
+
x(t != null);
|
|
727
727
|
const i = K({
|
|
728
728
|
name: "cubicRingMask",
|
|
729
729
|
type: "float",
|
|
@@ -733,7 +733,7 @@ class vs extends E {
|
|
|
733
733
|
{ name: "thickness", type: "float" }
|
|
734
734
|
]
|
|
735
735
|
})(([c, l, d]) => {
|
|
736
|
-
const m = dt(
|
|
736
|
+
const m = dt(Ve(c.sub(l)).div(d), 1);
|
|
737
737
|
return pt(m, m, k(3, m.mul(2))).oneMinus();
|
|
738
738
|
}), u = K({
|
|
739
739
|
name: "sampleHalo",
|
|
@@ -743,13 +743,13 @@ class vs extends E {
|
|
|
743
743
|
{ name: "radius", type: "float" }
|
|
744
744
|
]
|
|
745
745
|
})(([c, l]) => {
|
|
746
|
-
const d = p(
|
|
747
|
-
t.sample(m.mul(
|
|
748
|
-
t.sample(m.mul(
|
|
749
|
-
t.sample(m.mul(
|
|
750
|
-
),
|
|
751
|
-
return R.mulAssign(i(
|
|
752
|
-
}), a =
|
|
746
|
+
const d = p(r, 1), m = c.sub(0.5).mul(d).normalize().div(d), f = y(n).mul(y(-1, 0, 1)), g = mt(m.mul(l).add(c.oneMinus())), R = y(
|
|
747
|
+
t.sample(m.mul(f.r).add(g)).r,
|
|
748
|
+
t.sample(m.mul(f.g).add(g)).g,
|
|
749
|
+
t.sample(m.mul(f.b).add(g)).b
|
|
750
|
+
), S = c.sub(p(0.5, 0)).mul(d).add(p(0.5, 0)), B = ft(S, p(0.5)).saturate();
|
|
751
|
+
return R.mulAssign(i(B, 0.45, 0.25)), R;
|
|
752
|
+
}), a = V();
|
|
753
753
|
return u(a, 0.3).mul(s);
|
|
754
754
|
}
|
|
755
755
|
}
|
|
@@ -763,8 +763,8 @@ class We extends ae {
|
|
|
763
763
|
}
|
|
764
764
|
setupDownsampleNode(e) {
|
|
765
765
|
const { inputNode: t, inputTexelSize: s } = this;
|
|
766
|
-
return
|
|
767
|
-
const
|
|
766
|
+
return x(t != null), C(() => {
|
|
767
|
+
const n = V(), r = w(1, 1, -1, -1).mul(s.xyxy).add(n.xyxy).toVertexStage(), i = w(2, 2, -2, -2).mul(s.xyxy).add(n.xyxy).toVertexStage(), u = r.zy, a = r.xy, h = r.zw, c = r.xw, l = i.zy, d = i.xy, m = i.zw, f = i.xw, g = p(n.x, i.y), R = p(i.z, n.y), S = p(i.x, n.y), B = p(n.x, i.w), L = 1 / 4 / 2, j = 1 / 9 / 2, U = t.sample(n).mul(j);
|
|
768
768
|
let M;
|
|
769
769
|
return M = w(
|
|
770
770
|
b(u),
|
|
@@ -780,44 +780,44 @@ class We extends ae {
|
|
|
780
780
|
b(l),
|
|
781
781
|
b(d),
|
|
782
782
|
b(m),
|
|
783
|
-
b(
|
|
783
|
+
b(f)
|
|
784
784
|
).mul(j), U.addAssign(
|
|
785
785
|
t.sample(l).mul(M.x),
|
|
786
786
|
t.sample(d).mul(M.y),
|
|
787
787
|
t.sample(m).mul(M.z),
|
|
788
|
-
t.sample(
|
|
788
|
+
t.sample(f).mul(M.w)
|
|
789
789
|
), M = w(
|
|
790
|
-
b(
|
|
790
|
+
b(g),
|
|
791
791
|
b(R),
|
|
792
|
-
b(
|
|
793
|
-
b(
|
|
792
|
+
b(S),
|
|
793
|
+
b(B)
|
|
794
794
|
).mul(j), U.addAssign(
|
|
795
|
-
t.sample(
|
|
795
|
+
t.sample(g).mul(M.x),
|
|
796
796
|
t.sample(R).mul(M.y),
|
|
797
|
-
t.sample(
|
|
798
|
-
t.sample(
|
|
797
|
+
t.sample(S).mul(M.z),
|
|
798
|
+
t.sample(B).mul(M.w)
|
|
799
799
|
), U;
|
|
800
800
|
})();
|
|
801
801
|
}
|
|
802
802
|
setupUpsampleNode(e) {
|
|
803
|
-
const { inputNode: t, inputTexelSize: s, downsampleNode:
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
t.sample(
|
|
807
|
-
|
|
803
|
+
const { inputNode: t, inputTexelSize: s, downsampleNode: n } = this;
|
|
804
|
+
x(t != null);
|
|
805
|
+
const r = V(), i = w(1, 1, -1, -1).mul(s.xyxy).add(r.xyxy).toVertexStage(), u = p(r.x, i.y), a = p(i.z, r.y), h = p(i.x, r.y), c = p(r.x, i.w), l = i.zy, d = i.xy, m = i.zw, f = i.xw, g = N(
|
|
806
|
+
t.sample(r).mul(1 / 4),
|
|
807
|
+
N(
|
|
808
808
|
t.sample(u),
|
|
809
809
|
t.sample(a),
|
|
810
810
|
t.sample(h),
|
|
811
811
|
t.sample(c)
|
|
812
812
|
).mul(1 / 8),
|
|
813
|
-
|
|
813
|
+
N(
|
|
814
814
|
t.sample(l),
|
|
815
815
|
t.sample(d),
|
|
816
816
|
t.sample(m),
|
|
817
|
-
t.sample(
|
|
817
|
+
t.sample(f)
|
|
818
818
|
).mul(1 / 16)
|
|
819
819
|
);
|
|
820
|
-
return te(
|
|
820
|
+
return te(n.sample(r), g, this.blendAmount);
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
823
|
const oo = (...o) => new We(...o);
|
|
@@ -826,7 +826,7 @@ function He(o) {
|
|
|
826
826
|
}
|
|
827
827
|
class ys extends E {
|
|
828
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
|
|
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 gs(), this.featuresNode = ds(N(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
830
|
}
|
|
831
831
|
static get type() {
|
|
832
832
|
return "LensFlareNode";
|
|
@@ -835,34 +835,34 @@ class ys extends E {
|
|
|
835
835
|
const {
|
|
836
836
|
inputNode: t,
|
|
837
837
|
thresholdNode: s,
|
|
838
|
-
blurNode:
|
|
839
|
-
ghostNode:
|
|
838
|
+
blurNode: n,
|
|
839
|
+
ghostNode: r,
|
|
840
840
|
haloNode: i,
|
|
841
841
|
bloomNode: u,
|
|
842
842
|
featuresNode: a,
|
|
843
843
|
glareNode: h
|
|
844
844
|
} = this;
|
|
845
|
-
|
|
846
|
-
const c = s.getTextureNode(), l =
|
|
847
|
-
s.inputNode = t,
|
|
845
|
+
x(t != null);
|
|
846
|
+
const c = s.getTextureNode(), l = n.getTextureNode();
|
|
847
|
+
s.inputNode = t, n.inputNode = c, r.inputNode = l, i.inputNode = l, u.inputNode = c, h.inputNode = c;
|
|
848
848
|
const d = u.getTextureNode().mul(this.bloomIntensity), m = h.getTextureNode();
|
|
849
849
|
return C(() => {
|
|
850
|
-
const
|
|
851
|
-
return
|
|
850
|
+
const f = t;
|
|
851
|
+
return f.addAssign(d), He(e) && f.addAssign(m), f.add(a);
|
|
852
852
|
})();
|
|
853
853
|
}
|
|
854
854
|
dispose() {
|
|
855
855
|
this.thresholdNode.dispose(), this.blurNode.dispose(), this.ghostNode.dispose(), this.haloNode.dispose(), this.bloomNode.dispose(), this.glareNode.dispose(), this.featuresNode.dispose(), super.dispose();
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
|
-
const
|
|
858
|
+
const no = (o) => new ys(
|
|
859
859
|
o != null ? Le(o, "LensFlareNode.Input") : null
|
|
860
|
-
),
|
|
860
|
+
), ro = /* @__PURE__ */ G(
|
|
861
861
|
(o, e, t, s) => {
|
|
862
|
-
const
|
|
862
|
+
const n = o.sub(t), r = Q(e, n), i = Q(n, n).sub(s.pow2()), u = r.pow2().sub(i).toVar(), a = p(-1);
|
|
863
863
|
return F(u.greaterThanEqual(0), () => {
|
|
864
864
|
const h = Y(u);
|
|
865
|
-
a.assign(p(
|
|
865
|
+
a.assign(p(r.negate().sub(h), r.negate().add(h)));
|
|
866
866
|
}), a;
|
|
867
867
|
}
|
|
868
868
|
), ws = /* @__PURE__ */ oe(
|
|
@@ -870,24 +870,24 @@ const ro = (o) => new ys(
|
|
|
870
870
|
"raySpheresIntersections"
|
|
871
871
|
), io = /* @__PURE__ */ G(
|
|
872
872
|
(o, e, t, s) => {
|
|
873
|
-
const
|
|
873
|
+
const n = o.sub(t), r = Q(e, n), i = Q(n, n).sub(s.pow2()), u = r.pow2().sub(i).toVar(), a = w(-1), h = w(-1);
|
|
874
874
|
return F(u.greaterThanEqual(0), () => {
|
|
875
875
|
const c = Y(u);
|
|
876
|
-
a.assign(
|
|
876
|
+
a.assign(r.negate().sub(c)), h.assign(r.negate().add(c));
|
|
877
877
|
}), ws(a, h);
|
|
878
878
|
}
|
|
879
879
|
), ao = /* @__PURE__ */ G(
|
|
880
880
|
(o, e, t) => {
|
|
881
|
-
const s = o.div(t),
|
|
881
|
+
const s = o.div(t), n = e.div(t), r = n.dot(n), i = s.dot(n), u = s.dot(s), a = i.pow2().sub(r.mul(u.sub(1))).toVar(), h = p(-1);
|
|
882
882
|
return F(a.greaterThanEqual(0), () => {
|
|
883
883
|
const c = Y(a);
|
|
884
|
-
h.assign(p(i.negate().sub(c), i.negate().add(c)).div(
|
|
884
|
+
h.assign(p(i.negate().sub(c), i.negate().add(c)).div(r));
|
|
885
885
|
}), h;
|
|
886
886
|
}
|
|
887
887
|
), Ts = {
|
|
888
|
-
float:
|
|
888
|
+
float: ne,
|
|
889
889
|
int: H,
|
|
890
|
-
uint:
|
|
890
|
+
uint: zt,
|
|
891
891
|
bool: bt,
|
|
892
892
|
vec2: p,
|
|
893
893
|
ivec2: T,
|
|
@@ -895,21 +895,21 @@ const ro = (o) => new ys(
|
|
|
895
895
|
bvec2: Rt,
|
|
896
896
|
vec3: y,
|
|
897
897
|
ivec3: Mt,
|
|
898
|
-
uvec3:
|
|
899
|
-
bvec3:
|
|
898
|
+
uvec3: St,
|
|
899
|
+
bvec3: Nt,
|
|
900
900
|
vec4: w,
|
|
901
901
|
ivec4: Tt,
|
|
902
902
|
uvec4: wt,
|
|
903
903
|
bvec4: yt,
|
|
904
904
|
mat2: vt,
|
|
905
905
|
mat3: Pe,
|
|
906
|
-
mat4:
|
|
907
|
-
color:
|
|
906
|
+
mat4: xt,
|
|
907
|
+
color: gt
|
|
908
908
|
}, uo = Wt;
|
|
909
909
|
function lo(o) {
|
|
910
910
|
return Ts[o];
|
|
911
911
|
}
|
|
912
|
-
class
|
|
912
|
+
class Ns extends Ht {
|
|
913
913
|
static get type() {
|
|
914
914
|
return "OutputTexture3DNode";
|
|
915
915
|
}
|
|
@@ -923,23 +923,23 @@ class Ss extends Ht {
|
|
|
923
923
|
return new this.constructor(this.owner, this.value);
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
|
-
const co = (...o) => new
|
|
926
|
+
const co = (...o) => new Ns(...o), ho = /* @__PURE__ */ G(
|
|
927
927
|
(o, e) => {
|
|
928
|
-
const t = p(Ae(o)), s = t.reciprocal(),
|
|
929
|
-
return
|
|
928
|
+
const t = p(Ae(o)), s = t.reciprocal(), n = e.mul(t), r = n.sub(0.5).floor().add(0.5), i = n.sub(r), 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 = r.sub(1).mul(s), f = r.add(2).mul(s), g = r.add(d).mul(s);
|
|
929
|
+
return N(
|
|
930
930
|
o.sample(p(m.x, m.y)).mul(u.x).mul(u.y),
|
|
931
|
-
o.sample(p(
|
|
932
|
-
o.sample(p(
|
|
933
|
-
o.sample(p(m.x,
|
|
934
|
-
o.sample(p(
|
|
935
|
-
o.sample(p(
|
|
936
|
-
o.sample(p(m.x,
|
|
937
|
-
o.sample(p(
|
|
938
|
-
o.sample(p(
|
|
931
|
+
o.sample(p(g.x, m.y)).mul(l.x).mul(u.y),
|
|
932
|
+
o.sample(p(f.x, m.y)).mul(c.x).mul(u.y),
|
|
933
|
+
o.sample(p(m.x, g.y)).mul(u.x).mul(l.y),
|
|
934
|
+
o.sample(p(g.x, g.y)).mul(l.x).mul(l.y),
|
|
935
|
+
o.sample(p(f.x, g.y)).mul(c.x).mul(l.y),
|
|
936
|
+
o.sample(p(m.x, f.y)).mul(u.x).mul(c.y),
|
|
937
|
+
o.sample(p(g.x, f.y)).mul(l.x).mul(c.y),
|
|
938
|
+
o.sample(p(f.x, f.y)).mul(c.x).mul(c.y)
|
|
939
939
|
);
|
|
940
940
|
}
|
|
941
941
|
);
|
|
942
|
-
function
|
|
942
|
+
function xe(o, e) {
|
|
943
943
|
let t = 1, s = 0;
|
|
944
944
|
for (; o > 0; )
|
|
945
945
|
t /= e, s += t * (o % e), o = Math.floor(o / e);
|
|
@@ -947,16 +947,16 @@ function fe(o, e) {
|
|
|
947
947
|
}
|
|
948
948
|
const ve = /* @__PURE__ */ Array.from(
|
|
949
949
|
{ length: 16 },
|
|
950
|
-
(o, e) => new
|
|
951
|
-
),
|
|
952
|
-
const s = Fe(o, e, t);
|
|
953
|
-
return Bt(s, e, t);
|
|
954
|
-
}, po = (o, e, t) => {
|
|
950
|
+
(o, e) => new z(xe(e + 1, 2), xe(e + 1, 3))
|
|
951
|
+
), Ss = (o, e, t, { perspective: s = !0, logarithmic: n = !1 } = {}) => n ? De(o, e, t) : s ? je(o, e, t) : Bt(o, e, t), ye = (o, e, t) => {
|
|
955
952
|
const s = De(o, e, t);
|
|
956
|
-
return
|
|
957
|
-
},
|
|
958
|
-
const
|
|
959
|
-
return
|
|
953
|
+
return Pt(s, e, t);
|
|
954
|
+
}, po = (o, e, t) => {
|
|
955
|
+
const s = je(o, e, t);
|
|
956
|
+
return Fe(s, e, t);
|
|
957
|
+
}, mo = (o, e, t, s, n) => {
|
|
958
|
+
const r = 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(r).add(i));
|
|
959
|
+
return n.mul(a).xyz;
|
|
960
960
|
}, we = [
|
|
961
961
|
/* @__PURE__ */ y(58.1375, 2.7747, 26.8183),
|
|
962
962
|
/* @__PURE__ */ y(-150.5666, 4.2109, -88.5066),
|
|
@@ -964,17 +964,17 @@ const ve = /* @__PURE__ */ Array.from(
|
|
|
964
964
|
/* @__PURE__ */ y(-42.3277, 4.8052, -60.1097),
|
|
965
965
|
/* @__PURE__ */ y(4.5974, 2.1856, 12.5925),
|
|
966
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]),
|
|
968
|
-
const
|
|
969
|
-
return Ms(
|
|
970
|
-
},
|
|
971
|
-
const e = k(0.5, o.x).mul(
|
|
967
|
+
], Ms = (o) => we.slice(1).reduce((e, t) => t.add(o.mul(e)), we[0]), fo = (o, e, t, s) => {
|
|
968
|
+
const n = Ss(o, e, t, s);
|
|
969
|
+
return Ms(Fe(n, e, t));
|
|
970
|
+
}, go = (o) => {
|
|
971
|
+
const e = k(0.5, o.x).mul(Vt), t = k(o.y, 0.5).mul(Ct), s = le(t);
|
|
972
972
|
return y(s.mul(le(e)), ce(t), s.mul(ce(e)));
|
|
973
973
|
}, { resetRendererState: Rs, restoreRendererState: bs } = O;
|
|
974
|
-
function
|
|
974
|
+
function zs(o) {
|
|
975
975
|
return o.isPerspectiveCamera === !0 || o.isOrthographicCamera === !0 || "updateProjectionMatrix" in o && "setViewOffset" in o && "clearViewOffset" in o;
|
|
976
976
|
}
|
|
977
|
-
const
|
|
977
|
+
const Bs = /* @__PURE__ */ K({
|
|
978
978
|
name: "clipAABB",
|
|
979
979
|
type: "vec4",
|
|
980
980
|
inputs: [
|
|
@@ -984,10 +984,10 @@ const zs = /* @__PURE__ */ K({
|
|
|
984
984
|
{ name: "maxColor", type: "vec4" }
|
|
985
985
|
]
|
|
986
986
|
})(([o, e, t, s]) => {
|
|
987
|
-
const
|
|
987
|
+
const n = s.rgb.add(t.rgb).mul(0.5), r = s.rgb.sub(t.rgb).mul(0.5).add(1e-7), i = e.sub(w(n, o.a)), a = i.xyz.div(r).abs(), h = Ue(a.x, a.y, a.z);
|
|
988
988
|
return Ut(
|
|
989
989
|
h.greaterThan(1),
|
|
990
|
-
w(
|
|
990
|
+
w(n, o.a).add(i.div(h)),
|
|
991
991
|
e
|
|
992
992
|
);
|
|
993
993
|
}), Te = [
|
|
@@ -999,15 +999,15 @@ const zs = /* @__PURE__ */ K({
|
|
|
999
999
|
/* @__PURE__ */ T(0, -1),
|
|
1000
1000
|
/* @__PURE__ */ T(0, 1),
|
|
1001
1001
|
/* @__PURE__ */ T(-1, 0)
|
|
1002
|
-
],
|
|
1003
|
-
(o, e, t, s,
|
|
1004
|
-
const
|
|
1002
|
+
], Vs = /* @__PURE__ */ G(
|
|
1003
|
+
(o, e, t, s, n) => {
|
|
1004
|
+
const r = t.toVar(), i = t.pow2().toVar();
|
|
1005
1005
|
for (const d of Te) {
|
|
1006
1006
|
const m = o.load(e.add(d));
|
|
1007
|
-
|
|
1007
|
+
r.addAssign(m), i.addAssign(m.pow2());
|
|
1008
1008
|
}
|
|
1009
|
-
const u =
|
|
1010
|
-
return
|
|
1009
|
+
const u = ne(Te.length + 1), a = r.div(u), h = Y(i.div(u).sub(a.pow2()).max(0)).mul(n), c = a.sub(h), l = a.add(h);
|
|
1010
|
+
return Bs(a.clamp(c, l), s, c, l);
|
|
1011
1011
|
}
|
|
1012
1012
|
), Cs = [
|
|
1013
1013
|
/* @__PURE__ */ T(-1, -1),
|
|
@@ -1024,21 +1024,21 @@ const zs = /* @__PURE__ */ K({
|
|
|
1024
1024
|
depth: "float"
|
|
1025
1025
|
}), As = /* @__PURE__ */ G(
|
|
1026
1026
|
(o, e) => {
|
|
1027
|
-
const t =
|
|
1028
|
-
for (const
|
|
1029
|
-
const
|
|
1027
|
+
const t = ne(1), s = T(0);
|
|
1028
|
+
for (const n of Cs) {
|
|
1029
|
+
const r = e.add(n).toVar(), i = o.load(r).toVar();
|
|
1030
1030
|
F(i.r.lessThan(t), () => {
|
|
1031
|
-
s.assign(
|
|
1031
|
+
s.assign(r), t.assign(i.r);
|
|
1032
1032
|
});
|
|
1033
1033
|
}
|
|
1034
1034
|
return Ps(s, t);
|
|
1035
1035
|
}
|
|
1036
|
-
),
|
|
1036
|
+
), Ne = /* @__PURE__ */ new z(), Fs = /* @__PURE__ */ new et(1, 1);
|
|
1037
1037
|
class Ds extends E {
|
|
1038
|
-
constructor(e, t, s,
|
|
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 =
|
|
1038
|
+
constructor(e, t, s, n, 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 = n, !zs(r))
|
|
1040
1040
|
throw new Error("The provided camera is not supported.");
|
|
1041
|
-
this.camera =
|
|
1041
|
+
this.camera = r, this.textureNode = ke(this, this.resolveRT.texture), this.updateBeforeType = A.FRAME;
|
|
1042
1042
|
}
|
|
1043
1043
|
static get type() {
|
|
1044
1044
|
return "TemporalAntialiasNode";
|
|
@@ -1047,14 +1047,14 @@ class Ds extends E {
|
|
|
1047
1047
|
return Ie(this.camera.id, +this.debugShowRejection);
|
|
1048
1048
|
}
|
|
1049
1049
|
createRenderTarget(e) {
|
|
1050
|
-
const t = new
|
|
1050
|
+
const t = new Se(1, 1, {
|
|
1051
1051
|
depthBuffer: !1,
|
|
1052
1052
|
type: Re,
|
|
1053
1053
|
format: Me
|
|
1054
1054
|
}), s = t.texture;
|
|
1055
1055
|
s.minFilter = Z, s.magFilter = Z, s.generateMipmaps = !1;
|
|
1056
|
-
const
|
|
1057
|
-
return s.name = e != null ? `${
|
|
1056
|
+
const n = this.constructor.type;
|
|
1057
|
+
return s.name = e != null ? `${n}.${e}` : n, t;
|
|
1058
1058
|
}
|
|
1059
1059
|
getTextureNode() {
|
|
1060
1060
|
return this.textureNode;
|
|
@@ -1064,8 +1064,8 @@ class Ds extends E {
|
|
|
1064
1064
|
t != null && (t.projectionMatrix = e);
|
|
1065
1065
|
}
|
|
1066
1066
|
setSize(e, t) {
|
|
1067
|
-
const { resolveRT: s, historyRT:
|
|
1068
|
-
return (e !==
|
|
1067
|
+
const { resolveRT: s, historyRT: n } = this;
|
|
1068
|
+
return (e !== n.width || t !== n.height) && (s.setSize(e, t), n.setSize(e, t), this.needsClearHistory = !0), this;
|
|
1069
1069
|
}
|
|
1070
1070
|
clearHistory(e) {
|
|
1071
1071
|
e.setRenderTarget(this.resolveRT), e.clear(), e.setRenderTarget(this.historyRT), e.clear(), e.setRenderTarget(this.historyRT), this.mesh.material = this.copyMaterial, this.mesh.render(e), this.needsClearHistory = !1;
|
|
@@ -1073,8 +1073,8 @@ class Ds extends E {
|
|
|
1073
1073
|
setViewOffset(e, t) {
|
|
1074
1074
|
const { camera: s } = this;
|
|
1075
1075
|
s.updateProjectionMatrix(), this.originalProjectionMatrix.copy(s.projectionMatrix), this.setProjectionMatrix(this.originalProjectionMatrix);
|
|
1076
|
-
const
|
|
1077
|
-
s.setViewOffset(e, t,
|
|
1076
|
+
const n = ve[this.jitterIndex], r = n.x - 0.5, i = n.y - 0.5;
|
|
1077
|
+
s.setViewOffset(e, t, r, i, e, t);
|
|
1078
1078
|
}
|
|
1079
1079
|
clearViewOffset() {
|
|
1080
1080
|
this.camera.clearViewOffset(), this.setProjectionMatrix(null), this.jitterIndex = (this.jitterIndex + 1) % ve.length;
|
|
@@ -1090,84 +1090,84 @@ class Ds extends E {
|
|
|
1090
1090
|
updateBefore({ renderer: e }) {
|
|
1091
1091
|
if (e == null)
|
|
1092
1092
|
return;
|
|
1093
|
-
const t = e.getDrawingBufferSize(
|
|
1093
|
+
const t = e.getDrawingBufferSize(Ne);
|
|
1094
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();
|
|
1095
1095
|
}
|
|
1096
1096
|
setupResolveNode({ renderer: e }) {
|
|
1097
1097
|
const t = (s) => {
|
|
1098
|
-
const { previousDepthNode:
|
|
1098
|
+
const { previousDepthNode: n } = this, r = n.load(T(s.mul(Ae(n)).sub(0.5))).toVar();
|
|
1099
1099
|
return e.logarithmicDepthBuffer ? ye(
|
|
1100
|
-
|
|
1100
|
+
r,
|
|
1101
1101
|
de(this.camera),
|
|
1102
1102
|
pe(this.camera)
|
|
1103
|
-
) :
|
|
1103
|
+
) : r;
|
|
1104
1104
|
};
|
|
1105
1105
|
return C(() => {
|
|
1106
|
-
const s = T(
|
|
1106
|
+
const s = T(Be), n = At, r = 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 = n.sub(a.xy).toVar(), l = t(c), d = e.logarithmicDepthBuffer ? ye(
|
|
1107
1107
|
i.get("depth"),
|
|
1108
1108
|
de(this.camera),
|
|
1109
1109
|
pe(this.camera)
|
|
1110
1110
|
) : i.get("depth"), m = Ft(
|
|
1111
1111
|
d.add(a.z),
|
|
1112
1112
|
l.add(this.depthError)
|
|
1113
|
-
),
|
|
1113
|
+
), f = h.mul(m), g = Dt(
|
|
1114
1114
|
c.greaterThanEqual(0).all(),
|
|
1115
1115
|
c.lessThanEqual(1).all()
|
|
1116
|
-
).toFloat(), R = i.get("depth").notEqual(1).toFloat(),
|
|
1117
|
-
return F(
|
|
1118
|
-
const
|
|
1116
|
+
).toFloat(), R = i.get("depth").notEqual(1).toFloat(), S = w(0).toVar();
|
|
1117
|
+
return F(g.mul(R).mul(f).greaterThan(0), () => {
|
|
1118
|
+
const B = I(this.historyNode, c), L = Vs(
|
|
1119
1119
|
this.inputNode,
|
|
1120
1120
|
s,
|
|
1121
|
-
|
|
1122
|
-
|
|
1121
|
+
r,
|
|
1122
|
+
B,
|
|
1123
1123
|
this.varianceGamma
|
|
1124
1124
|
), j = a.xy.abs().mul(jt), U = Ue(j.x, j.y).fract().mul(0.5), M = te(
|
|
1125
1125
|
this.temporalAlpha,
|
|
1126
1126
|
0.8,
|
|
1127
1127
|
U
|
|
1128
1128
|
).saturate();
|
|
1129
|
-
|
|
1129
|
+
S.assign(te(L, r, M));
|
|
1130
1130
|
}).Else(() => {
|
|
1131
|
-
|
|
1132
|
-
}),
|
|
1131
|
+
S.assign(r), this.debugShowRejection && S.assign(y(1, 0, 0));
|
|
1132
|
+
}), S;
|
|
1133
1133
|
})();
|
|
1134
1134
|
}
|
|
1135
1135
|
setup(e) {
|
|
1136
1136
|
const { context: t } = e.getContext().postProcessing ?? {};
|
|
1137
1137
|
if (t != null) {
|
|
1138
|
-
const { onBeforePostProcessing:
|
|
1138
|
+
const { onBeforePostProcessing: r } = t;
|
|
1139
1139
|
t.onBeforePostProcessing = () => {
|
|
1140
|
-
|
|
1141
|
-
const i = e.renderer.getDrawingBufferSize(
|
|
1140
|
+
r?.();
|
|
1141
|
+
const i = e.renderer.getDrawingBufferSize(Ne);
|
|
1142
1142
|
this.setViewOffset(i.width, i.height);
|
|
1143
1143
|
}, this.needsSyncPostProcessing = !0;
|
|
1144
1144
|
}
|
|
1145
|
-
const { resolveMaterial: s, copyMaterial:
|
|
1146
|
-
return s.fragmentNode = this.setupResolveNode(e), s.needsUpdate = !0,
|
|
1145
|
+
const { resolveMaterial: s, copyMaterial: n } = this;
|
|
1146
|
+
return s.fragmentNode = this.setupResolveNode(e), s.needsUpdate = !0, n.fragmentNode = this.inputNode, n.needsUpdate = !0, this.textureNode.uvNode = this.inputNode.uvNode, this.textureNode;
|
|
1147
1147
|
}
|
|
1148
1148
|
dispose() {
|
|
1149
1149
|
this.resolveRT.dispose(), this.historyRT.dispose(), this.previousDepthTexture?.dispose(), this.resolveMaterial.dispose(), this.copyMaterial.dispose(), this.mesh.geometry.dispose(), super.dispose();
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
|
-
const
|
|
1152
|
+
const xo = (o) => (e, t, s, n) => new Ds(
|
|
1153
1153
|
o,
|
|
1154
1154
|
Le(e, "TemporalAntialiasNode.Input"),
|
|
1155
1155
|
t,
|
|
1156
1156
|
s,
|
|
1157
|
-
|
|
1157
|
+
n
|
|
1158
1158
|
);
|
|
1159
1159
|
export {
|
|
1160
1160
|
Ee as DownsampleThresholdNode,
|
|
1161
1161
|
K as FnLayout,
|
|
1162
1162
|
G as FnVar,
|
|
1163
1163
|
Oe as GaussianBlurNode,
|
|
1164
|
-
|
|
1164
|
+
rs as HighpVelocityNode,
|
|
1165
1165
|
is as KawaseBlurNode,
|
|
1166
1166
|
ys as LensFlareNode,
|
|
1167
1167
|
Jt as MipmapBlurNode,
|
|
1168
1168
|
We as MipmapSurfaceBlurNode,
|
|
1169
1169
|
uo as Node,
|
|
1170
|
-
|
|
1170
|
+
Ns as OutputTexture3DNode,
|
|
1171
1171
|
qt as OutputTextureNode,
|
|
1172
1172
|
Ge as RTTextureNode,
|
|
1173
1173
|
Ds as TemporalAntialiasNode,
|
|
@@ -1178,21 +1178,21 @@ export {
|
|
|
1178
1178
|
qs as debugFragmentNode,
|
|
1179
1179
|
Qs as debugNode,
|
|
1180
1180
|
Zs as debugVertexNode,
|
|
1181
|
-
|
|
1182
|
-
|
|
1181
|
+
fo as depthToColor,
|
|
1182
|
+
Ss as depthToViewZ,
|
|
1183
1183
|
Xs as dithering,
|
|
1184
1184
|
Ys as downsampleThreshold,
|
|
1185
1185
|
eo as equirectGrid,
|
|
1186
|
-
|
|
1186
|
+
go as equirectToDirectionWorld,
|
|
1187
1187
|
_s as gaussianBlur,
|
|
1188
1188
|
to as highpVelocity,
|
|
1189
1189
|
Ks as hookFunction,
|
|
1190
|
-
|
|
1190
|
+
ns as interleavedGradientNoise,
|
|
1191
1191
|
Ls as inverseProjectionMatrix,
|
|
1192
1192
|
Ws as inverseViewMatrix,
|
|
1193
1193
|
He as isWebGPU,
|
|
1194
1194
|
so as kawaseBlur,
|
|
1195
|
-
|
|
1195
|
+
no as lensFlare,
|
|
1196
1196
|
ye as logarithmicToPerspectiveDepth,
|
|
1197
1197
|
Js as mipmapBlur,
|
|
1198
1198
|
$e as mipmapBlurDownsample,
|
|
@@ -1204,12 +1204,12 @@ export {
|
|
|
1204
1204
|
po as perspectiveToLogarithmicDepth,
|
|
1205
1205
|
Os as projectionMatrix,
|
|
1206
1206
|
ao as rayEllipsoidIntersection,
|
|
1207
|
-
|
|
1207
|
+
ro as raySphereIntersection,
|
|
1208
1208
|
io as raySpheresIntersections,
|
|
1209
1209
|
ws as raySpheresIntersectionsStruct,
|
|
1210
1210
|
ds as rtTexture,
|
|
1211
1211
|
mo as screenToPositionView,
|
|
1212
|
-
|
|
1212
|
+
xo as temporalAntialias,
|
|
1213
1213
|
ho as textureCatmullRom,
|
|
1214
1214
|
Ms as turbo,
|
|
1215
1215
|
Gs as viewMatrix
|