fix mouse cursor mono mask bug.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -8,14 +8,13 @@ namespace uDesktopDuplication
|
|||||||
RequireComponent(typeof(Texture))]
|
RequireComponent(typeof(Texture))]
|
||||||
public class Cursor : MonoBehaviour
|
public class Cursor : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField] Vector2 modelScale = Vector2.one;
|
||||||
|
|
||||||
Vector3 worldPosition { get; set; }
|
Vector3 worldPosition { get; set; }
|
||||||
|
|
||||||
private Texture uddTexture_;
|
private Texture uddTexture_;
|
||||||
private Monitor monitor { get { return uddTexture_.monitor; } }
|
private Monitor monitor { get { return uddTexture_.monitor; } }
|
||||||
|
|
||||||
private Texture2D currentTexture_;
|
|
||||||
private Dictionary<Vector2, Texture2D> textures_ = new Dictionary<Vector2, Texture2D>();
|
private Dictionary<Vector2, Texture2D> textures_ = new Dictionary<Vector2, Texture2D>();
|
||||||
[SerializeField] Vector2 modelScale = Vector2.one;
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ inline fixed4 uddGetCursorTexture(float2 uv)
|
|||||||
uv.x = (uv.x - _CursorX) / _CursorWidth;
|
uv.x = (uv.x - _CursorX) / _CursorWidth;
|
||||||
uv.y = (uv.y - _CursorY) / _CursorHeight;
|
uv.y = (uv.y - _CursorY) / _CursorHeight;
|
||||||
fixed4 c = tex2D(_CursorTex, uv);
|
fixed4 c = tex2D(_CursorTex, uv);
|
||||||
fixed a = c.a * step(0, uv.x) * step(0, uv.y) * step(uv.x, 1) * step(uv.y, 1);
|
fixed a = step(0, uv.x) * step(0, uv.y) * step(uv.x, 1) * step(uv.y, 1);
|
||||||
c *= step(0.01, a);
|
c.a *= step(0.01, a);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Properties
|
|||||||
{
|
{
|
||||||
_Color ("Color", Color) = (1, 1, 1, 1)
|
_Color ("Color", Color) = (1, 1, 1, 1)
|
||||||
_MainTex ("Texture", 2D) = "white" {}
|
_MainTex ("Texture", 2D) = "white" {}
|
||||||
|
_CursorTex ("Cursor Texture", 2D) = "white" {}
|
||||||
[KeywordEnum(Off, Y, Z)] _Bend("Bending", Int) = 0
|
[KeywordEnum(Off, Y, Z)] _Bend("Bending", Int) = 0
|
||||||
[PowerSlider(10.0)]_Radius ("Radius", Range(1, 100)) = 30
|
[PowerSlider(10.0)]_Radius ("Radius", Range(1, 100)) = 30
|
||||||
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
|
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
|
||||||
|
|||||||
@@ -165,8 +165,8 @@ void Cursor::UpdateTexture()
|
|||||||
const int i = row * w + col;
|
const int i = row * w + col;
|
||||||
const BYTE andMask = apiBuffer_[col / 8 + row * p] & mask;
|
const BYTE andMask = apiBuffer_[col / 8 + row * p] & mask;
|
||||||
const BYTE xorMask = apiBuffer_[col / 8 + (row + h) * p] & mask;
|
const BYTE xorMask = apiBuffer_[col / 8 + (row + h) * p] & mask;
|
||||||
const UINT andMask32 = andMask ? 0xFFFFFFFF : 0xFF000000;
|
const UINT andMask32 = andMask ? 0xFFFFFFFF : 0x00000000;
|
||||||
const UINT xorMask32 = xorMask ? 0x00FFFFFF : 0x00000000;
|
const UINT xorMask32 = xorMask ? 0xFFFFFFFF : 0x00000000;
|
||||||
output32[i] = (desktop32[row * desktopPitch + col] & andMask32) ^ xorMask32;
|
output32[i] = (desktop32[row * desktopPitch + col] & andMask32) ^ xorMask32;
|
||||||
mask = (mask == 0x01) ? 0x80 : (mask >> 1);
|
mask = (mask == 0x01) ? 0x80 : (mask >> 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user