diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-29 01:42:28 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-29 01:42:28 +0100 |
| commit | 70b77307a9a9ee4fdff23f783e041fe49e60e100 (patch) | |
| tree | 828948256e04a1aee5762643da773b23d29f8e11 /src/procedural/generator.h | |
| parent | f05f76e07c8a91911aa61af16b7db4f30247a3d8 (diff) | |
feat(procedural): add plasma, voronoi, normalmap generators
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.
Diffstat (limited to 'src/procedural/generator.h')
| -rw-r--r-- | src/procedural/generator.h | 20 |
1 files changed, 17 insertions, 3 deletions
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); |
