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
98 lines
2.5 KiB
JavaScript
98 lines
2.5 KiB
JavaScript
import {
|
|
ColorManagement,
|
|
RawShaderMaterial,
|
|
UniformsUtils,
|
|
LinearToneMapping,
|
|
ReinhardToneMapping,
|
|
CineonToneMapping,
|
|
AgXToneMapping,
|
|
ACESFilmicToneMapping,
|
|
NeutralToneMapping,
|
|
SRGBTransfer
|
|
} from '../../three.module.min.js';
|
|
import { Pass, FullScreenQuad } from './Pass.js';
|
|
import { OutputShader } from '../shaders/OutputShader.js';
|
|
|
|
class OutputPass extends Pass {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
//
|
|
|
|
const shader = OutputShader;
|
|
|
|
this.uniforms = UniformsUtils.clone( shader.uniforms );
|
|
|
|
this.material = new RawShaderMaterial( {
|
|
name: shader.name,
|
|
uniforms: this.uniforms,
|
|
vertexShader: shader.vertexShader,
|
|
fragmentShader: shader.fragmentShader
|
|
} );
|
|
|
|
this.fsQuad = new FullScreenQuad( this.material );
|
|
|
|
// internal cache
|
|
|
|
this._outputColorSpace = null;
|
|
this._toneMapping = null;
|
|
|
|
}
|
|
|
|
render( renderer, writeBuffer, readBuffer/*, deltaTime, maskActive */ ) {
|
|
|
|
this.uniforms[ 'tDiffuse' ].value = readBuffer.texture;
|
|
this.uniforms[ 'toneMappingExposure' ].value = renderer.toneMappingExposure;
|
|
|
|
// rebuild defines if required
|
|
|
|
if ( this._outputColorSpace !== renderer.outputColorSpace || this._toneMapping !== renderer.toneMapping ) {
|
|
|
|
this._outputColorSpace = renderer.outputColorSpace;
|
|
this._toneMapping = renderer.toneMapping;
|
|
|
|
this.material.defines = {};
|
|
|
|
if ( ColorManagement.getTransfer( this._outputColorSpace ) === SRGBTransfer ) this.material.defines.SRGB_TRANSFER = '';
|
|
|
|
if ( this._toneMapping === LinearToneMapping ) this.material.defines.LINEAR_TONE_MAPPING = '';
|
|
else if ( this._toneMapping === ReinhardToneMapping ) this.material.defines.REINHARD_TONE_MAPPING = '';
|
|
else if ( this._toneMapping === CineonToneMapping ) this.material.defines.CINEON_TONE_MAPPING = '';
|
|
else if ( this._toneMapping === ACESFilmicToneMapping ) this.material.defines.ACES_FILMIC_TONE_MAPPING = '';
|
|
else if ( this._toneMapping === AgXToneMapping ) this.material.defines.AGX_TONE_MAPPING = '';
|
|
else if ( this._toneMapping === NeutralToneMapping ) this.material.defines.NEUTRAL_TONE_MAPPING = '';
|
|
|
|
this.material.needsUpdate = true;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
if ( this.renderToScreen === true ) {
|
|
|
|
renderer.setRenderTarget( null );
|
|
this.fsQuad.render( renderer );
|
|
|
|
} else {
|
|
|
|
renderer.setRenderTarget( writeBuffer );
|
|
if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
|
|
this.fsQuad.render( renderer );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dispose() {
|
|
|
|
this.material.dispose();
|
|
this.fsQuad.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export { OutputPass };
|