diff options
Diffstat (limited to 'shaders/tesseract/130.shader_test')
-rw-r--r-- | shaders/tesseract/130.shader_test | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/shaders/tesseract/130.shader_test b/shaders/tesseract/130.shader_test new file mode 100644 index 0000000..6823056 --- /dev/null +++ b/shaders/tesseract/130.shader_test @@ -0,0 +1,64 @@ +[require] +GLSL >= 1.10 + +[vertex shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +attribute vec4 vvertex; + attribute vec2 vtexcoord0; + varying vec2 texcoord0; + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + } + +[fragment shader] +#version 120 +#extension GL_ARB_texture_rectangle : enable +#define flat +#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset)) +#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset)) +#define fragdata(loc, name, type) +#define fragcolor gl_FragData[0] +uniform sampler2DRect tex0; + uniform vec2 hdrgamma; + varying vec2 texcoord0; + fragdata(0, fragcolor, vec4) + void main(void) + { + + vec3 color0 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, -1)).rgb*2.0; + + color0 *= color0; + + float lum0 = dot(color0, vec3(0.2126, 0.7152, 0.0722)); + float loglum0 = sqrt(clamp(lum0, 0.015625, 4.0)) * (1.0/2.0); + + vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).rgb*2.0; + + color1 *= color1; + + float lum1 = dot(color1, vec3(0.2126, 0.7152, 0.0722)); + float loglum1 = sqrt(clamp(lum1, 0.015625, 4.0)) * (1.0/2.0); + + vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2(1, 1)).rgb*2.0; + + color2 *= color2; + + float lum2 = dot(color2, vec3(0.2126, 0.7152, 0.0722)); + float loglum2 = sqrt(clamp(lum2, 0.015625, 4.0)) * (1.0/2.0); + + vec3 color3 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).rgb*2.0; + + color3 *= color3; + + float lum3 = dot(color3, vec3(0.2126, 0.7152, 0.0722)); + float loglum3 = sqrt(clamp(lum3, 0.015625, 4.0)) * (1.0/2.0); + + fragcolor.rgb = vec3(0.25*(loglum0 + loglum1 + loglum2 + loglum3)); + } + |