Mercurial > touhou
comparison eclviewer.py @ 106:c7847bfed427
Minor refactoring
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Mon, 05 Sep 2011 22:40:46 +0200 |
parents | 101abdc1a20b |
children | 2a03940deea3 |
comparison
equal
deleted
inserted
replaced
105:572740acdb25 | 106:c7847bfed427 |
---|---|
144 gluLookAt(192., 224., - 835.979370, | 144 gluLookAt(192., 224., - 835.979370, |
145 192., 224., 0., 0., -1., 0.) | 145 192., 224., 0., 0., -1., 0.) |
146 | 146 |
147 glDisable(GL_FOG) | 147 glDisable(GL_FOG) |
148 objects_by_texture = {} | 148 objects_by_texture = {} |
149 game.get_objects_by_texture(objects_by_texture) | 149 for enemy in game.enemies: |
150 enemy.get_objects_by_texture(objects_by_texture) | |
151 for (texture_key, blendfunc), (vertices, uvs, colors) in objects_by_texture.items(): | |
152 nb_vertices = len(vertices) | |
153 glBlendFunc(GL_SRC_ALPHA, (GL_ONE_MINUS_SRC_ALPHA, GL_ONE)[blendfunc]) | |
154 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key]) | |
155 glVertexPointer(3, GL_FLOAT, 0, struct.pack(str(3 * nb_vertices) + 'f', *chain(*vertices))) | |
156 glTexCoordPointer(2, GL_FLOAT, 0, struct.pack(str(2 * nb_vertices) + 'f', *chain(*uvs))) | |
157 glColorPointer(4, GL_UNSIGNED_BYTE, 0, struct.pack(str(4 * nb_vertices) + 'B', *chain(*colors))) | |
158 glDrawArrays(GL_QUADS, 0, nb_vertices) | |
159 | |
160 objects_by_texture = {} | |
161 for bullet in game.game_state.bullets: | |
162 bullet.get_objects_by_texture(objects_by_texture) | |
150 for (texture_key, blendfunc), (vertices, uvs, colors) in objects_by_texture.items(): | 163 for (texture_key, blendfunc), (vertices, uvs, colors) in objects_by_texture.items(): |
151 nb_vertices = len(vertices) | 164 nb_vertices = len(vertices) |
152 glBlendFunc(GL_SRC_ALPHA, (GL_ONE_MINUS_SRC_ALPHA, GL_ONE)[blendfunc]) | 165 glBlendFunc(GL_SRC_ALPHA, (GL_ONE_MINUS_SRC_ALPHA, GL_ONE)[blendfunc]) |
153 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key]) | 166 glBindTexture(GL_TEXTURE_2D, texture_manager[texture_key]) |
154 glVertexPointer(3, GL_FLOAT, 0, struct.pack(str(3 * nb_vertices) + 'f', *chain(*vertices))) | 167 glVertexPointer(3, GL_FLOAT, 0, struct.pack(str(3 * nb_vertices) + 'f', *chain(*vertices))) |