mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-05 03:19:23 +00:00
Logic rewrite
Update to LeapCSharp 5.13.1 Not tested in VR
This commit is contained in:
parent
a41f17af82
commit
3609500959
21 changed files with 566 additions and 103 deletions
54
ml_lme/vendor/LeapCSharp/Connection.cs
vendored
54
ml_lme/vendor/LeapCSharp/Connection.cs
vendored
|
@ -567,7 +567,7 @@ namespace LeapInternal
|
|||
StructMarshal<LEAP_VECTOR>.PtrToStruct(new IntPtr(posPtr), out position);
|
||||
StructMarshal<LEAP_QUATERNION>.PtrToStruct(new IntPtr(rotPtr), out orientation);
|
||||
|
||||
LeapTransform transform = new LeapTransform(position.ToLeapVector(), orientation.ToLeapQuaternion());
|
||||
LeapTransform transform = new LeapTransform(position.ToVector3(), orientation.ToQuaternion());
|
||||
if (id == leftId)
|
||||
{
|
||||
leftTransform = transform;
|
||||
|
@ -1189,6 +1189,7 @@ namespace LeapInternal
|
|||
/// <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);
|
||||
|
@ -1200,6 +1201,20 @@ namespace LeapInternal
|
|||
return new Vector(ray.x, ray.y, ray.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
|
||||
/// </summary>
|
||||
public UnityEngine.Vector3 PixelToRectilinear(Image.CameraType camera, UnityEngine.Vector3 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 UnityEngine.Vector3(ray.x, ray.y, ray.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
|
||||
///
|
||||
|
@ -1207,6 +1222,7 @@ namespace LeapInternal
|
|||
///
|
||||
/// @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)
|
||||
{
|
||||
|
@ -1222,10 +1238,31 @@ namespace LeapInternal
|
|||
pixelStruct);
|
||||
return new Vector(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.
|
||||
/// </summary>
|
||||
public UnityEngine.Vector3 PixelToRectilinearEx(IntPtr deviceHandle,
|
||||
Image.CameraType camera, Image.CalibrationType calibType, UnityEngine.Vector3 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 UnityEngine.Vector3(ray.x, ray.y, ray.z);
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
LEAP_VECTOR rayStruct = new LEAP_VECTOR(ray);
|
||||
|
@ -1236,6 +1273,19 @@ namespace LeapInternal
|
|||
rayStruct);
|
||||
return new Vector(pixel.x, pixel.y, pixel.z);
|
||||
}
|
||||
/// <summary>
|
||||
/// Converts from camera-space rectilinear coordinates to image-space pixel coordinates
|
||||
/// </summary>
|
||||
public UnityEngine.Vector3 RectilinearToPixel(Image.CameraType camera, UnityEngine.Vector3 ray)
|
||||
{
|
||||
LEAP_VECTOR rayStruct = new LEAP_VECTOR(ray);
|
||||
LEAP_VECTOR pixel = LeapC.LeapRectilinearToPixel(_leapConnection,
|
||||
(camera == Image.CameraType.LEFT ?
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
|
||||
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right),
|
||||
rayStruct);
|
||||
return new UnityEngine.Vector3(pixel.x, pixel.y, pixel.z);
|
||||
}
|
||||
|
||||
public void TelemetryProfiling(ref LEAP_TELEMETRY_DATA telemetryData)
|
||||
{
|
||||
|
@ -1272,7 +1322,9 @@ 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.ids = new UInt32[nPoints];
|
||||
|
||||
float[] points = new float[3 * nPoints];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue