summaryrefslogtreecommitdiff
path: root/src/effects/rotating_cube_effect_v2.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-16 10:03:18 +0100
committerskal <pascal.massimino@gmail.com>2026-02-16 10:03:18 +0100
commit2e33a435d6f1efee5a6c88cbfc99b97241fe2ad3 (patch)
tree6eb1890a738ff9050835cd88bc4cadebeeb390c8 /src/effects/rotating_cube_effect_v2.h
parenta126caf9e52b8f7c5be8e09b303e741aa9a410cb (diff)
feat(sequence): port rotating_cube_effect to v2
- Add RotatingCubeEffectV2 with 3D rendering + depth buffer - Create rotating_cube_v2.wgsl (hardcoded cube geometry) - Simplified: no auxiliary mask texture dependency - Declare depth node via NodeRegistry - Update timeline_v2.seq rotating_cube sequence - Add shader exports to shaders.{h,cc} - All 36 tests passing handoff(Claude): RotatingCube v2 complete, hybrid_3d next
Diffstat (limited to 'src/effects/rotating_cube_effect_v2.h')
-rw-r--r--src/effects/rotating_cube_effect_v2.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/effects/rotating_cube_effect_v2.h b/src/effects/rotating_cube_effect_v2.h
new file mode 100644
index 0000000..19ef410
--- /dev/null
+++ b/src/effects/rotating_cube_effect_v2.h
@@ -0,0 +1,49 @@
+// This file is part of the 64k demo project.
+// It declares RotatingCubeEffectV2 (simplified v2 port).
+
+#pragma once
+
+#include "gpu/effect_v2.h"
+#include "gpu/gpu.h"
+#include "gpu/uniform_helper.h"
+#include "util/mini_math.h"
+
+class RotatingCubeEffectV2 : public EffectV2 {
+ public:
+ RotatingCubeEffectV2(const GpuContext& ctx,
+ const std::vector<std::string>& inputs,
+ const std::vector<std::string>& outputs);
+ ~RotatingCubeEffectV2() override;
+
+ void declare_nodes(NodeRegistry& registry) override;
+ void render(WGPUCommandEncoder encoder,
+ const UniformsSequenceParams& params,
+ NodeRegistry& nodes) override;
+
+ private:
+ struct Uniforms {
+ mat4 view_proj;
+ mat4 inv_view_proj;
+ vec4 camera_pos_time;
+ vec4 params;
+ vec2 resolution;
+ float aspect_ratio;
+ float _pad;
+ };
+ static_assert(sizeof(Uniforms) == 176, "Uniforms size mismatch");
+
+ struct ObjectData {
+ mat4 model;
+ mat4 inv_model;
+ vec4 color;
+ vec4 params;
+ };
+ static_assert(sizeof(ObjectData) == 160, "ObjectData size mismatch");
+
+ WGPURenderPipeline pipeline_ = nullptr;
+ WGPUBindGroup bind_group_ = nullptr;
+ GpuBuffer uniform_buffer_;
+ GpuBuffer object_buffer_;
+ float rotation_ = 0.0f;
+ std::string depth_node_;
+};