fix vertical screen bug.

This commit is contained in:
hecomi
2016-10-30 19:56:22 +09:00
parent 14cd67e0c6
commit dc6b8bc204
6 changed files with 15 additions and 0 deletions
@@ -55,6 +55,12 @@ public class Texture : MonoBehaviour
} else { } else {
material_.DisableKeyword("INVERT_Y"); material_.DisableKeyword("INVERT_Y");
} }
if (monitor.isVertical) {
material_.EnableKeyword("VERTICAL");
} else {
material_.DisableKeyword("VERTICAL");
}
} }
} }
@@ -11,6 +11,11 @@ inline void uddInvertUV(inout float2 uv)
#ifdef INVERT_Y #ifdef INVERT_Y
uv.y = 1.0 - uv.y; uv.y = 1.0 - uv.y;
#endif #endif
#ifdef VERTICAL
float2 tmp = uv;
uv.x = tmp.y;
uv.y = 1.0 - tmp.x;
#endif
} }
inline fixed4 uddGetTexture(sampler2D tex, float2 uv) inline fixed4 uddGetTexture(sampler2D tex, float2 uv)
@@ -19,6 +19,7 @@ SubShader
#pragma surface surf Standard fullforwardshadows #pragma surface surf Standard fullforwardshadows
#pragma multi_compile ___ INVERT_X #pragma multi_compile ___ INVERT_X
#pragma multi_compile ___ INVERT_Y #pragma multi_compile ___ INVERT_Y
#pragma multi_compile ___ VERTICAL
#include "./uDD_Common.cginc" #include "./uDD_Common.cginc"
@@ -55,6 +55,7 @@ Pass
#pragma fragment frag #pragma fragment frag
#pragma multi_compile ___ INVERT_X #pragma multi_compile ___ INVERT_X
#pragma multi_compile ___ INVERT_Y #pragma multi_compile ___ INVERT_Y
#pragma multi_compile ___ VERTICAL
ENDCG ENDCG
} }
@@ -62,6 +62,7 @@ Pass
#pragma fragment frag #pragma fragment frag
#pragma multi_compile ___ INVERT_X #pragma multi_compile ___ INVERT_X
#pragma multi_compile ___ INVERT_Y #pragma multi_compile ___ INVERT_Y
#pragma multi_compile ___ VERTICAL
ENDCG ENDCG
} }
@@ -58,6 +58,7 @@ Pass
#pragma fragment frag #pragma fragment frag
#pragma multi_compile ___ INVERT_X #pragma multi_compile ___ INVERT_X
#pragma multi_compile ___ INVERT_Y #pragma multi_compile ___ INVERT_Y
#pragma multi_compile ___ VERTICAL
ENDCG ENDCG
} }