Shader: Refine preprocessing on GLES platform
Don't globally set float precision to mediump, only fragment shaders need that and defining it for vertex shaders causes tilemap cracks. Also manually define low precision for variables that hold color / alpha values.
This commit is contained in:
parent
a501e4f22f
commit
a53163660f
14 changed files with 67 additions and 42 deletions
|
@ -1,13 +1,13 @@
|
|||
|
||||
uniform sampler2D texture;
|
||||
|
||||
uniform vec4 tone;
|
||||
uniform lowp vec4 tone;
|
||||
|
||||
uniform float opacity;
|
||||
uniform vec4 color;
|
||||
uniform lowp float opacity;
|
||||
uniform lowp vec4 color;
|
||||
|
||||
uniform float bushDepth;
|
||||
uniform float bushOpacity;
|
||||
uniform lowp float bushOpacity;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
|
@ -32,7 +32,7 @@ void main()
|
|||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||
|
||||
/* Apply bush alpha by mathematical if */
|
||||
float underBush = float(v_texCoord.y < bushDepth);
|
||||
lowp float underBush = float(v_texCoord.y < bushDepth);
|
||||
frag.a *= clamp(bushOpacity + underBush, 0.0, 1.0);
|
||||
|
||||
gl_FragColor = frag;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue