comparison pytouhou/ui/gamerenderer.pyx @ 503:c622eaf64428

Optimize GameRunner some more, fix replay, and remove Window dependency in Renderer.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 04 Oct 2013 14:27:11 +0200
parents 1c891c71cf22
children bfea9e9a6845
comparison
equal deleted inserted replaced
502:3d3285918ba1 503:c622eaf64428
51 self.background_renderer.load(background) 51 self.background_renderer.load(background)
52 else: 52 else:
53 self.background_renderer = None 53 self.background_renderer = None
54 54
55 55
56 cdef void start(self, Game game): 56 cdef void start(self, common):
57 self.proj = perspective(30, float(game.width) / float(game.height), 57 self.proj = perspective(30, float(common.width) / float(common.height),
58 101010101./2010101., 101010101./10101.) 58 101010101./2010101., 101010101./10101.)
59 game_view = setup_camera(0, 0, 1) 59 game_view = setup_camera(0, 0, 1)
60 self.game_mvp = game_view * self.proj 60 self.game_mvp = game_view * self.proj
61 self.interface_mvp = ortho_2d(0., float(game.interface.width), float(game.interface.height), 0.) 61 self.interface_mvp = ortho_2d(0., float(common.interface.width),
62 62 float(common.interface.height), 0.)
63 63
64 cdef void render(self, Game game, Window window): 64
65 cdef void render(self, Game game):
65 if not self.use_fixed_pipeline: 66 if not self.use_fixed_pipeline:
66 self.framebuffer.bind() 67 self.framebuffer.bind()
67 68
68 self.render_game(game) 69 self.render_game(game)
69 self.render_text(game.texts + game.native_texts) 70 self.render_text(game.texts + game.native_texts)
70 self.render_interface(game.interface, game.boss) 71 self.render_interface(game.interface, game.boss)
71 72
72 if not self.use_fixed_pipeline: 73 if not self.use_fixed_pipeline:
73 self.passthrough_shader.bind() 74 self.passthrough_shader.bind()
74 self.passthrough_shader.uniform_matrix('mvp', self.interface_mvp) 75 self.passthrough_shader.uniform_matrix('mvp', self.interface_mvp)
75 self.render_framebuffer(self.framebuffer, window) 76 self.render_framebuffer(self.framebuffer)
76 77
77 78
78 cdef void render_game(self, Game game): 79 cdef void render_game(self, Game game):
79 cdef long game_x, game_y 80 cdef long game_x, game_y
80 cdef float x, y, z, dx, dy, dz, fog_data[4], fog_start, fog_end 81 cdef float x, y, z, dx, dy, dz, fog_data[4], fog_start, fog_end