From 70b77307a9a9ee4fdff23f783e041fe49e60e100 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 29 Mar 2026 01:42:28 +0100 Subject: feat(procedural): add plasma, voronoi, normalmap generators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add three new procedural texture generators: - gen_plasma: classic sine-sum color texture (RGB output) - gen_voronoi: Worley cellular noise (F1/F2/F2-F1 modes) - gen_normalmap: post-process grayscale→RGB normal map Remove gen_noise_256 (was an alias for gen_noise). Register new generators in asset_manager and asset_packer. Add unit tests for all three, and use them in test_3d_render (plasma sky, voronoi noise, fBm normal map). handoff(Gemini): plasma/voronoi/normalmap procedural generators added; gen_noise_256 removed; tests + 3d_render usage wired up. --- src/procedural/generator.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/procedural/generator.h') diff --git a/src/procedural/generator.h b/src/procedural/generator.h index 96d7651..9224d00 100644 --- a/src/procedural/generator.h +++ b/src/procedural/generator.h @@ -17,6 +17,7 @@ typedef bool (*ProcGenFunc)(uint8_t* buffer, int w, int h, const float* params, namespace procedural { // Simple noise generator +// Params[0]: Seed, Params[1]: Frequency bool gen_noise(uint8_t* buffer, int w, int h, const float* params, int num_params); @@ -38,11 +39,24 @@ bool gen_grid(uint8_t* buffer, int w, int h, const float* params, bool make_periodic(uint8_t* buffer, int w, int h, const float* params, int num_params); -#if !defined(DEMO_STRIP_ALL) -// Test-only: 256x256 noise generator -bool gen_noise_256(uint8_t* buffer, int w, int h, const float* params, +// Plasma: classic sine-sum color texture +// Params[0]: time/seed offset, Params[1]: frequency multiplier (default 2.0) +bool gen_plasma(uint8_t* buffer, int w, int h, const float* params, + int num_params); + +// Voronoi (Worley) cellular noise +// Params[0]: cell scale (default 4.0) +// Params[1]: mode: 0=F1, 1=F2, 2=F2-F1 borders (default 2) +// Params[2]: seed +bool gen_voronoi(uint8_t* buffer, int w, int h, const float* params, + int num_params); + +// Post-process: convert grayscale height (R channel) to RGB normal map +// Params[0]: strength (default 4.0) +bool gen_normalmap(uint8_t* buffer, int w, int h, const float* params, int num_params); +#if !defined(DEMO_STRIP_ALL) // Test-only: Failing generator bool gen_fail(uint8_t* buffer, int w, int h, const float* params, int num_params); -- cgit v1.2.3