comparison pytouhou/ui/opengl/gamerenderer.pyx @ 519:b18f0bd30ad0

Optimise background rendering.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 07 Dec 2013 22:16:38 +0100
parents dec43940f092
children 6e3b3d5d4691
comparison
equal deleted inserted replaced
518:75ae628522c9 519:b18f0bd30ad0
55 def load_textures(self, dict anms): 55 def load_textures(self, dict anms):
56 self.texture_manager.load(anms) 56 self.texture_manager.load(anms)
57 57
58 58
59 def load_background(self, background): 59 def load_background(self, background):
60 self.background = background
60 if background is not None: 61 if background is not None:
61 self.background_renderer = BackgroundRenderer(self.use_fixed_pipeline) 62 self.background_renderer = BackgroundRenderer(self.use_fixed_pipeline)
62 self.background_renderer.load(background, self) 63 self.background_renderer.load(background, self)
63 else: 64 else:
64 self.background_renderer = None 65 self.background_renderer = None
112 self.game_shader.bind() 113 self.game_shader.bind()
113 self.game_shader.uniform_matrix('mvp', self.game_mvp) 114 self.game_shader.uniform_matrix('mvp', self.game_mvp)
114 115
115 self.render_elements([game.spellcard_effect]) 116 self.render_elements([game.spellcard_effect])
116 elif self.background_renderer is not None: 117 elif self.background_renderer is not None:
117 back = self.background_renderer.background 118 back = self.background
118 x, y, z = back.position_interpolator.values 119 x, y, z = back.position_interpolator.values
119 dx, dy, dz = back.position2_interpolator.values 120 dx, dy, dz = back.position2_interpolator.values
120 fog_b, fog_g, fog_r, fog_start, fog_end = back.fog_interpolator.values 121 fog_b, fog_g, fog_r, fog_start, fog_end = back.fog_interpolator.values
121 122
122 # Those two lines may come from the difference between Direct3D and 123 # Those two lines may come from the difference between Direct3D and