Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Merge pull request #935 from codepawl/751-effects-cut-geometry

Nguyen Xuan An8e82a06b80a1
diff --cc bench/flicker/viewer.js
index 559ab73c,2c028f8e..b89af98c
--- a/bench/flicker/viewer.js
+++ b/bench/flicker/viewer.js
@@@ -5,9 -5,12 +5,13 @@@ import { Renderer67 } from '../../src/i
import { parseGltf } from '../../src/gltf.js';
import { resolveFlushParts } from '../../src/coplanar-overlap.js';
import { flushOrderOf } from '../../src/depth-layer.js';
- import { TRAPS } from './traps.js';
+ import { installRenderPasses } from '../../src/render-passes.js';
+ import { installCameraEffects } from '../../src/camera-effects.js';
+ import { installLineArt, resolveLineArt } from '../../src/line-art.js';
+ import { resolveEffects } from '../../src/effects.js';
+ import { TRAPS, TILED_TRAPS } from './traps.js';
import { collectWorldTriangles, castPixelOwners, compareWithGroundTruth } from './ground-truth.js';
+import { DEFAULT_HITS_PER_PIXEL } from './pixel-cast.js';
// One flat colour per part, no textures, so a pixel's colour says which part owns it and a changed colour is a changed owner.
function paintPartsByOwner(parts) {
@@@ -97,9 -100,13 +101,15 @@@ const options =
facets: parameters.get('facets') === '1' || parameters.get('facets') === '2',
// facets=2: the colour of every triangle is its own number, drawn unlit, so the frame tells exactly which face is shown at a pixel.
triangleIds: parameters.get('facets') === '2',
+ // hits=N keeps the N nearest faces per ray in the ray cast (default 6, at most 64): a deeper stack than that shows up as offRay.
+ hitsPerPixel: Math.min(64, Math.max(1, Number(parameters.get('hits')) || DEFAULT_HITS_PER_PIXEL)),
};
+ // effect=ao|dof|lines|all draws the frame through that screen-space stage (issue #751, effects on cut geometry): the renderer gets a
+ // depth texture, the add-ons install, and frameFor carries the stage settings. Without it nothing changes.
+ const EFFECTS = new Set(['ao', 'dof', 'lines', 'all']);
+ const effectName = parameters.get('effect');
+ if (effectName && !EFFECTS.has(effectName)) throw new Error(`Unknown effect ${effectName}. Use one of: ${[...EFFECTS].join(', ')}.`);
+ const usesEffect = name => effectName === name || effectName === 'all';
const trapName = parameters.get('trap');
// The trap name comes from the URL, so only the table's own entries count, never an inherited method such as toString.