mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 09:20:51 +00:00
- fraqment shader cleanup part one.
This commit is contained in:
parent
734d8b7d1e
commit
7185bbad81
1 changed files with 29 additions and 16 deletions
|
@ -136,16 +136,30 @@ vec4 convertColor(vec4 color, int effect, vec3 tint)
|
|||
|
||||
void main()
|
||||
{
|
||||
float coordY = mix(v_texCoord.y,v_texCoord.x,u_usePalette);
|
||||
float coordX = mix(v_texCoord.x,v_texCoord.y,u_usePalette);
|
||||
float coordX = v_texCoord.x;
|
||||
float coordY = v_texCoord.y;
|
||||
vec2 newCoord;
|
||||
|
||||
// Coordinate adjustment for NPOT textures (something must have gone very wrong to make this necessary...)
|
||||
if (u_npotEmulation != 0.0)
|
||||
{
|
||||
float period = floor(coordY / u_npotEmulationFactor);
|
||||
coordX += u_npotEmulationXOffset * floor(mod(coordY, u_npotEmulationFactor));
|
||||
coordY = period + mod(coordY, u_npotEmulationFactor);
|
||||
vec2 newCoord = mix(v_texCoord.xy,mix(vec2(coordX,coordY),vec2(coordY,coordX),u_usePalette),u_npotEmulation);
|
||||
}
|
||||
newCoord = vec2(coordX, coordY);
|
||||
#if 1
|
||||
if (u_clamp != 0.0) newCoord = clamp(newCoord.xy, 0.0, 1.0);
|
||||
#else
|
||||
// what is this for? The only effect I could observe was a significant degradation of anisotropic filtering.
|
||||
vec2 transitionBlend = fwidth(floor(newCoord.xy));
|
||||
transitionBlend = fwidth(transitionBlend) + transitionBlend;
|
||||
vec2 texCoord = mix(mix(fract(newCoord.xy), abs(c_one-mod(newCoord.xy+c_one, c_two)), transitionBlend), clamp(newCoord.xy, c_zero, c_one), u_clamp);
|
||||
vec4 color = texture2D(s_texture, texCoord);
|
||||
|
||||
vec2 val1 = mix(fract(newCoord.xy), abs(1.0-mod(newCoord.xy+1.0, 2.0)), transitionBlend);
|
||||
vec2 clampedCoord = clamp(newCoord.xy, 0.0, 1.0);
|
||||
newCoord = mix(val1, clampedCoord, u_clamp);
|
||||
#endif
|
||||
vec4 color = texture2D(s_texture, newCoord);
|
||||
|
||||
float shade = clamp((u_shade+max(u_visFactor*v_distance-0.5*u_shadeInterpolate,c_zero)), c_zero, u_numShades-c_one);
|
||||
float shadeFrac = mod(shade, c_one);
|
||||
|
@ -192,6 +206,5 @@ void main()
|
|||
|
||||
color.a *= v_color.a;
|
||||
color.rgb = pow(color.rgb, vec3(u_brightness));
|
||||
|
||||
fragColor = color;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue