Update to latest LeapCSharp and LeapC SDK

This commit is contained in:
SDraw 2022-04-13 10:09:55 +03:00
parent 450968964d
commit 987aa798ba
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
8 changed files with 257 additions and 26 deletions

View file

@ -1,10 +1,10 @@
using System.Reflection;
[assembly: AssemblyTitle("LeapMotionExtension")]
[assembly: AssemblyVersion("1.0.3")]
[assembly: AssemblyFileVersion("1.0.3")]
[assembly: AssemblyVersion("1.0.4")]
[assembly: AssemblyFileVersion("1.0.4")]
[assembly: MelonLoader.MelonInfo(typeof(ml_lme_cvr.LeapMotionExtension), "LeapMotionExtension", "1.0.3", "SDraw", "https://github.com/SDraw")]
[assembly: MelonLoader.MelonInfo(typeof(ml_lme_cvr.LeapMotionExtension), "LeapMotionExtension", "1.0.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]

View file

@ -409,19 +409,41 @@ namespace LeapInternal
}
public UInt64 GetInterpolatedFrameSize(Int64 time)
public UInt64 GetInterpolatedFrameSize(Int64 time, Device device = null)
{
UInt64 size = 0;
eLeapRS result = LeapC.GetFrameSize(_leapConnection, time, out size);
eLeapRS result;
if (device != null)
{
result = LeapC.GetFrameSizeEx(_leapConnection, device.Handle, time, out size);
}
else
{
result = LeapC.GetFrameSize(_leapConnection, time, out size);
}
reportAbnormalResults("LeapC get interpolated frame call was ", result);
return size;
}
public void GetInterpolatedFrame(Frame toFill, Int64 time)
public void GetInterpolatedFrame(Frame toFill, Int64 time, Device device = null)
{
UInt64 size = GetInterpolatedFrameSize(time);
UInt64 size = GetInterpolatedFrameSize(time, device);
IntPtr trackingBuffer = Marshal.AllocHGlobal((Int32)size);
eLeapRS result = LeapC.InterpolateFrame(_leapConnection, time, trackingBuffer, size);
eLeapRS result;
if (device != null)
{
result = LeapC.InterpolateFrameEx(_leapConnection, device.Handle, time, trackingBuffer, size);
}
else
{
result = LeapC.InterpolateFrame(_leapConnection, time, trackingBuffer, size);
}
reportAbnormalResults("LeapC get interpolated frame call was ", result);
if (result == eLeapRS.eLeapRS_Success)
{
@ -432,11 +454,22 @@ namespace LeapInternal
Marshal.FreeHGlobal(trackingBuffer);
}
public void GetInterpolatedFrameFromTime(Frame toFill, Int64 time, Int64 sourceTime)
public void GetInterpolatedFrameFromTime(Frame toFill, Int64 time, Int64 sourceTime, Device device = null)
{
UInt64 size = GetInterpolatedFrameSize(time);
UInt64 size = GetInterpolatedFrameSize(time, device);
IntPtr trackingBuffer = Marshal.AllocHGlobal((Int32)size);
eLeapRS result = LeapC.InterpolateFrameFromTime(_leapConnection, time, sourceTime, trackingBuffer, size);
eLeapRS result;
if (device != null)
{
result = LeapC.InterpolateFrameFromTimeEx(_leapConnection, device.Handle, time, sourceTime, trackingBuffer, size);
}
else
{
result = LeapC.InterpolateFrameFromTime(_leapConnection, time, sourceTime, trackingBuffer, size);
}
reportAbnormalResults("LeapC get interpolated frame from time call was ", result);
if (result == eLeapRS.eLeapRS_Success)
{
@ -447,10 +480,10 @@ namespace LeapInternal
Marshal.FreeHGlobal(trackingBuffer);
}
public Frame GetInterpolatedFrame(Int64 time)
public Frame GetInterpolatedFrame(Int64 time, Device device = null)
{
Frame frame = new Frame();
GetInterpolatedFrame(frame, time);
GetInterpolatedFrame(frame, time, device);
return frame;
}
@ -471,15 +504,26 @@ namespace LeapInternal
Int64 sourceTime,
Int64 leftId,
Int64 rightId,
Device device,
out LeapTransform leftTransform,
out LeapTransform rightTransform)
{
leftTransform = LeapTransform.Identity;
rightTransform = LeapTransform.Identity;
UInt64 size = GetInterpolatedFrameSize(time);
UInt64 size = GetInterpolatedFrameSize(time, device);
IntPtr trackingBuffer = Marshal.AllocHGlobal((Int32)size);
eLeapRS result = LeapC.InterpolateFrameFromTime(_leapConnection, time, sourceTime, trackingBuffer, size);
eLeapRS result;
if (device != null)
{
result = LeapC.InterpolateFrameFromTimeEx(_leapConnection, device.Handle, time, sourceTime, trackingBuffer, size);
}
else
{
result = LeapC.InterpolateFrameFromTime(_leapConnection, time, sourceTime, trackingBuffer, size);
}
reportAbnormalResults("LeapC get interpolated frame from time call was ", result);
if (result == eLeapRS.eLeapRS_Success)
@ -516,6 +560,17 @@ namespace LeapInternal
}
Marshal.FreeHGlobal(trackingBuffer);
}
public void GetInterpolatedLeftRightTransform(Int64 time,
Int64 sourceTime,
Int64 leftId,
Int64 rightId,
out LeapTransform leftTransform,
out LeapTransform rightTransform)
{
GetInterpolatedLeftRightTransform(time, sourceTime, leftId, rightId, null, out leftTransform, out rightTransform);
}
private void handleConnection(ref LEAP_CONNECTION_EVENT connectionMsg)
@ -545,7 +600,6 @@ namespace LeapInternal
device.UpdateStatus(statusEvent.status);
}
private void handleDevice(ref LEAP_DEVICE_EVENT deviceMsg)
{
IntPtr deviceHandle = deviceMsg.device.handle;

View file

@ -497,6 +497,17 @@ namespace Leap
}
}
/// <summary>
/// Returns the current Leap service version information.
/// </summary>
public LEAP_VERSION ServiceVersion
{
get
{
return _connection.GetCurrentServiceVersion();
}
}
/// <summary>
/// Checks whether a minimum or required tracking service version is installed.
/// Gets the currently installed service version from the connection and checks whether
@ -634,20 +645,28 @@ namespace Leap
return new Frame().CopyFrom(Frame(history)).Transform(trs);
}
/// <summary>
/// Returns the Frame at the specified time, interpolating the data between existing frames, if necessary.
/// </summary>
public Frame GetInterpolatedFrame(Int64 time, Device device = null)
{
return _connection.GetInterpolatedFrame(time, device);
}
/// <summary>
/// Returns the Frame at the specified time, interpolating the data between existing frames, if necessary.
/// </summary>
public Frame GetInterpolatedFrame(Int64 time)
{
return _connection.GetInterpolatedFrame(time);
return GetInterpolatedFrame(time, null);
}
/// <summary>
/// Fills the Frame with data taken at the specified time, interpolating the data between existing frames, if necessary.
/// </summary>
public void GetInterpolatedFrame(Frame toFill, Int64 time)
public void GetInterpolatedFrame(Frame toFill, Int64 time, Device device = null)
{
_connection.GetInterpolatedFrame(toFill, time);
_connection.GetInterpolatedFrame(toFill, time, device);
}
/// <summary>
@ -730,6 +749,27 @@ namespace Leap
_connection.GetPointMapping(ref pointMapping);
}
/// <summary>
/// This is a special variant of GetInterpolatedFrameFromTime, for use with special
/// features that only require the position and orientation of the palm positions, and do
/// not care about pose data or any other data.
///
/// You must specify the id of the hand that you wish to get a transform for. If you specify
/// an id that is not present in the interpolated frame, the output transform will be the
/// identity transform.
/// </summary>
public void GetInterpolatedLeftRightTransform(Int64 time,
Int64 sourceTime,
int leftId,
int rightId,
Device device,
out LeapTransform leftTransform,
out LeapTransform rightTransform)
{
_connection.GetInterpolatedLeftRightTransform(time, sourceTime, leftId, rightId, device, out leftTransform, out rightTransform);
}
/// <summary>
/// This is a special variant of GetInterpolatedFrameFromTime, for use with special
/// features that only require the position and orientation of the palm positions, and do
@ -746,12 +786,12 @@ namespace Leap
out LeapTransform leftTransform,
out LeapTransform rightTransform)
{
_connection.GetInterpolatedLeftRightTransform(time, sourceTime, leftId, rightId, out leftTransform, out rightTransform);
GetInterpolatedLeftRightTransform(time, sourceTime, leftId, rightId, null, out leftTransform, out rightTransform);
}
public void GetInterpolatedFrameFromTime(Frame toFill, Int64 time, Int64 sourceTime)
public void GetInterpolatedFrameFromTime(Frame toFill, Int64 time, Int64 sourceTime, Device device = null)
{
_connection.GetInterpolatedFrameFromTime(toFill, time, sourceTime);
_connection.GetInterpolatedFrameFromTime(toFill, time, sourceTime, device);
}
/// <summary>

View file

@ -578,6 +578,11 @@ namespace LeapInternal
public Int32 major;
public Int32 minor;
public Int32 patch;
public new string ToString()
{
return major + "." + minor + "." + patch;
}
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@ -657,6 +662,13 @@ namespace LeapInternal
public float framerate;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct LEAP_TRACKING_MODE_EVENT
{
public UInt32 reserved;
public eLeapTrackingMode current_tracking_mode;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct LEAP_DROPPED_FRAME_EVENT
{
@ -699,6 +711,8 @@ namespace LeapInternal
public Int64 timestamp;
public LEAP_VECTOR head_position;
public LEAP_QUATERNION head_orientation;
public LEAP_VECTOR head_linear_velocity;
public LEAP_VECTOR head_angular_velocity;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@ -965,9 +979,15 @@ namespace LeapInternal
[DllImport("LeapC", EntryPoint = "LeapSetTrackingMode")]
public static extern eLeapRS SetTrackingMode(IntPtr hConnection, eLeapTrackingMode mode);
[DllImport("LeapC", EntryPoint = "LeapSetTrackingModeEx")]
public static extern eLeapRS SetTrackingModeEx(IntPtr hConnection, IntPtr hDevice, eLeapTrackingMode mode);
[DllImport("LeapC", EntryPoint = "LeapGetTrackingMode")]
public static extern eLeapRS LeapGetTrackingMode(IntPtr hConnection);
[DllImport("LeapC", EntryPoint = "LeapGetTrackingModeEx")]
public static extern eLeapRS LeapGetTrackingModeEx(IntPtr hConnection, IntPtr hDevice);
[DllImport("LeapC", EntryPoint = "LeapGetNow")]
public static extern long GetNow();
@ -1017,6 +1037,9 @@ namespace LeapInternal
[DllImport("LeapC", EntryPoint = "LeapOpenDevice")]
public static extern eLeapRS OpenDevice(LEAP_DEVICE_REF rDevice, out IntPtr pDevice);
[DllImport("LeapC", EntryPoint = "LeapSetPrimaryDevice")]
public static extern eLeapRS LeapSetPrimaryDevice(IntPtr hConnection, IntPtr hDevice, bool unsubscribeOthers);
[DllImport("LeapC", EntryPoint = "LeapSubscribeEvents")]
public static extern eLeapRS LeapSubscribeEvents(IntPtr hConnection, IntPtr hDevice);
@ -1029,11 +1052,12 @@ namespace LeapInternal
[DllImport("LeapC", EntryPoint = "LeapGetDeviceTransform")]
public static extern eLeapRS GetDeviceTransform(IntPtr hDevice, out float[] transform);
// Will be a SetPolicyFlagsEx()..
[DllImport("LeapC", EntryPoint = "LeapSetPolicyFlags")]
public static extern eLeapRS SetPolicyFlags(IntPtr hConnection, UInt64 set, UInt64 clear);
[DllImport("LeapC", EntryPoint = "LeapSetPolicyFlagsEx")]
public static extern eLeapRS SetPolicyFlagsEx(IntPtr hConnection, IntPtr hDevice, UInt64 set, UInt64 clear);
[DllImport("LeapC", EntryPoint = "LeapSetPause")]
public static extern eLeapRS LeapSetPause(IntPtr hConnection, bool pause);
@ -1046,12 +1070,21 @@ namespace LeapInternal
[DllImport("LeapC", EntryPoint = "LeapGetFrameSize")]
public static extern eLeapRS GetFrameSize(IntPtr hConnection, Int64 timestamp, out UInt64 pncbEvent);
[DllImport("LeapC", EntryPoint = "LeapGetFrameSizeEx")]
public static extern eLeapRS GetFrameSizeEx(IntPtr hConnection, IntPtr hDevice, Int64 timestamp, out UInt64 pncbEvent);
[DllImport("LeapC", EntryPoint = "LeapInterpolateFrame")]
public static extern eLeapRS InterpolateFrame(IntPtr hConnection, Int64 timestamp, IntPtr pEvent, UInt64 ncbEvent);
[DllImport("LeapC", EntryPoint = "LeapInterpolateFrameEx")]
public static extern eLeapRS InterpolateFrameEx(IntPtr hConnection, IntPtr hDevice, Int64 timestamp, IntPtr pEvent, UInt64 ncbEvent);
[DllImport("LeapC", EntryPoint = "LeapInterpolateFrameFromTime")]
public static extern eLeapRS InterpolateFrameFromTime(IntPtr hConnection, Int64 timestamp, Int64 sourceTimestamp, IntPtr pEvent, UInt64 ncbEvent);
[DllImport("LeapC", EntryPoint = "LeapInterpolateFrameFromTimeEx")]
public static extern eLeapRS InterpolateFrameFromTimeEx(IntPtr hConnection, IntPtr hDevice, Int64 timestamp, Int64 sourceTimestamp, IntPtr pEvent, UInt64 ncbEvent);
[DllImport("LeapC", EntryPoint = "LeapInterpolateHeadPose")]
public static extern eLeapRS InterpolateHeadPose(IntPtr hConnection, Int64 timestamp, ref LEAP_HEAD_POSE_EVENT headPose);

View file

@ -1,5 +1,5 @@
ULTRALEAP TRACKING SDK AGREEMENT
Updated: 26 October 2021
Updated: 22 March 2022
Permitted uses
This SDK Agreement (“Agreement”) covers use of the Ultraleap hand tracking SDK (the “SDK”) by
individuals and businesses for the following purposes:
@ -355,7 +355,7 @@ permitted uses set out in this Agreement.
“Ultraleap” “we” or “us” means Ultraleap Limited, a company registered in England with company
number 08781720, with a principal place of business at The West Wing, Glass Wharf, Bristol, BS2 0EL,
United Kingdom.
“Ultraleap Hardware” means the Leap Motion Controller or Stereo IR 170, each being a device that
“Ultraleap Hardware” means the Leap Motion Controller, Stereo IR 170, Stereo IR 170 EK or Ultraleap 3Di each being a device that
detects and reads movements within a 3-D interaction space to precisely interact with and control
software on a computing device, or an Ultraleap-authorized embedded optical module.
“Ultraleap Redistributables” means any .lib code, .dll files, .so files, sample code, or other materials

View file

@ -5290,3 +5290,107 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
-------------------------------------------------------------------------------
nano-ecc (1.0.0) - BSD License
===============================================================================
```
Copyright (c) 2013, Mike Ryan
Based on micro-ecc, Copyright (c) 2013, Kenneth MacKay
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
-------------------------------------------------------------------------------
Qt third-party licences
=======================
Ultraleap Tracking Software makes use of QtCore and QtGui, which themselves use third-party libraries in their modules. The licenses are listed here: https://doc.qt.io/qt-5/licenses-used-in-qt.html
As of March 23, 2022, the dependencies for QtCore and QtGui were listed as:
#### Qt Core
| Library | License |
| -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
| Data Compression Library (zlib), version 1.2.11 | Zlib License |
| Easing Equations by Robert Penner | BSD 3-clause "New" or "Revised" License |
| Efficient Binary-Decimal and Decimal-Binary Conversion Routines for IEEE Doubles, version 3.1.5 | BSD 3-clause "New" or "Revised" License |
| FreeBSD strtoll and strtoull, version 18b29f3fb8abee5d57ed8f4a44f806bec7e0eeff | BSD 3-clause "New" or "Revised" License |
| MD4 | Public Domain |
| MD5 | Public Domain |
| PCRE2 - Stack-less Just-In-Time Compiler, version 10.39 | BSD 2-clause "Simplified" License |
| PCRE2, version 10.39 | BSD 3-clause "New" or "Revised" License |
| QEventDispatcher on macOS | BSD 3-clause "New" or "Revised" License |
| Secure Hash Algorithm SHA-1 | Public Domain |
| Secure Hash Algorithm SHA-3 - Keccak, version 3.2 | Creative Commons Zero v1.0 Universal |
| Secure Hash Algorithm SHA-3 - brg_endian, version https://github.com/BrianGladman/sha/ commit 4b9e13ead2c5b5e41ca27c65de4dd69ae0bac228 | BSD 2-clause "Simplified" License |
| Secure Hash Algorithms SHA-384 and SHA-512 | BSD 3-clause "New" or "Revised" License |
| Text Codec: EUC-JP | BSD 2-clause "Simplified" License |
| Text Codec: EUC-KR | BSD 2-clause "Simplified" License |
| Text Codec: GBK | BSD 2-clause "Simplified" License |
| Text Codec: ISO 2022-JP (JIS) | BSD 2-clause "Simplified" License |
| Text Codec: Shift-JIS | BSD 2-clause "Simplified" License |
| Text Codec: TSCII | BSD 2-clause "Simplified" License |
| Text Codecs: Big5, Big5-HKSCS | BSD 2-clause "Simplified" License |
| The Public Suffix List, version d4e247a71d1b6da08dad906b098c818493166fcc, fetched on 2021-06-11 | Mozilla Public License 2.0 |
| TinyCBOR, version 0.6+patches | MIT License |
| Unicode Character Database (UCD), version 26 | Unicode License Agreement - Data Files and Software (2016) |
| Unicode Common Locale Data Repository (CLDR), version v39 | Unicode License Agreement - Data Files and Software (2016) |
| forkfd | MIT License |
#### Qt GUI
| Library | License |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| ANGLE Library, version chromium/3280 | BSD 3-clause "New" or "Revised" License |
| ANGLE: Array Bounds Clamper for WebKit | BSD 2-clause "Simplified" License |
| ANGLE: Khronos Headers | MIT License |
| ANGLE: Murmurhash | Public Domain |
| ANGLE: Systeminfo | BSD 2-clause "Simplified" License |
| ANGLE: trace_event | BSD 3-clause "New" or "Revised" License |
| Adobe Glyph List For New Fonts, version 1.7 | BSD 3-Clause "New" or "Revised" License |
| Anti-aliasing rasterizer from FreeType 2 | Freetype Project License or GNU General Public License v2.0 only |
| Bitstream Vera Font, version 1.10 | Bitstream Vera Font License |
| Cocoa Platform Plugin | BSD 3-clause "New" or "Revised" License |
| DejaVu Fonts, version 2.37 | Bitstream Vera Font License |
| Freetype 2 - Bitmap Distribution Format (BDF) support | MIT License |
| Freetype 2 - Portable Compiled Format (PCF) support | MIT License |
| Freetype 2 - zlib | Zlib License |
| Freetype 2, version 2.10.4 | Freetype Project License or GNU General Public License v2.0 only |
| HarfBuzz | MIT License |
| HarfBuzz-NG, version 1.7.4 | MIT License |
| IAccessible2 IDL Specification, version 1.3.0 | BSD 3-clause "New" or "Revised" License |
| LibJPEG-turbo, version 2.1.1 | Independent JPEG Group License and BSD 3-Clause "New" or "Revised" License and zlib License |
| LibPNG, version 1.6.37 | Libpng License and PNG Reference Library version 2 |
| MD4C, version 0.4.8 | MIT License |
| Native Style for Android | Apache License 2.0 |
| OpenGL ES 2 Headers, version Revision 27673 | MIT License |
| OpenGL Headers, version Revision 27684 | MIT License |
| Pixman, version 0.17.12 | MIT License |
| Smooth Scaling Algorithm | BSD 2-clause "Simplified" License and Imlib2 License |
| Vulkan API Registry, version 1.0.39 | MIT License |
| Vulkan Memory Allocator, version 2.2.0 | MIT License |
| WebGradients | MIT License |
| Wintab API | LCS-Telegraphics License |
| X Server helper | X11 License and Historical Permission Notice and Disclaimer |
| XCB-XInput | MIT License |
| sRGB color profile icc file | International Color Consortium License |
-------------------------------------------------------------------------------

Binary file not shown.

Binary file not shown.