Last active
November 30, 2019 16:28
-
-
Save decitrig/20a05714797aeff43aadc80e9f954bc9 to your computer and use it in GitHub Desktop.
Shaders for showing DirectX coordinate conventions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const float4 kPositions[] = { | |
// A downard-pointing triangle near the viewer. | |
float4(-1, 1, 0, 1), // Red | |
float4(1, 1, 0, 1), // Green | |
float4(0, -1, 0, 1), // Blue | |
// An upward-pointing triangle far from the viewer. | |
float4(1, -1, .9, 1), // Red | |
float4(-1, -1, .9, 1), // Green | |
float4(0, 1, .9, 1), // Blue | |
}; | |
static const float4 kColors[] = { | |
float4(1, 0, 0, 1), | |
float4(0, 1, 0, 1), | |
float4(0, 0, 1, 1), | |
}; | |
ClipSpaceVertex main(uint index : SV_VertexId) { | |
ClipSpaceVertex v; | |
v.pos = kPositions[index % 6]; | |
v.color = kColors[index % 3]; | |
return v; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment