remove Cursor-related codes because they were handled directly in the native code.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,6 +15,11 @@ public class GazePointAnalyzer : MonoBehaviour
|
|||||||
{
|
{
|
||||||
get { return GetWorldPositionFromCoord((int)averageCoord_.x, (int)averageCoord_.y); }
|
get { return GetWorldPositionFromCoord((int)averageCoord_.x, (int)averageCoord_.y); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector3 cursorPos
|
||||||
|
{
|
||||||
|
get { return GetWorldPositionFromCoord(uddTexture_.monitor.cursorX, uddTexture_.monitor.cursorY); }
|
||||||
|
}
|
||||||
private Vector2 preCursorCoord_ = Vector2.zero;
|
private Vector2 preCursorCoord_ = Vector2.zero;
|
||||||
|
|
||||||
[Header("Filters")]
|
[Header("Filters")]
|
||||||
@@ -26,6 +31,7 @@ public class GazePointAnalyzer : MonoBehaviour
|
|||||||
|
|
||||||
[Header("Debug")]
|
[Header("Debug")]
|
||||||
public bool drawAveragePos;
|
public bool drawAveragePos;
|
||||||
|
public bool drawCursorPos;
|
||||||
public bool drawMoveRects;
|
public bool drawMoveRects;
|
||||||
public bool drawDirtyRects;
|
public bool drawDirtyRects;
|
||||||
|
|
||||||
@@ -142,6 +148,7 @@ public class GazePointAnalyzer : MonoBehaviour
|
|||||||
void DebugDraw()
|
void DebugDraw()
|
||||||
{
|
{
|
||||||
if (drawAveragePos) DrawAveragePos();
|
if (drawAveragePos) DrawAveragePos();
|
||||||
|
if (drawCursorPos) DrawCursorPos();
|
||||||
if (drawDirtyRects) DrawDirtyRects();
|
if (drawDirtyRects) DrawDirtyRects();
|
||||||
if (drawMoveRects) DrawMoveRects();
|
if (drawMoveRects) DrawMoveRects();
|
||||||
}
|
}
|
||||||
@@ -164,6 +171,11 @@ public class GazePointAnalyzer : MonoBehaviour
|
|||||||
Debug.DrawLine(transform.position, averagePos, Color.yellow);
|
Debug.DrawLine(transform.position, averagePos, Color.yellow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawCursorPos()
|
||||||
|
{
|
||||||
|
Debug.DrawLine(transform.position, cursorPos, Color.grey);
|
||||||
|
}
|
||||||
|
|
||||||
void DrawMoveRects()
|
void DrawMoveRects()
|
||||||
{
|
{
|
||||||
foreach (var rect in uddTexture_.monitor.moveRects) {
|
foreach (var rect in uddTexture_.monitor.moveRects) {
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[RequireComponent(typeof(uDesktopDuplication.Texture)),
|
[RequireComponent(typeof(uDesktopDuplication.Texture))]
|
||||||
RequireComponent(typeof(uDesktopDuplication.Cursor))]
|
|
||||||
public class Loupe : MonoBehaviour
|
public class Loupe : MonoBehaviour
|
||||||
{
|
{
|
||||||
private uDesktopDuplication.Texture uddTexture_;
|
private uDesktopDuplication.Texture uddTexture_;
|
||||||
private uDesktopDuplication.Cursor uddCursor_;
|
|
||||||
public float zoom = 3f;
|
public float zoom = 3f;
|
||||||
public float aspect = 1f;
|
public float aspect = 1f;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
uddTexture_ = GetComponent<uDesktopDuplication.Texture>();
|
uddTexture_ = GetComponent<uDesktopDuplication.Texture>();
|
||||||
uddCursor_ = GetComponent<uDesktopDuplication.Cursor>();
|
|
||||||
uddTexture_.useClip = true;
|
uddTexture_.useClip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,10 +28,10 @@ public class Loupe : MonoBehaviour
|
|||||||
|
|
||||||
var monitor = uddTexture_.monitor;
|
var monitor = uddTexture_.monitor;
|
||||||
var x = monitor.isCursorVisible ?
|
var x = monitor.isCursorVisible ?
|
||||||
uddCursor_.coord.x :
|
(float)monitor.cursorX / monitor.width :
|
||||||
(float)monitor.systemCursorX / monitor.width;
|
(float)monitor.systemCursorX / monitor.width;
|
||||||
var y = monitor.isCursorVisible ?
|
var y = monitor.isCursorVisible ?
|
||||||
uddCursor_.coord.y :
|
(float)monitor.cursorY / monitor.height :
|
||||||
(float)monitor.systemCursorY / monitor.height;
|
(float)monitor.systemCursorY / monitor.height;
|
||||||
var w = 1f / zoom;
|
var w = 1f / zoom;
|
||||||
var h = w / aspect * monitor.aspect;
|
var h = w / aspect * monitor.aspect;
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace uDesktopDuplication
|
|
||||||
{
|
|
||||||
|
|
||||||
[AddComponentMenu("uDesktopDuplication/Cursor"), RequireComponent(typeof(Texture))]
|
|
||||||
public class Cursor : MonoBehaviour
|
|
||||||
{
|
|
||||||
[SerializeField] Vector2 modelScale = Vector2.one;
|
|
||||||
|
|
||||||
public Vector3 worldPosition { get; set; }
|
|
||||||
public Vector2 coord { get; set; }
|
|
||||||
|
|
||||||
private Texture uddTexture_;
|
|
||||||
private Monitor monitor { get { return uddTexture_.monitor; } }
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
uddTexture_ = GetComponent<Texture>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
if (monitor.isCursorVisible) {
|
|
||||||
UpdatePosition();
|
|
||||||
}
|
|
||||||
UpdateCoords();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdatePosition()
|
|
||||||
{
|
|
||||||
var x = (1f * monitor.cursorX / monitor.width - 0.5f) * modelScale.x;
|
|
||||||
var y = (1f * monitor.cursorY / monitor.height - 0.5f) * modelScale.y;
|
|
||||||
var iy = uddTexture_.invertY ? -1 : +1;
|
|
||||||
var localPos = transform.right * x + iy * transform.up * y;
|
|
||||||
worldPosition = transform.TransformPoint(localPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateCoords()
|
|
||||||
{
|
|
||||||
var x = monitor.isCursorVisible ? (float)monitor.cursorX / monitor.width : -9999f;
|
|
||||||
var y = monitor.isCursorVisible ? (float)monitor.cursorY / monitor.height : -9999f;
|
|
||||||
coord = new Vector2(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d2d9e4ca459ecb44da8815bafe9655c5
|
|
||||||
timeCreated: 1477635630
|
|
||||||
licenseType: Pro
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {fileID: 2800000, guid: 89616e59e1cccb346bd4e959257990ca, type: 3}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace uDesktopDuplication
|
namespace uDesktopDuplication
|
||||||
{
|
{
|
||||||
|
|
||||||
[AddComponentMenu("uDesktopDuplication/Texture"), RequireComponent(typeof(Cursor))]
|
[AddComponentMenu("uDesktopDuplication/Texture")]
|
||||||
public class Texture : MonoBehaviour
|
public class Texture : MonoBehaviour
|
||||||
{
|
{
|
||||||
private Monitor monitor_;
|
private Monitor monitor_;
|
||||||
@@ -109,11 +109,6 @@ public class Texture : MonoBehaviour
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awake()
|
|
||||||
{
|
|
||||||
AddCursorIfNotAttached();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
{
|
{
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
@@ -143,14 +138,6 @@ public class Texture : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddCursorIfNotAttached()
|
|
||||||
{
|
|
||||||
if (!GetComponent<Cursor>())
|
|
||||||
{
|
|
||||||
gameObject.AddComponent<Cursor>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reinitialize()
|
void Reinitialize()
|
||||||
{
|
{
|
||||||
// Monitor instance is released here when initialized.
|
// Monitor instance is released here when initialized.
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ 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(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
|
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
|
||||||
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
|
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
|
||||||
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
|
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Properties
|
|||||||
_Color ("Color", Color) = (1, 1, 1, 1)
|
_Color ("Color", Color) = (1, 1, 1, 1)
|
||||||
_MainTex ("Texture", 2D) = "white" {}
|
_MainTex ("Texture", 2D) = "white" {}
|
||||||
_Mask ("Mask", Range(0, 1)) = 0.1
|
_Mask ("Mask", Range(0, 1)) = 0.1
|
||||||
_CursorTex ("Cursor Texture", 2D) = "white" {}
|
|
||||||
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
|
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
|
||||||
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
|
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
|
||||||
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
|
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ 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(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
|
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
|
||||||
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
|
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
|
||||||
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
|
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ 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(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
|
[KeywordEnum(Y, Z)] _Forward("Mesh Forward Direction", Int) = 0
|
||||||
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
|
[Toggle(BEND_ON)] _Bend("Use Bend", Int) = 0
|
||||||
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
|
[PowerSlider(10.0)] _Radius("Bend Radius", Range(1, 100)) = 30
|
||||||
|
|||||||
Reference in New Issue
Block a user