Skip to content

Commit

Permalink
add manual clamping to box shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterk committed Aug 25, 2018
1 parent 25b5220 commit 7bf5101
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
9 changes: 8 additions & 1 deletion auto-box/box-center.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ COMPAT_VARYING vec4 TEX0;

void main()
{
FragColor = COMPAT_TEXTURE(Source, vTexCoord);
vec3 outColor = COMPAT_TEXTURE(Source, vTexCoord);
/* TODO/FIXME - hacky clamp fix */
vec2 bordertest = gl_FragCoord.xy;
if ( bordertest.x > 0.0001 && bordertest.x < 0.9999 && bordertest.y > 0.0001 && bordertest.y < 0.9999)
outColor.rgb = outColor.rgb;
else
outColor.rgb = vec3(0.0);
FragColor = vec4(outColor, 1.0);
}
#endif
9 changes: 8 additions & 1 deletion auto-box/box-max.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ COMPAT_VARYING vec4 TEX0;

void main()
{
FragColor = COMPAT_TEXTURE(Source, vTexCoord);
vec3 outColor = COMPAT_TEXTURE(Source, vTexCoord);
/* TODO/FIXME - hacky clamp fix */
vec2 bordertest = gl_FragCoord.xy;
if ( bordertest.x > 0.0001 && bordertest.x < 0.9999 && bordertest.y > 0.0001 && bordertest.y < 0.9999)
outColor.rgb = outColor.rgb;
else
outColor.rgb = vec3(0.0);
FragColor = vec4(outColor, 1.0);
}
#endif
9 changes: 8 additions & 1 deletion auto-box/box.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ COMPAT_VARYING vec4 TEX0;

void main()
{
FragColor = COMPAT_TEXTURE(Source, vTexCoord);
vec3 outColor = COMPAT_TEXTURE(Source, vTexCoord);
/* TODO/FIXME - hacky clamp fix */
vec2 bordertest = gl_FragCoord.xy;
if ( bordertest.x > 0.0001 && bordertest.x < 0.9999 && bordertest.y > 0.0001 && bordertest.y < 0.9999)
outColor.rgb = outColor.rgb;
else
outColor.rgb = vec3(0.0);
FragColor = vec4(outColor, 1.0);
}
#endif

2 comments on commit 7bf5101

@ab235g
Copy link

@ab235g ab235g commented on 7bf5101 Aug 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change fixed the tearing but now auto bx no longer respects aspect ratio and stretches the game to fill the screen

@hizzlekizzle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ab235g Hmm, I can't reproduce that here. I don't know why such a thing would happen, since I didn't touch any of that code...

Please sign in to comment.