Render: Add depth-only pass (temporary until pass system is rewritten).

This commit is contained in:
Alberto Torres 2025-03-18 18:05:55 +01:00
parent 6f21f9fa87
commit c09499dd01
2 changed files with 8 additions and 0 deletions

View file

@ -495,6 +495,13 @@ proc draw_viewport*(self: RenderManager, viewport: Viewport, rect: (int32,int32,
# self.draw_mesh(ob, ob.world_matrix, cd, 0)
# glClear(GL_DEPTH_BUFFER_BIT)
if scene.depth_pass.len != 0:
glColorMask(false, false, false, false)
for ob in scene.depth_pass:
if ob.visible == true:
self.draw_mesh(ob, ob.world_matrix, cd, 0)
glColorMask(true, true, true, true)
# PASS 0 (opaque)
if passes.find(0) >= 0 and scene.mesh_passes[0].len != 0:
# Sort by distence to camera

View file

@ -353,6 +353,7 @@ type
children*: seq[GameObject]
auto_updated_children*: seq[GameObject]
mesh_passes*: seq[seq[Mesh]]
depth_pass*: seq[Mesh]
bg_pass*: seq[Mesh]
fg_pass*: seq[Mesh]
lights*: seq[Light]