Gobligine/tools/shaders/crt-hyllian-3d.cg.glsl
2016-05-26 01:57:32 +02:00

302 lines
9.3 KiB
GLSL

// GLSL shader autogenerated by cg2glsl.py.
#if defined(VERTEX)
#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif
#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING vec2 _texCoord1;
COMPAT_VARYING float _frame_rotation;
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
float _frame_count;
float _frame_direction;
float _frame_rotation;
};
struct out_vertex {
vec2 _texCoord1;
};
vec4 _oPosition1;
out_vertex _ret_0;
vec4 _r0009;
COMPAT_ATTRIBUTE vec4 gl_Vertex;
COMPAT_ATTRIBUTE vec4 gl_MultiTexCoord0;
COMPAT_VARYING vec4 TEX0;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
_r0009 = gl_Vertex.x*gl_ModelViewProjectionMatrix[0];
_r0009 = _r0009 + gl_Vertex.y*gl_ModelViewProjectionMatrix[1];
_r0009 = _r0009 + gl_Vertex.z*gl_ModelViewProjectionMatrix[2];
_r0009 = _r0009 + gl_Vertex.w*gl_ModelViewProjectionMatrix[3];
_oPosition1 = _r0009;
_ret_0._texCoord1 = gl_MultiTexCoord0.xy;
gl_Position = _r0009;
TEX0.xy = gl_MultiTexCoord0.xy;
return;
TEX0.xy = _ret_0._texCoord1;
}
#elif defined(FRAGMENT)
#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING vec2 _texCoord;
COMPAT_VARYING float _frame_rotation;
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
float _frame_count;
float _frame_direction;
float _frame_rotation;
};
struct out_vertex {
vec2 _texCoord;
};
vec4 _ret_0;
float _TMP18;
float _TMP17;
float _TMP16;
vec3 _TMP15;
float _TMP14;
float _TMP24;
float _TMP23;
float _TMP22;
float _TMP21;
vec3 _TMP20;
vec3 _TMP19;
vec3 _TMP12;
vec3 _TMP11;
vec3 _TMP10;
vec3 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec2 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _c0039;
vec2 _c0049;
vec2 _c0059;
vec2 _c0069;
vec2 _c0079;
vec2 _c0099;
vec2 _c0109;
vec4 _r0131;
vec4 _v0131;
vec3 _r0141;
vec3 _r0143;
vec3 _TMP144;
vec3 _TMP152;
vec3 _TMP164;
vec3 _x0165;
vec3 _TMP170;
vec3 _x0171;
vec3 _TMP176;
vec3 _x0177;
vec3 _TMP186;
vec3 _x0187;
vec3 _TMP196;
vec3 _x0197;
float _c0203;
float _a0205;
COMPAT_VARYING vec4 TEX0;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
vec2 _TextureSize;
vec3 _color;
vec2 _dx;
vec2 _dy;
vec2 _pix_coord;
vec2 _tc;
vec2 _fp;
vec3 _c00;
vec3 _c01;
vec3 _c02;
vec3 _c03;
vec3 _c10;
vec3 _c11;
vec3 _c12;
vec3 _c13;
vec3 _min_sample;
vec3 _max_sample;
vec3 _color0;
vec3 _color1;
float _pos1;
vec3 _lum0;
vec3 _lum1;
float _mod_factor;
vec3 _dotMaskWeights;
_TextureSize = vec2(TextureSize.x, TextureSize.y)/vec2( 2.00000000E+00, 2.00000000E+00);
_dx = vec2(1.00000000E+00/_TextureSize.x, 0.00000000E+00);
_dy = vec2(0.00000000E+00, 1.00000000E+00/_TextureSize.y);
_pix_coord = TEX0.xy*_TextureSize + vec2( -5.00000000E-01, 5.00000000E-01);
_TMP0 = floor(_pix_coord);
_tc = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/_TextureSize;
_fp = fract(_pix_coord);
_c0039 = (_tc - _dx) - _dy;
_TMP1 = COMPAT_TEXTURE(Texture, _c0039);
_TMP16 = pow(_TMP1.x, 2.40000010E+00);
_TMP17 = pow(_TMP1.y, 2.40000010E+00);
_TMP18 = pow(_TMP1.z, 2.40000010E+00);
_c00 = vec3(_TMP16, _TMP17, _TMP18);
_c0049 = _tc - _dy;
_TMP2 = COMPAT_TEXTURE(Texture, _c0049);
_TMP16 = pow(_TMP2.x, 2.40000010E+00);
_TMP17 = pow(_TMP2.y, 2.40000010E+00);
_TMP18 = pow(_TMP2.z, 2.40000010E+00);
_c01 = vec3(_TMP16, _TMP17, _TMP18);
_c0059 = (_tc + _dx) - _dy;
_TMP3 = COMPAT_TEXTURE(Texture, _c0059);
_TMP16 = pow(_TMP3.x, 2.40000010E+00);
_TMP17 = pow(_TMP3.y, 2.40000010E+00);
_TMP18 = pow(_TMP3.z, 2.40000010E+00);
_c02 = vec3(_TMP16, _TMP17, _TMP18);
_c0069 = (_tc + 2.00000000E+00*_dx) - _dy;
_TMP4 = COMPAT_TEXTURE(Texture, _c0069);
_TMP16 = pow(_TMP4.x, 2.40000010E+00);
_TMP17 = pow(_TMP4.y, 2.40000010E+00);
_TMP18 = pow(_TMP4.z, 2.40000010E+00);
_c03 = vec3(_TMP16, _TMP17, _TMP18);
_c0079 = _tc - _dx;
_TMP5 = COMPAT_TEXTURE(Texture, _c0079);
_TMP16 = pow(_TMP5.x, 2.40000010E+00);
_TMP17 = pow(_TMP5.y, 2.40000010E+00);
_TMP18 = pow(_TMP5.z, 2.40000010E+00);
_c10 = vec3(_TMP16, _TMP17, _TMP18);
_TMP6 = COMPAT_TEXTURE(Texture, _tc);
_TMP16 = pow(_TMP6.x, 2.40000010E+00);
_TMP17 = pow(_TMP6.y, 2.40000010E+00);
_TMP18 = pow(_TMP6.z, 2.40000010E+00);
_c11 = vec3(_TMP16, _TMP17, _TMP18);
_c0099 = _tc + _dx;
_TMP7 = COMPAT_TEXTURE(Texture, _c0099);
_TMP16 = pow(_TMP7.x, 2.40000010E+00);
_TMP17 = pow(_TMP7.y, 2.40000010E+00);
_TMP18 = pow(_TMP7.z, 2.40000010E+00);
_c12 = vec3(_TMP16, _TMP17, _TMP18);
_c0109 = _tc + 2.00000000E+00*_dx;
_TMP8 = COMPAT_TEXTURE(Texture, _c0109);
_TMP16 = pow(_TMP8.x, 2.40000010E+00);
_TMP17 = pow(_TMP8.y, 2.40000010E+00);
_TMP18 = pow(_TMP8.z, 2.40000010E+00);
_c13 = vec3(_TMP16, _TMP17, _TMP18);
_TMP9 = min(_c01, _c11);
_TMP10 = min(_c02, _c12);
_min_sample = min(_TMP9, _TMP10);
_TMP11 = max(_c01, _c11);
_TMP12 = max(_c02, _c12);
_max_sample = max(_TMP11, _TMP12);
_v0131 = vec4(_fp.x*_fp.x*_fp.x, _fp.x*_fp.x, _fp.x, 1.00000000E+00);
_r0131.x = dot(vec4( -5.00000000E-01, 1.00000000E+00, -5.00000000E-01, 0.00000000E+00), _v0131);
_r0131.y = dot(vec4( 1.50000000E+00, -2.50000000E+00, 0.00000000E+00, 1.00000000E+00), _v0131);
_r0131.z = dot(vec4( -1.50000000E+00, 2.00000000E+00, 5.00000000E-01, 0.00000000E+00), _v0131);
_r0131.w = dot(vec4( 5.00000000E-01, -5.00000000E-01, 0.00000000E+00, 0.00000000E+00), _v0131);
_r0141 = _r0131.x*_c00;
_r0141 = _r0141 + _r0131.y*_c01;
_r0141 = _r0141 + _r0131.z*_c02;
_r0141 = _r0141 + _r0131.w*_c03;
_r0143 = _r0131.x*_c10;
_r0143 = _r0143 + _r0131.y*_c11;
_r0143 = _r0143 + _r0131.z*_c12;
_r0143 = _r0143 + _r0131.w*_c13;
_TMP19 = min(_max_sample, _r0141);
_TMP144 = max(_min_sample, _TMP19);
_color0 = _r0141 + 8.00000012E-01*(_TMP144 - _r0141);
_TMP19 = min(_max_sample, _r0143);
_TMP152 = max(_min_sample, _TMP19);
_color1 = _r0143 + 8.00000012E-01*(_TMP152 - _r0143);
_pos1 = 1.00000000E+00 - _fp.y;
_lum0 = vec3( 8.60000014E-01, 8.60000014E-01, 8.60000014E-01) + _color0*vec3( 1.39999986E-01, 1.39999986E-01, 1.39999986E-01);
_lum1 = vec3( 8.60000014E-01, 8.60000014E-01, 8.60000014E-01) + _color1*vec3( 1.39999986E-01, 1.39999986E-01, 1.39999986E-01);
_x0165 = _fp.y/(_lum0 + 1.00000001E-07);
_TMP20 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0165);
_TMP164 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP20);
_x0171 = _pos1/(_lum1 + 1.00000001E-07);
_TMP20 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0171);
_TMP170 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP20);
_x0177 = (-7.20000029E+00*_TMP164)*_TMP164;
_TMP16 = pow(2.71828198E+00, _x0177.x);
_TMP17 = pow(2.71828198E+00, _x0177.y);
_TMP18 = pow(2.71828198E+00, _x0177.z);
_TMP176 = vec3(_TMP16, _TMP17, _TMP18);
_x0187 = (-7.20000029E+00*_TMP170)*_TMP170;
_TMP16 = pow(2.71828198E+00, _x0187.x);
_TMP17 = pow(2.71828198E+00, _x0187.y);
_TMP18 = pow(2.71828198E+00, _x0187.z);
_TMP186 = vec3(_TMP16, _TMP17, _TMP18);
_x0197 = _color0*_TMP176 + _color1*_TMP186;
_TMP20 = min(vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _x0197);
_TMP196 = max(vec3( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP20);
_color = _TMP196*vec3( 1.50000000E+00, 1.50000000E+00, 1.50000000E+00);
_mod_factor = (TEX0.x*OutputSize.x*TextureSize.x)/InputSize.x;
_a0205 = _mod_factor/2.00000000E+00;
_TMP21 = abs(_a0205);
_TMP22 = fract(_TMP21);
_TMP23 = abs(2.00000000E+00);
_c0203 = _TMP22*_TMP23;
if (_mod_factor < 0.00000000E+00) {
_TMP24 = -_c0203;
} else {
_TMP24 = _c0203;
}
_TMP14 = floor(_TMP24);
_dotMaskWeights = vec3( 1.00000000E+00, 6.99999988E-01, 1.00000000E+00) + _TMP14*vec3( -3.00000012E-01, 3.00000012E-01, -3.00000012E-01);
_TMP15 = vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_dotMaskWeights - vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
_color.xyz = _color.xyz*_TMP15;
_TMP16 = pow(_color.x, 4.54545438E-01);
_TMP17 = pow(_color.y, 4.54545438E-01);
_TMP18 = pow(_color.z, 4.54545438E-01);
_color = vec3(_TMP16, _TMP17, _TMP18);
_ret_0 = vec4(_color.x, _color.y, _color.z, 1.00000000E+00);
FragColor = _ret_0;
return;
}
#endif