diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-03 19:06:41 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-03 19:06:41 +0100 |
| commit | 3108fb0065a51dfc3548836ea16b287e92cd8881 (patch) | |
| tree | b20d3ffd904b65596ce9dd2df15a527b91a6539f /src/procedural/generator.h | |
| parent | c3714939897af2541c655c03bcdd61108fff46ea (diff) | |
feat: side-quest - Perlin noise sky and ProcGenFunc error handling
- Updated ProcGenFunc signature to return bool for error reporting.
- Implemented gen_perlin (Fractional Brownian Motion) in procedural/generator.cc.
- Added support for sky texture in Renderer3D and its shader.
- Integrated Perlin noise sky texture in test_3d_render.cc.
- Caught and handled memory/generation errors in AssetManager and TextureManager.
- Assigned reference numbers to all remaining tasks in documentation.
handoff(Gemini): Side-quest complete. ProcGenFunc now returns bool. Perlin noise added and used for sky in 3D test. Windows build remains stable. All tasks numbered.
Diffstat (limited to 'src/procedural/generator.h')
| -rw-r--r-- | src/procedural/generator.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/procedural/generator.h b/src/procedural/generator.h index 72682b0..e57ef61 100644 --- a/src/procedural/generator.h +++ b/src/procedural/generator.h @@ -10,22 +10,32 @@ // buffer: Pointer to RGBA8 buffer (size w * h * 4) // w, h: Dimensions // params: Arbitrary float parameters for the generator -typedef void (*ProcGenFunc)(uint8_t* buffer, int w, int h, const float* params, +// Returns true on success, false on failure. +typedef bool (*ProcGenFunc)(uint8_t* buffer, int w, int h, const float* params, int num_params); namespace procedural { -// Example: Simple noise generator -void gen_noise(uint8_t* buffer, int w, int h, const float* params, +// Simple noise generator +bool gen_noise(uint8_t* buffer, int w, int h, const float* params, int num_params); +// Perlin noise generator +// Params[0]: Seed +// Params[1]: Frequency (Scale) +// Params[2]: Amplitude +// Params[3]: Amplitude decay (e.g. 0.5) +// Params[4]: Number of octaves (int) +bool gen_perlin(uint8_t* buffer, int w, int h, const float* params, + int num_params); + // Example: Grid pattern -void gen_grid(uint8_t* buffer, int w, int h, const float* params, +bool gen_grid(uint8_t* buffer, int w, int h, const float* params, int num_params); // Post-process: Make texture periodic by blending edges // Params[0]: Border size ratio (0.0 - 0.5), default 0.1 -void make_periodic(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); } // namespace procedural |
