mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-02 16:38:51 +00:00
Composite angles are signed.
This commit is contained in:
parent
8b6879a782
commit
807cb99f6d
@ -51,7 +51,7 @@ struct Scan {
|
||||
struct EndPoint {
|
||||
uint16_t position[2];
|
||||
uint16_t dataOffset;
|
||||
uint16_t compositeAngle;
|
||||
int16_t compositeAngle;
|
||||
uint16_t cyclesSinceRetrace;
|
||||
} endPoints[2];
|
||||
|
||||
@ -64,7 +64,7 @@ struct Scan {
|
||||
struct Line {
|
||||
struct EndPoint {
|
||||
uint16_t position[2];
|
||||
uint16_t compositeAngle;
|
||||
int16_t compositeAngle;
|
||||
uint16_t cyclesSinceRetrace;
|
||||
} endPoints[2];
|
||||
|
||||
@ -176,8 +176,10 @@ vertex SourceInterpolator scanToComposition( constant Uniforms &uniforms [[buffe
|
||||
result.position.x = mix(scans[instanceID].endPoints[0].cyclesSinceRetrace, scans[instanceID].endPoints[1].cyclesSinceRetrace, float(vertexID));
|
||||
result.position.y = scans[instanceID].line;
|
||||
result.position.zw = float2(0.0f, 1.0f);
|
||||
|
||||
result.textureCoordinates.x = mix(scans[instanceID].endPoints[0].dataOffset, scans[instanceID].endPoints[1].dataOffset, float(vertexID));
|
||||
result.textureCoordinates.y = scans[instanceID].dataY;
|
||||
|
||||
result.colourPhase = 3.141592654f * mix(
|
||||
float(scans[instanceID].endPoints[0].compositeAngle),
|
||||
float(scans[instanceID].endPoints[1].compositeAngle),
|
||||
@ -186,8 +188,10 @@ vertex SourceInterpolator scanToComposition( constant Uniforms &uniforms [[buffe
|
||||
result.colourAmplitude = float(scans[instanceID].compositeAmplitude) / 255.0f;
|
||||
|
||||
// Map position into eye space, allowing for target texture dimensions.
|
||||
// TODO: is this really necessary? Is there nothing like coord::pixel that applies here?
|
||||
result.position.xy = ((result.position.xy + float2(0.5)) / float2(texture.get_width(), texture.get_height())) * float2(2.0, -2.0) + float2(-1.0, 1.0);
|
||||
const float2 textureSize = float2(texture.get_width(), texture.get_height());
|
||||
result.position.xy =
|
||||
((result.position.xy + float2(0.5f)) / textureSize)
|
||||
* float2(2.0f, -2.0f) + float2(-1.0f, 1.0f);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -514,14 +514,15 @@ std::unique_ptr<Shader> ScanTarget::composition_shader() const {
|
||||
)x";
|
||||
|
||||
std::string fragment_shader =
|
||||
"#version 150\n"
|
||||
R"x(#version 150
|
||||
|
||||
"out vec4 fragColour;"
|
||||
"in vec2 textureCoordinate;"
|
||||
out vec4 fragColour;
|
||||
in vec2 textureCoordinate;
|
||||
|
||||
"uniform usampler2D textureName;"
|
||||
uniform usampler2D textureName;
|
||||
|
||||
"void main(void) {";
|
||||
void main(void) {
|
||||
)x";
|
||||
|
||||
switch(modals.input_data_type) {
|
||||
case InputDataType::Luminance1:
|
||||
|
Loading…
x
Reference in New Issue
Block a user