diff options
Diffstat (limited to 'shaders/tesseract/178.shader_test')
-rw-r--r-- | shaders/tesseract/178.shader_test | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/shaders/tesseract/178.shader_test b/shaders/tesseract/178.shader_test new file mode 100644 index 0000000..e848fb8 --- /dev/null +++ b/shaders/tesseract/178.shader_test @@ -0,0 +1,61 @@ +[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; + uniform float offsets[8]; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + void main(void) + { + gl_Position = vvertex; + texcoord0 = vtexcoord0; + vec2 tc1 = vtexcoord0.xy, tc2 = vtexcoord0; + tc1.x += offsets[1]; + tc2.x -= offsets[1]; + texcoord1 = tc1; + texcoord2 = tc2; + + tc1.x = vtexcoord0.x + offsets[2]; + tc2.x = vtexcoord0.x - offsets[2]; + texcoord3 = tc1; + texcoord4 = tc2; + + } + +[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 float weights[8]; + uniform float offsets[8]; + uniform sampler2DRect tex0; + varying vec2 texcoord0, texcoord1, texcoord2; + + varying vec2 texcoord3, texcoord4; + + fragdata(0, fragcolor, vec4) + void main(void) + { + #define texval(coords) texture2DRect(tex0, (coords)) + vec4 val = texval(texcoord0) * weights[0]; + + val += weights[1] * (texval(texcoord1) + texval(texcoord2)); + + val += weights[2] * (texval(texcoord3) + texval(texcoord4)); + + fragcolor = val; + } + |