comparison pytouhou/ui/opengl/gamerenderer.pyx @ 569:b21922a03830

Don’t render spellcard background when --no-background is passed.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 09 Jul 2014 16:46:55 +0200
parents c759b97f4f81
children b8df946d394d
comparison
equal deleted inserted replaced
568:e7a4731a278b 569:b21922a03830
114 114
115 if is_legacy: 115 if is_legacy:
116 glMatrixMode(GL_PROJECTION) 116 glMatrixMode(GL_PROJECTION)
117 glLoadIdentity() 117 glLoadIdentity()
118 118
119 if game is not None and game.spellcard_effect is not None: 119 if self.background_renderer is None:
120 glClear(GL_COLOR_BUFFER_BIT)
121 elif game is not None and game.spellcard_effect is not None:
120 if is_legacy: 122 if is_legacy:
121 glMatrixMode(GL_MODELVIEW) 123 glMatrixMode(GL_MODELVIEW)
122 glLoadMatrixf(<GLfloat*>self.game_mvp) 124 glLoadMatrixf(<GLfloat*>self.game_mvp)
123 glDisable(GL_FOG) 125 glDisable(GL_FOG)
124 else: 126 else:
125 self.game_shader.bind() 127 self.game_shader.bind()
126 self.game_shader.uniform_matrix('mvp', self.game_mvp) 128 self.game_shader.uniform_matrix('mvp', self.game_mvp)
127 129
128 self.render_elements([game.spellcard_effect]) 130 self.render_elements([game.spellcard_effect])
129 elif self.background_renderer is not None: 131 else:
130 back = self.background 132 back = self.background
131 x, y, z = back.position_interpolator.values 133 x, y, z = back.position_interpolator.values
132 dx, dy, dz = back.position2_interpolator.values 134 dx, dy, dz = back.position2_interpolator.values
133 fog_b, fog_g, fog_r, fog_start, fog_end = back.fog_interpolator.values 135 fog_b, fog_g, fog_r, fog_start, fog_end = back.fog_interpolator.values
134 136
173 self.background_shader.uniform_1('fog_end', fog_end) 175 self.background_shader.uniform_1('fog_end', fog_end)
174 self.background_shader.uniform_4('fog_color', fog_r / 255., fog_g / 255., fog_b / 255., 1.) 176 self.background_shader.uniform_4('fog_color', fog_r / 255., fog_g / 255., fog_b / 255., 1.)
175 177
176 free(mvp) 178 free(mvp)
177 self.background_renderer.render_background() 179 self.background_renderer.render_background()
178 else:
179 glClear(GL_COLOR_BUFFER_BIT)
180 180
181 if game is not None: 181 if game is not None:
182 if is_legacy: 182 if is_legacy:
183 glMatrixMode(GL_MODELVIEW) 183 glMatrixMode(GL_MODELVIEW)
184 glLoadMatrixf(<GLfloat*>self.game_mvp) 184 glLoadMatrixf(<GLfloat*>self.game_mvp)