add bending test.
This commit is contained in:
Binary file not shown.
@@ -5,6 +5,8 @@ Properties
|
|||||||
{
|
{
|
||||||
_Color ("Color", Color) = (1, 1, 1, 1)
|
_Color ("Color", Color) = (1, 1, 1, 1)
|
||||||
_MainTex ("Texture", 2D) = "white" {}
|
_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
|
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,9 +22,16 @@ CGINCLUDE
|
|||||||
#include "./uDD_Common.cginc"
|
#include "./uDD_Common.cginc"
|
||||||
#include "./uDD_Params.cginc"
|
#include "./uDD_Params.cginc"
|
||||||
|
|
||||||
|
fixed _Radius;
|
||||||
|
|
||||||
v2f vert(appdata v)
|
v2f vert(appdata v)
|
||||||
{
|
{
|
||||||
v2f o;
|
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.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||||
return o;
|
return o;
|
||||||
@@ -40,9 +49,10 @@ Pass
|
|||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
#pragma fragment frag
|
#pragma fragment frag
|
||||||
#pragma multi_compile ___ INVERT_X
|
#pragma shader_feature ___ INVERT_X
|
||||||
#pragma multi_compile ___ INVERT_Y
|
#pragma shader_feature ___ INVERT_Y
|
||||||
#pragma multi_compile ___ VERTICAL
|
#pragma shader_feature ___ VERTICAL
|
||||||
|
#pragma shader_feature ___ USE_BEND
|
||||||
ENDCG
|
ENDCG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user