diff --git a/Assets/uDesktopDuplication/Examples/Scenes/Toggle Monitors.unity b/Assets/uDesktopDuplication/Examples/Scenes/Toggle Monitors.unity index 9b4363c..00ca42c 100644 Binary files a/Assets/uDesktopDuplication/Examples/Scenes/Toggle Monitors.unity and b/Assets/uDesktopDuplication/Examples/Scenes/Toggle Monitors.unity differ diff --git a/Assets/uDesktopDuplication/Materials/uDD_Screen_Unlit.mat b/Assets/uDesktopDuplication/Materials/uDD_Screen_Unlit.mat index 0585cc8..ad65d2b 100644 Binary files a/Assets/uDesktopDuplication/Materials/uDD_Screen_Unlit.mat and b/Assets/uDesktopDuplication/Materials/uDD_Screen_Unlit.mat differ diff --git a/Assets/uDesktopDuplication/Shaders/uDD_Common.cginc b/Assets/uDesktopDuplication/Shaders/uDD_Common.cginc index 5d0ab44..71b8b17 100644 --- a/Assets/uDesktopDuplication/Shaders/uDD_Common.cginc +++ b/Assets/uDesktopDuplication/Shaders/uDD_Common.cginc @@ -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 \ No newline at end of file diff --git a/Assets/uDesktopDuplication/Shaders/uDD_Standard.shader b/Assets/uDesktopDuplication/Shaders/uDD_Standard.shader index b91f701..7621874 100644 --- a/Assets/uDesktopDuplication/Shaders/uDD_Standard.shader +++ b/Assets/uDesktopDuplication/Shaders/uDD_Standard.shader @@ -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) { diff --git a/Assets/uDesktopDuplication/Shaders/uDD_Unlit.shader b/Assets/uDesktopDuplication/Shaders/uDD_Unlit.shader index 1e4d72d..16c229b 100644 --- a/Assets/uDesktopDuplication/Shaders/uDD_Unlit.shader +++ b/Assets/uDesktopDuplication/Shaders/uDD_Unlit.shader @@ -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 diff --git a/Assets/uDesktopDuplication/Shaders/uDD_Unlit_BlackMask.shader b/Assets/uDesktopDuplication/Shaders/uDD_Unlit_BlackMask.shader index 5dbfadf..21de4a4 100644 --- a/Assets/uDesktopDuplication/Shaders/uDD_Unlit_BlackMask.shader +++ b/Assets/uDesktopDuplication/Shaders/uDD_Unlit_BlackMask.shader @@ -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 } } diff --git a/Assets/uDesktopDuplication/Textures/NotAvailable.png b/Assets/uDesktopDuplication/Textures/NotAvailable.png index 465cf1e..20eb003 100644 Binary files a/Assets/uDesktopDuplication/Textures/NotAvailable.png and b/Assets/uDesktopDuplication/Textures/NotAvailable.png differ