comparison 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
comparison
equal deleted inserted replaced
71:a03d7a94b997 72:6a08f44fa01b
128 gluLookAt(192., 224., - 835.979370 * dz, 128 gluLookAt(192., 224., - 835.979370 * dz,
129 192. + dx, 224. - dy, 0., 0., -1., 0.) 129 192. + dx, 224. - dy, 0., 0., -1., 0.)
130 glTranslatef(-x, -y, -z) 130 glTranslatef(-x, -y, -z)
131 131
132 glEnable(GL_DEPTH_TEST) 132 glEnable(GL_DEPTH_TEST)
133 for texture_key, (nb_vertices, vertices, uvs, colors) in background.objects_by_texture.items(): 133 for (texture_key, blendfunc), (nb_vertices, vertices, uvs, colors) in background.objects_by_texture.items():
134 glBlendFunc(GL_SRC_ALPHA, {0: GL_ONE_MINUS_SRC_ALPHA, 1: GL_ONE}[blendfunc])
134 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key]) 135 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key])
135 glVertexPointer(3, GL_FLOAT, 0, vertices) 136 glVertexPointer(3, GL_FLOAT, 0, vertices)
136 glTexCoordPointer(2, GL_FLOAT, 0, uvs) 137 glTexCoordPointer(2, GL_FLOAT, 0, uvs)
137 glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors) 138 glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors)
138 glDrawArrays(GL_QUADS, 0, nb_vertices) 139 glDrawArrays(GL_QUADS, 0, nb_vertices)
148 # This is so that objects on the (O, x, y) plane use pixel coordinates 149 # This is so that objects on the (O, x, y) plane use pixel coordinates
149 gluLookAt(192., 224., - 835.979370, 150 gluLookAt(192., 224., - 835.979370,
150 192., 224., 0., 0., -1., 0.) 151 192., 224., 0., 0., -1., 0.)
151 152
152 glDisable(GL_FOG) 153 glDisable(GL_FOG)
153 for texture_key, (nb_vertices, vertices, uvs, colors) in enemy_manager.objects_by_texture.items(): 154 for (texture_key, blendfunc), (nb_vertices, vertices, uvs, colors) in enemy_manager.objects_by_texture.items():
155 glBlendFunc(GL_SRC_ALPHA, {0: GL_ONE_MINUS_SRC_ALPHA, 1: GL_ONE}[blendfunc])
154 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key]) 156 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key])
155 glVertexPointer(3, GL_FLOAT, 0, vertices) 157 glVertexPointer(3, GL_FLOAT, 0, vertices)
156 glTexCoordPointer(2, GL_FLOAT, 0, uvs) 158 glTexCoordPointer(2, GL_FLOAT, 0, uvs)
157 glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors) 159 glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors)
158 glDrawArrays(GL_QUADS, 0, nb_vertices) 160 glDrawArrays(GL_QUADS, 0, nb_vertices)