comparison pytouhou/opengl/sprite.py @ 120:4300a832f033

Small refactoring and massive performance improvement
author Thibaut Girka <thib@sitedethib.com>
date Thu, 08 Sep 2011 12:46:05 +0200
parents 2a03940deea3
children 0313ca2c50e9
comparison
equal deleted inserted replaced
119:fad7b44cebf2 120:4300a832f033
19 19
20 20
21 def get_sprite_rendering_data(sprite): 21 def get_sprite_rendering_data(sprite):
22 if not sprite._changed: 22 if not sprite._changed:
23 return sprite._rendering_data 23 return sprite._rendering_data
24
25 if sprite.fade_interpolator:
26 sprite.fade_interpolator.update(sprite.frame)
27 sprite.alpha = int(sprite.fade_interpolator.values[0])
28
29 if sprite.scale_interpolator:
30 sprite.scale_interpolator.update(sprite.frame)
31 sprite.rescale = sprite.scale_interpolator.values
32
33 if sprite.offset_interpolator:
34 sprite.offset_interpolator.update(sprite.frame)
35 sprite.dest_offset = sprite.offset_interpolator.values
36 24
37 vertmat = Matrix([[-.5, .5, .5, -.5], 25 vertmat = Matrix([[-.5, .5, .5, -.5],
38 [-.5, -.5, .5, .5], 26 [-.5, -.5, .5, .5],
39 [ .0, .0, .0, .0], 27 [ .0, .0, .0, .0],
40 [ 1., 1., 1., 1.]]) 28 [ 1., 1., 1., 1.]])