Mercurial > touhou
annotate pytouhou/ui/gamerenderer.pyx @ 425:1104dc2553ee
Make the anmviewer use the new architecture.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 16 Jul 2013 21:07:15 +0200 |
parents | f4d76d3d6f2a |
children | 0604f4fbbe3c |
rev | line source |
---|---|
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
2 ## |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
3 ## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com> |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
4 ## |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
5 ## This program is free software; you can redistribute it and/or modify |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
6 ## it under the terms of the GNU General Public License as published |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
7 ## by the Free Software Foundation; version 3 only. |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
8 ## |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
9 ## This program is distributed in the hope that it will be useful, |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
12 ## GNU General Public License for more details. |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
13 ## |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
14 |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
15 from libc.stdlib cimport malloc, free |
201 | 16 from itertools import chain |
131
fab7ad2f0d8b
Use Cython, improve performances!
Thibaut Girka <thib@sitedethib.com>
parents:
130
diff
changeset
|
17 |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
18 from pytouhou.lib.opengl cimport \ |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
19 (glClear, glMatrixMode, glLoadIdentity, glLoadMatrixf, glDisable, |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
20 glEnable, glFogi, glFogf, glFogfv, GL_DEPTH_BUFFER_BIT, |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
21 GL_PROJECTION, GL_MODELVIEW, GL_FOG, GL_FOG_MODE, GL_LINEAR, |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
22 GL_FOG_START, GL_FOG_END, GL_FOG_COLOR, GL_COLOR_BUFFER_BIT, GLfloat) |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
23 |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
24 from pytouhou.utils.matrix cimport Matrix, matrix_to_floats |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
25 from pytouhou.utils.maths cimport setup_camera |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
26 |
391
84b151962708
Convert pytouhou.ui.gamerenderer back to pure python, it doesn’t use or need any cython feature.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
27 from .renderer import Renderer |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
28 |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
29 |
125
0313ca2c50e9
Small refactoring and massive performance improvements
Thibaut Girka <thib@sitedethib.com>
parents:
123
diff
changeset
|
30 |
391
84b151962708
Convert pytouhou.ui.gamerenderer back to pure python, it doesn’t use or need any cython feature.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
384
diff
changeset
|
31 class GameRenderer(Renderer): |
422
52829ebe2561
Refactor window management in its own class.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
412
diff
changeset
|
32 def __init__(self, resource_loader): |
222
5cac48b328ad
Refactor rendering code a bit.
Thibaut Girka <thib@sitedethib.com>
parents:
221
diff
changeset
|
33 Renderer.__init__(self, resource_loader) |
254
6bd565019f9a
Preload textures to avoid slowdowns during gameplay
Thibaut Girka <thib@sitedethib.com>
parents:
242
diff
changeset
|
34 |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
35 |
131
fab7ad2f0d8b
Use Cython, improve performances!
Thibaut Girka <thib@sitedethib.com>
parents:
130
diff
changeset
|
36 def render(self): |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
37 cdef float* fog_data |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
38 |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
39 glClear(GL_DEPTH_BUFFER_BIT) |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
40 |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
41 back = self.background |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
42 game = self.game |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
43 |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
44 if self.use_fixed_pipeline: |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
45 glMatrixMode(GL_PROJECTION) |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
46 glLoadIdentity() |
217
577f45454402
Change background during spellcards.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
205
diff
changeset
|
47 |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
48 if game is not None and game.spellcard_effect is not None: |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
49 if self.use_fixed_pipeline: |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
50 glMatrixMode(GL_MODELVIEW) |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
51 glLoadMatrixf(matrix_to_floats(self.game_mvp)) |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
52 glDisable(GL_FOG) |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
53 else: |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
54 self.game_shader.bind() |
424
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
55 self.game_shader.uniform_matrix('mvp', self.game_mvp) |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
56 |
306
52d791bb7c32
Rename a few attributes/methods to make a little more sense.
Thibaut Girka <thib@sitedethib.com>
parents:
304
diff
changeset
|
57 self.render_elements([game.spellcard_effect]) |
217
577f45454402
Change background during spellcards.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
205
diff
changeset
|
58 elif back is not None: |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
59 x, y, z = back.position_interpolator.values |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
60 dx, dy, dz = back.position2_interpolator.values |
399
1c773544eaeb
Make the background use a single vbo and offsets, just like the 2D code.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
398
diff
changeset
|
61 fog_b, fog_g, fog_r, fog_start, fog_end = back.fog_interpolator.values |
1c773544eaeb
Make the background use a single vbo and offsets, just like the 2D code.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
398
diff
changeset
|
62 |
401
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
63 # Those two lines may come from the difference between Direct3D and |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
64 # OpenGL’s distance handling. The first one seem to calculate fog |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
65 # from the eye, while the second does that starting from the near |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
66 # plane. |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
67 #TODO: investigate, and use a variable to keep the near plane |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
68 # distance at a single place. |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
69 fog_start -= 101010101./2010101. |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
70 fog_end -= 101010101./2010101. |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
71 |
399
1c773544eaeb
Make the background use a single vbo and offsets, just like the 2D code.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
398
diff
changeset
|
72 model = Matrix() |
1c773544eaeb
Make the background use a single vbo and offsets, just like the 2D code.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
398
diff
changeset
|
73 model.data[3] = [-x, -y, -z, 1] |
412
5fe6cd6ceb48
Refactor the maths functions out of Renderer.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
406
diff
changeset
|
74 view = setup_camera(dx, dy, dz) |
424
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
75 mvp = model * view * self.proj |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
76 |
399
1c773544eaeb
Make the background use a single vbo and offsets, just like the 2D code.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
398
diff
changeset
|
77 if self.use_fixed_pipeline: |
401
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
78 glMatrixMode(GL_MODELVIEW) |
424
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
79 glLoadMatrixf(matrix_to_floats(mvp)) |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
80 |
401
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
81 glEnable(GL_FOG) |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
82 glFogi(GL_FOG_MODE, GL_LINEAR) |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
83 glFogf(GL_FOG_START, fog_start) |
3ce4065840e9
Calculate the fog per-fragment and remove the fixed-pipeline glFog* functions; now both vertex shaders are the same.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
399
diff
changeset
|
84 glFogf(GL_FOG_END, fog_end) |
424
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
85 |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
86 fog_data = <float*>malloc(4 * sizeof(float)) |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
87 fog_data[0] = fog_r / 255. |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
88 fog_data[1] = fog_g / 255. |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
89 fog_data[2] = fog_b / 255. |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
90 fog_data[3] = 1. |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
91 glFogfv(GL_FOG_COLOR, fog_data) |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
92 free(fog_data) |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
93 else: |
399
1c773544eaeb
Make the background use a single vbo and offsets, just like the 2D code.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
398
diff
changeset
|
94 self.background_shader.bind() |
424
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
95 self.background_shader.uniform_matrix('mvp', mvp) |
399
1c773544eaeb
Make the background use a single vbo and offsets, just like the 2D code.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
398
diff
changeset
|
96 |
424
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
97 self.background_shader.uniform_1('fog_scale', 1. / (fog_end - fog_start)) |
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
98 self.background_shader.uniform_1('fog_end', fog_end) |
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
99 self.background_shader.uniform_4('fog_color', fog_r / 255., fog_g / 255., fog_b / 255., 1.) |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
100 |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
101 self.background_renderer.render_background() |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
102 else: |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
103 glClear(GL_COLOR_BUFFER_BIT) |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
104 |
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
105 if game is not None: |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
106 if self.use_fixed_pipeline: |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
107 glMatrixMode(GL_MODELVIEW) |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
422
diff
changeset
|
108 glLoadMatrixf(matrix_to_floats(self.game_mvp)) |
370
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
109 glDisable(GL_FOG) |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
110 else: |
74471afbac37
Add a programmable pipeline renderer, and a --fixed-pipeline switch to use the old one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
345
diff
changeset
|
111 self.game_shader.bind() |
424
f4d76d3d6f2a
Make the Shader class use cython too.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
112 self.game_shader.uniform_matrix('mvp', self.game_mvp) |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
diff
changeset
|
113 |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
294
diff
changeset
|
114 self.render_elements(enemy for enemy in game.enemies if enemy.visible) |
166
dcf32488a2c9
Better enemy death, with animation and (hopefully) correct flags handling.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
164
diff
changeset
|
115 self.render_elements(game.effects) |
201 | 116 self.render_elements(chain(game.players_bullets, |
294
94c636f8f863
Add player lasers for MarisaB.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
117 game.lasers_sprites(), |
201 | 118 game.players, |
384
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
383
diff
changeset
|
119 game.msg_sprites())) |
315
e935ed8dc5e6
Add out-of-screen item indicators.
Thibaut Girka <thib@sitedethib.com>
parents:
306
diff
changeset
|
120 self.render_elements(chain(game.bullets, game.lasers, |
e935ed8dc5e6
Add out-of-screen item indicators.
Thibaut Girka <thib@sitedethib.com>
parents:
306
diff
changeset
|
121 game.cancelled_bullets, game.items, |
384
690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
383
diff
changeset
|
122 game.labels)) |