mozaik bugfix
This commit is contained in:
@@ -92,14 +92,13 @@ def update(game, dt):
|
|||||||
btrans_timer += dt
|
btrans_timer += dt
|
||||||
|
|
||||||
if btrans_timer >= BTRANS_DURATION:
|
if btrans_timer >= BTRANS_DURATION:
|
||||||
game.mos_enabled = False
|
game.mosaic = 1
|
||||||
btrans_active = False
|
btrans_active = False
|
||||||
btrans_sound.stop()
|
btrans_sound.stop()
|
||||||
gamestate.switch_gamestate(game, "battle")
|
gamestate.switch_gamestate(game, "battle")
|
||||||
|
|
||||||
game.mos_enabled = True
|
|
||||||
cycle_progress = (btrans_timer % BTRANS_PULSE_DUR) / BTRANS_PULSE_DUR
|
cycle_progress = (btrans_timer % BTRANS_PULSE_DUR) / BTRANS_PULSE_DUR
|
||||||
game.mosaic = max(1, math.floor(cycle_progress * 16))
|
game.mosaic = max(1, math.floor(cycle_progress * 8))
|
||||||
return
|
return
|
||||||
|
|
||||||
balthasar.update()
|
balthasar.update()
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class Game(arcade.Window):
|
|||||||
self.screen_width = SCREEN_WIDTH
|
self.screen_width = SCREEN_WIDTH
|
||||||
self.screen_height = SCREEN_HEIGHT
|
self.screen_height = SCREEN_HEIGHT
|
||||||
self.mosaic = 1
|
self.mosaic = 1
|
||||||
self.mos_enabled = False
|
|
||||||
|
|
||||||
self.game_texture = self.ctx.texture(
|
self.game_texture = self.ctx.texture(
|
||||||
(SCREEN_WIDTH, SCREEN_HEIGHT),
|
(SCREEN_WIDTH, SCREEN_HEIGHT),
|
||||||
@@ -76,8 +75,9 @@ class Game(arcade.Window):
|
|||||||
y,
|
y,
|
||||||
scaled_width,
|
scaled_width,
|
||||||
scaled_height,
|
scaled_height,
|
||||||
self.mosaic,
|
SCREEN_WIDTH,
|
||||||
self.mos_enabled
|
SCREEN_HEIGHT,
|
||||||
|
self.mosaic
|
||||||
)
|
)
|
||||||
|
|
||||||
game = Game()
|
game = Game()
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ class TextureRenderer:
|
|||||||
""",
|
""",
|
||||||
fragment_shader="""
|
fragment_shader="""
|
||||||
#version 330
|
#version 330
|
||||||
#define INV_RESOLUTION_X (1. / bounds.z)
|
#define INV_RESOLUTION_X (1. / orig_size.x)
|
||||||
#define INV_RESOLUTION_Y (1. / bounds.w)
|
#define INV_RESOLUTION_Y (1. / orig_size.y)
|
||||||
|
|
||||||
uniform vec4 bounds;
|
uniform vec4 bounds;
|
||||||
|
uniform vec2 orig_size;
|
||||||
uniform sampler2D tex;
|
uniform sampler2D tex;
|
||||||
uniform float mosaic;
|
uniform float mosaic;
|
||||||
uniform bool mos_enabled;
|
|
||||||
|
|
||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
out vec4 color;
|
out vec4 color;
|
||||||
@@ -51,19 +51,20 @@ class TextureRenderer:
|
|||||||
(floor((uv.y / INV_RESOLUTION_Y) / mosaic) * INV_RESOLUTION_Y) * mosaic
|
(floor((uv.y / INV_RESOLUTION_Y) / mosaic) * INV_RESOLUTION_Y) * mosaic
|
||||||
);
|
);
|
||||||
|
|
||||||
color = texture(tex, mos_enabled ? new_uv : uv);
|
color = texture(tex, new_uv);
|
||||||
}
|
}
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
|
|
||||||
self.quad = arcade.gl.geometry.quad_2d_fs()
|
self.quad = arcade.gl.geometry.quad_2d_fs()
|
||||||
|
|
||||||
def render(self, texture, x, y, width, height, mosaic, mos_enabled):
|
def render(self, texture, x, y, width, height, orig_width, orig_height, mosaic):
|
||||||
self.program["screen_size"] = (self.ctx.screen.width,
|
self.program["screen_size"] = (self.ctx.screen.width,
|
||||||
self.ctx.screen.height)
|
self.ctx.screen.height)
|
||||||
|
self.program["orig_size"] = (orig_width,
|
||||||
|
orig_height)
|
||||||
self.program["bounds"] = (x, y, width, height)
|
self.program["bounds"] = (x, y, width, height)
|
||||||
self.program["mosaic"] = mosaic
|
self.program["mosaic"] = mosaic
|
||||||
self.program["mos_enabled"] = mos_enabled
|
|
||||||
|
|
||||||
texture.use(0)
|
texture.use(0)
|
||||||
self.program["tex"] = 0
|
self.program["tex"] = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user