summaryrefslogtreecommitdiff
path: root/model.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-29 14:49:07 +1100
committerquou <quou@disroot.org>2024-12-29 14:49:07 +1100
commit96c459ca2f52cf2c5bec269d0f30e01d21bc916b (patch)
tree7e98cb0b36f77eabb55b1b96f66225eb13ca351d /model.cpp
parent09d6ea353e1ed9502967c1406061613272eafb63 (diff)
add depth prepass
Diffstat (limited to 'model.cpp')
-rw-r--r--model.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/model.cpp b/model.cpp
index e8be727..c3d01ac 100644
--- a/model.cpp
+++ b/model.cpp
@@ -165,6 +165,7 @@ void Model::render(
cbuffers[i].view_projection = view_projection;
cbuffers[i].model = transform * meshes[i].world;
}
+ bool depth_only = !pass.colour_count;
dev->unmap_buffer(mvp);
for (i = 0; i < c; i++) {
Mesh& mesh = meshes[i];
@@ -187,7 +188,10 @@ void Model::render(
draw.first_vertex = mesh.offset;
draw.vertex_offset = mesh.vbo_offset;
pb.begin();
- pb.depth(true, true, Depth_Mode::less);
+ if (depth_only)
+ pb.depth(true, true, Depth_Mode::less);
+ else
+ pb.depth(true, false, Depth_Mode::equal);
pb.shader(mesh.shader);
pb.cbuffer(
mesh.mvp_binding,