diff --git a/src/graphics/render.nim b/src/graphics/render.nim index cf9dae1..b949d28 100644 --- a/src/graphics/render.nim +++ b/src/graphics/render.nim @@ -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 diff --git a/src/types.nim b/src/types.nim index b805ba0..b8d0479 100644 --- a/src/types.nim +++ b/src/types.nim @@ -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]