feat(postfx): afegir push constants i efectes chromatic aberration + scanlines
- PostFXUniforms struct (vignette_strength, chroma_strength, scanline_strength, time) - Shader MSL actualitzat: aberració cromàtica RGB + scanlines sin-wave + vinyeta paramètrica - Pipeline postfx declara num_uniform_buffers=1 (buffer(0) en MSL) - Engine acumula temps i fa SDL_PushGPUFragmentUniformData cada frame - Valors per defecte: vignette=1.5, chroma=0, scanlines=0 (comportament idèntic a l'anterior) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,18 @@
|
||||
|
||||
#include <SDL3/SDL_gpu.h>
|
||||
|
||||
// ============================================================================
|
||||
// PostFXUniforms — pushed to the fragment stage each frame via
|
||||
// SDL_PushGPUFragmentUniformData(pass, 0, &uniforms, sizeof(PostFXUniforms))
|
||||
// MSL binding: constant PostFXUniforms& u [[buffer(0)]]
|
||||
// ============================================================================
|
||||
struct PostFXUniforms {
|
||||
float vignette_strength; // 0 = none, 1.5 = default subtle
|
||||
float chroma_strength; // 0 = off, 1 = full chromatic aberration
|
||||
float scanline_strength; // 0 = off, 1 = full scanlines
|
||||
float time; // accumulated seconds (for future animations)
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// GpuPipeline — Creates and owns the graphics pipelines used by the engine.
|
||||
//
|
||||
@@ -9,6 +21,7 @@
|
||||
// Vertex layout: GpuVertex (pos float2, uv float2, col float4).
|
||||
// postfx_pipeline_ : full-screen triangle, no vertex buffer, no blend.
|
||||
// Reads offscreen texture, writes to swapchain.
|
||||
// Accepts PostFXUniforms via fragment uniform buffer slot 0.
|
||||
// ============================================================================
|
||||
class GpuPipeline {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user