2020-08-05 01:49:01 +00:00
|
|
|
//
|
|
|
|
// ScanTarget.metal
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 04/08/2020.
|
|
|
|
// Copyright © 2020 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
|
|
|
2020-08-05 21:27:43 +00:00
|
|
|
// These two structs are the same, but defined separately as an artefact
|
|
|
|
// of my learning process, and the fact that they soon won't be.
|
|
|
|
|
|
|
|
struct InputVertex {
|
2020-08-06 01:33:25 +00:00
|
|
|
float2 position [[attribute(0)]];
|
|
|
|
float3 colour [[attribute(1)]];
|
2020-08-05 21:27:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ColouredVertex {
|
2020-08-05 01:49:01 +00:00
|
|
|
float4 position [[position]];
|
2020-08-05 21:27:43 +00:00
|
|
|
float4 colour;
|
2020-08-05 01:49:01 +00:00
|
|
|
};
|
|
|
|
|
2020-08-06 01:33:25 +00:00
|
|
|
vertex ColouredVertex vertex_main(InputVertex vert [[stage_in]]) {
|
2020-08-05 21:27:43 +00:00
|
|
|
ColouredVertex output;
|
2020-08-06 01:33:25 +00:00
|
|
|
output.position = float4(vert.position, 0.0, 1.0);
|
|
|
|
output.colour = float4(vert.colour, 1.0);
|
2020-08-05 21:27:43 +00:00
|
|
|
return output;
|
2020-08-05 01:49:01 +00:00
|
|
|
}
|
|
|
|
|
2020-08-05 21:27:43 +00:00
|
|
|
fragment float4 fragment_main(ColouredVertex vert [[stage_in]]) {
|
|
|
|
return vert.colour;
|
2020-08-05 01:49:01 +00:00
|
|
|
}
|