diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-10-29 20:48:09 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-10-29 20:48:09 -0300 |
commit | d6567010bf1c65abcbe09b959cde63664778d923 (patch) | |
tree | 5a1ec061f317770c41ece7bb378c0ab2dbb2aef4 /drivers/gles3/shaders/copy.glsl | |
parent | 53d8f2b1ec1d86b189800b7fe156c464fdf9e380 (diff) |
-Many many fixes
-Gizmos work again
Diffstat (limited to 'drivers/gles3/shaders/copy.glsl')
-rw-r--r-- | drivers/gles3/shaders/copy.glsl | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index eb58d66431..79982ecf25 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -5,9 +5,9 @@ layout(location=0) in highp vec4 vertex_attrib; #ifdef USE_CUBEMAP layout(location=4) in vec3 cube_in; #else -layout(location=4) in vec2 uv_in; // attrib:4 +layout(location=4) in vec2 uv_in; #endif -layout(location=5) in vec2 uv2_in; // attrib:5 +layout(location=5) in vec2 uv2_in; #ifdef USE_CUBEMAP out vec3 cube_interp; @@ -40,6 +40,15 @@ uniform sampler2D source; //texunit:0 #endif +float sRGB_gamma_correct(float c){ + float a = 0.055; + if(c < 0.0031308) + return 12.92*c; + else + return (1.0+a)*pow(c, 1.0/2.4) - a; +} + + uniform float stuff; in vec2 uv2_interp; @@ -57,6 +66,20 @@ void main() { vec4 color = texture( source, uv_interp ); #endif +#ifdef LINEAR_TO_SRGB + //regular Linear -> SRGB conversion + vec3 a = vec3(0.055); + color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308))); +#endif + +#ifdef DEBUG_GRADIENT + color.rg=uv_interp; + color.b=0.0; +#endif + +#ifdef DISABLE_ALPHA + color.a=1.0; +#endif frag_color = color; } |