[docs]
class SceneRenderer:
def __init__(self, app):
self.app = app
self.ctx = app.ctx
self.mesh = app.mesh
self.scene = app.scene
# Render depth buffer
self.depth_texture = self.mesh.texture.textures['depth_texture']
self.depth_fbo = self.ctx.framebuffer(depth_attachment=self.depth_texture)
[docs]
def render_shadow(self):
self.depth_fbo.clear()
self.depth_fbo.use()
for obj in self.scene.objects:
obj.render_shadow()
[docs]
def main_render(self):
self.app.ctx.screen.use()
for obj in self.scene.objects:
obj.render()
self.scene.skybox.render()
[docs]
def render(self):
self.scene.update()
# Pass 1
self.render_shadow()
# Pass 2
self.main_render()
[docs]
def destroy(self):
self.depth_fbo.release()