summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-03 19:06:41 +0100
committerskal <pascal.massimino@gmail.com>2026-02-03 19:06:41 +0100
commit3108fb0065a51dfc3548836ea16b287e92cd8881 (patch)
treeb20d3ffd904b65596ce9dd2df15a527b91a6539f /src/tests
parentc3714939897af2541c655c03bcdd61108fff46ea (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/tests')
-rw-r--r--src/tests/test_3d_render.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/tests/test_3d_render.cc b/src/tests/test_3d_render.cc
index 6e639cd..024dd87 100644
--- a/src/tests/test_3d_render.cc
+++ b/src/tests/test_3d_render.cc
@@ -167,11 +167,12 @@ void setup_scene() {
}
// Wrapper to generate periodic noise
-void gen_periodic_noise(uint8_t* buffer, int w, int h, const float* params,
+bool gen_periodic_noise(uint8_t* buffer, int w, int h, const float* params,
int num_params) {
- procedural::gen_noise(buffer, w, h, params, num_params);
+ if (!procedural::gen_noise(buffer, w, h, params, num_params))
+ return false;
float p_params[] = {0.1f}; // 10% overlap
- procedural::make_periodic(buffer, w, h, p_params, 1);
+ return procedural::make_periodic(buffer, w, h, p_params, 1);
}
int main(int argc, char** argv) {
@@ -209,6 +210,14 @@ int main(int argc, char** argv) {
g_renderer.set_noise_texture(g_textures.get_texture_view("noise"));
+ ProceduralTextureDef sky_def;
+ sky_def.width = 512;
+ sky_def.height = 256;
+ sky_def.gen_func = procedural::gen_perlin;
+ sky_def.params = {42.0f, 4.0f, 1.0f, 0.5f, 6.0f};
+ g_textures.create_procedural_texture("sky", sky_def);
+ g_renderer.set_sky_texture(g_textures.get_texture_view("sky"));
+
setup_scene();
g_camera.position = vec3(0, 5, 10);