19 lines
		
	
	
		
			451 B
		
	
	
	
		
			GLSL
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			451 B
		
	
	
	
		
			GLSL
		
	
	
	
	
	
| precision mediump float;
 | |
| 
 | |
| varying vec2 fragTexCoord;
 | |
| varying vec4 fragColor;
 | |
| uniform sampler2D texture0;
 | |
| 
 | |
| vec3 srgb_to_linear(vec3 c) {
 | |
| 	bvec3 cutoff = lessThanEqual(c, vec3(0.04045));
 | |
| 	vec3  low    = c / 12.92;
 | |
| 	vec3  high   = pow((c + 0.055) / 1.055, vec3(2.4));
 | |
| 	return mix(high, low, vec3(cutoff));
 | |
| }
 | |
| 
 | |
| void main() {
 | |
| 	vec4 c = texture2D(texture0, fragTexCoord) * fragColor;
 | |
| 	c.rgb  = srgb_to_linear(c.rgb); // decode to linear
 | |
| 	gl_FragColor = c;
 | |
| }
 |