@descix/frqtl-web 0.6.1-p3.3 → 0.6.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/CLAUDE.md +11 -13
- package/LICENSE.md +63 -79
- package/README.md +7 -9
- package/dist/artifact/double-slit.html +1 -1
- package/dist/dist-manifest.json +37 -42
- package/dist/frqtl/compat/providers/wasm-load-browser.js +1 -2
- package/dist/frqtl/compat/renderer/providers/godrays-layer.js +12 -301
- package/dist/frqtl/compat/renderer/providers/p5-provider.js +0 -6
- package/dist/frqtl/compat/renderer/providers/three-provider.js +17 -66
- package/dist/frqtl/objects/FrqtlApp.js +1 -17
- package/dist/frqtl/objects/RecipeContext.js +41 -38
- package/dist/frqtl/objects/objects/QuantumEmitter.js +1 -1
- package/dist/frqtl/objects/objects/sustainedSource.js +2 -2
- package/dist/frqtl/objects/record/Record.js +9 -4
- package/dist/frqtl/objects/setup/setupConeEmitter3D.js +3 -3
- package/dist/frqtl/objects/setup/setupSphereEmitter3D.js +6 -8
- package/dist/frqtl/parts/FrqtlVision.js +27 -158
- package/dist/frqtl/parts/GraphingDetectorWall.js +1 -1
- package/dist/frqtl/parts/LiveChart.js +1 -1
- package/dist/frqtl/parts/SphereEmitter.js +2 -2
- package/dist/frqtl/parts/Tunnel.js +1 -1
- package/dist/frqtl/parts/Wall.js +10 -97
- package/dist/frqtl/scenes/dse-tunnel-rebuild.js +22 -33
- package/dist/frqtl/scenes/mirror-route.js +6 -10
- package/dist/frqtl-web.min.js +51 -56
- package/dist/notebooks/notebooks.json +1 -1
- package/dist/sdk.html +2 -3
- package/dist/shim/controls/index.js +2 -2
- package/dist/shim/engine/router.js +30 -49
- package/dist/shim/field-descriptor/index.js +5 -5
- package/dist/shim/host/host-view.js +10 -7
- package/dist/shim/host/index.js +1 -2
- package/dist/shim/project/index.js +3 -13
- package/dist/shim/project/record-format.js +4 -96
- package/dist/shim/project/specifiers.js +3 -5
- package/dist/shim/registry/exhibits.js +11 -11
- package/dist/shim/registry/index.js +0 -6
- package/dist/shim/registry/walkthrough.js +90 -38
- package/dist/shim/render/capture-envelope.js +0 -21
- package/dist/shim/render/sun-look.js +11 -6
- package/llms.txt +8 -9
- package/package.json +2 -3
- package/dist/shim/engine/site-graph.js +0 -184
- package/dist/shim/host/device.js +0 -42
- package/dist/shim/project/parts-spelling.js +0 -77
- package/dist/shim/registry/showcase-link.js +0 -61
- package/dist/shim/registry/studio-landing.js +0 -70
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* godrays-layer.js — the three provider's god-rays layer: WHAT the rays are computed from
|
|
5
|
-
* (the source rule
|
|
5
|
+
* (the source rule), the light position, and the radial march + composite passes.
|
|
6
6
|
*
|
|
7
7
|
* God-rays are a render effect computed from the density of the LIGHT particles: by default
|
|
8
8
|
* (`godraySource: 'leaf'`) the frames of the fundamental (lowest) layer. A parent frame at a higher layer is drawn in the scene
|
|
@@ -96,140 +96,6 @@
|
|
|
96
96
|
return out;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
/**
|
|
100
|
-
* The `godrayMode` render option — the ONE owner of its values and default. HOW the rays are
|
|
101
|
-
* computed from the source frames:
|
|
102
|
-
* 'streak' (default) — each source frame trails a short streak BEHIND it along its own
|
|
103
|
-
* projected direction of travel (FrameData vx,vy,vz: the mean axis);
|
|
104
|
-
* 'field' — every source frame's projected direction is splatted into a
|
|
105
|
-
* direction grid; each pixel's march steps UPSTREAM along the local
|
|
106
|
-
* direction, so the shafts extend ahead of the light and bend with the flow;
|
|
107
|
-
* 'radial' — every pixel marches toward ONE light point (`lightUV`).
|
|
108
|
-
* `godrayDensity` is the reach in every mode: the march's fraction of the distance to the
|
|
109
|
-
* light (radial), the streak length (streak), the march length (field).
|
|
110
|
-
*/
|
|
111
|
-
var GODRAY_MODES = ['streak', 'field', 'radial'];
|
|
112
|
-
var GODRAY_MODE_DEFAULT = 'streak';
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* The effective mode for a bag value: unset → the default; anything not declared THROWS.
|
|
116
|
-
* @param {*} value — opts.godrayMode
|
|
117
|
-
* @returns {'streak'|'field'|'radial'}
|
|
118
|
-
*/
|
|
119
|
-
function resolveGodrayMode(value) {
|
|
120
|
-
if (value === undefined || value === null) { return GODRAY_MODE_DEFAULT; }
|
|
121
|
-
if (GODRAY_MODES.indexOf(value) === -1) {
|
|
122
|
-
throw new Error('GodraysLayer: godrayMode ' + JSON.stringify(value) + ' is not one of [' +
|
|
123
|
-
GODRAY_MODES.join(', ') + '] (default ' + JSON.stringify(GODRAY_MODE_DEFAULT) + ').');
|
|
124
|
-
}
|
|
125
|
-
return value;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Screen-fraction scales (of the screen's SHORT side) the density knob multiplies.
|
|
129
|
-
var STREAK_REACH = 0.06; // streak length = godrayDensity × this
|
|
130
|
-
var STREAK_WIDTH = 0.004; // streak width (floor 1.5 physical px)
|
|
131
|
-
var STREAK_GAIN = 0.6; // streak brightness relative to the source pixel at the head
|
|
132
|
-
var FIELD_REACH = 0.25; // field march length = godrayDensity × this
|
|
133
|
-
var FIELD_CELLS = 96; // direction-grid columns along the LONG side
|
|
134
|
-
var FIELD_RADIUS = 3; // splat radius in grid cells (tent weight)
|
|
135
|
-
var MARCH_SAMPLES = 50; // steps per pixel in the radial and field marches
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Each frame's head in screen UV and its projected direction of travel as a UNIT vector in
|
|
139
|
-
* PIXEL space (aspect-corrected). The direction is the projection of (pos + d̂) minus the
|
|
140
|
-
* projection of pos, d̂ = normalize(vx,vy,vz). A frame with no direction, one whose direction
|
|
141
|
-
* projects to under 1e-6 px (along the view axis), or one outside the clip volume yields NO
|
|
142
|
-
* entry: it still draws in the scene as itself, a dot with no streak and no flow.
|
|
143
|
-
* @param {Array<object>} frames — FrameData (rect.x, rect.y, z, vx, vy, vz)
|
|
144
|
-
* @param {Function} project — (x,y,z) → NDC {x,y,z}
|
|
145
|
-
* @param {number} w @param {number} h — the target's pixel size
|
|
146
|
-
* @returns {{count:number, u:Float32Array, v:Float32Array, dx:Float32Array, dy:Float32Array}}
|
|
147
|
-
*/
|
|
148
|
-
function screenDirections(frames, project, w, h) {
|
|
149
|
-
var n = frames.length;
|
|
150
|
-
var out = { count: 0, u: new Float32Array(n), v: new Float32Array(n), dx: new Float32Array(n), dy: new Float32Array(n) };
|
|
151
|
-
for (var i = 0; i < n; i++) {
|
|
152
|
-
var f = frames[i];
|
|
153
|
-
var vx = f.vx || 0, vy = f.vy || 0, vz = f.vz || 0;
|
|
154
|
-
var len = Math.sqrt(vx * vx + vy * vy + vz * vz);
|
|
155
|
-
if (len === 0) { continue; }
|
|
156
|
-
var x = f.rect.x, y = f.rect.y, z = f.z || 0;
|
|
157
|
-
var p0 = project(x, y, z), x0 = p0.x, y0 = p0.y, z0 = p0.z;
|
|
158
|
-
if (!(Math.abs(x0) <= 1 && Math.abs(y0) <= 1 && Math.abs(z0) <= 1)) { continue; }
|
|
159
|
-
var p1 = project(x + vx / len, y + vy / len, z + vz / len);
|
|
160
|
-
var px = (p1.x - x0) * w / 2, py = (p1.y - y0) * h / 2;
|
|
161
|
-
var pl = Math.sqrt(px * px + py * py);
|
|
162
|
-
if (!(pl > 1e-6)) { continue; }
|
|
163
|
-
var k = out.count++;
|
|
164
|
-
out.u[k] = x0 * 0.5 + 0.5; out.v[k] = y0 * 0.5 + 0.5;
|
|
165
|
-
out.dx[k] = px / pl; out.dy[k] = py / pl;
|
|
166
|
-
}
|
|
167
|
-
return out;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Screen-space streak quads (two triangles each), in NDC: the head at the frame, the tail
|
|
172
|
-
* `lengthPx` BEHIND it (opposite its direction), `widthPx` wide. Per vertex: `head` (the head's
|
|
173
|
-
* UV, where the colour is sampled) and `fade` (1 at the head, 0 at the tail).
|
|
174
|
-
* @param {object} dirs — screenDirections(...)
|
|
175
|
-
* @returns {{count:number, position:Float32Array, head:Float32Array, fade:Float32Array}}
|
|
176
|
-
*/
|
|
177
|
-
function streakQuads(dirs, lengthPx, widthPx, w, h) {
|
|
178
|
-
var n = dirs.count, pos = new Float32Array(n * 18), head = new Float32Array(n * 12), fade = new Float32Array(n * 6);
|
|
179
|
-
var sx = 2 / w, sy = 2 / h, half = widthPx / 2;
|
|
180
|
-
for (var i = 0; i < n; i++) {
|
|
181
|
-
var hx = dirs.u[i] * 2 - 1, hy = dirs.v[i] * 2 - 1, dx = dirs.dx[i], dy = dirs.dy[i];
|
|
182
|
-
var tx = hx - dx * lengthPx * sx, ty = hy - dy * lengthPx * sy;
|
|
183
|
-
var nx = -dy * half * sx, ny = dx * half * sy;
|
|
184
|
-
// head+n, head-n, tail+n ; tail+n, head-n, tail-n
|
|
185
|
-
var vs = [hx + nx, hy + ny, 1, hx - nx, hy - ny, 1, tx + nx, ty + ny, 0,
|
|
186
|
-
tx + nx, ty + ny, 0, hx - nx, hy - ny, 1, tx - nx, ty - ny, 0];
|
|
187
|
-
for (var j = 0; j < 6; j++) {
|
|
188
|
-
var o = i * 6 + j;
|
|
189
|
-
pos[o * 3] = vs[j * 3]; pos[o * 3 + 1] = vs[j * 3 + 1]; pos[o * 3 + 2] = 0;
|
|
190
|
-
fade[o] = vs[j * 3 + 2];
|
|
191
|
-
head[o * 2] = dirs.u[i]; head[o * 2 + 1] = dirs.v[i];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return { count: n * 6, position: pos, head: head, fade: fade };
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* The direction field: a `gw × gh` RGBA grid (row 0 = bottom, UV v = 0). Each direction is
|
|
199
|
-
* splatted with a tent weight over `radius` cells; a cell stores its normalized mean direction
|
|
200
|
-
* in R,G (0.5 + 0.5·d̂) and in B the strength a = coherence × coverage (coherence = |mean|,
|
|
201
|
-
* 0 where opposed flows cancel; coverage = min(1, Σweight)). Decode: d = (RG·2 − 1)·B.
|
|
202
|
-
* @param {object} dirs — screenDirections(...)
|
|
203
|
-
* @returns {{width:number, height:number, data:Uint8Array}}
|
|
204
|
-
*/
|
|
205
|
-
function buildDirectionField(dirs, gw, gh, radius) {
|
|
206
|
-
var cells = gw * gh, sx = new Float32Array(cells), sy = new Float32Array(cells), sw = new Float32Array(cells);
|
|
207
|
-
for (var i = 0; i < dirs.count; i++) {
|
|
208
|
-
var cx = dirs.u[i] * gw - 0.5, cy = dirs.v[i] * gh - 0.5;
|
|
209
|
-
var i0 = Math.max(0, Math.ceil(cx - radius)), i1 = Math.min(gw - 1, Math.floor(cx + radius));
|
|
210
|
-
var j0 = Math.max(0, Math.ceil(cy - radius)), j1 = Math.min(gh - 1, Math.floor(cy + radius));
|
|
211
|
-
for (var j = j0; j <= j1; j++) {
|
|
212
|
-
for (var ii = i0; ii <= i1; ii++) {
|
|
213
|
-
var ex = ii - cx, ey = j - cy, wt = 1 - Math.sqrt(ex * ex + ey * ey) / (radius + 1);
|
|
214
|
-
if (wt <= 0) { continue; }
|
|
215
|
-
var c = j * gw + ii;
|
|
216
|
-
sx[c] += dirs.dx[i] * wt; sy[c] += dirs.dy[i] * wt; sw[c] += wt;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
var data = new Uint8Array(cells * 4);
|
|
221
|
-
for (var k = 0; k < cells; k++) {
|
|
222
|
-
var r = 0.5, g = 0.5, a = 0;
|
|
223
|
-
if (sw[k] > 0) {
|
|
224
|
-
var mx = sx[k] / sw[k], my = sy[k] / sw[k], m = Math.sqrt(mx * mx + my * my);
|
|
225
|
-
if (m > 1e-6) { r = 0.5 + 0.5 * mx / m; g = 0.5 + 0.5 * my / m; a = m * Math.min(1, sw[k]); }
|
|
226
|
-
}
|
|
227
|
-
data[k * 4] = Math.round(r * 255); data[k * 4 + 1] = Math.round(g * 255);
|
|
228
|
-
data[k * 4 + 2] = Math.round(a * 255); data[k * 4 + 3] = 255;
|
|
229
|
-
}
|
|
230
|
-
return { width: gw, height: gh, data: data };
|
|
231
|
-
}
|
|
232
|
-
|
|
233
99
|
// R4-B god-rays — radial light-scattering march (adapted from abberg's
|
|
234
100
|
// VolumetericLightShader / GPU Gems 3). For each pixel it steps TOWARD the
|
|
235
101
|
// projected light position, accumulating SOURCE brightness with exponential
|
|
@@ -244,7 +110,7 @@
|
|
|
244
110
|
'uniform float uWeight;',
|
|
245
111
|
'uniform float uExposure;',
|
|
246
112
|
'varying vec2 vTexCoord;',
|
|
247
|
-
'const int SAMPLES =
|
|
113
|
+
'const int SAMPLES = 50;',
|
|
248
114
|
'void main() {',
|
|
249
115
|
' vec2 tc = vTexCoord;',
|
|
250
116
|
' vec2 delta = (tc - uLightPos) * (1.0 / float(SAMPLES)) * uDensity;',
|
|
@@ -260,64 +126,6 @@
|
|
|
260
126
|
'}'
|
|
261
127
|
].join('\n');
|
|
262
128
|
|
|
263
|
-
// The 'field' march: the radial march's accumulation (same decay/weight/exposure), but each
|
|
264
|
-
// step reads the LOCAL direction from the field and steps upstream along it, so a pixel
|
|
265
|
-
// collects the light that flowed into it. An empty cell (strength 0) does not step.
|
|
266
|
-
var GODRAY_FIELD_FRAG = [
|
|
267
|
-
'uniform sampler2D uScene;',
|
|
268
|
-
'uniform sampler2D uField;',
|
|
269
|
-
'uniform vec2 uStepUV;', // one step's length in UV per unit pixel-space direction
|
|
270
|
-
'uniform float uDecay;',
|
|
271
|
-
'uniform float uWeight;',
|
|
272
|
-
'uniform float uExposure;',
|
|
273
|
-
'varying vec2 vTexCoord;',
|
|
274
|
-
'const int SAMPLES = ' + MARCH_SAMPLES + ';',
|
|
275
|
-
'void main() {',
|
|
276
|
-
' vec2 tc = vTexCoord;',
|
|
277
|
-
' vec3 rays = vec3(0.0);',
|
|
278
|
-
' float decay = 1.0;',
|
|
279
|
-
' for (int i = 0; i < SAMPLES; i++) {',
|
|
280
|
-
' vec3 f = texture2D(uField, tc).rgb;',
|
|
281
|
-
' tc -= (f.rg * 2.0 - 1.0) * f.b * uStepUV;',
|
|
282
|
-
' vec3 s = texture2D(uScene, tc).rgb;',
|
|
283
|
-
' rays += s * decay * uWeight;',
|
|
284
|
-
' decay *= uDecay;',
|
|
285
|
-
' }',
|
|
286
|
-
' gl_FragColor = vec4(rays * uExposure, 1.0);',
|
|
287
|
-
'}'
|
|
288
|
-
].join('\n');
|
|
289
|
-
|
|
290
|
-
// The 'streak' quads: positions are NDC already; colour = the source image AT THE HEAD,
|
|
291
|
-
// fading to black at the tail, added (additive blending) into a black rays target.
|
|
292
|
-
var GODRAY_STREAK_VERT = [
|
|
293
|
-
'attribute vec2 aHead;',
|
|
294
|
-
'attribute float aFade;',
|
|
295
|
-
'varying vec2 vHead;',
|
|
296
|
-
'varying float vFade;',
|
|
297
|
-
'void main() {',
|
|
298
|
-
' vHead = aHead; vFade = aFade;',
|
|
299
|
-
' gl_Position = vec4(position.xy, 0.0, 1.0);',
|
|
300
|
-
'}'
|
|
301
|
-
].join('\n');
|
|
302
|
-
// The head colour is the brightest texel of the 3×3 around the head: a sub-pixel quantum lands
|
|
303
|
-
// between texels, so a single tap at its centre reads it dimmed.
|
|
304
|
-
var GODRAY_STREAK_FRAG = [
|
|
305
|
-
'uniform sampler2D uSource;',
|
|
306
|
-
'uniform vec2 uTexel;',
|
|
307
|
-
'uniform float uGain;',
|
|
308
|
-
'varying vec2 vHead;',
|
|
309
|
-
'varying float vFade;',
|
|
310
|
-
'void main() {',
|
|
311
|
-
' vec3 c = vec3(0.0);',
|
|
312
|
-
' for (int i = -1; i <= 1; i++) {',
|
|
313
|
-
' for (int j = -1; j <= 1; j++) {',
|
|
314
|
-
' c = max(c, texture2D(uSource, vHead + vec2(float(i), float(j)) * uTexel).rgb);',
|
|
315
|
-
' }',
|
|
316
|
-
' }',
|
|
317
|
-
' gl_FragColor = vec4(c * vFade * uGain, 1.0);',
|
|
318
|
-
'}'
|
|
319
|
-
].join('\n');
|
|
320
|
-
|
|
321
129
|
// R4-B composite — unblurred scene + additive rays * intensity knob.
|
|
322
130
|
var GODRAY_COMP_FRAG = [
|
|
323
131
|
'uniform sampler2D uScene;',
|
|
@@ -332,19 +140,17 @@
|
|
|
332
140
|
].join('\n');
|
|
333
141
|
|
|
334
142
|
/**
|
|
335
|
-
* The live passes, created lazily by the provider on first activation.
|
|
336
|
-
* same composite (sceneRT + rays × intensity → screen); they differ in how rtRays is made.
|
|
143
|
+
* The live passes, created lazily by the provider on first activation.
|
|
337
144
|
* @param {object} THREE
|
|
338
145
|
* @param {string} quadVert — the provider's full-screen-quad vertex shader
|
|
339
146
|
* @param {number} w @param {number} h — the provider's physical size
|
|
340
|
-
* @returns {{rtSource:object, setSize:Function, lightUV:Function, march:Function
|
|
147
|
+
* @returns {{rtSource:object, setSize:Function, lightUV:Function, march:Function}}
|
|
341
148
|
*/
|
|
342
149
|
function makeGodrayPasses(THREE, quadVert, w, h) {
|
|
343
150
|
var fxScene = new THREE.Scene();
|
|
344
151
|
var fxQuad = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), null);
|
|
345
152
|
fxScene.add(fxQuad);
|
|
346
|
-
var vLight = new THREE.Vector3()
|
|
347
|
-
var size = { w: w, h: h };
|
|
153
|
+
var vLight = new THREE.Vector3();
|
|
348
154
|
var blurMat = new THREE.ShaderMaterial({
|
|
349
155
|
uniforms: {
|
|
350
156
|
uScene: { value: null },
|
|
@@ -360,49 +166,9 @@
|
|
|
360
166
|
uniforms: { uScene: { value: null }, uRays: { value: null }, uIntensity: { value: 1.0 } },
|
|
361
167
|
vertexShader: quadVert, fragmentShader: GODRAY_COMP_FRAG, depthWrite: false, depthTest: false
|
|
362
168
|
});
|
|
363
|
-
var fieldMat = new THREE.ShaderMaterial({
|
|
364
|
-
uniforms: {
|
|
365
|
-
uScene: { value: null },
|
|
366
|
-
uField: { value: null },
|
|
367
|
-
uStepUV: { value: new THREE.Vector2(0, 0) },
|
|
368
|
-
uDecay: blurMat.uniforms.uDecay, // the SAME accumulation as the radial march
|
|
369
|
-
uWeight: blurMat.uniforms.uWeight,
|
|
370
|
-
uExposure: blurMat.uniforms.uExposure
|
|
371
|
-
},
|
|
372
|
-
vertexShader: quadVert, fragmentShader: GODRAY_FIELD_FRAG, depthWrite: false, depthTest: false
|
|
373
|
-
});
|
|
374
|
-
var fieldTex = null;
|
|
375
|
-
|
|
376
|
-
var streakScene = new THREE.Scene();
|
|
377
|
-
var streakGeo = new THREE.BufferGeometry(), streakCap = 0;
|
|
378
|
-
var streakMat = new THREE.ShaderMaterial({
|
|
379
|
-
uniforms: { uSource: { value: null }, uTexel: { value: new THREE.Vector2(1 / w, 1 / h) }, uGain: { value: STREAK_GAIN } },
|
|
380
|
-
vertexShader: GODRAY_STREAK_VERT, fragmentShader: GODRAY_STREAK_FRAG,
|
|
381
|
-
blending: THREE.AdditiveBlending, transparent: true, depthWrite: false, depthTest: false,
|
|
382
|
-
side: THREE.DoubleSide // a quad's winding follows its direction; never cull it
|
|
383
|
-
});
|
|
384
|
-
var streakMesh = new THREE.Mesh(streakGeo, streakMat);
|
|
385
|
-
streakMesh.frustumCulled = false;
|
|
386
|
-
streakScene.add(streakMesh);
|
|
387
|
-
|
|
388
|
-
function composite(renderer, quadCamera, sceneRT, rtRays, intensity) {
|
|
389
|
-
compMat.uniforms.uScene.value = sceneRT.texture;
|
|
390
|
-
compMat.uniforms.uRays.value = rtRays.texture;
|
|
391
|
-
compMat.uniforms.uIntensity.value = intensity;
|
|
392
|
-
fxQuad.material = compMat;
|
|
393
|
-
renderer.setRenderTarget(null);
|
|
394
|
-
renderer.render(fxScene, quadCamera);
|
|
395
|
-
}
|
|
396
|
-
// The reach in every mode is the density knob; unset → the value the radial march holds.
|
|
397
|
-
function densityOf(density) { return (typeof density === 'number') ? density : blurMat.uniforms.uDensity.value; }
|
|
398
|
-
function directionsOf(frames, camera) {
|
|
399
|
-
return screenDirections(frames, function (x, y, z) { return vProj.set(x, y, z).project(camera); }, size.w, size.h);
|
|
400
|
-
}
|
|
401
|
-
function shortSide() { return Math.min(size.w, size.h); }
|
|
402
|
-
|
|
403
169
|
var passes = {
|
|
404
170
|
rtSource: new THREE.WebGLRenderTarget(w, h), // the SOURCE image the provider renders into
|
|
405
|
-
setSize: function (sw, sh) {
|
|
171
|
+
setSize: function (sw, sh) { passes.rtSource.setSize(sw, sh); },
|
|
406
172
|
// Light position in [0,1] screen UV: the fullness-weighted centroid of the SOURCE
|
|
407
173
|
// frames, projected through `camera` (2D ortho + 3D persp); screen centre when none.
|
|
408
174
|
lightUV: function (tickData, camera, source) {
|
|
@@ -417,7 +183,7 @@
|
|
|
417
183
|
vLight.set(sx / sw, sy / sw, sz / sw).project(camera); // → NDC [-1,1]
|
|
418
184
|
return new THREE.Vector2(vLight.x * 0.5 + 0.5, vLight.y * 0.5 + 0.5);
|
|
419
185
|
},
|
|
420
|
-
//
|
|
186
|
+
// Pass 2: march sourceRT → rtRays. Pass 3: sceneRT + rays × intensity → screen.
|
|
421
187
|
march: function (renderer, quadCamera, sceneRT, sourceRT, rtRays, lightUV, density, intensity) {
|
|
422
188
|
blurMat.uniforms.uScene.value = sourceRT.texture;
|
|
423
189
|
blurMat.uniforms.uLightPos.value.copy(lightUV);
|
|
@@ -425,61 +191,12 @@
|
|
|
425
191
|
fxQuad.material = blurMat;
|
|
426
192
|
renderer.setRenderTarget(rtRays);
|
|
427
193
|
renderer.render(fxScene, quadCamera);
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
var q = streakQuads(directionsOf(frames, camera), densityOf(density) * STREAK_REACH * shortSide(),
|
|
434
|
-
Math.max(1.5, STREAK_WIDTH * shortSide()), size.w, size.h);
|
|
435
|
-
if (q.count > streakCap) {
|
|
436
|
-
streakCap = Math.max(q.count, streakCap * 2, 600);
|
|
437
|
-
streakGeo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(streakCap * 3), 3));
|
|
438
|
-
streakGeo.setAttribute('aHead', new THREE.BufferAttribute(new Float32Array(streakCap * 2), 2));
|
|
439
|
-
streakGeo.setAttribute('aFade', new THREE.BufferAttribute(new Float32Array(streakCap), 1));
|
|
440
|
-
}
|
|
441
|
-
if (q.count > 0) {
|
|
442
|
-
streakGeo.attributes.position.array.set(q.position);
|
|
443
|
-
streakGeo.attributes.aHead.array.set(q.head);
|
|
444
|
-
streakGeo.attributes.aFade.array.set(q.fade);
|
|
445
|
-
streakGeo.attributes.position.needsUpdate = true;
|
|
446
|
-
streakGeo.attributes.aHead.needsUpdate = true;
|
|
447
|
-
streakGeo.attributes.aFade.needsUpdate = true;
|
|
448
|
-
}
|
|
449
|
-
streakGeo.setDrawRange(0, q.count);
|
|
450
|
-
streakMat.uniforms.uSource.value = sourceRT.texture;
|
|
451
|
-
streakMat.uniforms.uTexel.value.set(1 / size.w, 1 / size.h);
|
|
452
|
-
renderer.getClearColor(clearKeep);
|
|
453
|
-
var alphaKeep = renderer.getClearAlpha();
|
|
454
|
-
renderer.setClearColor(0x000000, 1);
|
|
455
|
-
renderer.setRenderTarget(rtRays);
|
|
456
|
-
renderer.clear();
|
|
457
|
-
if (q.count > 0) { renderer.render(streakScene, quadCamera); }
|
|
458
|
-
renderer.setClearColor(clearKeep, alphaKeep);
|
|
459
|
-
composite(renderer, quadCamera, sceneRT, rtRays, intensity);
|
|
460
|
-
},
|
|
461
|
-
// 'field' — the source frames' directions → a grid texture; march sourceRT along it →
|
|
462
|
-
// rtRays; then the composite.
|
|
463
|
-
field: function (renderer, quadCamera, sceneRT, sourceRT, rtRays, frames, camera, density, intensity) {
|
|
464
|
-
var long = Math.max(size.w, size.h);
|
|
465
|
-
var gw = Math.max(8, Math.round(FIELD_CELLS * size.w / long)), gh = Math.max(8, Math.round(FIELD_CELLS * size.h / long));
|
|
466
|
-
var grid = buildDirectionField(directionsOf(frames, camera), gw, gh, FIELD_RADIUS);
|
|
467
|
-
if (!fieldTex || fieldTex.image.width !== gw || fieldTex.image.height !== gh) {
|
|
468
|
-
if (fieldTex) { fieldTex.dispose(); }
|
|
469
|
-
fieldTex = new THREE.DataTexture(grid.data, gw, gh, THREE.RGBAFormat);
|
|
470
|
-
fieldTex.minFilter = THREE.LinearFilter; fieldTex.magFilter = THREE.LinearFilter;
|
|
471
|
-
} else {
|
|
472
|
-
fieldTex.image.data.set(grid.data);
|
|
473
|
-
}
|
|
474
|
-
fieldTex.needsUpdate = true;
|
|
475
|
-
var stepPx = densityOf(density) * FIELD_REACH * shortSide() / MARCH_SAMPLES;
|
|
476
|
-
fieldMat.uniforms.uScene.value = sourceRT.texture;
|
|
477
|
-
fieldMat.uniforms.uField.value = fieldTex;
|
|
478
|
-
fieldMat.uniforms.uStepUV.value.set(stepPx / size.w, stepPx / size.h);
|
|
479
|
-
fxQuad.material = fieldMat;
|
|
480
|
-
renderer.setRenderTarget(rtRays);
|
|
194
|
+
compMat.uniforms.uScene.value = sceneRT.texture;
|
|
195
|
+
compMat.uniforms.uRays.value = rtRays.texture;
|
|
196
|
+
compMat.uniforms.uIntensity.value = intensity;
|
|
197
|
+
fxQuad.material = compMat;
|
|
198
|
+
renderer.setRenderTarget(null);
|
|
481
199
|
renderer.render(fxScene, quadCamera);
|
|
482
|
-
composite(renderer, quadCamera, sceneRT, rtRays, intensity);
|
|
483
200
|
}
|
|
484
201
|
};
|
|
485
202
|
return passes;
|
|
@@ -492,11 +209,5 @@ export {
|
|
|
492
209
|
GODRAY_SOURCES,
|
|
493
210
|
GODRAY_SOURCE_DEFAULT,
|
|
494
211
|
resolveGodraySource,
|
|
495
|
-
GODRAY_MODES,
|
|
496
|
-
GODRAY_MODE_DEFAULT,
|
|
497
|
-
resolveGodrayMode,
|
|
498
|
-
screenDirections,
|
|
499
|
-
streakQuads,
|
|
500
|
-
buildDirectionField,
|
|
501
212
|
makeGodrayPasses
|
|
502
213
|
};
|
|
@@ -491,12 +491,6 @@ import * as RendererProviderContract from '../renderer-provider-contract.js';
|
|
|
491
491
|
var prog = compileProgram(gl, VERT_SRC, fragSrc);
|
|
492
492
|
if (!prog) return { skip: true };
|
|
493
493
|
|
|
494
|
-
// Both uploads (the scene canvas and FieldBuilder's field) are TOP row first, and
|
|
495
|
-
// vTexCoord has its origin at the BOTTOM-left (Filters.js convention). Flip on upload,
|
|
496
|
-
// once for this context, or the composite draws the whole picture upside down while
|
|
497
|
-
// screenToWorld (and every hand on the canvas) stays right side up.
|
|
498
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
499
|
-
|
|
500
494
|
var quadBuf = gl.createBuffer();
|
|
501
495
|
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
|
502
496
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1,-1, 1,-1, -1,1, 1,1]), gl.STATIC_DRAW);
|
|
@@ -258,13 +258,6 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
258
258
|
description: "What the god-rays are computed from: 'leaf' = the fundamental-layer frames " +
|
|
259
259
|
"(LOs only occlude), 'all' = the whole lit scene (every frame of every layer and every LO)."
|
|
260
260
|
}),
|
|
261
|
-
normalizeFieldDescriptor({
|
|
262
|
-
name: 'godrayMode', type: 'enum', default: GodraysLayer.GODRAY_MODE_DEFAULT,
|
|
263
|
-
constraint: { values: GodraysLayer.GODRAY_MODES.reduce(function (m, v) { m[v] = v; return m; }, {}) },
|
|
264
|
-
description: "How the god-rays are computed: 'streak' = each source frame trails a streak behind " +
|
|
265
|
-
"its direction of travel, 'field' = each pixel marches along the local direction of travel, " +
|
|
266
|
-
"'radial' = each pixel marches toward one light point (the source frames' centroid)."
|
|
267
|
-
}),
|
|
268
261
|
normalizeFieldDescriptor({
|
|
269
262
|
name: 'glowIntensity', type: 'number', unit: 'intensity', default: 0,
|
|
270
263
|
constraint: { min: 0, max: 3, integer: false },
|
|
@@ -621,9 +614,6 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
621
614
|
// ── R4-B god-rays layer (GodraysLayer.makeGodrayPasses; created lazily on first activation) ──
|
|
622
615
|
var _godrays = null;
|
|
623
616
|
var _cubeSourceCount = 0; // cube instances [0, n) are god-rays source frames
|
|
624
|
-
// The particle objects LAID this tick but hidden from the lit picture (Particles OFF while
|
|
625
|
-
// god rays consume the particle layer): the source pass shows them, the lit scene never does.
|
|
626
|
-
var _particlesLaidHidden = [];
|
|
627
617
|
|
|
628
618
|
var _initialized = false;
|
|
629
619
|
var _lastTickData = null;
|
|
@@ -1270,14 +1260,14 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
1270
1260
|
// Position one clone of the loaded mesh per frame (reusing a pool). The loaded scene is
|
|
1271
1261
|
// unit-normalized; each clone is scaled to the frame's voxel size (w) and placed at the
|
|
1272
1262
|
// frame's (x,y,z) — the SAME physics coords the cube/points paths use. Extra clones hide.
|
|
1273
|
-
function _layoutMeshClones(entry, frameData,
|
|
1263
|
+
function _layoutMeshClones(entry, frameData, drawParticles, scaleMul, assetId) {
|
|
1274
1264
|
if (!_meshGroup) { _meshGroup = new THREE.Group(); _meshGroup.frustumCulled = false; _scene.add(_meshGroup); }
|
|
1275
1265
|
// Per-ASSET clone sub-pool (spec §2): one pool per asset id so concurrent assets never
|
|
1276
1266
|
// fight over slots. Callers: the scene-wide useMesh branch (assetId = resolvedMesh) and
|
|
1277
1267
|
// the per-frame mesh siphon in the Points path (one call per stamped asset).
|
|
1278
1268
|
var pool = _meshClonesByAsset[assetId] || (_meshClonesByAsset[assetId] = []);
|
|
1279
1269
|
var mul = (typeof scaleMul === 'number' && scaleMul > 0) ? scaleMul : 1;
|
|
1280
|
-
var n = (
|
|
1270
|
+
var n = (drawParticles && frameData) ? frameData.length : 0;
|
|
1281
1271
|
for (var i = 0; i < n; i++) {
|
|
1282
1272
|
var f = frameData[i];
|
|
1283
1273
|
var clone = pool[i];
|
|
@@ -1501,19 +1491,10 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
1501
1491
|
|
|
1502
1492
|
// The god-rays SOURCE image → _godrays.rtSource: same scene/camera/paint, ONLY the fundamental-layer
|
|
1503
1493
|
// frames drawn. LOs write depth but no colour (they shadow, never shine). All flags restored.
|
|
1504
|
-
function _renderGodraySource(tickData
|
|
1494
|
+
function _renderGodraySource(tickData) {
|
|
1505
1495
|
var gs = GodraysLayer, fund = gs.fundamentalLayerOf(tickData);
|
|
1506
1496
|
var hidden = [], cubeCount = null, colourOff = [];
|
|
1507
1497
|
function hide(o) { if (o && o.visible) { o.visible = false; hidden.push(o); } }
|
|
1508
|
-
// The rays read the PARTICLE LAYER whether or not the lit picture draws it.
|
|
1509
|
-
for (var p = 0; p < _particlesLaidHidden.length; p++) { _particlesLaidHidden[p].visible = true; }
|
|
1510
|
-
if (!leaf) {
|
|
1511
|
-
// 'all': the lit scene WITH its particles (only reached when Particles are OFF).
|
|
1512
|
-
_renderer.setRenderTarget(_godrays.rtSource);
|
|
1513
|
-
_renderer.render(_scene, _camera);
|
|
1514
|
-
for (var pa = 0; pa < _particlesLaidHidden.length; pa++) { _particlesLaidHidden[pa].visible = false; }
|
|
1515
|
-
return;
|
|
1516
|
-
}
|
|
1517
1498
|
for (var k in _dimLayers) {
|
|
1518
1499
|
if (_dimLayers.hasOwnProperty(k) && !gs.isGodraySource(_dimLayers[k].layer, fund)) { hide(_dimLayers[k].mesh); }
|
|
1519
1500
|
}
|
|
@@ -1541,36 +1522,19 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
1541
1522
|
for (var h = 0; h < hidden.length; h++) { hidden[h].visible = true; }
|
|
1542
1523
|
if (cubeCount !== null) { _cubeMesh.count = cubeCount; }
|
|
1543
1524
|
for (var c = 0; c < colourOff.length; c++) { colourOff[c].colorWrite = true; }
|
|
1544
|
-
for (var q = 0; q < _particlesLaidHidden.length; q++) { _particlesLaidHidden[q].visible = false; }
|
|
1545
1525
|
}
|
|
1546
1526
|
|
|
1547
|
-
//
|
|
1548
|
-
//
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
// God-rays to screen: the rays read the SOURCE image (fundamental-layer frames, LOs
|
|
1552
|
-
// depth-only) and add over the full lit scene. Cost paid ONLY when on.
|
|
1553
|
-
// `godraySource` 'all' reads the lit scene itself (every frame, every LO); `godrayMode`
|
|
1554
|
-
// picks the pass (GodraysLayer owns both values and defaults).
|
|
1527
|
+
// God-rays to screen: the march reads the SOURCE image (fundamental-layer frames, LOs
|
|
1528
|
+
// depth-only) and adds its rays over the full lit scene. Cost paid ONLY when on.
|
|
1529
|
+
// `godraySource` 'all' marches the lit scene itself (every frame, every LO).
|
|
1555
1530
|
function _renderGodrays(opts, tickData) {
|
|
1556
1531
|
var gl = GodraysLayer, leaf = gl.resolveGodraySource(opts.godraySource) === 'leaf';
|
|
1557
|
-
var mode = gl.resolveGodrayMode(opts.godrayMode);
|
|
1558
1532
|
if (!_godrays) { _godrays = gl.makeGodrayPasses(THREE, QUAD_VERT, _physW(), _physH()); }
|
|
1559
1533
|
_renderer.setRenderTarget(_rtA); // Pass 1: lit scene → _rtA
|
|
1560
1534
|
_renderer.render(_scene, _camera);
|
|
1561
|
-
// Pass 1b: source → rtSource
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
if (ownSource) { _renderGodraySource(tickData, leaf); }
|
|
1565
|
-
var src = ownSource ? _godrays.rtSource : _rtA;
|
|
1566
|
-
if (mode === 'radial') {
|
|
1567
|
-
_godrays.march(_renderer, _quadCamera, _rtA, src, _rtB,
|
|
1568
|
-
_godrays.lightUV(tickData, _camera, opts.godraySource), opts.godrayDensity, opts.godrays);
|
|
1569
|
-
} else {
|
|
1570
|
-
var pass = (mode === 'streak') ? _godrays.streak : _godrays.field;
|
|
1571
|
-
pass(_renderer, _quadCamera, _rtA, src, _rtB,
|
|
1572
|
-
gl.godraySourceFrames(tickData, opts.godraySource), _camera, opts.godrayDensity, opts.godrays);
|
|
1573
|
-
}
|
|
1535
|
+
if (leaf) { _renderGodraySource(tickData); } // Pass 1b: source → rtSource
|
|
1536
|
+
_godrays.march(_renderer, _quadCamera, _rtA, leaf ? _godrays.rtSource : _rtA, _rtB,
|
|
1537
|
+
_godrays.lightUV(tickData, _camera, opts.godraySource), opts.godrayDensity, opts.godrays);
|
|
1574
1538
|
}
|
|
1575
1539
|
|
|
1576
1540
|
// ── Aim feedback layer update ─────────────────────────────────────────────────
|
|
@@ -1765,10 +1729,7 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
1765
1729
|
// built ONLY when a consumer (a queued filter) is active — never unconditionally (that was one sugar object hijacking the
|
|
1766
1730
|
// render loop). Each flag comes from the render OPTIONS bag (setRenderOption).
|
|
1767
1731
|
var opts = options || {};
|
|
1768
|
-
var drawParticles = opts.renderBaseCanvas !== false; // Particles layer
|
|
1769
|
-
// The particle layer is LAID when drawn OR consumed: god rays read it as their source,
|
|
1770
|
-
// so Particles OFF + god rays ON lays it out hidden and the rays still shine.
|
|
1771
|
-
var layParticles = drawParticles || _wantGodrays(opts);
|
|
1732
|
+
var drawParticles = opts.renderBaseCanvas !== false; // Particles layer
|
|
1772
1733
|
// SNAPSHOT, not the reference: _renderOptsWithFeedback() returns
|
|
1773
1734
|
// this._renderOptions ITSELF when there is no aim-feedback bag, so retaining
|
|
1774
1735
|
// `opts` would let a setRenderOption between ticks silently change what
|
|
@@ -1822,7 +1783,7 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
1822
1783
|
var _me = _meshCache[resolvedMesh];
|
|
1823
1784
|
var _sceneLaid = 0;
|
|
1824
1785
|
if (_me && _me.status === 'ready') {
|
|
1825
|
-
_sceneLaid = _layoutMeshClones(_me, tickData.frameData,
|
|
1786
|
+
_sceneLaid = _layoutMeshClones(_me, tickData.frameData, opts.renderBaseCanvas !== false, opts.meshScale, resolvedMesh);
|
|
1826
1787
|
}
|
|
1827
1788
|
_hideMeshClonesExcept([resolvedMesh]); // drop any stale per-frame/other-asset clones
|
|
1828
1789
|
if (_meshGroup) { _meshGroup.visible = _sceneLaid > 0; } // loading/empty → hidden (error already overlaid)
|
|
@@ -1834,7 +1795,7 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
1834
1795
|
// bright; back/bottom are dark — so the cube reads as a solid 3D object.
|
|
1835
1796
|
_hideAllDimLayers();
|
|
1836
1797
|
|
|
1837
|
-
if (
|
|
1798
|
+
if (drawParticles && tickData && tickData.frameData) {
|
|
1838
1799
|
var fdC = tickData.frameData;
|
|
1839
1800
|
var totalC = fdC.length;
|
|
1840
1801
|
var defaultColorSchemeC = opts.colorScheme || 'warmcool';
|
|
@@ -1886,7 +1847,7 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
1886
1847
|
_cubeMesh.count = cubeCount;
|
|
1887
1848
|
_cubeMesh.instanceMatrix.needsUpdate = true;
|
|
1888
1849
|
if (_cubeMesh.instanceColor) { _cubeMesh.instanceColor.needsUpdate = true; }
|
|
1889
|
-
_cubeMesh.visible = cubeCount > 0;
|
|
1850
|
+
_cubeMesh.visible = drawParticles && cubeCount > 0;
|
|
1890
1851
|
} else {
|
|
1891
1852
|
if (_cubeMesh) { _cubeMesh.visible = false; }
|
|
1892
1853
|
}
|
|
@@ -1897,7 +1858,7 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
1897
1858
|
if (_cubeMesh) { _cubeMesh.visible = false; }
|
|
1898
1859
|
_hideAllDimLayers();
|
|
1899
1860
|
|
|
1900
|
-
if (
|
|
1861
|
+
if (drawParticles && tickData && tickData.frameData) {
|
|
1901
1862
|
var fd = tickData.frameData;
|
|
1902
1863
|
var total = fd.length;
|
|
1903
1864
|
|
|
@@ -2078,7 +2039,7 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
2078
2039
|
}
|
|
2079
2040
|
|
|
2080
2041
|
entry.centroid.x = cx / n; entry.centroid.y = cy / n; entry.centroid.z = cz / n;
|
|
2081
|
-
entry.mesh.visible =
|
|
2042
|
+
entry.mesh.visible = drawParticles;
|
|
2082
2043
|
}
|
|
2083
2044
|
|
|
2084
2045
|
// ── Camera-distance sort (painter's algorithm) — farthest
|
|
@@ -2109,7 +2070,7 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
2109
2070
|
_ensureMeshLoaded(_aid);
|
|
2110
2071
|
var _pfMe = _meshCache[_aid];
|
|
2111
2072
|
if (_pfMe && _pfMe.status === 'ready') {
|
|
2112
|
-
_pfMeshLaid += _layoutMeshClones(_pfMe, meshByAsset[_aid],
|
|
2073
|
+
_pfMeshLaid += _layoutMeshClones(_pfMe, meshByAsset[_aid], drawParticles, opts.meshScale, _aid);
|
|
2113
2074
|
}
|
|
2114
2075
|
}
|
|
2115
2076
|
_hideMeshClonesExcept(_pfMeshAssets);
|
|
@@ -2117,16 +2078,6 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
2117
2078
|
}
|
|
2118
2079
|
}
|
|
2119
2080
|
|
|
2120
|
-
// ── Particles OFF: what was laid (for the god-rays source) leaves the lit picture ──
|
|
2121
|
-
_particlesLaidHidden = [];
|
|
2122
|
-
if (!drawParticles) {
|
|
2123
|
-
var laid = [_cubeMesh, _meshGroup];
|
|
2124
|
-
for (var lk in _dimLayers) { if (_dimLayers.hasOwnProperty(lk)) { laid.push(_dimLayers[lk].mesh); } }
|
|
2125
|
-
for (var li = 0; li < laid.length; li++) {
|
|
2126
|
-
if (laid[li] && laid[li].visible) { laid[li].visible = false; _particlesLaidHidden.push(laid[li]); }
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
2081
|
// ── Field layer — build the heightfield ONLY when consumed ──
|
|
2131
2082
|
if (fieldConsumed) { _updateFieldTex(tickData); }
|
|
2132
2083
|
|
|
@@ -2147,7 +2098,7 @@ import * as ThreeCameraGeometry from './three-camera-geometry.js';
|
|
|
2147
2098
|
opts = opts || {};
|
|
2148
2099
|
// godrays is a final-composite layer (a declared render option). It owns the final pass when on; it and the 2D water-fx
|
|
2149
2100
|
// filter are alternative final composites (concurrent use is a phase-2 item).
|
|
2150
|
-
var wantGodrays =
|
|
2101
|
+
var wantGodrays = opts.godrays > 0;
|
|
2151
2102
|
var time = _filters.length > 0
|
|
2152
2103
|
? RendererProviderContract.filterTime(tickData) : null;
|
|
2153
2104
|
_lastFilterTime = time; // capture provenance (§1a.4)
|
|
@@ -2010,19 +2010,6 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
|
|
|
2010
2010
|
return [x, y];
|
|
2011
2011
|
};
|
|
2012
2012
|
|
|
2013
|
-
/**
|
|
2014
|
-
* isPointable(d) → whether declared object `d` can be under a pointer on the canvas: at least one of
|
|
2015
|
-
* its members is not hidden by its own `visible:false`. The ONE rule both canvas picks read — the 3D
|
|
2016
|
-
* pick below (per member) and the host's 2D box hit-test (per object).
|
|
2017
|
-
*/
|
|
2018
|
-
FrqtlApp.prototype.isPointable = function (d) {
|
|
2019
|
-
var ms = this.membersOf(d);
|
|
2020
|
-
for (var i = 0; i < ms.length; i++) { if (_memberPointable(ms[i])) { return true; } }
|
|
2021
|
-
return false;
|
|
2022
|
-
};
|
|
2023
|
-
/** A member is under the pointer unless its own `visible:false` hides it. */
|
|
2024
|
-
function _memberPointable(lo) { return lo.visible !== false; }
|
|
2025
|
-
|
|
2026
2013
|
/** Screen radius (in the caller's screen units) inside which a click picks an object. */
|
|
2027
2014
|
FrqtlApp.PICK_RADIUS_PX = 32;
|
|
2028
2015
|
/** A center-bearing (drivable) object's pick distance is divided by this, so in a dense scene
|
|
@@ -2037,9 +2024,7 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
|
|
|
2037
2024
|
* anisotropic on screen and different per plane, which let a wall behind the emitter win inside
|
|
2038
2025
|
* the emitter's own footprint. A drivable object's distance is divided by PICK_DRIVE_PRIORITY.
|
|
2039
2026
|
* Objects-layer; consumed downward by AuthorView. Null (fail-soft) with no screenToWorld
|
|
2040
|
-
* capability — the host falls back to the Layers panel.
|
|
2041
|
-
* is never under the pointer (isPointable): an invisible counter spanning the scene would
|
|
2042
|
-
* otherwise answer every press. The Layers panel still selects it.
|
|
2027
|
+
* capability — the host falls back to the Layers panel.
|
|
2043
2028
|
*/
|
|
2044
2029
|
FrqtlApp.prototype.pickObjectAtScreen = function (cssX, cssY, cssW, cssH) {
|
|
2045
2030
|
var r = this.renderer;
|
|
@@ -2050,7 +2035,6 @@ import { paintBootFailure } from '../experiments/_shared/boot-failure.js';
|
|
|
2050
2035
|
var lo = los[i];
|
|
2051
2036
|
var owner = this.declaredOf(lo);
|
|
2052
2037
|
if (!owner) { continue; } // a primitive-surface object is never picked
|
|
2053
|
-
if (!_memberPointable(lo)) { continue; } // hidden: not under the pointer (isPointable)
|
|
2054
2038
|
var c = this._objectCentroid(lo);
|
|
2055
2039
|
if (!c) { continue; }
|
|
2056
2040
|
var sp = this.screenPointOf(c, cssW, cssH, [cssX, cssY]);
|