@hecomi hecomi released this Sep 12, 2018 · 3 commits to master since this release

Assets 3

Bug Fix

  • fix the crash bug caused by Windows sleep.

@hecomi hecomi released this Sep 11, 2018 · 5 commits to master since this release

Assets 3

Bug Fix

  • fixed a runtime error when using the IL2CPP scripting backend #24 (thank you @dj-kusuha 👍)
  • consider clipPos and clipScale for raycast.

@hecomi hecomi released this Aug 4, 2018 · 10 commits to master since this release

Assets 3

Bug fix

  • Fix darker screen bug caused after Unity 2018.1.

@hecomi hecomi released this Jan 7, 2017 · 25 commits to master since this release

Assets 3

Bug Fix

  • Fix flickering cursor bug caused by the update timing of cursor image in GPU.

Demo

@hecomi hecomi released this Jan 6, 2017 · 35 commits to master since this release

Assets 4

Updates

  • CPU performance was highly improved by calling AcquireNextFrame() of DDA in a separated thread per monitor #9 #10 (Thanks a lot ousttrue).

Before

udd-1

After

udd-2

Demo

@hecomi hecomi released this Dec 18, 2016 · 62 commits to master since this release

Assets 3

raycast2

Updates

  • Add raycast function.
    • Texture.Raycast(Vector3 from, Vector3 dir) was added.

Bug Fix

  • small bug fixes.

Raycast

These methods have been added to Texture class.

  • Texture.RayCastResult Texture.Raycast(Vector3 from, Vector3 dir)
  • Texture.RayCastResult Texture.RaycastAll(Vector3 from, Vector3 dir) (static)
struct uDesktopDuplication.Texture.RayCastResult
{
    public bool hit;
    public uDesktopDuplication.Texture texture;
    public Vector3 position;
    public Vector3 normal;
    public Vector2 coords;
    public Vector2 desktopCoord;
}

Please see RaycastTest scene for more details.

@hecomi hecomi released this Dec 3, 2016 · 70 commits to master since this release

Assets 3

Update

  • Add DLL for x86.
  • Add the editor script for uDesktopDuplication.Texture.
    • Can switch the monitor from the inspector quickly for test.

editor

Demo

@hecomi hecomi released this Dec 1, 2016 · 75 commits to master since this release

Assets 3

Updates

  • Add displacement shader and the example.
  • Remove Cursor.cs.
  • Add GetPixels() and GetPixel() APIs.

Bug Fix

  • Fix bug that sometimes hid the cursor in non-main monitor.
  • Fix cursor out-of-area bug.

Demo

Displacement Mapping Shader

3

Added displacement shader with distance-based tessallation (uDD_Unlit_Displacement). This works with DisplacementMapping.cs component.

4

You can control parameters of the distance-based tessellation from this script. Target represents the target display and if you set it as another monitor (Next or Prev), the mesh is transformed by it.

Please see Displacement scene for your reference for more details.

Remove Cursor.cs

uDD does not need Cursor.cs anymore because the cursor is now directly drawn into the image in the native code. Some functions that belonged to it was moved to appropriate components.

  • Cursor world position
    • GazePointAnalyzer.cursorPos for one monitor (maybe this will be moved into the other component in the future).
    • MultipleMonitorAnalyzer.gazePoint sees the cursor position and dirty/move rects and suggests where virtual character should see in the displays.

GetPixels() and GetPixel()

There are APIs like Texture2D.GetPixels().

  • bool uDesktopDuplication.Monitor.GetPixels(Color32[] target, int x, int y, int width, int height)
  • Color32[] uDesktopDuplication.Monitor.GetPixels(int x, int y, int width, int height)
  • Color32 uDesktopDuplication.Monitor.GetPixel(int x, int y)

However, before using these APIs, please set uDesktopDuplication.Monitor.useGetPixels property as true. This makes the native code copy the desktop texture from GPU to CPU in the rendering thread. It tooks some costs, so please set it as false in case that it is unnecessary.

There is an example scene named GetPixels to explain how to use the APIs. The below code is an example of them:

using UnityEngine;

public class GetPixelsExample : MonoBehaviour
{
    [SerializeField] uDesktopDuplication.Texture uddTexture;

    [SerializeField] int x = 100;
    [SerializeField] int y = 100;
    const int width = 64;
    const int height = 32;

    public Texture2D texture;
    Color32[] colors = new Color32[width * height];

    void Start()
    {
        texture = new Texture2D(width, height, TextureFormat.ARGB32, false);
        GetComponent<Renderer>().material.mainTexture = texture;
    }

    void Update()
    {
        // must be called (performance will be slightly down).
        uDesktopDuplication.Manager.primary.useGetPixels = true;

        var monitor = uddTexture.monitor;
        if (!monitor.hasBeenUpdated) return;

        if (monitor.GetPixels(colors, x, y, width, height)) {
            texture.SetPixels32(colors);
            texture.Apply();
        }

        Debug.Log(monitor.GetPixel(monitor.cursorX, monitor.cursorY));
    }
}