dungeon_crawler

diff prototype/src/renderer.cc @ 62:f71381c9e245

gamo to xristo
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Sep 2012 06:59:11 +0300
parents d57df51f6b50
children 7f52d6310317
line diff
     1.1 --- a/prototype/src/renderer.cc	Tue Sep 25 06:37:56 2012 +0300
     1.2 +++ b/prototype/src/renderer.cc	Tue Sep 25 06:59:11 2012 +0300
     1.3 @@ -44,6 +44,20 @@
     1.4  	height = ysz;
     1.5  }
     1.6  
     1.7 +void Renderer::render_pre(const Level *level) const
     1.8 +{
     1.9 +	glEnable(GL_FOG);
    1.10 +	glFogi(GL_FOG_MODE, GL_LINEAR);
    1.11 +	glFogf(GL_FOG_START, 3.0f);
    1.12 +	glFogf(GL_FOG_END, 6.0f);
    1.13 +	// TODO level->draw_pre();
    1.14 +}
    1.15 +
    1.16 +void Renderer::render_post(const Level *level) const
    1.17 +{
    1.18 +	level->draw_post();
    1.19 +}
    1.20 +
    1.21  
    1.22  // ---- fallback forward renderer ----
    1.23  FwdRenderer::FwdRenderer()
    1.24 @@ -86,17 +100,14 @@
    1.25  {
    1.26  	glPushAttrib(GL_ENABLE_BIT);
    1.27  	glEnable(GL_LIGHTING);
    1.28 -	glEnable(GL_FOG);
    1.29 -	glFogi(GL_FOG_MODE, GL_LINEAR);
    1.30 -	glFogf(GL_FOG_START, 3.0f);
    1.31 -	glFogf(GL_FOG_END, 6.0f);
    1.32 +
    1.33 +	render_pre(level);
    1.34  
    1.35  	glUseProgram(sdrprog);
    1.36 +	level->draw();
    1.37 +	glUseProgram(0);
    1.38  
    1.39 -	level->draw();
    1.40 -
    1.41 -	glUseProgram(0);
    1.42 -	level->draw_post();
    1.43 +	render_post(level);
    1.44  
    1.45  	glPopAttrib();
    1.46  }