Fix shader problems on GLES2
This commit is contained in:
@@ -3,21 +3,21 @@
|
||||
//Currently does not work with AtlasTextures, going to need some work.
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform highp vec2 positionInput = vec2(0,0);
|
||||
uniform highp vec2 pixelSize = vec2(32, 32);
|
||||
uniform highp float alphaCutoff = 0.0;
|
||||
uniform bool removeTransparency = false;
|
||||
uniform highp vec2 positionInput;
|
||||
uniform highp vec2 pixelSize;
|
||||
uniform highp float alphaCutoff;
|
||||
uniform bool removeTransparency;
|
||||
|
||||
void fragment() {
|
||||
float pixelLength = pixelSize.x*2;
|
||||
float halvedLength = pixelLength/2;
|
||||
highp float pixelLength = pixelSize.x*2.0;
|
||||
highp float halvedLength = pixelLength/2.0;
|
||||
if(FRAGCOORD.x > positionInput.x - halvedLength && FRAGCOORD.x < positionInput.x + halvedLength && FRAGCOORD.y > positionInput.y - halvedLength && FRAGCOORD.y < positionInput.y + halvedLength){
|
||||
vec2 finalCoords = (FRAGCOORD.xy-positionInput+(pixelLength/2))/pixelLength;
|
||||
vec4 color = texture(tex, finalCoords);
|
||||
highp vec2 finalCoords = (FRAGCOORD.xy-positionInput+(pixelLength/2.0))/pixelLength;
|
||||
highp vec4 color = texture2D(tex, finalCoords);
|
||||
if(color.a > alphaCutoff){
|
||||
if(removeTransparency)
|
||||
color.a = 1.0;
|
||||
COLOR = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user