1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Made some further minor attempted improvements.

This commit is contained in:
Thomas Harte 2015-09-02 20:51:56 -04:00 committed by Thomas Harte
parent 161450942a
commit 11acf3f2d3

View File

@ -214,41 +214,36 @@ const char *fragmentShader =
"\n"
"float sample(float c, float angle)\n"
"{\n"
"float y = 0.1 + (mod(c * 128.0, 8.0) / 8.0) * 0.9;\n"
"float y = 0.1 + mod(c * 128.0, 8.0) * 0.1125;\n"
"float rawCh = (c * 16.0);\n"
"float aOffset = 2.0 * 3.141592654 * floor(mod(rawCh, 16.0)) / 17.0;\n"
"return y + step(1.0, rawCh) * (0.1 * sin(angle + aOffset));\n"
"float aOffset = 6.283185308 * floor(rawCh) / 17.0;\n"
"return y + step(1.0, rawCh) * 0.1 * sin(angle + aOffset);\n"
"}\n"
"\n"
"void main(void)\n"
"{\n"
"vec4 samples[2];\n"
"float angles[7];\n"
"vec4 angles[2];\n"
"\n"
"angles[2] = mod(phase, 6.283185308);\n"
"vec4 angle = vec4(mod(phase, 6.283185308));\n"
"angles[0] = angle + vec4(3.7699111848, 5.0265482464, 0.0, 1.2566370616);\n"
"angles[1] = angle + vec4(2.5132741232, 5.6548667772, 0.6283185308, 0.0);\n"
"\n"
"angles[0] = angles[2] + 3.7699111848;\n"
"angles[1] = angles[2] + 5.0265482464;\n"
"angles[3] = angles[2] + 1.2566370616;\n"
"angles[4] = angles[2] + 2.5132741232;\n"
"angles[5] = angles[2] + 5.6548667772;\n"
"angles[6] = angles[2] + 0.6283185308;\n"
"\n"
"samples[0] = vec4(sample(texture(texID, srcCoordinatesVarying[0]).r, angles[0]),"
" sample(texture(texID, srcCoordinatesVarying[1]).r, angles[1]),"
" sample(texture(texID, srcCoordinatesVarying[2]).r, angles[2]),"
" sample(texture(texID, srcCoordinatesVarying[3]).r, angles[3]));\n"
"samples[1] = vec4(sample(texture(texID, srcCoordinatesVarying[4]).r, angles[4]),"
" sample(texture(texID, srcCoordinatesVarying[5]).r, angles[5]),"
" sample(texture(texID, srcCoordinatesVarying[6]).r, angles[6]),"
"samples[0] = vec4(sample(texture(texID, srcCoordinatesVarying[0]).r, angles[0].x),"
" sample(texture(texID, srcCoordinatesVarying[1]).r, angles[0].y),"
" sample(texture(texID, srcCoordinatesVarying[2]).r, angles[0].z),"
" sample(texture(texID, srcCoordinatesVarying[3]).r, angles[0].w));\n"
"samples[1] = vec4(sample(texture(texID, srcCoordinatesVarying[4]).r, angles[1].x),"
" sample(texture(texID, srcCoordinatesVarying[5]).r, angles[1].y),"
" sample(texture(texID, srcCoordinatesVarying[6]).r, angles[1].z),"
" 1.0);\n"
"float y = dot(vec4(0.2, 0.2, 0.2, 0.2), samples[0]) + dot(vec4(0.2, 0.0, 0.0, 0.0), samples[1]);\n"
"\n"
"samples[0] -= vec4(y, y, y, y);\n"
"samples[1] -= vec4(y, y, y, y);\n"
"samples[0] -= vec4(y);\n"
"samples[1] -= vec4(y);\n"
"\n"
"float i = dot(vec4(0.0, sin(angles[1]), sin(angles[2]), sin(angles[3])), samples[0]) + dot(vec4(0.0, sin(angles[5]), sin(angles[6]), 0.0), samples[1]);"
"float q = dot(vec4(0.0, cos(angles[1]), cos(angles[2]), cos(angles[3])), samples[0]) + dot(vec4(0.0, cos(angles[5]), cos(angles[6]), 0.0), samples[1]);"
"float i = dot(vec4(0.0, sin(angles[0].y), sin(angles[0].z), sin(angles[0].w)), samples[0]) + dot(vec4(0.0, sin(angles[1].y), sin(angles[1].z), 0.0), samples[1]);"
"float q = dot(vec4(0.0, cos(angles[0].y), cos(angles[0].z), cos(angles[0].w)), samples[0]) + dot(vec4(0.0, cos(angles[1].y), cos(angles[1].z), 0.0), samples[1]);"
"\n"
"const mat3 yiqToRGB = mat3(1.0, 1.149701, 0.6490692, 1.0, -0.3240608, -0.6762444, 1.0, -1.3176884, 1.7799756);\n"
"fragColour = vec4( yiqToRGB * vec3(y, i, q),"