-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use different slots for different rotations
So we won't get hard to debug errors later when we decide to support serial processing on Windows for example.
- Loading branch information
Showing
3 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
struct PS_INPUT | ||
{ | ||
float4 pos : SV_POSITION; | ||
float2 tex : TEXCOORD; | ||
}; | ||
|
||
cbuffer rotation_info : register(b2) { | ||
int rotation; | ||
}; | ||
|
||
PS_INPUT main_vs(uint vI : SV_VERTEXID) | ||
{ | ||
PS_INPUT output; | ||
|
||
if (vI == 0) { | ||
output.pos = float4(-1, -1, 0, 1); | ||
output.tex = float2(0, 1); | ||
} | ||
else if (vI == 1) { | ||
output.pos = float4(-1, 3, 0, 1); | ||
output.tex = float2(0, -1); | ||
} | ||
else if (vI == 2) { | ||
output.pos = float4(3, -1, 0, 1); | ||
output.tex = float2(2, 1); | ||
} | ||
|
||
if (rotation != 0) { | ||
float rotation_radians = radians(90 * rotation); | ||
float2x2 rotation_matrix = { cos(rotation_radians), -sin(rotation_radians), | ||
sin(rotation_radians), cos(rotation_radians) }; | ||
float2 rotation_center = { 0.5, 0.5 }; | ||
output.tex = round(rotation_center + mul(rotation_matrix, output.tex - rotation_center)); | ||
} | ||
|
||
return output; | ||
} |