summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app/main.cc4
-rwxr-xr-xtools/seq_compiler_v2.py63
2 files changed, 61 insertions, 6 deletions
diff --git a/src/app/main.cc b/src/app/main.cc
index 587c4fc..406c944 100644
--- a/src/app/main.cc
+++ b/src/app/main.cc
@@ -20,6 +20,7 @@
#include "generated/assets.h" // Include generated asset header
#include "gpu/demo_effects.h" // For GetDemoDuration()
#include "gpu/gpu.h"
+#include "generated/timeline_v2.h"
#include "platform/platform.h"
#include "util/math.h"
#include <cmath>
@@ -107,6 +108,9 @@ int main(int argc, char** argv) {
platform_state = platform_init(fullscreen_enabled, width, height);
gpu_init(&platform_state);
+ // Initialize v2 sequences
+ InitializeV2Sequences(*gpu_get_context(), width, height);
+
// Load timeline data (visual effects layering)
#if !defined(DEMO_HEADLESS)
LoadTimeline(*gpu_get_main_sequence(), *gpu_get_context());
diff --git a/tools/seq_compiler_v2.py b/tools/seq_compiler_v2.py
index cb30585..9918a92 100755
--- a/tools/seq_compiler_v2.py
+++ b/tools/seq_compiler_v2.py
@@ -479,21 +479,72 @@ def main():
cpp = generate_cpp(seq, sorted_effects, aliases, args.flatten)
all_cpp += cpp + '\n'
- # Generate compatibility stubs for v1 API
+ # Generate sequence registry and accessors
all_cpp += '''
-// V1 compatibility stubs (TODO: Replace with proper v2 integration)
+// V2 Sequence Registry
#include "gpu/effect.h"
+#include <vector>
+#include <memory>
+struct SequenceV2Entry {
+ float start_time;
+ int priority;
+ std::unique_ptr<SequenceV2> sequence;
+};
+
+static std::vector<SequenceV2Entry> g_v2_sequences;
+static bool g_v2_initialized = false;
+
+void InitializeV2Sequences(const GpuContext& ctx, int width, int height) {
+ if (g_v2_initialized) return;
+ g_v2_initialized = true;
+
+'''
+
+ # Instantiate each sequence
+ for seq in sequences:
+ class_name = f"{seq.name}Sequence"
+ all_cpp += f' g_v2_sequences.push_back({{{seq.start_time}f, {seq.priority}, std::make_unique<{class_name}>(ctx, width, height)}});\n'
+
+ all_cpp += '''
+}
+
+SequenceV2* GetActiveV2Sequence(float time) {
+ // Find active sequence (latest start_time <= current time)
+ SequenceV2* active = nullptr;
+ for (auto& entry : g_v2_sequences) {
+ if (entry.start_time <= time) {
+ active = entry.sequence.get();
+ }
+ }
+ return active;
+}
+
+void RenderV2Timeline(WGPUCommandEncoder encoder, float time, int width, int height,
+ float beat_time, float audio_intensity) {
+ SequenceV2* seq = GetActiveV2Sequence(time);
+ if (seq) {
+ UniformsSequenceParams params = {};
+ params.resolution = {(float)width, (float)height};
+ params.aspect_ratio = (float)width / (float)height;
+ params.time = time;
+ params.beat_time = beat_time;
+ params.beat_phase = 0.0f;
+ params.audio_intensity = audio_intensity;
+
+ seq->render_effects(encoder);
+ }
+}
+
+// V1 compatibility stub
void LoadTimeline(MainSequence& main_seq, const GpuContext& ctx) {
- // TODO: Integrate v2 sequences with MainSequence
- // For now, this is a no-op to allow linking
+ // V1 stub - v2 sequences initialized separately
(void)main_seq;
(void)ctx;
}
float GetDemoDuration() {
- // TODO: Calculate from v2 sequences
- return 40.0f;
+ return 40.0f; // TODO: Calculate from v2 sequences
}
'''