summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-17 13:24:56 +0100
committerskal <pascal.massimino@gmail.com>2026-02-17 13:24:56 +0100
commite3f0b002c0998c8553e782273b254869107ffc0f (patch)
treee1e5f8a6c5d119e7764d8d7a43b43bc0c65f4e78 /src
parentbdb1a4e95a545f3f4d88630b8aec6ab771776d99 (diff)
feat(uniforms): Add noise field with per-frame random values
Replace _pad with noise field in UniformsSequenceParams, providing effects with non-deterministic random values [0..1] updated each frame. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/sequence.cc7
-rw-r--r--src/gpu/sequence.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/gpu/sequence.cc b/src/gpu/sequence.cc
index 901d560..9de4133 100644
--- a/src/gpu/sequence.cc
+++ b/src/gpu/sequence.cc
@@ -4,6 +4,7 @@
#include "gpu/effect.h"
#include "util/fatal_error.h"
#include <algorithm>
+#include <random>
// NodeRegistry implementation
@@ -227,7 +228,11 @@ void Sequence::preprocess(float seq_time, float beat_time, float beat_phase,
params_.beat_time = beat_time;
params_.beat_phase = beat_phase;
params_.audio_intensity = audio_intensity;
- params_._pad = 0.0f;
+
+ static std::random_device rd;
+ static std::mt19937 gen(rd());
+ static std::uniform_real_distribution<float> dis(0.0f, 1.0f);
+ params_.noise = dis(gen);
uniforms_buffer_.update(ctx_.queue, params_);
}
diff --git a/src/gpu/sequence.h b/src/gpu/sequence.h
index 3bb770f..2ad0a8f 100644
--- a/src/gpu/sequence.h
+++ b/src/gpu/sequence.h
@@ -38,7 +38,7 @@ struct UniformsSequenceParams {
float beat_time; // Musical beats
float beat_phase; // Fractional beat 0.0-1.0
float audio_intensity;
- float _pad;
+ float noise; // Random value [0..1]
};
static_assert(sizeof(UniformsSequenceParams) == 32,
"UniformsSequenceParams must be 32 bytes for WGSL alignment");