summaryrefslogtreecommitdiff
path: root/c2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c2.cpp')
-rw-r--r--c2.cpp53
1 files changed, 29 insertions, 24 deletions
diff --git a/c2.cpp b/c2.cpp
index 573744e..29f3955 100644
--- a/c2.cpp
+++ b/c2.cpp
@@ -152,28 +152,6 @@ extern "C" int entrypoint() {
dev->unmap_buffer(cbuf);
}
- {
- Texture& bb = dev->get_texture(dev->get_backbuffer());
- void* mem;
- mem = dev->map_buffer(cbuf2, 0, sizeof(Config_Buffer2));
- Config_Buffer2* c = (Config_Buffer2*)mem;
- c->projection = m4f::pers(
- 70.0f,
- (float)bb.w / (float)bb.h,
- 0.01f,
- 100.0f
- );
- c->transform = (m4f::translate(
- m4f::identity(),
- v3f(0.0f, 0.0f, -5.0f)
- ) * m4f::rotate(
- m4f::identity(),
- rot,
- raxis
- ));
- dev->unmap_buffer(cbuf2);
- }
-
Pipeline_Builder pb(&frame_arena, dev);
pb.begin_rp();
pb.rp_target(dev->get_backbuffer(), { r, 0x00, 0xff, 0xff });
@@ -207,10 +185,37 @@ extern "C" int entrypoint() {
dev->get_ctx().submit(draw, pip, pass);
pb.begin_rp();
- pb.rp_target(dev->get_backbuffer(), Clear_Mode::restore);
pb.rp_depth_target(dev->get_depth_target(), 1.0f);
+ dev->get_ctx().submit(pb.build_rp());
+
+ pb.begin_rp();
+ pb.rp_target(dev->get_backbuffer(), Clear_Mode::restore);
+ pb.rp_depth_target(dev->get_depth_target(), Clear_Mode::restore);
Render_Pass& pass2 = pb.build_rp();
- monkey->render(dev, &frame_arena, pass2, cbuf2);
+
+ Texture& bb = dev->get_texture(dev->get_backbuffer());
+ m4f projection = m4f::pers(
+ 70.0f,
+ (float)bb.w / (float)bb.h,
+ 0.01f,
+ 100.0f
+ );
+ m4f transform = (m4f::translate(
+ m4f::identity(),
+ v3f(0.0f, 0.0f, -5.0f)
+ ) * m4f::rotate(
+ m4f::identity(),
+ rot,
+ raxis
+ ));
+ monkey->update_transforms();
+ monkey->render(
+ dev,
+ &frame_arena,
+ pass2,
+ transform,
+ projection
+ );
ui->render(&frame_arena, dev->get_backbuffer());