diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-08 19:14:55 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-08 19:14:55 +0100 |
| commit | b7d282249394a8c0a48d5dfe5af410b541c724cc (patch) | |
| tree | 19020b59ae03b5029db33cee8932589c92bde11e /assets/final/shaders/ray_box.wgsl | |
| parent | 6071c9f6bea2d3890024cb47083b92d9ddbf0447 (diff) | |
refactor(procedural): Use hash-based noise instead of lattice approach
Replaces lattice-based noise generation with deterministic hash functions
matching the WGSL implementation. Eliminates heap allocations and rand()
dependency.
Changes:
- Added hash_2f() and noise_2d() C++ functions (matches WGSL)
- Refactored gen_perlin() to use hash-based FBM (no malloc/free)
- Refactored gen_noise() to use hash_based value noise
- Removed all rand()/srand() calls (now deterministic via seed offset)
- Eliminated lattice allocation/deallocation per octave
Benefits:
- Zero heap allocations (was allocating lattice per octave)
- Deterministic output (seed-based, not rand-based)
- 28% smaller code (270 → 194 lines, -75 lines)
- Matches WGSL noise implementation behavior
- Faster (no malloc overhead, better cache locality)
Testing:
- All 33 tests pass (100%)
- test_procedural validates noise/perlin/grid generation
- No visual regressions
Size Impact: ~200-300 bytes smaller (malloc/free overhead eliminated)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'assets/final/shaders/ray_box.wgsl')
0 files changed, 0 insertions, 0 deletions
