format glsl files

pull/6/head
casperlamboo 5 years ago
parent ad94402400
commit 4cb60940f8
  1. 27
      shaders/anaglyph_frag.glsl
  2. 5
      shaders/anaglyph_vert.glsl

@ -5,32 +5,25 @@ varying vec2 vUv;
uniform mat3 colorMatrixLeft;
uniform mat3 colorMatrixRight;
float lin( float c ) {
return c <= 0.04045 ? c * 0.0773993808 :
pow( c * 0.9478672986 + 0.0521327014, 2.4 );
float lin(float c) {
return c <= 0.04045 ? c * 0.0773993808 : pow(c * 0.9478672986 + 0.0521327014, 2.4);
}
vec4 lin( vec4 c ) {
return vec4( lin( c.r ), lin( c.g ), lin( c.b ), c.a );
vec4 lin(vec4 c) {
return vec4(lin(c.r), lin(c.g), lin(c.b), c.a);
}
float dev( float c ) {
return c <= 0.0031308 ? c * 12.92 : pow( c, 0.41666 ) * 1.055 - 0.055;
float dev(float c) {
return c <= 0.0031308 ? c * 12.92 : pow(c, 0.41666) * 1.055 - 0.055;
}
void main() {
vec2 uv = vUv;
vec4 colorL = lin( texture2D( mapLeft, uv ) );
vec4 colorR = lin( texture2D( mapRight, uv ) );
vec3 color = clamp(
colorMatrixLeft * colorL.rgb +
colorMatrixRight * colorR.rgb, 0., 1. );
vec4 colorL = lin(texture2D(mapLeft, uv));
vec4 colorR = lin(texture2D(mapRight, uv));
gl_FragColor = vec4(
dev( color.r ), dev( color.g ), dev( color.b ),
max( colorL.a, colorR.a ) );
vec3 color = clamp(colorMatrixLeft * colorL.rgb + colorMatrixRight * colorR.rgb, 0., 1.);
gl_FragColor = vec4(dev(color.r), dev(color.g), dev(color.b), max(colorL.a, colorR.a));
}

@ -1,5 +1,6 @@
varying vec2 vUv;
void main() {
vUv = vec2( uv.x, uv.y );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
vUv = vec2(uv.x, uv.y);
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}

Loading…
Cancel
Save