[fix] Fixed an issue that the clipping post effect was broken.

This commit is contained in:
falsycat 2019-10-09 00:00:00 +00:00
parent 5a7e710a1a
commit b4690f9603
2 changed files with 7 additions and 6 deletions

View File

@ -12,9 +12,9 @@ class PostEffect {
struct Instance { struct Instance {
public: public:
/// ///
align(1) vec2 clip_lefttop = vec2(1, 1); align(1) vec2 clip_lefttop = vec2(0, 0);
/// ///
align(1) vec2 clip_rightbottom = vec2(1, 1); align(1) vec2 clip_rightbottom = vec2(0, 0);
} }
/// ///
@ -115,10 +115,10 @@ class PostEffectProgram {
pixel_ = texture(fb, fb_size * tex_uv); pixel_ = texture(fb, fb_size * tex_uv);
pixel_.a *= pixel_.a *=
step(-instance.clip_lefttop.x, uv_.x) * step(-1+instance.clip_lefttop.x, uv_.x) *
(1-step(instance.clip_rightbottom.x, uv_.x)) * (1-step(1-instance.clip_rightbottom.x, uv_.x)) *
(1-step(instance.clip_lefttop.y, uv_.y)) * (1-step(1-instance.clip_lefttop.y, uv_.y)) *
step(-instance.clip_rightbottom.y, uv_.x); step(-1+instance.clip_rightbottom.y, uv_.y);
} }
}; };

View File

@ -51,6 +51,7 @@ int main(string[] args) {
"nearness: %f (%f)".writefln(dmg.nearness, beat); "nearness: %f (%f)".writefln(dmg.nearness, beat);
} }
gl.Clear(GL_COLOR_BUFFER_BIT);
context.StartDrawing(); context.StartDrawing();
context.DrawBackground(); context.DrawBackground();