mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Corrects shader generation for S-Video input to S-Video output.
This commit is contained in:
parent
4fa6bc0ad1
commit
6a62cf9146
@ -264,8 +264,8 @@ std::unique_ptr<Shader> ScanTarget::input_shader(InputDataType input_data_type,
|
|||||||
"vec2 yc = texture(textureName, textureCoordinate).rg / vec2(255.0);"
|
"vec2 yc = texture(textureName, textureCoordinate).rg / vec2(255.0);"
|
||||||
|
|
||||||
"float phaseOffset = 3.141592654 * 2.0 * 2.0 * yc.y;"
|
"float phaseOffset = 3.141592654 * 2.0 * 2.0 * yc.y;"
|
||||||
"float chroma = step(yc.y, 0.75) * cos(compositeAngle + phaseOffset);"
|
"float rawChroma = step(yc.y, 0.75) * cos(compositeAngle + phaseOffset);"
|
||||||
"fragColour = vec3(yc.x, 0.5 + chroma*0.5, 0.0);";
|
"fragColour = vec3(yc.x, 0.5 + rawChroma*0.5, 0.0);";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputDataType::Red1Green1Blue1:
|
case InputDataType::Red1Green1Blue1:
|
||||||
@ -299,10 +299,9 @@ std::unique_ptr<Shader> ScanTarget::input_shader(InputDataType input_data_type,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(computed_display_type != display_type) {
|
|
||||||
// If the input type is RGB but the output type isn't then
|
// If the input type is RGB but the output type isn't then
|
||||||
// there'll definitely be an RGB to SVideo step.
|
// there'll definitely be an RGB to SVideo step.
|
||||||
if(computed_display_type == DisplayType::RGB) {
|
if(computed_display_type == DisplayType::RGB && display_type != DisplayType::RGB) {
|
||||||
fragment_shader +=
|
fragment_shader +=
|
||||||
"vec3 composite_colour = rgbToLumaChroma * fragColour;"
|
"vec3 composite_colour = rgbToLumaChroma * fragColour;"
|
||||||
"vec2 quadrature = vec2(cos(compositeAngle), sin(compositeAngle));"
|
"vec2 quadrature = vec2(cos(compositeAngle), sin(compositeAngle));"
|
||||||
@ -319,9 +318,13 @@ std::unique_ptr<Shader> ScanTarget::input_shader(InputDataType input_data_type,
|
|||||||
fragment_shader +=
|
fragment_shader +=
|
||||||
"vec2 chroma = (((fragColour.y - 0.5)*2.0) * quadrature)*0.5 + vec2(0.5);"
|
"vec2 chroma = (((fragColour.y - 0.5)*2.0) * quadrature)*0.5 + vec2(0.5);"
|
||||||
"fragColour = vec3(fragColour.x, chroma);";
|
"fragColour = vec3(fragColour.x, chroma);";
|
||||||
} else {
|
|
||||||
fragment_shader += "fragColour = vec3(fragColour.r, 2.0*(fragColour.g - 0.5) * quadrature);";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(
|
||||||
|
(display_type == DisplayType::CompositeMonochrome || display_type == DisplayType::CompositeColour) &&
|
||||||
|
computed_display_type != DisplayType::CompositeMonochrome
|
||||||
|
) {
|
||||||
|
fragment_shader += "fragColour = vec3(fragColour.r, 2.0*(fragColour.g - 0.5) * quadrature);";
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::unique_ptr<Shader>(new Shader(
|
return std::unique_ptr<Shader>(new Shader(
|
||||||
|
Loading…
Reference in New Issue
Block a user