diff eclviewer.py @ 72:6a08f44fa01b

Handle a few more ANM instructions. pytouhou.game.background needs some serious refactoring.
author Thibaut Girka <thib@sitedethib.com>
date Sun, 28 Aug 2011 01:23:11 +0200
parents 4fe37a620b22
children fc0294c745b6
line wrap: on
line diff
--- a/eclviewer.py
+++ b/eclviewer.py
@@ -130,7 +130,8 @@ def main(path, stage_num):
             glTranslatef(-x, -y, -z)
 
             glEnable(GL_DEPTH_TEST)
-            for texture_key, (nb_vertices, vertices, uvs, colors) in background.objects_by_texture.items():
+            for (texture_key, blendfunc), (nb_vertices, vertices, uvs, colors) in background.objects_by_texture.items():
+                glBlendFunc(GL_SRC_ALPHA, {0: GL_ONE_MINUS_SRC_ALPHA, 1: GL_ONE}[blendfunc])
                 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key])
                 glVertexPointer(3, GL_FLOAT, 0, vertices)
                 glTexCoordPointer(2, GL_FLOAT, 0, uvs)
@@ -150,7 +151,8 @@ def main(path, stage_num):
                       192., 224., 0., 0., -1., 0.)
 
             glDisable(GL_FOG)
-            for texture_key, (nb_vertices, vertices, uvs, colors) in enemy_manager.objects_by_texture.items():
+            for (texture_key, blendfunc), (nb_vertices, vertices, uvs, colors) in enemy_manager.objects_by_texture.items():
+                glBlendFunc(GL_SRC_ALPHA, {0: GL_ONE_MINUS_SRC_ALPHA, 1: GL_ONE}[blendfunc])
                 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key])
                 glVertexPointer(3, GL_FLOAT, 0, vertices)
                 glTexCoordPointer(2, GL_FLOAT, 0, uvs)