mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-10-03 11:37:54 +00:00
The single biggest fidelity lever from the charrette. Core had only three.module.min.js (no postprocessing addons), so this vendors the r170 EffectComposer/RenderPass/UnrealBloomPass/OutputPass + their shader deps into static/vendor/three/addons/, with every `from 'three'` rewritten to the SAME vendored three (../../three.module.min.js) so the addons share the plugin's three instance (a CDN copy would be a second, non-interoperable module). highway_3d wiring: - Lazy-loads the addons only when the new `bloom` setting is on (dynamic import), builds EffectComposer(RenderPass → UnrealBloomPass(strength .65/radius .5/ threshold .82 — high so only emissive gems + the hit flash bloom) → OutputPass). - Render loop uses composer.render() with ACES tone-mapping when bloom is active, else the unchanged direct ren.render() with NoToneMapping (bloom-off = today's look). - Perf-gated: OFF in splitscreen; graceful fallback to direct render if the modules or composer fail; composer.setSize on canvas resize; disposed on teardown. - settings.html: "Glow bloom" toggle (default on). Verified the import chain resolves + renders via a same-origin module-load test (EffectComposer built + a bloom frame rendered, three r170). Charrette status: 7/8 (only #5's early/late timing tint remains — a notedetect verdict-field change, outside the highway). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Q9BpGYqUaga9ZJyS3dDPq
100 lines
1.9 KiB
JavaScript
100 lines
1.9 KiB
JavaScript
import {
|
|
Color
|
|
} from '../../three.module.min.js';
|
|
import { Pass } from './Pass.js';
|
|
|
|
class RenderPass extends Pass {
|
|
|
|
constructor( scene, camera, overrideMaterial = null, clearColor = null, clearAlpha = null ) {
|
|
|
|
super();
|
|
|
|
this.scene = scene;
|
|
this.camera = camera;
|
|
|
|
this.overrideMaterial = overrideMaterial;
|
|
|
|
this.clearColor = clearColor;
|
|
this.clearAlpha = clearAlpha;
|
|
|
|
this.clear = true;
|
|
this.clearDepth = false;
|
|
this.needsSwap = false;
|
|
this._oldClearColor = new Color();
|
|
|
|
}
|
|
|
|
render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
|
|
|
|
const oldAutoClear = renderer.autoClear;
|
|
renderer.autoClear = false;
|
|
|
|
let oldClearAlpha, oldOverrideMaterial;
|
|
|
|
if ( this.overrideMaterial !== null ) {
|
|
|
|
oldOverrideMaterial = this.scene.overrideMaterial;
|
|
|
|
this.scene.overrideMaterial = this.overrideMaterial;
|
|
|
|
}
|
|
|
|
if ( this.clearColor !== null ) {
|
|
|
|
renderer.getClearColor( this._oldClearColor );
|
|
renderer.setClearColor( this.clearColor, renderer.getClearAlpha() );
|
|
|
|
}
|
|
|
|
if ( this.clearAlpha !== null ) {
|
|
|
|
oldClearAlpha = renderer.getClearAlpha();
|
|
renderer.setClearAlpha( this.clearAlpha );
|
|
|
|
}
|
|
|
|
if ( this.clearDepth == true ) {
|
|
|
|
renderer.clearDepth();
|
|
|
|
}
|
|
|
|
renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
|
|
|
|
if ( this.clear === true ) {
|
|
|
|
// TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
|
|
renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
|
|
|
|
}
|
|
|
|
renderer.render( this.scene, this.camera );
|
|
|
|
// restore
|
|
|
|
if ( this.clearColor !== null ) {
|
|
|
|
renderer.setClearColor( this._oldClearColor );
|
|
|
|
}
|
|
|
|
if ( this.clearAlpha !== null ) {
|
|
|
|
renderer.setClearAlpha( oldClearAlpha );
|
|
|
|
}
|
|
|
|
if ( this.overrideMaterial !== null ) {
|
|
|
|
this.scene.overrideMaterial = oldOverrideMaterial;
|
|
|
|
}
|
|
|
|
renderer.autoClear = oldAutoClear;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export { RenderPass };
|