1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Reintroduces less-filtered black and white video where there's no colour burst.

This commit is contained in:
Thomas Harte 2019-01-16 22:22:29 -05:00
parent ef0dbc2a41
commit d593796dae
2 changed files with 11 additions and 3 deletions

View File

@ -14,10 +14,10 @@ using namespace Outputs::Display::OpenGL;
namespace {
/// The texture unit from which to source input data.
constexpr GLenum SourceDataTextureUnit = GL_TEXTURE1;
constexpr GLenum SourceDataTextureUnit = GL_TEXTURE0;
/// The texture unit which contains raw line-by-line composite, S-Video or RGB data.
constexpr GLenum UnprocessedLineBufferTextureUnit = GL_TEXTURE3;
constexpr GLenum UnprocessedLineBufferTextureUnit = GL_TEXTURE1;
/// The texture unit that contains the current display.
constexpr GLenum AccumulationTextureUnit = GL_TEXTURE2;

View File

@ -431,6 +431,10 @@ std::unique_ptr<Shader> ScanTarget::conversion_shader(InputDataType input_data_t
"composite_sample(textureCoordinates[3], angles[3])"
");"
// Compute a luminance for use if there's no colour information, now, before
// modifying samples.
"float mono_luminance = dot(samples.yz, vec2(0.5));"
// Take the average to calculate luminance, then subtract that from all four samples to
// give chrominance.
"float luminance = dot(samples, vec4(0.25 / (1.0 - compositeAmplitude)));"
@ -443,7 +447,11 @@ std::unique_ptr<Shader> ScanTarget::conversion_shader(InputDataType input_data_t
") * vec2(0.125 * oneOverCompositeAmplitude);"
// Apply a colour space conversion to get RGB.
"fragColour3 = lumaChromaToRGB * vec3(luminance, channels);";
"fragColour3 = mix("
"lumaChromaToRGB * vec3(luminance, channels),"
"vec3(mono_luminance),"
"step(oneOverCompositeAmplitude, 0.01)"
");";
break;
case DisplayType::CompositeMonochrome: