mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Of course, being in-phase means being the cosine wave.
This commit is contained in:
parent
82aa6d074a
commit
5d6bee4927
@ -158,7 +158,7 @@ const char *Machine::get_signal_decoder()
|
|||||||
"vec2 c = texture(texID, coordinate).rg;"
|
"vec2 c = texture(texID, coordinate).rg;"
|
||||||
"float y = 0.1 + c.x * 0.91071428571429;\n"
|
"float y = 0.1 + c.x * 0.91071428571429;\n"
|
||||||
"float aOffset = 6.283185308 * (c.y - 3.0 / 16.0) * 1.14285714285714;\n"
|
"float aOffset = 6.283185308 * (c.y - 3.0 / 16.0) * 1.14285714285714;\n"
|
||||||
"return y + step(0.03125, c.y) * 0.1 * sin(phase + aOffset);\n"
|
"return y + step(0.03125, c.y) * 0.1 * cos(phase - aOffset);\n"
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
|||||||
{
|
{
|
||||||
NSOpenGLPFADoubleBuffer,
|
NSOpenGLPFADoubleBuffer,
|
||||||
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
|
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
|
||||||
// NSOpenGLPFASampleBuffers, 1,
|
NSOpenGLPFASampleBuffers, 1,
|
||||||
// NSOpenGLPFASamples, 2,
|
NSOpenGLPFASamples, 2,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -246,12 +246,12 @@ static NSString *const fragmentShader =
|
|||||||
"samples[0] -= vec4(y);\n"
|
"samples[0] -= vec4(y);\n"
|
||||||
"samples[1] -= vec4(y);\n"
|
"samples[1] -= vec4(y);\n"
|
||||||
"\n"
|
"\n"
|
||||||
"float i = dot(vec4(0.0, sin(angles[0].y), sin(angles[0].z), sin(angles[0].w)), samples[0]) + dot(vec4(sin(angles[1].x), sin(angles[1].y), 0.0, 0.0), samples[1]);\n"
|
"float i = dot(vec4(0.0, cos(angles[0].y), cos(angles[0].z), cos(angles[0].w)), samples[0]) + dot(vec4(cos(angles[1].x), cos(angles[1].y), 0.0, 0.0), samples[1]);\n"
|
||||||
"float q = dot(vec4(0.0, cos(angles[0].y), cos(angles[0].z), cos(angles[0].w)), samples[0]) + dot(vec4(cos(angles[1].x), cos(angles[1].y), 0.0, 0.0), samples[1]);\n"
|
"float q = dot(vec4(0.0, sin(angles[0].y), sin(angles[0].z), sin(angles[0].w)), samples[0]) + dot(vec4(sin(angles[1].x), sin(angles[1].y), 0.0, 0.0), samples[1]);\n"
|
||||||
"\n"
|
"\n"
|
||||||
"// now i and q are in the range [-0.5, 0.5], so i needs to be multiplied by 1.1914 and q by 1.0452\n"
|
"// now i and q are in the range [-0.5, 0.5], so i needs to be multiplied by 1.1914 and q by 1.0452\n"
|
||||||
"const mat3 yiqToRGB = mat3(1.0, 1.0, 1.0, 1.1389784, -0.3240608, -1.3176884, 0.6490692, -0.6762444, 1.7799756);\n"
|
"const mat3 yiqToRGB = mat3(1.0, 1.0, 1.0, 1.1389784, -0.3240608, -1.3176884, 0.6490692, -0.6762444, 1.7799756);\n"
|
||||||
"fragColour = vec4( yiqToRGB * vec3(y, i, q), 1.0);\n"
|
"fragColour = vec4( yiqToRGB * vec3(y, i, q), sin(lateralVarying));\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user