1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-01 13:58:20 +00:00

Full separate 'lateral' usage is go. Also probably at some point I need to throw in a phase property, which this new flexibility will help with.

This commit is contained in:
Thomas Harte 2015-08-02 14:32:29 -04:00
parent 3ab6585789
commit 6e52e5df1c
2 changed files with 12 additions and 10 deletions

View File

@ -156,14 +156,15 @@ const char *vertexShader =
"\n"
"in vec2 position;\n"
"in vec2 srcCoordinates;\n"
"in float lateral;\n"
"\n"
"out vec2 srcCoordinatesVarying;\n"
"out float offsetVarying;\n"
"out float lateralVarying;\n"
"\n"
"void main (void)\n"
"{\n"
"srcCoordinatesVarying = vec2(srcCoordinates.x / 512.0, srcCoordinates.y / 512.0);\n"
"offsetVarying = mod(srcCoordinatesVarying.y * 512, 1.0) * 2.09435310266667 + 0.52359877566668;"
"srcCoordinatesVarying = vec2(srcCoordinates.x / 512.0, (srcCoordinates.y + 0.5) / 512.0);\n"
"lateralVarying = lateral * 2.09435310266667 + 0.52359877566668;"
"gl_Position = vec4(position.x * 2.0 - 1.0, 1.0 - position.y * 2.0 + position.x / 131.0, 0.0, 1.0);\n"
"}\n";
@ -172,13 +173,13 @@ const char *fragmentShader =
"#version 150\n"
"\n"
"in vec2 srcCoordinatesVarying;\n"
"in float offsetVarying;"
"in float lateralVarying;"
"out vec4 fragColour;\n"
"uniform sampler2D texID;\n"
"\n"
"void main(void)\n"
"{\n"
"fragColour = texture(texID, srcCoordinatesVarying) * vec4(1.0, 1.0, 1.0, sin(offsetVarying));\n" // vec4(1.0, 1.0, 1.0, 0.5)
"fragColour = texture(texID, srcCoordinatesVarying) * vec4(1.0, 1.0, 1.0, sin(lateralVarying));\n"
"}\n";
#if defined(DEBUG)

View File

@ -58,7 +58,7 @@ void CRT::set_new_timing(int cycles_per_line, int height_of_display)
// width should be 1.0 / _height_of_display, rotated to match the direction
float angle = atan2f(scanSpeedYfl, scanSpeedXfl);
float halfLineWidth = (float)_height_of_display * 1.2f;
float halfLineWidth = (float)_height_of_display * 1.0f;
_widths[0][0] = (sinf(angle) / halfLineWidth) * kCRTFixedPointRange;
_widths[0][1] = (cosf(angle) / halfLineWidth) * kCRTFixedPointRange;
}
@ -222,8 +222,11 @@ void CRT::advance_cycles(int number_of_cycles, bool hsync_requested, const bool
position_y(1) = (kCRTFixedPointOffset + _rasterPosition.y - width[1]) >> 16;
tex_x(0) = tex_x(1) = tex_x(4) = tex_x;
tex_y(0) = tex_y(4) = tex_y;
tex_y(1) = tex_y + 1;
// these things are constants across the line so just throw them out now
tex_y(0) = tex_y(4) = tex_y(1) = tex_y(2) = tex_y(3) = tex_y(5) = tex_y;
lateral(0) = lateral(4) = lateral(5) = 0;
lateral(1) = lateral(2) = lateral(3) = 1;
}
// advance the raster position as dictated by current sync status
@ -250,8 +253,6 @@ void CRT::advance_cycles(int number_of_cycles, bool hsync_requested, const bool
// if this is a data or level run then store the end point
tex_x(2) = tex_x(3) = tex_x(5) = tex_x;
tex_y(2) = tex_y(3) = tex_y+1;
tex_y(5) = tex_y;
}
// decrement the number of cycles left to run for and increment the