Skip to content

Commit

Permalink
support windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed Sep 10, 2017
1 parent 9affcb6 commit 9d8092e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Assets/uHomography/Sahders/Homography.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ v2f_homography vert_homography(appdata_homography v)
float s = _Homography[6] * p.x + _Homography[7] * p.y + _Homography[8];
float x = (_Homography[0] * p.x + _Homography[1] * p.y + _Homography[2]) / s;
float y = (_Homography[3] * p.x + _Homography[4] * p.y + _Homography[5]) / s;
#if UNITY_UV_STARTS_AT_TOP
o.vertex = float4(2 * (x - 0.5), 2 * (0.5 - y), 0, 1);
#else
o.vertex = float4(2 * (x - 0.5), 2 * (y - 0.5), 0, 1);
#endif
o.screenPos = float2(o.vertex.x, o.vertex.y);

return o;
Expand All @@ -66,6 +70,9 @@ v2f_homography vert_homography(appdata_homography v)
fixed4 frag_homography(v2f_homography i) : SV_Target
{
float2 p = (i.screenPos + 1.0) * 0.5;
#if UNITY_UV_STARTS_AT_TOP
p.y = 1 - p.y;
#endif
float s = _InvHomography[6] * p.x + _InvHomography[7] * p.y + _InvHomography[8];
float u = (_InvHomography[0] * p.x + _InvHomography[1] * p.y + _InvHomography[2]) / s;
float v = (_InvHomography[3] * p.x + _InvHomography[4] * p.y + _InvHomography[5]) / s;
Expand Down

0 comments on commit 9d8092e

Please sign in to comment.