fix text orientation.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -17,18 +17,18 @@ struct v2f
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
float2 uv_MainTex;
|
||||
};
|
||||
|
||||
float2 uddInvertUV(float2 uv)
|
||||
{
|
||||
#ifdef INVERT_X
|
||||
uv.x = 1.0 - uv.x;
|
||||
uv.x = 1.0 - uv.x;
|
||||
#endif
|
||||
#ifdef INVERT_Y
|
||||
uv.y = 1.0 - uv.y;
|
||||
uv.y = 1.0 - uv.y;
|
||||
#endif
|
||||
return uv;
|
||||
return uv;
|
||||
}
|
||||
|
||||
float2 uddRotateUV(float2 uv)
|
||||
@@ -38,14 +38,14 @@ float2 uddRotateUV(float2 uv)
|
||||
uv.x = tmp.y;
|
||||
uv.y = 1.0 - tmp.x;
|
||||
#elif ROTATE180
|
||||
uv.x = 1.0 - uv.x;
|
||||
uv.y = 1.0 - uv.y;
|
||||
uv.x = 1.0 - uv.x;
|
||||
uv.y = 1.0 - uv.y;
|
||||
#elif ROTATE270
|
||||
float2 tmp = uv;
|
||||
uv.x = 1.0 - tmp.y;
|
||||
uv.y = tmp.x;
|
||||
#endif
|
||||
return uv;
|
||||
return uv;
|
||||
}
|
||||
|
||||
inline void uddConvertToLinearIfNeeded(inout fixed3 rgb)
|
||||
@@ -66,19 +66,19 @@ inline fixed4 uddGetCursorTexture(sampler2D tex, float2 uv, fixed4 cursorPosScal
|
||||
uv.x = (uv.x - cursorPosScale.x) / cursorPosScale.z;
|
||||
uv.y = (uv.y - cursorPosScale.y) / cursorPosScale.w;
|
||||
fixed4 c = tex2D(tex, uv);
|
||||
fixed a = c.a * step(0, uv.x) * step(0, uv.y) * step(uv.x, 1) * step(uv.y, 1);
|
||||
c *= step(0.01, a);
|
||||
return c;
|
||||
fixed a = c.a * step(0, uv.x) * step(0, uv.y) * step(uv.x, 1) * step(uv.y, 1);
|
||||
c *= step(0.01, a);
|
||||
return c;
|
||||
}
|
||||
|
||||
inline fixed4 uddGetScreenTextureWithCursor(sampler2D screenTex, sampler2D cursorTex, float2 uv, fixed4 cursorPosScale)
|
||||
{
|
||||
uv = uddInvertUV(uv);
|
||||
fixed4 screen = uddGetScreenTexture(screenTex, uddRotateUV(uv));
|
||||
fixed4 cursor = uddGetCursorTexture(cursorTex, uv, cursorPosScale);
|
||||
fixed4 color = lerp(screen, cursor, cursor.a);
|
||||
uddConvertToLinearIfNeeded(color.rgb);
|
||||
return color;
|
||||
uv = uddInvertUV(uv);
|
||||
fixed4 screen = uddGetScreenTexture(screenTex, uddRotateUV(uv));
|
||||
fixed4 cursor = uddGetCursorTexture(cursorTex, uv, cursorPosScale);
|
||||
fixed4 color = lerp(screen, cursor, cursor.a);
|
||||
uddConvertToLinearIfNeeded(color.rgb);
|
||||
return color;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -25,12 +25,12 @@ SubShader
|
||||
#pragma multi_compile ___ VERTICAL
|
||||
#pragma multi_compile ___ ROTATE90 ROTATE180 ROTATE270
|
||||
|
||||
#define SURFACE_SHADER
|
||||
#define SURFACE_SHADER
|
||||
#include "./uDD_Common.cginc"
|
||||
#include "./uDD_Params.cginc"
|
||||
#include "./uDD_Params.cginc"
|
||||
|
||||
half _Glossiness;
|
||||
half _Metallic;
|
||||
half _Glossiness;
|
||||
half _Metallic;
|
||||
|
||||
void surf(Input IN, inout SurfaceOutputStandard o)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ Properties
|
||||
_Color ("Color", Color) = (1, 1, 1, 1)
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
[Toggle(USE_BEND)] _UseBend("UseBend", Float) = 0
|
||||
[PowerSlider(10.0)]_Radius ("Radius", Range(3, 100)) = 10
|
||||
[PowerSlider(10.0)]_Radius ("Radius", Range(3, 100)) = 10
|
||||
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
#ifdef USE_BEND
|
||||
half a = v.vertex.x / _Radius;
|
||||
v.vertex.x = _Radius * sin(a);
|
||||
v.vertex.y += _Radius * (1 - cos(a));
|
||||
half a = v.vertex.x / _Radius;
|
||||
v.vertex.x = _Radius * sin(a);
|
||||
v.vertex.y += _Radius * (1 - cos(a));
|
||||
#endif
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
@@ -39,7 +39,7 @@ v2f vert(appdata v)
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
return uddGetScreenTextureWithCursor(_MainTex, _CursorTex, i.uv, _CursorPositionScale);
|
||||
return uddGetScreenTextureWithCursor(_MainTex, _CursorTex, i.uv, _CursorPositionScale);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
@@ -35,23 +35,23 @@ v2f vert(appdata v)
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
fixed4 tex = uddGetScreenTextureWithCursor(_MainTex, _CursorTex, i.uv, _CursorPositionScale);
|
||||
fixed alpha = pow((tex.r + tex.g + tex.b) / 3.0, _Mask);
|
||||
return fixed4(tex.rgb * _Color.rgb, alpha * _Color.a);
|
||||
fixed4 tex = uddGetScreenTextureWithCursor(_MainTex, _CursorTex, i.uv, _CursorPositionScale);
|
||||
fixed alpha = pow((tex.r + tex.g + tex.b) / 3.0, _Mask);
|
||||
return fixed4(tex.rgb * _Color.rgb, alpha * _Color.a);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile ___ INVERT_X
|
||||
#pragma multi_compile ___ INVERT_Y
|
||||
#pragma multi_compile ___ VERTICAL
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile ___ INVERT_X
|
||||
#pragma multi_compile ___ INVERT_Y
|
||||
#pragma multi_compile ___ VERTICAL
|
||||
#pragma multi_compile ___ ROTATE90 ROTATE180 ROTATE270
|
||||
ENDCG
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Reference in New Issue
Block a user