improve bending.

This commit is contained in:
hecomi
2016-11-12 04:25:12 +09:00
parent 804bfb96bd
commit 3a705732d1
5 changed files with 13 additions and 9 deletions
@@ -42,7 +42,7 @@ public class MultipleMonitorRoundLayouter : MultipleMonitorLayouter
uddTex.bend = uDesktopDuplication.Texture.Bend.Z;
}
uddTex.radius = radius;
uddTex.width = uddTex.monitor.widthMeter;
uddTex.width = uddTex.transform.localScale.x;
}
}
@@ -13,8 +13,9 @@ public class Texture : MonoBehaviour
set
{
monitor_ = value;
material = GetComponent<Renderer>().material;
material = GetComponent<Renderer>().material; // clone
material.mainTexture = monitor_.texture;
material.SetFloat("_Width", transform.localScale.x);
}
}
@@ -95,18 +95,15 @@ inline fixed4 uddGetScreenTextureWithCursor(float2 uv)
inline void uddBendVertex(inout float4 v, half radius, half width)
{
#if !defined(_BEND_OFF)
#ifdef _BEND_Y
radius = radius - v.y;
#elif _BEND_Z
radius = radius - v.z;
#endif
half angle = width * v.x / radius;
v.x = radius * sin(angle) / width;
#ifdef _BEND_Y
radius -= v.y;
v.y += radius * (1 - cos(angle));
#elif _BEND_Z
v.z -= radius * (1 - cos(angle));
radius -= v.z;
v.z += radius * (1 - cos(angle));
#endif
v.x = radius * sin(angle) / width;
#endif
}
@@ -6,6 +6,9 @@ Properties
_Color ("Color", Color) = (1, 1, 1, 1)
_MainTex ("Texture", 2D) = "white" {}
_Mask ("Mask", Range(0, 1)) = 0.1
_CursorTex ("Cursor Texture", 2D) = "white" {}
[KeywordEnum(Off, Y, Z)] _Bend("Bending", Int) = 0
[PowerSlider(10.0)] _Radius("Radius", Range(1, 100)) = 30
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
}
@@ -5,6 +5,9 @@ Properties
{
_Color ("Color", Color) = (1, 1, 1, 1)
_MainTex ("Texture", 2D) = "white" {}
_CursorTex ("Cursor Texture", 2D) = "white" {}
[KeywordEnum(Off, Y, Z)] _Bend("Bending", Int) = 0
[PowerSlider(10.0)] _Radius("Radius", Range(1, 100)) = 30
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
}