mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-05 03:19:23 +00:00
Update to Ultraleap Gemini v5.12
Update to Ultraleap Unity Plugin v6.9.0 Unclamped spreads and curls
This commit is contained in:
parent
965c0bf93d
commit
5c33abc9d2
46 changed files with 1143 additions and 2564 deletions
127
ml_lme/vendor/LeapCSharp/Connection.cs
vendored
127
ml_lme/vendor/LeapCSharp/Connection.cs
vendored
|
@ -1,5 +1,5 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) Ultraleap, Inc. 2011-2021. *
|
||||
* Copyright (C) Ultraleap, Inc. 2011-2023. *
|
||||
* *
|
||||
* Use subject to the terms of the Apache License 2.0 available at *
|
||||
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
|
||||
|
@ -21,7 +21,7 @@ namespace LeapInternal
|
|||
public readonly int connectionId;
|
||||
public readonly string serverNamespace;
|
||||
|
||||
public Key(int connectionId, string serverNamespace = null)
|
||||
public Key(int connectionId, string serverNamespace = "Leap Service")
|
||||
{
|
||||
this.connectionId = connectionId;
|
||||
this.serverNamespace = serverNamespace;
|
||||
|
@ -417,6 +417,11 @@ namespace LeapInternal
|
|||
{
|
||||
LeapFrame.DispatchOnContext(this, EventContext, new FrameEventArgs(new Frame(deviceID).CopyFrom(ref trackingMsg)));
|
||||
}
|
||||
|
||||
if (LeapInternalFrame != null)
|
||||
{
|
||||
LeapInternalFrame.DispatchOnContext(this, EventContext, new InternalFrameEventArgs(ref trackingMsg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -853,6 +858,7 @@ namespace LeapInternal
|
|||
//since the distortion struct cannot be represented safely in c#
|
||||
distortionData.Data = new float[(int)(distortionData.Width * distortionData.Height * 2)]; //2 float values per map point
|
||||
Marshal.Copy(image.distortionMatrix, distortionData.Data, 0, distortionData.Data.Length);
|
||||
distortionData.OnDataChanged();
|
||||
|
||||
if (LeapDistortionChange != null)
|
||||
{
|
||||
|
@ -1019,6 +1025,56 @@ namespace LeapInternal
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Temporarily makes a connection to determine if a Service is available.
|
||||
/// Returns the result and closes the temporary connection upon completion.
|
||||
/// </summary>
|
||||
public static bool IsConnectionAvailable(string serverNamespace = "Leap Service")
|
||||
{
|
||||
LEAP_CONNECTION_CONFIG config = new LEAP_CONNECTION_CONFIG();
|
||||
config.server_namespace = Marshal.StringToHGlobalAnsi(serverNamespace);
|
||||
config.flags = 0;
|
||||
config.size = (uint)Marshal.SizeOf(config);
|
||||
|
||||
IntPtr tempConnection;
|
||||
|
||||
eLeapRS result;
|
||||
|
||||
result = LeapC.CreateConnection(ref config, out tempConnection);
|
||||
|
||||
if (result != eLeapRS.eLeapRS_Success || tempConnection == IntPtr.Zero)
|
||||
{
|
||||
LeapC.CloseConnection(tempConnection);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = LeapC.OpenConnection(tempConnection);
|
||||
|
||||
if (result != eLeapRS.eLeapRS_Success)
|
||||
{
|
||||
LeapC.CloseConnection(tempConnection);
|
||||
return false;
|
||||
}
|
||||
|
||||
LEAP_CONNECTION_MESSAGE _msg = new LEAP_CONNECTION_MESSAGE();
|
||||
uint timeout = 150;
|
||||
result = LeapC.PollConnection(tempConnection, timeout, ref _msg);
|
||||
|
||||
LEAP_CONNECTION_INFO pInfo = new LEAP_CONNECTION_INFO();
|
||||
pInfo.size = (uint)Marshal.SizeOf(pInfo);
|
||||
result = LeapC.GetConnectionInfo(tempConnection, ref pInfo);
|
||||
|
||||
if (pInfo.status == eLeapConnectionStatus.eLeapConnectionStatus_Connected)
|
||||
{
|
||||
LeapC.CloseConnection(tempConnection);
|
||||
return true;
|
||||
}
|
||||
|
||||
LeapC.CloseConnection(tempConnection);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the active setting for a specific policy.
|
||||
///
|
||||
|
@ -1056,6 +1112,17 @@ namespace LeapInternal
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool IsDeviceAvailable(Device device = null)
|
||||
{
|
||||
uint deviceID = 0;
|
||||
if (device != null)
|
||||
{
|
||||
deviceID = device.DeviceID;
|
||||
}
|
||||
|
||||
return _activePolicies.ContainsKey(deviceID);
|
||||
}
|
||||
|
||||
public uint GetConfigValue(string config_key)
|
||||
{
|
||||
uint requestId = 0;
|
||||
|
@ -1186,21 +1253,6 @@ namespace LeapInternal
|
|||
reportAbnormalResults("LeapC UnsubscribeEvents call was ", result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
|
||||
/// </summary>
|
||||
[System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")]
|
||||
public Vector PixelToRectilinear(Image.CameraType camera, Vector pixel)
|
||||
{
|
||||
LEAP_VECTOR pixelStruct = new LEAP_VECTOR(pixel);
|
||||
LEAP_VECTOR ray = LeapC.LeapPixelToRectilinear(_leapConnection,
|
||||
(camera == Image.CameraType.LEFT ?
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right),
|
||||
pixelStruct);
|
||||
return new Vector(ray.x, ray.y, ray.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
|
||||
/// </summary>
|
||||
|
@ -1215,29 +1267,6 @@ namespace LeapInternal
|
|||
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
|
||||
///
|
||||
/// Also allows specifying a specific device handle and calibration type.
|
||||
///
|
||||
/// @since 4.1
|
||||
/// </summary>
|
||||
[System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")]
|
||||
public Vector PixelToRectilinearEx(IntPtr deviceHandle,
|
||||
Image.CameraType camera, Image.CalibrationType calibType, Vector pixel)
|
||||
{
|
||||
LEAP_VECTOR pixelStruct = new LEAP_VECTOR(pixel);
|
||||
LEAP_VECTOR ray = LeapC.LeapPixelToRectilinearEx(_leapConnection,
|
||||
deviceHandle,
|
||||
(camera == Image.CameraType.LEFT ?
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right),
|
||||
(calibType == Image.CalibrationType.INFRARED ?
|
||||
eLeapCameraCalibrationType.eLeapCameraCalibrationType_infrared :
|
||||
eLeapCameraCalibrationType.eLeapCameraCalibrationType_visual),
|
||||
pixelStruct);
|
||||
return new Vector(ray.x, ray.y, ray.z);
|
||||
}
|
||||
/// <summary>
|
||||
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
|
||||
///
|
||||
|
@ -1262,8 +1291,7 @@ namespace LeapInternal
|
|||
/// <summary>
|
||||
/// Converts from camera-space rectilinear coordinates to image-space pixel coordinates
|
||||
/// </summary>
|
||||
[System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")]
|
||||
public Vector RectilinearToPixel(Image.CameraType camera, Vector ray)
|
||||
public UnityEngine.Vector3 RectilinearToPixel(Image.CameraType camera, UnityEngine.Vector3 ray)
|
||||
{
|
||||
LEAP_VECTOR rayStruct = new LEAP_VECTOR(ray);
|
||||
LEAP_VECTOR pixel = LeapC.LeapRectilinearToPixel(_leapConnection,
|
||||
|
@ -1271,15 +1299,20 @@ namespace LeapInternal
|
|||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right),
|
||||
rayStruct);
|
||||
return new Vector(pixel.x, pixel.y, pixel.z);
|
||||
return new UnityEngine.Vector3(pixel.x, pixel.y, pixel.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from camera-space rectilinear coordinates to image-space pixel coordinates
|
||||
///
|
||||
/// Also allows specifying a specific device handle and calibration type.
|
||||
/// </summary>
|
||||
public UnityEngine.Vector3 RectilinearToPixel(Image.CameraType camera, UnityEngine.Vector3 ray)
|
||||
public UnityEngine.Vector3 RectilinearToPixelEx(IntPtr deviceHandle,
|
||||
Image.CameraType camera, UnityEngine.Vector3 ray)
|
||||
{
|
||||
LEAP_VECTOR rayStruct = new LEAP_VECTOR(ray);
|
||||
LEAP_VECTOR pixel = LeapC.LeapRectilinearToPixel(_leapConnection,
|
||||
LEAP_VECTOR pixel = LeapC.LeapRectilinearToPixelEx(_leapConnection,
|
||||
deviceHandle,
|
||||
(camera == Image.CameraType.LEFT ?
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right),
|
||||
|
@ -1322,9 +1355,7 @@ namespace LeapInternal
|
|||
|
||||
pm.frameId = pmi.frame_id;
|
||||
pm.timestamp = pmi.timestamp;
|
||||
#pragma warning disable 0618
|
||||
pm.points = new Vector[nPoints];
|
||||
#pragma warning restore 0618
|
||||
pm.points = new UnityEngine.Vector3[nPoints];
|
||||
pm.ids = new UInt32[nPoints];
|
||||
|
||||
float[] points = new float[3 * nPoints];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue