From 1d7b7e86502ffc23193771867b2de99e42896916 Mon Sep 17 00:00:00 2001 From: hecomi Date: Fri, 4 Nov 2016 23:29:40 +0900 Subject: [PATCH] add bending test. --- .../Materials/uDD_Screen_Unlit.mat | Bin 5120 -> 5180 bytes .../Shaders/uDD_Unlit.shader | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Assets/uDesktopDuplication/Materials/uDD_Screen_Unlit.mat b/Assets/uDesktopDuplication/Materials/uDD_Screen_Unlit.mat index c4a0400d4e5d9b892875b48d7f8776b8ff0abed7..f8049b6cd51c4df1237cdc82443f86a5cbb0a8fe 100644 GIT binary patch delta 128 zcmZqB*rUP0z`(JDfkDJ(BS#Adqs``Cj`i#catsU%o_=AjK_T%G3h}PKp25MM{(cJa zp~0?Bu6{1@n*#*aFfvL^{wt_0zzS3w?_8Rb1Ehh#VY7yi0;2#skQpD8n37pq3}h)d ZPWBK^;Q`vk5Fc8c>Xe$7GI@n?1OU%d9`67E delta 69 zcmdm^(V)S>z`(JDfkA{}BS#AdBg5uij`i#!LJSNHo_=AjK_T%G3h}PKp25MMn_~pl ZFfxix<`mN2>>{MVIJrbPW%3K*5CA$T5!?U( diff --git a/Assets/uDesktopDuplication/Shaders/uDD_Unlit.shader b/Assets/uDesktopDuplication/Shaders/uDD_Unlit.shader index c27d1a7..bea41f3 100644 --- a/Assets/uDesktopDuplication/Shaders/uDD_Unlit.shader +++ b/Assets/uDesktopDuplication/Shaders/uDD_Unlit.shader @@ -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 }