|
Implements comprehensive RNG and noise functions for procedural
shader effects:
Hash Functions:
- hash_1f, hash_2f, hash_3f (float-based, fast)
- hash_2f_2f, hash_3f_3f (vector output)
- hash_1u, hash_1u_2f, hash_1u_3f (integer-based, high quality)
Noise Functions:
- noise_2d, noise_3d (value noise with smoothstep)
- fbm_2d, fbm_3d (fractional Brownian motion)
- gyroid (periodic minimal surface)
Integration:
- Added to ShaderComposer as "math/noise" snippet
- Available via #include "math/noise" in WGSL shaders
- Test suite validates all 11 functions compile
Testing:
- test_noise_functions.cc validates shader loading
- All 33 tests pass (100%)
Size Impact: ~200-400 bytes per function used (dead-code eliminated)
Files:
- assets/final/shaders/math/noise.wgsl (new, 4.2KB, 150 lines)
- assets/final/demo_assets.txt (added SHADER_MATH_NOISE)
- assets/final/test_assets_list.txt (added SHADER_MATH_NOISE)
- src/gpu/effects/shaders.cc (registered snippet)
- src/tests/test_noise_functions.cc (new test)
- CMakeLists.txt (added test target)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|