diff pytouhou/ui/sprite.pyx @ 505:bfea9e9a6845

Manage the texture-specific indices in the Texture, and some more renderer optimisations.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 01 Nov 2013 14:45:53 +0100
parents d56536ef28e8
children b39ad30c6620
line wrap: on
line diff
--- a/pytouhou/ui/sprite.pyx
+++ b/pytouhou/ui/sprite.pyx
@@ -16,6 +16,7 @@
 from libc.math cimport M_PI as pi
 
 from pytouhou.utils.matrix cimport Matrix
+from pytouhou.ui.renderer cimport Texture #XXX
 
 
 cpdef object get_sprite_rendering_data(Sprite sprite):
@@ -67,7 +68,7 @@ cpdef object get_sprite_rendering_data(S
            ty * y_1 + toy,
            (ty + th) * y_1 + toy)
 
-    key = MAX_TEXTURES * sprite.blendfunc + <long>sprite.anm.texture
+    key = ((<Texture>sprite.anm.texture).texture << 1) | sprite.blendfunc
     r, g, b = sprite.color
     values = tuple([x for x in vertmat.data[:12]]), uvs, (r, g, b, sprite.alpha)
     sprite._rendering_data = key, values