summaryrefslogtreecommitdiff
path: root/src/effects/hybrid3_d_effect.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-17 08:16:03 +0100
committerskal <pascal.massimino@gmail.com>2026-02-17 08:16:03 +0100
commit64f977f6fbedf75d5edbc3963e002b593c8428d8 (patch)
treeef711b63d34b5c3f5ecc93d46a0a3ab0b6d26a6f /src/effects/hybrid3_d_effect.cc
parent8c9332c16b44270921eb1b6a2886717eb3435d5d (diff)
style: Apply clang-format
Diffstat (limited to 'src/effects/hybrid3_d_effect.cc')
-rw-r--r--src/effects/hybrid3_d_effect.cc36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/effects/hybrid3_d_effect.cc b/src/effects/hybrid3_d_effect.cc
index c13c1e9..027e2a7 100644
--- a/src/effects/hybrid3_d_effect.cc
+++ b/src/effects/hybrid3_d_effect.cc
@@ -8,8 +8,8 @@
#include <cmath>
Hybrid3D::Hybrid3D(const GpuContext& ctx,
- const std::vector<std::string>& inputs,
- const std::vector<std::string>& outputs)
+ const std::vector<std::string>& inputs,
+ const std::vector<std::string>& outputs)
: Effect(ctx, inputs, outputs), depth_node_(outputs[0] + "_depth"),
dummy_texture_(nullptr), dummy_texture_view_(nullptr) {
// Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
@@ -33,24 +33,12 @@ Hybrid3D::Hybrid3D(const GpuContext& ctx,
uint32_t white_pixel = 0xFFFFFFFF;
#if defined(DEMO_CROSS_COMPILE_WIN32)
WGPUImageCopyTexture dst = {
- .texture = dummy_texture_,
- .mipLevel = 0,
- .origin = {0, 0, 0}
- };
- WGPUTextureDataLayout data_layout = {
- .bytesPerRow = 4,
- .rowsPerImage = 1
- };
+ .texture = dummy_texture_, .mipLevel = 0, .origin = {0, 0, 0}};
+ WGPUTextureDataLayout data_layout = {.bytesPerRow = 4, .rowsPerImage = 1};
#else
WGPUTexelCopyTextureInfo dst = {
- .texture = dummy_texture_,
- .mipLevel = 0,
- .origin = {0, 0, 0}
- };
- WGPUTexelCopyBufferLayout data_layout = {
- .bytesPerRow = 4,
- .rowsPerImage = 1
- };
+ .texture = dummy_texture_, .mipLevel = 0, .origin = {0, 0, 0}};
+ WGPUTexelCopyBufferLayout data_layout = {.bytesPerRow = 4, .rowsPerImage = 1};
#endif
WGPUExtent3D size = {1, 1, 1};
wgpuQueueWriteTexture(ctx_.queue, &dst, &white_pixel, 4, &data_layout, &size);
@@ -68,8 +56,9 @@ Hybrid3D::Hybrid3D(const GpuContext& ctx,
scene_.add_object(center);
for (int i = 0; i < 8; ++i) {
- ObjectType type = (i % 3 == 1) ? ObjectType::TORUS :
- (i % 3 == 2) ? ObjectType::BOX : ObjectType::SPHERE;
+ ObjectType type = (i % 3 == 1) ? ObjectType::TORUS
+ : (i % 3 == 2) ? ObjectType::BOX
+ : ObjectType::SPHERE;
Object3D obj(type);
float angle = (i / 8.0f) * 6.28318f;
@@ -101,8 +90,8 @@ void Hybrid3D::declare_nodes(NodeRegistry& registry) {
}
void Hybrid3D::render(WGPUCommandEncoder encoder,
- const UniformsSequenceParams& params,
- NodeRegistry& nodes) {
+ const UniformsSequenceParams& params,
+ NodeRegistry& nodes) {
// Update camera (orbiting)
float angle = params.time * 0.3f;
vec3 cam_pos = vec3(std::cos(angle) * 10.0f, 5.0f, std::sin(angle) * 10.0f);
@@ -135,7 +124,8 @@ void Hybrid3D::render(WGPUCommandEncoder encoder,
pass_desc.colorAttachments = &color_attachment;
pass_desc.depthStencilAttachment = &depth_attachment;
- WGPURenderPassEncoder pass = wgpuCommandEncoderBeginRenderPass(encoder, &pass_desc);
+ WGPURenderPassEncoder pass =
+ wgpuCommandEncoderBeginRenderPass(encoder, &pass_desc);
renderer_.draw(pass, scene_, camera_, params.time);
wgpuRenderPassEncoderEnd(pass);
wgpuRenderPassEncoderRelease(pass);