add bending test.

This commit is contained in:
hecomi
2016-11-04 23:29:40 +09:00
parent 6f784860e5
commit 1d7b7e8650
2 changed files with 13 additions and 3 deletions
@@ -5,6 +5,8 @@ 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
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
}
@@ -20,9 +22,16 @@ CGINCLUDE
#include "./uDD_Common.cginc"
#include "./uDD_Params.cginc"
fixed _Radius;
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));
#endif
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
@@ -40,9 +49,10 @@ Pass
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile ___ INVERT_X
#pragma multi_compile ___ INVERT_Y
#pragma multi_compile ___ VERTICAL
#pragma shader_feature ___ INVERT_X
#pragma shader_feature ___ INVERT_Y
#pragma shader_feature ___ VERTICAL
#pragma shader_feature ___ USE_BEND
ENDCG
}