Mercurial > touhou
comparison pytouhou/ui/opengl/gamerenderer.pyx @ 610:1b31169dc344
Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 21 Dec 2014 18:52:18 +0100 |
parents | 3c2f96f1d715 |
children | a6af3ff86612 |
comparison
equal
deleted
inserted
replaced
609:23b9418e4b2f | 610:1b31169dc344 |
---|---|
26 | 26 |
27 from pytouhou.utils.matrix cimport mul, new_identity | 27 from pytouhou.utils.matrix cimport mul, new_identity |
28 from pytouhou.utils.maths cimport perspective, setup_camera, ortho_2d | 28 from pytouhou.utils.maths cimport perspective, setup_camera, ortho_2d |
29 from pytouhou.game.text cimport NativeText, GlyphCollection | 29 from pytouhou.game.text cimport NativeText, GlyphCollection |
30 from pytouhou.ui.window cimport Window | 30 from pytouhou.ui.window cimport Window |
31 from .shaders.eosd import GameShader, BackgroundShader, PassthroughShader | 31 from .shaders.eosd import GameShader, BackgroundShader |
32 from .renderer cimport Texture | 32 from .renderer cimport Texture |
33 from .backend cimport is_legacy, use_debug_group, use_pack_invert | 33 from .backend cimport is_legacy, use_debug_group, use_pack_invert, use_scaled_rendering |
34 | 34 |
35 from collections import namedtuple | 35 from collections import namedtuple |
36 Rect = namedtuple('Rect', 'x y w h') | 36 Rect = namedtuple('Rect', 'x y w h') |
37 Color = namedtuple('Color', 'r g b a') | 37 Color = namedtuple('Color', 'r g b a') |
38 | 38 |
43 | 43 |
44 if not is_legacy: | 44 if not is_legacy: |
45 self.game_shader = GameShader() | 45 self.game_shader = GameShader() |
46 self.background_shader = BackgroundShader() | 46 self.background_shader = BackgroundShader() |
47 self.interface_shader = self.game_shader | 47 self.interface_shader = self.game_shader |
48 self.passthrough_shader = PassthroughShader() | 48 |
49 | 49 if use_scaled_rendering: |
50 self.framebuffer = Framebuffer(0, 0, window.width, window.height) | 50 self.framebuffer = Framebuffer(0, 0, window.width, window.height) |
51 | 51 |
52 | 52 |
53 def __dealloc__(self): | 53 def __dealloc__(self): |
54 if self.game_mvp != NULL: | 54 if self.game_mvp != NULL: |
86 self.interface_mvp = ortho_2d(0., float(common.interface.width), | 86 self.interface_mvp = ortho_2d(0., float(common.interface.width), |
87 float(common.interface.height), 0.) | 87 float(common.interface.height), 0.) |
88 | 88 |
89 | 89 |
90 def render(self, Game game): | 90 def render(self, Game game): |
91 if not is_legacy: | 91 if use_scaled_rendering: |
92 self.framebuffer.bind() | 92 self.framebuffer.bind() |
93 | 93 |
94 self.render_game(game) | 94 self.render_game(game) |
95 self.render_text(game.texts) | 95 self.render_text(game.texts) |
96 self.render_interface(game.interface, game.boss) | 96 self.render_interface(game.interface, game.boss) |
97 | 97 |
98 if not is_legacy: | 98 if use_scaled_rendering: |
99 if use_debug_group: | |
100 glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Scaled rendering") | |
101 | |
102 self.passthrough_shader.bind() | |
103 self.passthrough_shader.uniform_matrix('mvp', self.interface_mvp) | |
104 self.framebuffer.render(self.x, self.y, self.width, self.height) | 99 self.framebuffer.render(self.x, self.y, self.width, self.height) |
105 | |
106 if use_debug_group: | |
107 glPopDebugGroup() | |
108 | 100 |
109 | 101 |
110 def capture(self, filename, int width, int height): | 102 def capture(self, filename, int width, int height): |
111 capture_memory = <char*>malloc(width * height * 3) | 103 capture_memory = <char*>malloc(width * height * 3) |
112 | 104 |