diff --git a/ml_lme/AssetsHandler.cs b/ml_lme/AssetsHandler.cs index bbbb1e7..a56affb 100644 --- a/ml_lme/AssetsHandler.cs +++ b/ml_lme/AssetsHandler.cs @@ -9,7 +9,8 @@ namespace ml_lme { static readonly List ms_assets = new List() { - "leapmotion_controller.asset" + "leapmotion_controller.asset", + "leapmotion_hands.asset" }; static Dictionary ms_loadedAssets = new Dictionary(); diff --git a/ml_lme/GestureMatcher.cs b/ml_lme/GestureMatcher.cs index 9b93c24..daa6d7e 100644 --- a/ml_lme/GestureMatcher.cs +++ b/ml_lme/GestureMatcher.cs @@ -22,11 +22,15 @@ namespace ml_lme public readonly float[] m_spreads = null; public readonly float[] m_bends = null; public float m_grabStrength = 0f; + public Vector3[] m_fingerPosition; + public Quaternion[] m_fingerRotation; public HandData() { m_spreads = new float[5]; m_bends = new float[5]; + m_fingerPosition = new Vector3[20]; + m_fingerRotation = new Quaternion[20]; } public void Reset() @@ -37,6 +41,11 @@ namespace ml_lme m_bends[i] = 0f; m_spreads[i] = 0f; } + for(int i = 0; i < 20; i++) + { + m_fingerPosition[i].Set(0f, 0f, 0f); + m_fingerRotation[i].Set(0f, 0f, 0f, 1f); + } m_grabStrength = 0f; } } @@ -77,9 +86,9 @@ namespace ml_lme { // Unity's IK and FinalIK move hand bones to target, therefore - wrist p_data.m_present = true; - p_data.m_position.Set(p_hand.WristPosition.x, p_hand.WristPosition.y, p_hand.WristPosition.z); - p_data.m_rotation.Set(p_hand.Rotation.x, p_hand.Rotation.y, p_hand.Rotation.z, p_hand.Rotation.w); - p_data.m_elbowPosition.Set(p_hand.Arm.ElbowPosition.x, p_hand.Arm.ElbowPosition.y, p_hand.Arm.ElbowPosition.z); + p_data.m_position = p_hand.WristPosition; + p_data.m_rotation = p_hand.Rotation; + p_data.m_elbowPosition = p_hand.Arm.ElbowPosition; // Bends foreach(Leap.Finger l_finger in p_hand.Fingers) @@ -89,41 +98,36 @@ namespace ml_lme float l_angle = 0f; foreach(Leap.Bone l_bone in l_finger.bones) { + p_data.m_fingerPosition[(int)l_finger.Type * 4 + (int)l_bone.Type] = l_bone.PrevJoint; + p_data.m_fingerRotation[(int)l_finger.Type * 4 + (int)l_bone.Type] = l_bone.Rotation; + if(l_bone.Type == Leap.Bone.BoneType.TYPE_METACARPAL) { - l_prevSegment = new Quaternion(l_bone.Rotation.x, l_bone.Rotation.y, l_bone.Rotation.z, l_bone.Rotation.w); + l_prevSegment = l_bone.Rotation; continue; } - Quaternion l_curSegment = new Quaternion(l_bone.Rotation.x, l_bone.Rotation.y, l_bone.Rotation.z, l_bone.Rotation.w); - Quaternion l_diff = Quaternion.Inverse(l_prevSegment) * l_curSegment; - l_prevSegment = l_curSegment; + Quaternion l_diff = Quaternion.Inverse(l_prevSegment) * l_bone.Rotation; + l_prevSegment = l_bone.Rotation; - // Bend - local X rotation - float l_curAngle = 360f - l_diff.eulerAngles.x; - if(l_curAngle > 180f) - l_curAngle -= 360f; - l_angle += l_curAngle; + float l_angleDiff = l_diff.eulerAngles.x; + if(l_angleDiff > 180f) + l_angleDiff -= 360f; + l_angle += l_angleDiff; } - p_data.m_bends[(int)l_finger.Type] = Mathf.InverseLerp(0f, (l_finger.Type == Leap.Finger.FingerType.TYPE_THUMB) ? 90f : 180f, l_angle); + p_data.m_bends[(int)l_finger.Type] = Utils.InverseLerpUnclamped(0f, (l_finger.Type == Leap.Finger.FingerType.TYPE_THUMB) ? 90f : 180f, l_angle); } // Spreads foreach(Leap.Finger l_finger in p_hand.Fingers) { - float l_angle = 0f; - Leap.Bone l_parent = l_finger.Bone(Leap.Bone.BoneType.TYPE_METACARPAL); Leap.Bone l_child = l_finger.Bone(Leap.Bone.BoneType.TYPE_PROXIMAL); - - Quaternion l_parentRot = new Quaternion(l_parent.Rotation.x, l_parent.Rotation.y, l_parent.Rotation.z, l_parent.Rotation.w); - Quaternion l_childRot = new Quaternion(l_child.Rotation.x, l_child.Rotation.y, l_child.Rotation.z, l_child.Rotation.w); - - Quaternion l_diff = Quaternion.Inverse(l_parentRot) * l_childRot; + Quaternion l_diff = Quaternion.Inverse(l_parent.Rotation) * l_child.Rotation; // Spread - local Y rotation, but thumb is obnoxious - l_angle = l_diff.eulerAngles.y; + float l_angle = 360f - l_diff.eulerAngles.y; if(l_angle > 180f) l_angle -= 360f; @@ -134,15 +138,15 @@ namespace ml_lme if(l_finger.Type != Leap.Finger.FingerType.TYPE_THUMB) { if(l_angle < 0f) - p_data.m_spreads[(int)l_finger.Type] = 0.5f * Mathf.InverseLerp(ms_fingerLimits[(int)l_finger.Type].x, 0f, l_angle); + p_data.m_spreads[(int)l_finger.Type] = 0.5f * Utils.InverseLerpUnclamped(ms_fingerLimits[(int)l_finger.Type].x, 0f, l_angle); else - p_data.m_spreads[(int)l_finger.Type] = 0.5f + 0.5f * Mathf.InverseLerp(0f, ms_fingerLimits[(int)l_finger.Type].y, l_angle); + p_data.m_spreads[(int)l_finger.Type] = 0.5f + 0.5f * Utils.InverseLerpUnclamped(0f, ms_fingerLimits[(int)l_finger.Type].y, l_angle); } else - p_data.m_spreads[(int)l_finger.Type] = Mathf.InverseLerp(ms_fingerLimits[(int)l_finger.Type].x, ms_fingerLimits[(int)l_finger.Type].y, l_angle); + p_data.m_spreads[(int)l_finger.Type] = Utils.InverseLerpUnclamped(ms_fingerLimits[(int)l_finger.Type].x, ms_fingerLimits[(int)l_finger.Type].y, l_angle); } - p_data.m_grabStrength = (p_data.m_bends[1] + p_data.m_bends[2] + p_data.m_bends[3] + p_data.m_bends[4]) * 0.25f; + p_data.m_grabStrength = Mathf.Clamp01((p_data.m_bends[1] + p_data.m_bends[2] + p_data.m_bends[3] + p_data.m_bends[4]) * 0.25f); } } } diff --git a/ml_lme/LeapTracked.cs b/ml_lme/LeapTracked.cs index fe0b76a..c7ff8ed 100644 --- a/ml_lme/LeapTracked.cs +++ b/ml_lme/LeapTracked.cs @@ -145,58 +145,58 @@ namespace ml_lme { if(p_data.m_leftHand.m_present) { - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftThumb1Stretched, Mathf.Lerp(0.85f, -0.85f, p_data.m_leftHand.m_bends[0])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftThumb2Stretched, Mathf.Lerp(0.85f, -0.85f, p_data.m_leftHand.m_bends[0])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftThumb3Stretched, Mathf.Lerp(0.85f, -0.85f, p_data.m_leftHand.m_bends[0])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftThumbSpread, Mathf.Lerp(-1.5f, 1.0f, p_data.m_leftHand.m_spreads[0])); // Ok + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftThumb1Stretched, Mathf.LerpUnclamped(0.85f, -0.85f, p_data.m_leftHand.m_bends[0])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftThumb2Stretched, Mathf.LerpUnclamped(0.85f, -0.85f, p_data.m_leftHand.m_bends[0])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftThumb3Stretched, Mathf.LerpUnclamped(0.85f, -0.85f, p_data.m_leftHand.m_bends[0])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftThumbSpread, Mathf.LerpUnclamped(-1.5f, 1.0f, p_data.m_leftHand.m_spreads[0])); // Ok - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftIndex1Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[1])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftIndex2Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[1])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftIndex3Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[1])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftIndexSpread, Mathf.Lerp(1f, -1f, p_data.m_leftHand.m_spreads[1])); // Ok + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftIndex1Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[1])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftIndex2Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[1])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftIndex3Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[1])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftIndexSpread, Mathf.LerpUnclamped(1f, -1f, p_data.m_leftHand.m_spreads[1])); // Ok - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftMiddle1Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[2])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftMiddle2Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[2])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftMiddle3Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[2])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftMiddleSpread, Mathf.Lerp(2f, -2f, p_data.m_leftHand.m_spreads[2])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftMiddle1Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[2])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftMiddle2Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[2])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftMiddle3Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[2])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftMiddleSpread, Mathf.LerpUnclamped(2f, -2f, p_data.m_leftHand.m_spreads[2])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftRing1Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[3])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftRing2Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[3])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftRing3Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[3])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftRingSpread, Mathf.Lerp(-2f, 2f, p_data.m_leftHand.m_spreads[3])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftRing1Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[3])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftRing2Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[3])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftRing3Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[3])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftRingSpread, Mathf.LerpUnclamped(-2f, 2f, p_data.m_leftHand.m_spreads[3])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftLittle1Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[4])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftLittle2Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[4])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftLittle3Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_leftHand.m_bends[4])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftLittleSpread, Mathf.Lerp(-0.5f, 1f, p_data.m_leftHand.m_spreads[4])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftLittle1Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[4])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftLittle2Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[4])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftLittle3Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_leftHand.m_bends[4])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.LeftLittleSpread, Mathf.LerpUnclamped(-0.5f, 1f, p_data.m_leftHand.m_spreads[4])); } if(p_data.m_rightHand.m_present) { - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightThumb1Stretched, Mathf.Lerp(0.85f, -0.85f, p_data.m_rightHand.m_bends[0])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightThumb2Stretched, Mathf.Lerp(0.85f, -0.85f, p_data.m_rightHand.m_bends[0])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightThumb3Stretched, Mathf.Lerp(0.85f, -0.85f, p_data.m_rightHand.m_bends[0])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightThumbSpread, Mathf.Lerp(-1.5f, 1.0f, p_data.m_rightHand.m_spreads[0])); // Ok + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightThumb1Stretched, Mathf.LerpUnclamped(0.85f, -0.85f, p_data.m_rightHand.m_bends[0])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightThumb2Stretched, Mathf.LerpUnclamped(0.85f, -0.85f, p_data.m_rightHand.m_bends[0])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightThumb3Stretched, Mathf.LerpUnclamped(0.85f, -0.85f, p_data.m_rightHand.m_bends[0])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightThumbSpread, Mathf.LerpUnclamped(-1.5f, 1.0f, p_data.m_rightHand.m_spreads[0])); // Ok - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightIndex1Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[1])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightIndex2Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[1])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightIndex3Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[1])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightIndexSpread, Mathf.Lerp(1f, -1f, p_data.m_rightHand.m_spreads[1])); // Ok + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightIndex1Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[1])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightIndex2Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[1])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightIndex3Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[1])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightIndexSpread, Mathf.LerpUnclamped(1f, -1f, p_data.m_rightHand.m_spreads[1])); // Ok - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightMiddle1Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[2])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightMiddle2Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[2])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightMiddle3Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[2])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightMiddleSpread, Mathf.Lerp(2f, -2f, p_data.m_rightHand.m_spreads[2])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightMiddle1Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[2])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightMiddle2Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[2])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightMiddle3Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[2])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightMiddleSpread, Mathf.LerpUnclamped(2f, -2f, p_data.m_rightHand.m_spreads[2])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightRing1Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[3])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightRing2Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[3])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightRing3Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[3])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightRingSpread, Mathf.Lerp(-2f, 2f, p_data.m_rightHand.m_spreads[3])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightRing1Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[3])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightRing2Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[3])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightRing3Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[3])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightRingSpread, Mathf.LerpUnclamped(-2f, 2f, p_data.m_rightHand.m_spreads[3])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightLittle1Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[4])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightLittle2Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[4])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightLittle3Stretched, Mathf.Lerp(0.7f, -1f, p_data.m_rightHand.m_bends[4])); - UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightLittleSpread, Mathf.Lerp(-0.5f, 1f, p_data.m_rightHand.m_spreads[4])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightLittle1Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[4])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightLittle2Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[4])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightLittle3Stretched, Mathf.LerpUnclamped(0.7f, -1f, p_data.m_rightHand.m_bends[4])); + UpdatePoseMuscle(ref m_pose, (int)MuscleIndex.RightLittleSpread, Mathf.LerpUnclamped(-0.5f, 1f, p_data.m_rightHand.m_spreads[4])); } } diff --git a/ml_lme/LeapTracking.cs b/ml_lme/LeapTracking.cs index 429b904..6bb9ffb 100644 --- a/ml_lme/LeapTracking.cs +++ b/ml_lme/LeapTracking.cs @@ -8,7 +8,9 @@ namespace ml_lme class LeapTracking : MonoBehaviour { public static LeapTracking Instance { get; private set; } = null; - static Quaternion ms_identityRotation = Quaternion.identity; + static Quaternion ms_dummyRotation = Quaternion.identity; + static readonly Quaternion ms_hmdRotation = new Quaternion(0f, 0.7071068f, 0.7071068f, 0f); + static readonly Quaternion ms_screentopRotation = new Quaternion(0f, 0f, -1f, 0f); bool m_inVR = false; @@ -17,6 +19,9 @@ namespace ml_lme GameObject m_leapElbowLeft = null; GameObject m_leapElbowRight = null; GameObject m_leapControllerModel = null; + GameObject m_visualHands = null; + VisualHand m_visualHandLeft = null; + VisualHand m_visualHandRight = null; float m_scaleRelation = 1f; @@ -56,8 +61,21 @@ namespace ml_lme m_leapControllerModel.transform.localRotation = Quaternion.identity; } + m_visualHands = AssetsHandler.GetAsset("assets/models/hands/leaphands.prefab"); + if(m_visualHands != null) + { + m_visualHands.name = "VisualHands"; + m_visualHands.transform.parent = this.transform; + m_visualHands.transform.localPosition = Vector3.zero; + m_visualHands.transform.localRotation = Quaternion.identity; + + m_visualHandLeft = new VisualHand(m_visualHands.transform.Find("HandL"), true); + m_visualHandRight = new VisualHand(m_visualHands.transform.Find("HandR"), false); + } + Settings.DesktopOffsetChange += this.OnDesktopOffsetChange; Settings.ModelVisibilityChange += this.OnModelVisibilityChange; + Settings.VisualHandsChange += this.OnVisualHandsChange; Settings.TrackingModeChange += this.OnTrackingModeChange; Settings.RootAngleChange += this.OnRootAngleChange; Settings.HeadAttachChange += this.OnHeadAttachChange; @@ -66,6 +84,7 @@ namespace ml_lme MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer()); OnModelVisibilityChange(Settings.ModelVisibility); + OnVisualHandsChange(Settings.VisualHands); OnTrackingModeChange(Settings.TrackingMode); OnRootAngleChange(Settings.RootAngle); } @@ -99,22 +118,34 @@ namespace ml_lme if(l_data.m_leftHand.m_present) { - Utils.LeapToUnity(ref l_data.m_leftHand.m_position, ref l_data.m_leftHand.m_rotation, Settings.TrackingMode); + OrientationAdjustment(ref l_data.m_leftHand.m_position, ref l_data.m_leftHand.m_rotation, Settings.TrackingMode); + for(int i = 0; i < 20; i++) + OrientationAdjustment(ref l_data.m_leftHand.m_fingerPosition[i], ref l_data.m_leftHand.m_fingerRotation[i], Settings.TrackingMode); + m_leapHandLeft.transform.localPosition = l_data.m_leftHand.m_position; m_leapHandLeft.transform.localRotation = l_data.m_leftHand.m_rotation; - Utils.LeapToUnity(ref l_data.m_leftHand.m_elbowPosition, ref ms_identityRotation, Settings.TrackingMode); + OrientationAdjustment(ref l_data.m_leftHand.m_elbowPosition, ref ms_dummyRotation, Settings.TrackingMode); m_leapElbowLeft.transform.localPosition = l_data.m_leftHand.m_elbowPosition; + + if(Settings.VisualHands) + m_visualHandLeft?.Update(l_data.m_leftHand); } if(l_data.m_rightHand.m_present) { - Utils.LeapToUnity(ref l_data.m_rightHand.m_position, ref l_data.m_rightHand.m_rotation, Settings.TrackingMode); + OrientationAdjustment(ref l_data.m_rightHand.m_position, ref l_data.m_rightHand.m_rotation, Settings.TrackingMode); + for(int i = 0; i < 20; i++) + OrientationAdjustment(ref l_data.m_rightHand.m_fingerPosition[i], ref l_data.m_rightHand.m_fingerRotation[i], Settings.TrackingMode); + m_leapHandRight.transform.localPosition = l_data.m_rightHand.m_position; m_leapHandRight.transform.localRotation = l_data.m_rightHand.m_rotation; - Utils.LeapToUnity(ref l_data.m_rightHand.m_elbowPosition, ref ms_identityRotation, Settings.TrackingMode); + OrientationAdjustment(ref l_data.m_rightHand.m_elbowPosition, ref ms_dummyRotation, Settings.TrackingMode); m_leapElbowRight.transform.localPosition = l_data.m_rightHand.m_elbowPosition; + + if(Settings.VisualHands) + m_visualHandRight?.Update(l_data.m_rightHand); } } } @@ -136,6 +167,11 @@ namespace ml_lme m_leapControllerModel.SetActive(p_state); } + void OnVisualHandsChange(bool p_state) + { + m_visualHands.SetActive(p_state); + } + void OnTrackingModeChange(Settings.LeapTrackingMode p_mode) { switch(p_mode) @@ -198,5 +234,27 @@ namespace ml_lme m_scaleRelation = p_relation; OnHeadAttachChange(Settings.HeadAttach); } + + static void OrientationAdjustment(ref Vector3 p_pos, ref Quaternion p_rot, Settings.LeapTrackingMode p_mode) + { + switch(p_mode) + { + case Settings.LeapTrackingMode.Screentop: + { + p_pos.x *= -1f; + p_pos.y *= -1f; + p_rot = (ms_screentopRotation * p_rot); + } + break; + + case Settings.LeapTrackingMode.HMD: + { + p_pos.x *= -1f; + Utils.Swap(ref p_pos.y, ref p_pos.z); + p_rot = (ms_hmdRotation * p_rot); + } + break; + } + } } } diff --git a/ml_lme/Settings.cs b/ml_lme/Settings.cs index 56ff521..eea6c63 100644 --- a/ml_lme/Settings.cs +++ b/ml_lme/Settings.cs @@ -34,7 +34,8 @@ namespace ml_lme TrackElbows, Input, InteractThreadhold, - GripThreadhold + GripThreadhold, + VisualHands }; public static bool Enabled { get; private set; } = false; @@ -49,6 +50,7 @@ namespace ml_lme public static bool Input { get; private set; } = true; public static float InteractThreadhold { get; private set; } = 0.8f; public static float GripThreadhold { get; private set; } = 0.4f; + public static bool VisualHands { get; private set; } = false; static MelonLoader.MelonPreferences_Category ms_category = null; static List ms_entries = null; @@ -65,6 +67,7 @@ namespace ml_lme static public event Action InputChange; static public event Action InteractThreadholdChange; static public event Action GripThreadholdChange; + static public event Action VisualHandsChange; internal static void Init() { @@ -90,6 +93,7 @@ namespace ml_lme ms_category.CreateEntry(ModSetting.Input.ToString(), Input), ms_category.CreateEntry(ModSetting.InteractThreadhold.ToString(), (int)(InteractThreadhold * 100f)), ms_category.CreateEntry(ModSetting.GripThreadhold.ToString(), (int)(GripThreadhold * 100f)), + ms_category.CreateEntry(ModSetting.VisualHands.ToString(), VisualHands) }; Load(); @@ -146,6 +150,7 @@ namespace ml_lme Input = (bool)ms_entries[(int)ModSetting.Input].BoxedValue; InteractThreadhold = (int)ms_entries[(int)ModSetting.InteractThreadhold].BoxedValue * 0.01f; GripThreadhold = (int)ms_entries[(int)ModSetting.GripThreadhold].BoxedValue * 0.01f; + VisualHands = (bool)ms_entries[(int)ModSetting.VisualHands].BoxedValue; } static void OnToggleUpdate(string p_name, string p_value) @@ -195,6 +200,13 @@ namespace ml_lme InputChange?.Invoke(Input); } break; + + case ModSetting.VisualHands: + { + VisualHands = bool.Parse(p_value); + VisualHandsChange?.Invoke(VisualHands); + } + break; } ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value); diff --git a/ml_lme/Utils.cs b/ml_lme/Utils.cs index 455a165..779f0ad 100644 --- a/ml_lme/Utils.cs +++ b/ml_lme/Utils.cs @@ -10,9 +10,6 @@ namespace ml_lme { static class Utils { - static readonly Quaternion ms_hmdRotationFix = new Quaternion(0f, 0.7071068f, 0.7071068f, 0f); - static readonly Quaternion ms_screentopRotationFix = new Quaternion(0f, 0f, -1f, 0f); - static FieldInfo ms_cohtmlView = typeof(CohtmlControlledViewDisposable).GetField("_view", BindingFlags.NonPublic | BindingFlags.Instance); public static bool IsInVR() => ((CheckVR.Instance != null) && CheckVR.Instance.hasVrDeviceLoaded); @@ -38,38 +35,18 @@ namespace ml_lme public static void ExecuteScript(this CohtmlControlledViewDisposable p_instance, string p_script) => ((cohtml.Net.View)ms_cohtmlView.GetValue(p_instance))?.ExecuteScript(p_script); - public static void LeapToUnity(ref Vector3 p_pos, ref Quaternion p_rot, Settings.LeapTrackingMode p_mode) - { - p_pos *= 0.001f; - p_pos.z *= -1f; - p_rot.x *= -1f; - p_rot.y *= -1f; - - switch(p_mode) - { - case Settings.LeapTrackingMode.Screentop: - { - p_pos.x *= -1f; - p_pos.y *= -1f; - p_rot = (ms_screentopRotationFix * p_rot); - } - break; - - case Settings.LeapTrackingMode.HMD: - { - p_pos.x *= -1f; - Swap(ref p_pos.y, ref p_pos.z); - p_rot = (ms_hmdRotationFix * p_rot); - } - break; - } - } - public static void Swap(ref T lhs, ref T rhs) { T temp = lhs; lhs = rhs; rhs = temp; } + + public static float InverseLerpUnclamped(float a, float b, float value) + { + if(a != b) + return (value - a) / (b - a); + return 0f; + } } } diff --git a/ml_lme/VisualHand.cs b/ml_lme/VisualHand.cs new file mode 100644 index 0000000..ee7157e --- /dev/null +++ b/ml_lme/VisualHand.cs @@ -0,0 +1,71 @@ +using UnityEngine; + +namespace ml_lme +{ + class VisualHand + { + Transform m_root = null; + Transform m_wrist = null; + Transform[] m_fingers = null; + + public VisualHand(Transform p_root, bool p_left) + { + m_root = p_root; + + if(m_root != null) + { + m_wrist = m_root.Find(p_left ? "LeftHand/Wrist" : "RightHand/Wrist"); + if(m_wrist != null) + { + m_fingers = new Transform[20]; + + m_fingers[0] = null; // Actual thumb-meta, look at Leap Motion docs, dummy + m_fingers[1] = m_wrist.Find("thumb_meta"); + m_fingers[2] = m_wrist.Find("thumb_meta/thumb_a"); + m_fingers[3] = m_wrist.Find("thumb_meta/thumb_a/thumb_b"); + + m_fingers[4] = m_wrist.Find("index_meta"); + m_fingers[5] = m_wrist.Find("index_meta/index_a"); + m_fingers[6] = m_wrist.Find("index_meta/index_a/index_b"); + m_fingers[7] = m_wrist.Find("index_meta/index_a/index_b/index_c"); + + m_fingers[8] = m_wrist.Find("middle_meta"); + m_fingers[9] = m_wrist.Find("middle_meta/middle_a"); + m_fingers[10] = m_wrist.Find("middle_meta/middle_a/middle_b"); + m_fingers[11] = m_wrist.Find("middle_meta/middle_a/middle_b/middle_c"); + + m_fingers[12] = m_wrist.Find("ring_meta"); + m_fingers[13] = m_wrist.Find("ring_meta/ring_a"); + m_fingers[14] = m_wrist.Find("ring_meta/ring_a/ring_b"); + m_fingers[15] = m_wrist.Find("ring_meta/ring_a/ring_b/ring_c"); + + m_fingers[16] = m_wrist.Find("pinky_meta"); + m_fingers[17] = m_wrist.Find("pinky_meta/pinky_a"); + m_fingers[18] = m_wrist.Find("pinky_meta/pinky_a/pinky_b"); + m_fingers[19] = m_wrist.Find("pinky_meta/pinky_a/pinky_b/pinky_c"); + } + } + } + + public void Update(GestureMatcher.HandData p_data) + { + if(m_wrist != null) + { + m_wrist.position = p_data.m_position; + m_wrist.rotation = p_data.m_rotation; + + for(int i = 0; i < 20; i++) + { + if(m_fingers[i] != null) + { + //m_fingers[i].position = p_data.m_fingerPosition[i]; + m_fingers[i].rotation = p_data.m_fingerRotation[i]; + } + } + + m_wrist.localPosition = p_data.m_position; + m_wrist.localRotation = p_data.m_rotation; + } + } + } +} diff --git a/ml_lme/ml_lme.csproj b/ml_lme/ml_lme.csproj index b3fef32..9556272 100644 --- a/ml_lme/ml_lme.csproj +++ b/ml_lme/ml_lme.csproj @@ -4,7 +4,7 @@ netstandard2.1 x64 LeapMotionExtension - 1.3.7 + 1.3.8 SDraw None LeapMotionExtension @@ -24,11 +24,13 @@ + + LeapC.dll @@ -85,6 +87,10 @@ false + + + + diff --git a/ml_lme/resources/leapmotion_hands.asset b/ml_lme/resources/leapmotion_hands.asset new file mode 100644 index 0000000..24c8aea Binary files /dev/null and b/ml_lme/resources/leapmotion_hands.asset differ diff --git a/ml_lme/resources/menu.js b/ml_lme/resources/menu.js index 3a54314..6ad2321 100644 --- a/ml_lme/resources/menu.js +++ b/ml_lme/resources/menu.js @@ -385,6 +385,13 @@ function inp_dropdown_mod_lme(_obj, _callbackName) { +
+
Visualize hands:
+
+
+
+
+
Interaction input:
diff --git a/ml_lme/vendor/LeapCSharp/Arm.cs b/ml_lme/vendor/LeapCSharp/Arm.cs index 1547fc5..03ff19f 100644 --- a/ml_lme/vendor/LeapCSharp/Arm.cs +++ b/ml_lme/vendor/LeapCSharp/Arm.cs @@ -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 * @@ -26,27 +26,6 @@ namespace Leap /// public Arm() : base() { } - /// - /// Constructs a new Arm object. - /// @since 3.0 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 and Quaternion instead.")] - public Arm(Vector elbow, - Vector wrist, - Vector center, - Vector direction, - float length, - float width, - LeapQuaternion rotation) - : base(elbow, - wrist, - center, - direction, - length, - width, - BoneType.TYPE_METACARPAL, //ignored for arms - rotation) - { } /// /// Constructs a new Arm object. /// @@ -94,8 +73,7 @@ namespace Leap /// /// @since 2.0.3 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector ElbowPosition + public Vector3 ElbowPosition { get { @@ -112,8 +90,7 @@ namespace Leap /// /// @since 2.0.3 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector WristPosition + public Vector3 WristPosition { get { diff --git a/ml_lme/vendor/LeapCSharp/Bone.cs b/ml_lme/vendor/LeapCSharp/Bone.cs index 4e51fff..dfee543 100644 --- a/ml_lme/vendor/LeapCSharp/Bone.cs +++ b/ml_lme/vendor/LeapCSharp/Bone.cs @@ -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 * @@ -27,7 +27,6 @@ namespace Leap [Serializable] public class Bone : IEquatable { -#pragma warning disable 0618 /// /// Constructs a default invalid Bone object. /// @@ -38,30 +37,6 @@ namespace Leap Type = BoneType.TYPE_INVALID; } - /// - /// Constructs a new Bone object. - /// @since 3.0 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use Bone with Vector3s instead. If you believe that it needs to be kept, please open a discussion on the GitHub forum (https://github.com/ultraleap/UnityPlugin/discussions)")] - public Bone(Vector prevJoint, - Vector nextJoint, - Vector center, - Vector direction, - float length, - float width, - Bone.BoneType type, - LeapQuaternion rotation) - { - PrevJoint = prevJoint; - NextJoint = nextJoint; - Center = center; - Direction = direction; - Rotation = rotation; - Length = length; - Width = width; - Type = type; - } - /// /// Constructs a new Bone object. /// @since 3.0 @@ -75,11 +50,11 @@ namespace Leap Bone.BoneType type, Quaternion rotation) { - PrevJoint = new Vector(prevJoint.x, prevJoint.y, prevJoint.z); - NextJoint = new Vector(nextJoint.x, nextJoint.y, nextJoint.z); - Center = new Vector(center.x, center.y, center.z); - Direction = new Vector(direction.x, direction.y, direction.z); - Rotation = new LeapQuaternion(rotation.x, rotation.y, rotation.z, rotation.w); + PrevJoint = prevJoint; + NextJoint = nextJoint; + Center = center; + Direction = direction; + Rotation = rotation; Length = length; Width = width; Type = type; @@ -111,31 +86,27 @@ namespace Leap /// In anatomical terms, this is the proximal end of the bone. /// @since 2.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector PrevJoint; + public Vector3 PrevJoint; /// /// The end of the bone, closest to the finger tip. /// In anatomical terms, this is the distal end of the bone. /// @since 2.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector NextJoint; + public Vector3 NextJoint; /// /// The midpoint of the bone. /// @since 2.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector Center; + public Vector3 Center; /// /// The normalized direction of the bone from base to tip. /// @since 2.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector Direction; + public Vector3 Direction; /// /// The estimated length of the bone. @@ -159,8 +130,9 @@ namespace Leap /// The orientation of this Bone as a Quaternion. /// @since 2.0 /// - [System.Obsolete("Its type will be changed from LeapQuaternion to UnityEngine.Quaternion")] - public LeapQuaternion Rotation; + public Quaternion Rotation; + + LeapTransform _basis = new LeapTransform(Vector3.one, Quaternion.identity); /// /// The orthonormal basis vectors for this Bone as a Matrix. @@ -193,7 +165,16 @@ namespace Leap /// /// @since 2.0 /// - public LeapTransform Basis { get { return new LeapTransform(PrevJoint, Rotation); } } + public LeapTransform Basis + { + get + { + _basis.translation = PrevJoint; + _basis.rotation = Rotation; + + return _basis; + } + } /// /// Enumerates the type of bones. @@ -210,7 +191,5 @@ namespace Leap TYPE_INTERMEDIATE = 2, TYPE_DISTAL = 3 } -#pragma warning restore 0618 - } } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/CSharpExtensions.cs b/ml_lme/vendor/LeapCSharp/CSharpExtensions.cs index 8435d54..c229bc6 100644 --- a/ml_lme/vendor/LeapCSharp/CSharpExtensions.cs +++ b/ml_lme/vendor/LeapCSharp/CSharpExtensions.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/CircularObjectBuffer.cs b/ml_lme/vendor/LeapCSharp/CircularObjectBuffer.cs index 2dfb485..173d65d 100644 --- a/ml_lme/vendor/LeapCSharp/CircularObjectBuffer.cs +++ b/ml_lme/vendor/LeapCSharp/CircularObjectBuffer.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/Config.cs b/ml_lme/vendor/LeapCSharp/Config.cs index c33421c..b291c67 100644 --- a/ml_lme/vendor/LeapCSharp/Config.cs +++ b/ml_lme/vendor/LeapCSharp/Config.cs @@ -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 * @@ -119,66 +119,6 @@ namespace Leap return false; } - [Obsolete("Use the generic Set method instead.")] - public ValueType Type(string key) - { - return ValueType.TYPE_UNKNOWN; - } - - [Obsolete("Use the generic Get method instead.")] - public bool GetBool(string key) - { - return false; - } - - [Obsolete("Use the generic Set method instead.")] - public bool SetBool(string key, bool value) - { - return false; - } - - [Obsolete("Use the generic Get method instead.")] - public bool GetInt32(string key) - { - return false; - } - - [Obsolete("Use the generic Set method instead.")] - public bool SetInt32(string key, int value) - { - return false; - } - - [Obsolete("Use the generic Get method instead.")] - public bool GetFloat(string key) - { - return false; - } - - [Obsolete("Use the generic Set method instead.")] - public bool SetFloat(string key, float value) - { - return false; - } - - [Obsolete("Use the generic Get method instead.")] - public bool GetString(string key) - { - return false; - } - - [Obsolete("Use the generic Set method instead.")] - public bool SetString(string key, string value) - { - return false; - } - - [Obsolete] - public bool Save() - { - return false; - } - /// /// Enumerates the possible data types for configuration values. /// @since 1.0 diff --git a/ml_lme/vendor/LeapCSharp/Connection.cs b/ml_lme/vendor/LeapCSharp/Connection.cs index 2c17b05..e1990ae 100644 --- a/ml_lme/vendor/LeapCSharp/Connection.cs +++ b/ml_lme/vendor/LeapCSharp/Connection.cs @@ -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 } } + /// + /// Temporarily makes a connection to determine if a Service is available. + /// Returns the result and closes the temporary connection upon completion. + /// + 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; + } + /// /// 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); } - /// - /// Converts from image-space pixel coordinates to camera-space rectilinear coordinates - /// - [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); - } - /// /// Converts from image-space pixel coordinates to camera-space rectilinear coordinates /// @@ -1215,29 +1267,6 @@ namespace LeapInternal return new UnityEngine.Vector3(ray.x, ray.y, ray.z); } - /// - /// Converts from image-space pixel coordinates to camera-space rectilinear coordinates - /// - /// Also allows specifying a specific device handle and calibration type. - /// - /// @since 4.1 - /// - [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); - } /// /// Converts from image-space pixel coordinates to camera-space rectilinear coordinates /// @@ -1262,8 +1291,7 @@ namespace LeapInternal /// /// Converts from camera-space rectilinear coordinates to image-space pixel coordinates /// - [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); } + /// /// Converts from camera-space rectilinear coordinates to image-space pixel coordinates + /// + /// Also allows specifying a specific device handle and calibration type. /// - 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]; diff --git a/ml_lme/vendor/LeapCSharp/Controller.cs b/ml_lme/vendor/LeapCSharp/Controller.cs index 64782e2..1955f7f 100644 --- a/ml_lme/vendor/LeapCSharp/Controller.cs +++ b/ml_lme/vendor/LeapCSharp/Controller.cs @@ -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 * @@ -542,25 +542,6 @@ namespace Leap return Controller.CheckRequiredServiceVersion(minServiceVersion, _connection); } - /// - /// Requests setting and clearing policy flags on a specific device - /// - /// A request to change a policy is subject to user approval and a policy - /// can be changed by the user at any time (using the Leap Motion settings dialog). - /// The desired policy flags must be set every time an application runs. - /// - /// Policy changes are completed asynchronously and, because they are subject - /// to user approval or system compatibility checks, may not complete successfully. Call - /// Controller.IsPolicySet() after a suitable interval to test whether - /// the change was accepted. - /// @since 2.1.6 (5.4.4 for specific device) - /// - [Obsolete("This method signature will be removed in a future update. Please use the equivalent method that does not take the serial number")] - public void SetAndClearPolicy(PolicyFlag set, PolicyFlag clear, string deviceSerial = "", Device device = null) - { - _connection.SetAndClearPolicy(set, clear, device); - } - /// /// Requests setting and clearing policy flags on a specific device /// @@ -597,25 +578,6 @@ namespace Leap _connection.SetPolicy(policy, device); } - /// - /// Requests setting a policy. - /// - /// A request to change a policy is subject to user approval and a policy - /// can be changed by the user at any time (using the Leap Motion settings dialog). - /// The desired policy flags must be set every time an application runs. - /// - /// Policy changes are completed asynchronously and, because they are subject - /// to user approval or system compatibility checks, may not complete successfully. Call - /// Controller.IsPolicySet() after a suitable interval to test whether - /// the change was accepted. - /// @since 2.1.6 - /// - [Obsolete("Use the version of SetPolicy that also takes the device")] - public void SetPolicy(PolicyFlag policy) - { - SetPolicy(policy, null); - } - /// /// Requests clearing a policy on a specific device /// @@ -630,21 +592,6 @@ namespace Leap _connection.ClearPolicy(policy, device); } - /// - /// Requests clearing a policy - /// - /// Policy changes are completed asynchronously and, because they are subject - /// to user approval or system compatibility checks, may not complete successfully. Call - /// Controller.IsPolicySet() after a suitable interval to test whether - /// the change was accepted. - /// @since 2.1.6 - /// - [Obsolete("Use the version of ClearPolicy that also takes the device")] - public void ClearPolicy(PolicyFlag policy) - { - ClearPolicy(policy, null); - } - /// /// Gets the active setting for a specific device. /// @@ -665,22 +612,14 @@ namespace Leap } /// - /// Gets the active setting + /// Checks if the specified device is available. /// - /// Keep in mind that setting a policy flag is asynchronous, so changes are - /// not effective immediately after calling setPolicyFlag(). In addition, a - /// policy request can be declined by the user. You should always set the - /// policy flags required by your application at startup and check that the - /// policy change request was successful after an appropriate interval. - /// - /// If the controller object is not connected to the Leap Motion software, then the default - /// state for the selected policy is returned. - /// - /// @since 2.1.6 - [Obsolete("Use the version of IsPolicySet that also takes the device")] - public bool IsPolicySet(PolicyFlag policy) + /// Device availability is determined by checking it has active policy flags set against it + /// via its connection. + /// + public bool IsDeviceAvailable(Device device = null) { - return IsPolicySet(policy, null); + return _connection.IsDeviceAvailable(device); } /// diff --git a/ml_lme/vendor/LeapCSharp/CopyFromLeapCExtensions.cs b/ml_lme/vendor/LeapCSharp/CopyFromLeapCExtensions.cs index 4c88bd8..a398f2c 100644 --- a/ml_lme/vendor/LeapCSharp/CopyFromLeapCExtensions.cs +++ b/ml_lme/vendor/LeapCSharp/CopyFromLeapCExtensions.cs @@ -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 * @@ -9,9 +9,19 @@ namespace LeapInternal { using Leap; -#pragma warning disable 0618 + using UnityEngine; public static class CopyFromLeapCExtensions { + public static readonly float MM_TO_M = 1e-3f; + + public static void TransformToUnityUnits(this Hand hand) + { + LeapTransform leapTransform = new LeapTransform(Vector3.zero, Quaternion.identity, new Vector3(MM_TO_M, MM_TO_M, MM_TO_M)); + leapTransform.MirrorZ(); + + hand.Transform(leapTransform); + } + /** * Copies the data from an internal tracking message into a frame. @@ -42,7 +52,7 @@ namespace LeapInternal * @param leapHand The internal hand definition to be copied into this hand. * @param frameId The frame id of the frame this hand belongs to. */ - public static Hand CopyFrom(this Hand hand, ref LEAP_HAND leapHand, long frameId) + private static Hand CopyFrom(this Hand hand, ref LEAP_HAND leapHand, long frameId) { hand.FrameId = frameId; hand.Id = (int)leapHand.id; @@ -51,18 +61,17 @@ namespace LeapInternal hand.Confidence = leapHand.confidence; hand.GrabStrength = leapHand.grab_strength; - hand.GrabAngle = leapHand.grab_angle; hand.PinchStrength = leapHand.pinch_strength; hand.PinchDistance = leapHand.pinch_distance; hand.PalmWidth = leapHand.palm.width; hand.IsLeft = leapHand.type == eLeapHandType.eLeapHandType_Left; hand.TimeVisible = (float)(leapHand.visible_time * 1e-6); - hand.PalmPosition = leapHand.palm.position.ToLeapVector(); - hand.StabilizedPalmPosition = leapHand.palm.stabilized_position.ToLeapVector(); - hand.PalmVelocity = leapHand.palm.velocity.ToLeapVector(); - hand.PalmNormal = leapHand.palm.normal.ToLeapVector(); - hand.Rotation = leapHand.palm.orientation.ToLeapQuaternion(); - hand.Direction = leapHand.palm.direction.ToLeapVector(); + hand.PalmPosition = leapHand.palm.position.ToVector3(); + hand.StabilizedPalmPosition = leapHand.palm.stabilized_position.ToVector3(); + hand.PalmVelocity = leapHand.palm.velocity.ToVector3(); + hand.PalmNormal = leapHand.palm.normal.ToVector3(); + hand.Rotation = leapHand.palm.orientation.ToQuaternion(); + hand.Direction = leapHand.palm.direction.ToVector3(); hand.WristPosition = hand.Arm.NextJoint; hand.Fingers[0].CopyFrom(leapHand.thumb, Leap.Finger.FingerType.TYPE_THUMB, hand.Id, hand.TimeVisible); @@ -71,6 +80,8 @@ namespace LeapInternal hand.Fingers[3].CopyFrom(leapHand.ring, Leap.Finger.FingerType.TYPE_RING, hand.Id, hand.TimeVisible); hand.Fingers[4].CopyFrom(leapHand.pinky, Leap.Finger.FingerType.TYPE_PINKY, hand.Id, hand.TimeVisible); + hand.TransformToUnityUnits(); + return hand; } @@ -83,7 +94,7 @@ namespace LeapInternal * @param handId The hand id of the hand this finger belongs to. * @param timeVisible The time in seconds that this finger has been visible. */ - public static Finger CopyFrom(this Finger finger, LEAP_DIGIT leapBone, Finger.FingerType type, int handId, float timeVisible) + private static Finger CopyFrom(this Finger finger, LEAP_DIGIT leapBone, Finger.FingerType type, int handId, float timeVisible) { finger.Id = (handId * 10) + leapBone.finger_id; finger.HandId = handId; @@ -115,17 +126,17 @@ namespace LeapInternal * @param leapBone The internal bone definition to be copied into this bone. * @param type The bone type of this bone. */ - public static Bone CopyFrom(this Bone bone, LEAP_BONE leapBone, Bone.BoneType type) + private static Bone CopyFrom(this Bone bone, LEAP_BONE leapBone, Bone.BoneType type) { bone.Type = type; - bone.PrevJoint = leapBone.prev_joint.ToLeapVector(); - bone.NextJoint = leapBone.next_joint.ToLeapVector(); + bone.PrevJoint = leapBone.prev_joint.ToVector3(); + bone.NextJoint = leapBone.next_joint.ToVector3(); bone.Direction = (bone.NextJoint - bone.PrevJoint); - bone.Length = bone.Direction.Magnitude; + bone.Length = bone.Direction.magnitude; if (bone.Length < float.Epsilon) { - bone.Direction = Vector.Zero; + bone.Direction = Vector3.zero; } else { @@ -133,11 +144,10 @@ namespace LeapInternal } bone.Center = (bone.PrevJoint + bone.NextJoint) / 2.0f; - bone.Rotation = leapBone.rotation.ToLeapQuaternion(); + bone.Rotation = leapBone.rotation.ToQuaternion(); bone.Width = leapBone.width; return bone; } } -#pragma warning restore 0618 } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/CopyFromOtherExtensions.cs b/ml_lme/vendor/LeapCSharp/CopyFromOtherExtensions.cs index 318d247..ca91ea9 100644 --- a/ml_lme/vendor/LeapCSharp/CopyFromOtherExtensions.cs +++ b/ml_lme/vendor/LeapCSharp/CopyFromOtherExtensions.cs @@ -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 * @@ -8,7 +8,6 @@ namespace Leap { -#pragma warning disable 0618 public static class CopyFromOtherExtensions { @@ -46,7 +45,6 @@ namespace Leap hand.Id = source.Id; hand.Confidence = source.Confidence; hand.GrabStrength = source.GrabStrength; - hand.GrabAngle = source.GrabAngle; hand.Rotation = source.Rotation; hand.PinchStrength = source.PinchStrength; hand.PinchDistance = source.PinchDistance; @@ -117,5 +115,4 @@ namespace Leap return bone; } } -#pragma warning restore 0618 } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/Device.cs b/ml_lme/vendor/LeapCSharp/Device.cs index fdc31ce..0f77f70 100644 --- a/ml_lme/vendor/LeapCSharp/Device.cs +++ b/ml_lme/vendor/LeapCSharp/Device.cs @@ -1,11 +1,13 @@ /****************************************************************************** - * 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 * * between Ultraleap and you, your company or other organization. * ******************************************************************************/ +using UnityEngine; + namespace Leap { using LeapInternal; @@ -53,7 +55,6 @@ namespace Leap uint deviceID) { Handle = deviceHandle; - InternalHandle = internalHandle; HorizontalViewAngle = horizontalViewAngle; VerticalViewAngle = verticalViewAngle; Range = range; @@ -139,12 +140,10 @@ namespace Leap /// public IntPtr Handle { get; private set; } - private IntPtr InternalHandle; - + [Obsolete("Use LeapC.SetLeapPause instead")] public bool SetPaused(bool pause) { - eLeapRS result = LeapC.LeapSetPause(Handle, pause); - return result == eLeapRS.eLeapRS_Success; + return false; } /// @@ -246,10 +245,57 @@ namespace Leap /// /// Reports the ID assoicated with the device - /// /// public uint DeviceID { get; private set; } + private bool poseSet = false; + private Pose devicePose = Pose.identity; + + /// + /// The transform to world coordinates from 3D Leap coordinates. + /// + public Pose DevicePose + { + get + { + if (poseSet) // Assumes the devicePose never changes and so, uses the cached pose. + { + return devicePose; + } + + //float[] data = new float[16]; + //eLeapRS result = LeapC.GetDeviceTransform(Handle, data); + + //if (result != eLeapRS.eLeapRS_Success || data == null) + //{ + // devicePose = Pose.identity; + // return devicePose; + //} + + //// Get transform matrix and convert to unity space by inverting Z. + //Matrix4x4 transformMatrix = new Matrix4x4( + // new Vector4(data[0], data[1], data[2], data[3]), + // new Vector4(data[4], data[5], data[6], data[7]), + // new Vector4(data[8], data[9], data[10], data[11]), + // new Vector4(data[12], data[13], data[14], data[15])); + //Matrix4x4 toUnity = Matrix4x4.Scale(new Vector3(1, 1, -1)); + //transformMatrix = toUnity * transformMatrix; + + //// Identity matrix here means we have no device transform, also check validity. + //if (transformMatrix.isIdentity || !transformMatrix.ValidTRS()) + //{ + // devicePose = Pose.identity; + // return devicePose; + //} + + //// Return the valid pose + //devicePose = new Pose(transformMatrix.GetColumn(3), transformMatrix.rotation); + + poseSet = true; + return devicePose; + } + } + /// /// Returns the internal status field of the current device /// @@ -260,7 +306,7 @@ namespace Leap LEAP_DEVICE_INFO deviceInfo = new LEAP_DEVICE_INFO(); deviceInfo.serial = IntPtr.Zero; deviceInfo.size = (uint)System.Runtime.InteropServices.Marshal.SizeOf(deviceInfo); - result = LeapC.GetDeviceInfo(InternalHandle, ref deviceInfo); + result = LeapC.GetDeviceInfo(Handle, ref deviceInfo); if (result != eLeapRS.eLeapRS_Success) return 0; @@ -329,10 +375,10 @@ namespace Leap /// TYPE_3DI = (int)eLeapDeviceType.eLeapDevicePID_3Di, - [Obsolete] - TYPE_LAPTOP, - [Obsolete] - TYPE_KEYBOARD + /// + /// The Ultraleap Leap Motion Controller 2 hand tracking camera. + /// + TYPE_LMC2 = (int)eLeapDeviceType.eLeapDevicePID_LMC2 } } } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/DeviceList.cs b/ml_lme/vendor/LeapCSharp/DeviceList.cs index 5e13771..69bf84d 100644 --- a/ml_lme/vendor/LeapCSharp/DeviceList.cs +++ b/ml_lme/vendor/LeapCSharp/DeviceList.cs @@ -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 * @@ -54,33 +54,6 @@ namespace Leap return null; } - [Obsolete("Multiple devices can now be streaming, use ActiveDevices instead.", false)] - /// - /// The device that is currently streaming tracking data. - /// If no streaming devices are found, returns null - /// - public Device ActiveDevice - { - get - { - if (Count == 1) - { - return this[0]; - } - - for (int d = 0; d < Count; d++) - { - this[d].UpdateStatus(LeapInternal.eLeapDeviceStatus.eLeapDeviceStatus_Streaming); - if (this[d].IsStreaming) - { - return this[d]; - } - } - - return null; - } - } - /// /// The devices that are currently streaming tracking data. /// If no streaming devices are found, returns null diff --git a/ml_lme/vendor/LeapCSharp/DistortionData.cs b/ml_lme/vendor/LeapCSharp/DistortionData.cs index 7271650..99630ec 100644 --- a/ml_lme/vendor/LeapCSharp/DistortionData.cs +++ b/ml_lme/vendor/LeapCSharp/DistortionData.cs @@ -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 * @@ -22,6 +22,9 @@ namespace Leap /// public class DistortionData { + private float[] _flippedData; + private float[] _originalData; + /// /// Constructs an uninitialized distortion object. /// @since 3.0 @@ -67,11 +70,41 @@ namespace Leap /// public float Height { get; set; } /// - /// The distortion data. + /// The original distortion data, as provided by the service /// /// @since 3.0 /// - public float[] Data { get; set; } + public float[] Data + { + get + { + return _originalData; + } + + set + { + _originalData = value; + + // Note, the contents of the array are normally copied into the buffer by a marshall operation, + // so the flipped data needs to be updated explicitly, not when the _orginalData member is set + } + } + + /// + /// Returns the distortion data, adjusted so that a location in the distortion map texture now refers to the + /// same region of the texture containing the IR image - e.g. the bottom left of the distortion texture + /// maps to bottom left of the IR image + /// + /// @since 3.0 + /// + public float[] FlippedData + { + get + { + return _flippedData; + } + } + /// /// Reports whether the distortion data is internally consistent. /// @since 3.0 @@ -89,5 +122,33 @@ namespace Leap return false; } } + + internal void OnDataChanged() + { + UpdateFlippedData(); + } + + private void UpdateFlippedData() + { + if (_originalData == null) + { + return; + } + + // This is called normally once a session, so allocation is fine + float[] flipped = new float[LeapInternal.LeapC.DistortionSize * LeapInternal.LeapC.DistortionSize * 2]; + for (int x = 0; x < LeapInternal.LeapC.DistortionSize; x++) + { + for (int y = 0; y < LeapInternal.LeapC.DistortionSize; y++) + { + // We change the data so that the *mapped* Y value is inverted + flipped[((x + y * LeapInternal.LeapC.DistortionSize) * 2)] = _originalData[((x + y * LeapInternal.LeapC.DistortionSize) * 2)]; + flipped[((x + y * LeapInternal.LeapC.DistortionSize) * 2) + 1] = (float)1.0 - _originalData[((x + y * LeapInternal.LeapC.DistortionSize) * 2) + 1]; + } + } + + _flippedData = flipped; + } + } } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/Events.cs b/ml_lme/vendor/LeapCSharp/Events.cs index 5671776..a4ee783 100644 --- a/ml_lme/vendor/LeapCSharp/Events.cs +++ b/ml_lme/vendor/LeapCSharp/Events.cs @@ -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 * @@ -113,13 +113,6 @@ namespace Leap this.device = device; } - [Obsolete("Use the constructor that takes the device and oldPolicyIsValid flag")] - public PolicyEventArgs(UInt64 currentPolicies, UInt64 oldPolicies) : base(LeapEvent.EVENT_POLICY_CHANGE) - { - this.currentPolicies = currentPolicies; - this.oldPolicies = oldPolicies; - } - /// /// Current policy flags /// diff --git a/ml_lme/vendor/LeapCSharp/FailedDevice.cs b/ml_lme/vendor/LeapCSharp/FailedDevice.cs index 46579a7..020794e 100644 --- a/ml_lme/vendor/LeapCSharp/FailedDevice.cs +++ b/ml_lme/vendor/LeapCSharp/FailedDevice.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/FailedDeviceList.cs b/ml_lme/vendor/LeapCSharp/FailedDeviceList.cs index 89e16cd..1562dae 100644 --- a/ml_lme/vendor/LeapCSharp/FailedDeviceList.cs +++ b/ml_lme/vendor/LeapCSharp/FailedDeviceList.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/Finger.cs b/ml_lme/vendor/LeapCSharp/Finger.cs index 5a110fe..2f46fa4 100644 --- a/ml_lme/vendor/LeapCSharp/Finger.cs +++ b/ml_lme/vendor/LeapCSharp/Finger.cs @@ -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 * @@ -11,7 +11,6 @@ using UnityEngine; namespace Leap { using System; -#pragma warning disable 0618 /// /// The Finger class represents a tracked finger. /// @@ -22,6 +21,12 @@ namespace Leap [Serializable] public class Finger { + /// + /// An array of Bone objects that represents each bone of the finger + /// + /// There are 4 bones per finger by default + /// @since 3.0 + /// public Bone[] bones = new Bone[4]; /// @@ -40,44 +45,6 @@ namespace Leap bones[3] = new Bone(); } - /// - /// Constructs a finger. - /// - /// Generally, you should not create your own finger objects. Such objects will not - /// have valid tracking data. Get valid finger objects from a hand in a frame - /// received from the service. - /// @since 3.0 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")] - public Finger(long frameId, - int handId, - int fingerId, - float timeVisible, - Vector tipPosition, - Vector direction, - float width, - float length, - bool isExtended, - FingerType type, - Bone metacarpal, - Bone proximal, - Bone intermediate, - Bone distal) - { - Type = type; - bones[0] = metacarpal; - bones[1] = proximal; - bones[2] = intermediate; - bones[3] = distal; - Id = (handId * 10) + fingerId; - HandId = handId; - TipPosition = tipPosition; - Direction = direction; - Width = width; - Length = length; - IsExtended = isExtended; - TimeVisible = timeVisible; - } /// /// Constructs a finger. /// @@ -107,8 +74,8 @@ namespace Leap bones[3] = distal; Id = (handId * 10) + fingerId; HandId = handId; - TipPosition = ToVector(tipPosition); - Direction = ToVector(direction); + TipPosition = tipPosition; + Direction = direction; Width = width; Length = length; IsExtended = isExtended; @@ -164,16 +131,14 @@ namespace Leap /// The tip position of this Finger. /// @since 1.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector TipPosition; + public Vector3 TipPosition; /// /// The direction in which this finger or tool is pointing. The direction is expressed - /// as a unit vector pointing in the same direction as the tip. + /// as a unit vector pointing in the same direction as the intermediate bone. /// @since 1.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector Direction; + public Vector3 Direction; /// /// The estimated width of the finger. @@ -220,13 +185,5 @@ namespace Leap TYPE_PINKY = 4, TYPE_UNKNOWN = -1 } - - - [Obsolete("This will be removed in the next major version update")] - private Vector ToVector(Vector3 v) - { - return new Vector(v.x, v.y, v.z); - } } -#pragma warning restore 0618 } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/Frame.cs b/ml_lme/vendor/LeapCSharp/Frame.cs index 02f4e57..dd1513b 100644 --- a/ml_lme/vendor/LeapCSharp/Frame.cs +++ b/ml_lme/vendor/LeapCSharp/Frame.cs @@ -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 * @@ -70,30 +70,6 @@ namespace Leap /// public UInt32 DeviceID; - [Obsolete] - public int SerializeLength - { - get - { - throw new NotImplementedException(); - } - } - - [Obsolete] - public byte[] Serialize - { - get - { - throw new NotImplementedException(); - } - } - - [Obsolete] - public void Deserialize(byte[] arg) - { - throw new NotImplementedException(); - } - /// /// The Hand object with the specified ID in this frame, or null if none /// exists. diff --git a/ml_lme/vendor/LeapCSharp/Hand.cs b/ml_lme/vendor/LeapCSharp/Hand.cs index 3f77c50..16cee65 100644 --- a/ml_lme/vendor/LeapCSharp/Hand.cs +++ b/ml_lme/vendor/LeapCSharp/Hand.cs @@ -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 * @@ -11,7 +11,6 @@ namespace Leap { using System; using System.Collections.Generic; -#pragma warning disable 0618 /// /// The Hand class reports the physical characteristics of a detected hand. /// @@ -47,56 +46,6 @@ namespace Leap Fingers.Add(new Finger()); } - - /// - /// Constructs a hand. - /// - /// Generally, you should not create your own Hand objects. Such objects will not - /// have valid tracking data. Get valid Hand objects from a frame - /// received from the service. - /// @since 3.0 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 and Quaternion instead.")] - public Hand(long frameID, - int id, - float confidence, - float grabStrength, - float grabAngle, - float pinchStrength, - float pinchDistance, - float palmWidth, - bool isLeft, - float timeVisible, - Arm arm, - List fingers, - Vector palmPosition, - Vector stabilizedPalmPosition, - Vector palmVelocity, - Vector palmNormal, - LeapQuaternion palmOrientation, - Vector direction, - Vector wristPosition) - { - FrameId = frameID; - Id = id; - Confidence = confidence; - GrabStrength = grabStrength; - GrabAngle = grabAngle; - PinchStrength = pinchStrength; - PinchDistance = pinchDistance; - PalmWidth = palmWidth; - IsLeft = isLeft; - TimeVisible = timeVisible; - Arm = arm; - Fingers = fingers; - PalmPosition = palmPosition; - StabilizedPalmPosition = stabilizedPalmPosition; - PalmVelocity = palmVelocity; - PalmNormal = palmNormal; - Rotation = palmOrientation; - Direction = direction; - WristPosition = wristPosition; - } /// /// Constructs a hand. /// @@ -108,7 +57,6 @@ namespace Leap int id, float confidence, float grabStrength, - float grabAngle, float pinchStrength, float pinchDistance, float palmWidth, @@ -128,7 +76,6 @@ namespace Leap Id = id; Confidence = confidence; GrabStrength = grabStrength; - GrabAngle = grabAngle; PinchStrength = pinchStrength; PinchDistance = pinchDistance; PalmWidth = palmWidth; @@ -136,13 +83,13 @@ namespace Leap TimeVisible = timeVisible; Arm = arm; Fingers = fingers; - PalmPosition = ToVector(palmPosition); - StabilizedPalmPosition = ToVector(stabilizedPalmPosition); - PalmVelocity = ToVector(palmVelocity); - PalmNormal = ToVector(palmNormal); - Rotation = ToLeapQuaternion(palmOrientation); - Direction = ToVector(direction); - WristPosition = ToVector(wristPosition); + PalmPosition = palmPosition; + StabilizedPalmPosition = stabilizedPalmPosition; + PalmVelocity = palmVelocity; + PalmNormal = palmNormal; + Rotation = palmOrientation; + Direction = direction; + WristPosition = wristPosition; } /// @@ -221,15 +168,13 @@ namespace Leap /// The center position of the palm. /// @since 1.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector PalmPosition; + public Vector3 PalmPosition; /// /// The rate of change of the palm position. /// @since 1.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector PalmVelocity; + public Vector3 PalmVelocity; /// /// The normal vector to the palm. If your hand is flat, this vector will @@ -242,8 +187,7 @@ namespace Leap /// respect to the horizontal plane. /// @since 1.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector PalmNormal; + public Vector3 PalmNormal; /// /// The direction from the palm position toward the fingers. @@ -255,8 +199,9 @@ namespace Leap /// respect to the horizontal plane. /// @since 1.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector Direction; + public Vector3 Direction; + + LeapTransform _basis = new LeapTransform(Vector3.one, Quaternion.identity); /// /// The transform of the hand. @@ -264,15 +209,23 @@ namespace Leap /// Note, in version prior to 3.1, the Basis was a Matrix object. /// @since 3.1 /// - public LeapTransform Basis { get { return new LeapTransform(PalmPosition, Rotation); } } + public LeapTransform Basis + { + get + { + _basis.translation = PalmPosition; + _basis.rotation = Rotation; + + return _basis; + } + } /// /// The rotation of the hand as a quaternion. /// /// @since 3.1 /// - [System.Obsolete("Its type will be changed from LeapQuaternion to UnityEngine.Quaternion")] - public LeapQuaternion Rotation; + public Quaternion Rotation; /// /// The strength of a grab hand pose. @@ -283,20 +236,6 @@ namespace Leap /// public float GrabStrength; - /// - /// The angle between the fingers and the hand of a grab hand pose. - /// - /// The angle is computed by looking at the angle between the direction of the - /// 4 fingers and the direction of the hand. Thumb is not considered when - /// computing the angle. - /// The angle is 0 radian for an open hand, and reaches pi radians when the pose - /// is a tight fist. - /// - /// @since 3.0 - /// - [System.Obsolete("This code will be removed in the next major version of the plugin. If you believe that it needs to be kept, please open a discussion on the GitHub forum (https://github.com/ultraleap/UnityPlugin/discussions)")] - public float GrabAngle; - /// /// The holding strength of a pinch hand pose. /// @@ -332,15 +271,13 @@ namespace Leap /// primarily on the speed of movement. /// @since 1.0 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector StabilizedPalmPosition; + public Vector3 StabilizedPalmPosition; /// /// The position of the wrist of this hand. /// @since 2.0.3 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector WristPosition; + public Vector3 WristPosition; /// /// The duration of time this Hand has been visible to the Leap Motion Controller, in seconds @@ -376,20 +313,5 @@ namespace Leap /// @since 2.0.3 /// public Arm Arm; - - - - [Obsolete("This will be removed in the next major version update")] - private Vector ToVector(Vector3 v) - { - return new Vector(v.x, v.y, v.z); - } - - [Obsolete("This will be removed in the next major version update")] - private LeapQuaternion ToLeapQuaternion(Quaternion q) - { - return new LeapQuaternion(q.x, q.y, q.z, q.w); - } } -#pragma warning restore 0618 } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/IController.cs b/ml_lme/vendor/LeapCSharp/IController.cs index 62657eb..84d6ca3 100644 --- a/ml_lme/vendor/LeapCSharp/IController.cs +++ b/ml_lme/vendor/LeapCSharp/IController.cs @@ -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 * @@ -17,13 +17,6 @@ namespace Leap Frame GetTransformedFrame(LeapTransform trs, int history = 0); Frame GetInterpolatedFrame(Int64 time); - [Obsolete] - void SetPolicy(Controller.PolicyFlag policy); - [Obsolete] - void ClearPolicy(Controller.PolicyFlag policy); - [Obsolete] - bool IsPolicySet(Controller.PolicyFlag policy); - void SetPolicy(Controller.PolicyFlag policy, Device device = null); void ClearPolicy(Controller.PolicyFlag policy, Device device = null); bool IsPolicySet(Controller.PolicyFlag policy, Device device = null); diff --git a/ml_lme/vendor/LeapCSharp/Image.cs b/ml_lme/vendor/LeapCSharp/Image.cs index ef1eb12..f10f215 100644 --- a/ml_lme/vendor/LeapCSharp/Image.cs +++ b/ml_lme/vendor/LeapCSharp/Image.cs @@ -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 * @@ -151,14 +151,10 @@ namespace Leap if (camera != CameraType.LEFT && camera != CameraType.RIGHT) return null; - return imageData(camera).DistortionData.Data; + // We return the FlippedData, not the Data member as this corrects for a Y flip in the distortion matrix coming from the service. + return imageData(camera).DistortionData.FlippedData; } - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")] - public Vector PixelToRectilinear(CameraType camera, Vector pixel) - { - return Connection.GetConnection().PixelToRectilinear(camera, pixel); - } /// /// Provides the corrected camera ray intercepting the specified point on the image. /// @@ -183,11 +179,6 @@ namespace Leap return Connection.GetConnection().PixelToRectilinear(camera, pixel); } - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")] - public Vector RectilinearToPixel(CameraType camera, Vector ray) - { - return Connection.GetConnection().RectilinearToPixel(camera, ray); - } /// /// Provides the point in the image corresponding to a ray projecting /// from the camera. @@ -214,7 +205,11 @@ namespace Leap /// public UnityEngine.Vector3 RectilinearToPixel(CameraType camera, UnityEngine.Vector3 ray) { - return Connection.GetConnection().RectilinearToPixel(camera, ray); + return Connection.GetConnection().RectilinearToPixelEx( + Connection.GetConnection().Devices.FindDeviceByID(deviceId).Handle, + camera, + ray + ); } /// diff --git a/ml_lme/vendor/LeapCSharp/ImageData.cs b/ml_lme/vendor/LeapCSharp/ImageData.cs index 87d5d4a..f258317 100644 --- a/ml_lme/vendor/LeapCSharp/ImageData.cs +++ b/ml_lme/vendor/LeapCSharp/ImageData.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/LeapC.cs b/ml_lme/vendor/LeapCSharp/LeapC.cs index 386ac05..ccd5963 100644 --- a/ml_lme/vendor/LeapCSharp/LeapC.cs +++ b/ml_lme/vendor/LeapCSharp/LeapC.cs @@ -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 * @@ -20,7 +20,6 @@ namespace LeapInternal eLeapConnectionFlag_MultipleDevicesAware = 0x00000001, }; - // public enum eLeapConnectionStatus : uint { /// @@ -74,7 +73,11 @@ namespace LeapInternal /// /// The Ultraleap 3Di hand tracking camera. /// - eLeapDevicePID_3Di = 0x1204 + eLeapDevicePID_3Di = 0x1204, + /// + /// The Ultraleap Leap Motion Controller 2 hand tracking camera. + /// + eLeapDevicePID_LMC2 = 0x1206 }; public enum eLeapServiceDisposition : uint @@ -799,23 +802,11 @@ namespace LeapInternal public float y; public float z; - [System.Obsolete("This code will be removed in the next major version of the plugin. Use 'ToVector3()' instead.")] - public Leap.Vector ToLeapVector() - { - return new Leap.Vector(x, y, z); - } public UnityEngine.Vector3 ToVector3() { return new UnityEngine.Vector3(x, y, z); } - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one taking a Vector3 instead.")] - public LEAP_VECTOR(Leap.Vector leap) - { - x = leap.x; - y = leap.y; - z = leap.z; - } public LEAP_VECTOR(UnityEngine.Vector3 vector) { x = vector.x; @@ -832,24 +823,11 @@ namespace LeapInternal public float z; public float w; - [System.Obsolete("This code will be removed in the next major version of the plugin. Use 'ToQuaternion()' instead.")] - public Leap.LeapQuaternion ToLeapQuaternion() - { - return new Leap.LeapQuaternion(x, y, z, w); - } public UnityEngine.Quaternion ToQuaternion() { return new UnityEngine.Quaternion(x, y, z, w); } - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one taking a UnityEngine.Quaternion instead.")] - public LEAP_QUATERNION(Leap.LeapQuaternion q) - { - x = q.x; - y = q.y; - z = q.z; - w = q.w; - } public LEAP_QUATERNION(UnityEngine.Quaternion q) { x = q.x; @@ -1075,7 +1053,7 @@ namespace LeapInternal public static extern eLeapRS GetDeviceInfo(IntPtr hDevice, ref LEAP_DEVICE_INFO info); [DllImport("LeapC", EntryPoint = "LeapGetDeviceTransform")] - public static extern eLeapRS GetDeviceTransform(IntPtr hDevice, out float[] transform); + public static extern eLeapRS GetDeviceTransform(IntPtr hDevice, [MarshalAs(UnmanagedType.LPArray, SizeConst = 16)] float[] transform); [DllImport("LeapC", EntryPoint = "LeapSetPolicyFlags")] public static extern eLeapRS SetPolicyFlags(IntPtr hConnection, UInt64 set, UInt64 clear); @@ -1130,7 +1108,7 @@ namespace LeapInternal [DllImport("LeapC", EntryPoint = "LeapRectilinearToPixelEx")] public static extern LEAP_VECTOR LeapRectilinearToPixelEx(IntPtr hConnection, - IntPtr hDevice, eLeapPerspectiveType camera, eLeapCameraCalibrationType calibrationType, LEAP_VECTOR rectilinear); + IntPtr hDevice, eLeapPerspectiveType camera, LEAP_VECTOR rectilinear); [DllImport("LeapC", EntryPoint = "LeapCloseDevice")] public static extern void CloseDevice(IntPtr pDevice); diff --git a/ml_lme/vendor/LeapCSharp/LeapQuaternion.cs b/ml_lme/vendor/LeapCSharp/LeapQuaternion.cs deleted file mode 100644 index 4802da5..0000000 --- a/ml_lme/vendor/LeapCSharp/LeapQuaternion.cs +++ /dev/null @@ -1,172 +0,0 @@ -/****************************************************************************** - * Copyright (C) Ultraleap, Inc. 2011-2021. * - * * - * Use subject to the terms of the Apache License 2.0 available at * - * http://www.apache.org/licenses/LICENSE-2.0, or another agreement * - * between Ultraleap and you, your company or other organization. * - ******************************************************************************/ - -namespace Leap -{ - using System; - - /// - /// The LeapQuaternion struct represents a rotation in three-dimensional space. - /// @since 3.1.2 - /// - [System.Obsolete("This code will be moved to a legacy package in the next major version of the plugin. Use Unity's Quaternion instead. If you believe that it needs to be kept in tracking, please open a discussion on the GitHub forum (https://github.com/ultraleap/UnityPlugin/discussions)")] - [Serializable] - public struct LeapQuaternion : - IEquatable - { - - /// - /// Creates a new LeapQuaternion with the specified component values. - /// @since 3.1.2 - /// - public LeapQuaternion(float x, float y, float z, float w) : - this() - { - this.x = x; - this.y = y; - this.z = z; - this.w = w; - } - - /// - /// Copies the specified LeapQuaternion. - /// @since 3.1.2 - /// - public LeapQuaternion(LeapQuaternion quaternion) : - this() - { - x = quaternion.x; - y = quaternion.y; - z = quaternion.z; - w = quaternion.w; - } - - /// - /// Copies the specified LEAP_QUATERNION. - /// @since 3.1.2 - /// - public LeapQuaternion(LeapInternal.LEAP_QUATERNION quaternion) : - this() - { - x = quaternion.x; - y = quaternion.y; - z = quaternion.z; - w = quaternion.w; - } - - /// - /// Returns a string containing this quaternion in a human readable format: (x, y, z). - /// @since 3.1.2 - /// - public override string ToString() - { - return "(" + x + ", " + y + ", " + z + ", " + w + ")"; - } - - /// - /// Compare LeapQuaternion equality component-wise. - /// @since 3.1.2 - /// - public bool Equals(LeapQuaternion v) - { - return x.NearlyEquals(v.x) && y.NearlyEquals(v.y) && z.NearlyEquals(v.z) && w.NearlyEquals(v.w); - } - public override bool Equals(Object obj) - { - return obj is LeapQuaternion && Equals((LeapQuaternion)obj); - } - - /// - /// Returns true if all of the quaternion's components are finite. If any - /// component is NaN or infinite, then this returns false. - /// @since 3.1.2 - /// - public bool IsValid() - { - return !(float.IsNaN(x) || float.IsInfinity(x) || - float.IsNaN(y) || float.IsInfinity(y) || - float.IsNaN(z) || float.IsInfinity(z) || - float.IsNaN(w) || float.IsInfinity(w)); - } - - public float x; - public float y; - public float z; - public float w; - - /// - /// The magnitude, or length, of this quaternion. - /// @since 3.1.2 - /// - public float Magnitude - { - get { return (float)Math.Sqrt(x * x + y * y + z * z + w * w); } - } - - /// - /// The square of the magnitude, or length, of this quaternion. - /// @since 3.1.2 - /// - public float MagnitudeSquared - { - get { return x * x + y * y + z * z + w * w; } - } - - /// - /// A normalized copy of this quaternion. - /// @since 3.1.2 - /// - public LeapQuaternion Normalized - { - get - { - float denom = MagnitudeSquared; - if (denom <= CSharpExtensions.Constants.EPSILON) - { - return Identity; - } - denom = 1.0f / (float)Math.Sqrt(denom); - return new LeapQuaternion(x * denom, y * denom, z * denom, w * denom); - } - } - - /// - /// Concatenates the rotation described by this quaternion with the one provided - /// and returns the result. - /// @since 3.1.2 - /// - public LeapQuaternion Multiply(LeapQuaternion rhs) - { - return new LeapQuaternion( - w * rhs.x + x * rhs.w + y * rhs.z - z * rhs.y, - w * rhs.y + y * rhs.w + z * rhs.x - x * rhs.z, - w * rhs.z + z * rhs.w + x * rhs.y - y * rhs.x, - w * rhs.w - x * rhs.x - y * rhs.y - z * rhs.z); - } - - /// - /// The identity quaternion. - /// @since 3.1.2 - /// - public static readonly LeapQuaternion Identity = new LeapQuaternion(0, 0, 0, 1); - - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hash = 17; - hash = hash * 23 + x.GetHashCode(); - hash = hash * 23 + y.GetHashCode(); - hash = hash * 23 + z.GetHashCode(); - hash = hash * 23 + w.GetHashCode(); - - return hash; - } - } - } -} \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/LeapTransform.cs b/ml_lme/vendor/LeapCSharp/LeapTransform.cs index e7f121f..9ccfcfa 100644 --- a/ml_lme/vendor/LeapCSharp/LeapTransform.cs +++ b/ml_lme/vendor/LeapCSharp/LeapTransform.cs @@ -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 * @@ -10,7 +10,6 @@ using UnityEngine; namespace Leap { using System; -#pragma warning disable 0618 /// /// The LeapTransform class represents a transform in three dimensional space. /// @@ -19,15 +18,6 @@ namespace Leap /// public struct LeapTransform { - /// - /// Constructs a new transform from the specified translation and rotation. - /// @since 3.1.2 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 and Quaternion instead.")] - public LeapTransform(Vector translation, LeapQuaternion rotation) : - this(translation, rotation, Vector.Ones) - { - } /// /// Constructs a new transform from the specified translation and rotation. /// @@ -36,29 +26,16 @@ namespace Leap { } - /// - /// Constructs a new transform from the specified translation, rotation and scale. - /// @since 3.1.2 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 and Quaternion instead.")] - public LeapTransform(Vector translation, LeapQuaternion rotation, Vector scale) : - this() - { - _scale = scale; - // these are non-trival setters. - this.translation = translation; - this.rotation = rotation; // Calls validateBasis - } /// /// Constructs a new transform from the specified translation, rotation and scale. /// public LeapTransform(Vector3 translation, Quaternion rotation, Vector3 scale) : this() { - _scale = ToVector(scale); + this.scale = scale; // these are non-trival setters. - this.translation = ToVector(translation); - this.rotation = ToLeapQuaternion(rotation); // Calls validateBasis + this.translation = translation; + this.rotation = rotation; // Calls validateBasis } /// @@ -67,92 +44,35 @@ namespace Leap /// Unity Transform public LeapTransform(Transform t) : this() { - float MM_TO_M = 1e-3f; - _scale = new Vector(t.lossyScale.x * MM_TO_M, t.lossyScale.y * MM_TO_M, t.lossyScale.z * MM_TO_M); - this.translation = ToVector(t.position); - this.rotation = ToLeapQuaternion(t.rotation); - this.MirrorZ(); // Unity is left handed. + this.scale = t.lossyScale; + this.translation = t.position; + this.rotation = t.rotation; } - /// - /// Transforms the specified position vector, applying translation, rotation and scale. - /// @since 3.1.2 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")] - public Vector TransformPoint(Vector point) - { - return _xBasisScaled * point.x + _yBasisScaled * point.y + _zBasisScaled * point.z + translation; - } /// /// Transforms the specified position vector, applying translation, rotation and scale. /// public Vector3 TransformPoint(Vector3 point) { - return ToVector3(_xBasisScaled * point.x + _yBasisScaled * point.y + _zBasisScaled * point.z + translation); + return _xBasisScaled * point.x + _yBasisScaled * point.y + _zBasisScaled * point.z + translation; } - /// - /// Transforms the specified direction vector, applying rotation only. - /// @since 3.1.2 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")] - public Vector TransformDirection(Vector direction) - { - return _xBasis * direction.x + _yBasis * direction.y + _zBasis * direction.z; - } /// /// Transforms the specified direction vector, applying rotation only. /// public Vector3 TransformDirection(Vector3 direction) { - return ToVector3(_xBasis * direction.x + _yBasis * direction.y + _zBasis * direction.z); + return _xBasis * direction.x + _yBasis * direction.y + _zBasis * direction.z; } - /// - /// Transforms the specified velocity vector, applying rotation and scale. - /// @since 3.1.2 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with Vector3 instead.")] - public Vector TransformVelocity(Vector velocity) - { - return _xBasisScaled * velocity.x + _yBasisScaled * velocity.y + _zBasisScaled * velocity.z; - } /// /// Transforms the specified velocity vector, applying rotation and scale. /// public Vector3 TransformVelocity(Vector3 velocity) { - return ToVector3(_xBasisScaled * velocity.x + _yBasisScaled * velocity.y + _zBasisScaled * velocity.z); + return _xBasisScaled * velocity.x + _yBasisScaled * velocity.y + _zBasisScaled * velocity.z; } - /// - /// Transforms the specified quaternion. - /// Multiplies the quaternion representing the rotational part of this transform by the specified - /// quaternion. - /// - /// **Important:** Modifying the basis vectors of this transform directly leaves the underlying quaternion in - /// an indeterminate state. Neither this function nor the LeapTransform.rotation quaternion can be used after - /// the basis vectors are set. - /// - /// @since 3.1.2 - /// - [System.Obsolete("This signature will be removed in the next major version of the plugin. Use the one with UnityEngine.Quaternion instead.")] - public LeapQuaternion TransformQuaternion(LeapQuaternion rhs) - { - if (_quaternionDirty) - throw new InvalidOperationException("Calling TransformQuaternion after Basis vectors have been modified."); - - if (_flip) - { - // Mirror the axis of rotation across the flip axis. - rhs.x *= _flipAxes.x; - rhs.y *= _flipAxes.y; - rhs.z *= _flipAxes.z; - } - - LeapQuaternion t = _quaternion.Multiply(rhs); - return t; - } /// /// Transforms the specified quaternion. /// Multiplies the quaternion representing the rotational part of this transform by the specified @@ -175,7 +95,7 @@ namespace Leap rhs.z *= _flipAxes.z; } - Quaternion t = ToQuaternion(_quaternion) * rhs; + Quaternion t = _quaternion * rhs; return t; } @@ -216,8 +136,7 @@ namespace Leap /// /// @since 3.1.2 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector xBasis + public Vector3 xBasis { get { return _xBasis; } set @@ -237,8 +156,7 @@ namespace Leap /// /// @since 3.1.2 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector yBasis + public Vector3 yBasis { get { return _yBasis; } set @@ -258,8 +176,7 @@ namespace Leap /// /// @since 3.1.2 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector zBasis + public Vector3 zBasis { get { return _zBasis; } set @@ -274,8 +191,7 @@ namespace Leap /// The translation component of the transform. /// @since 3.1.2 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector translation + public Vector3 translation { get { return _translation; } set @@ -289,8 +205,7 @@ namespace Leap /// Scale is kept separate from translation. /// @since 3.1.2 /// - [System.Obsolete("Its type will be changed from Vector to Vector3")] - public Vector scale + public Vector3 scale { get { return _scale; } set @@ -311,8 +226,7 @@ namespace Leap /// /// @since 3.1.2 /// - [System.Obsolete("Its type will be changed from LeapQuaternion to UnityEngine.Quaternion")] - public LeapQuaternion rotation + public Quaternion rotation { get { @@ -331,9 +245,9 @@ namespace Leap float xx = value.x * xs, xy = value.x * ys, xz = value.x * zs; float yy = value.y * ys, yz = value.y * zs, zz = value.z * zs; - _xBasis = new Vector(1.0f - (yy + zz), xy + wz, xz - wy); - _yBasis = new Vector(xy - wz, 1.0f - (xx + zz), yz + wx); - _zBasis = new Vector(xz + wy, yz - wx, 1.0f - (xx + yy)); + _xBasis = new Vector3(1.0f - (yy + zz), xy + wz, xz - wy); + _yBasis = new Vector3(xy - wz, 1.0f - (xx + zz), yz + wx); + _zBasis = new Vector3(xz + wy, yz - wx, 1.0f - (xx + yy)); _xBasisScaled = _xBasis * scale.x; _yBasisScaled = _yBasis * scale.y; @@ -341,7 +255,7 @@ namespace Leap _quaternionDirty = false; _flip = false; - _flipAxes = new Vector(1.0f, 1.0f, 1.0f); + _flipAxes = new Vector3(1.0f, 1.0f, 1.0f); } } @@ -351,52 +265,17 @@ namespace Leap /// public static readonly LeapTransform Identity = new LeapTransform(Vector3.zero, Quaternion.identity, Vector3.one); - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _translation; - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _scale; - [System.Obsolete("Its type will be changed from LeapQuaternion to UnityEngine.Quaternion")] - private LeapQuaternion _quaternion; + private Vector3 _translation; + private Vector3 _scale; + private Quaternion _quaternion; private bool _quaternionDirty; private bool _flip; - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _flipAxes; - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _xBasis; - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _yBasis; - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _zBasis; - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _xBasisScaled; - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _yBasisScaled; - [System.Obsolete("Its type will be changed from Vector to Vector3")] - private Vector _zBasisScaled; - - [Obsolete("This will be removed in the next major version update")] - private Vector ToVector(Vector3 v) - { - return new Vector(v.x, v.y, v.z); - } - - [Obsolete("This will be removed in the next major version update")] - private Vector3 ToVector3(Vector v) - { - return new Vector3(v.x, v.y, v.z); - } - - [Obsolete("This will be removed in the next major version update")] - private LeapQuaternion ToLeapQuaternion(Quaternion q) - { - return new LeapQuaternion(q.x, q.y, q.z, q.w); - } - - [Obsolete("This will be removed in the next major version update")] - private Quaternion ToQuaternion(LeapQuaternion q) - { - return new Quaternion(q.x, q.y, q.z, q.w); - } + private Vector3 _flipAxes; + private Vector3 _xBasis; + private Vector3 _yBasis; + private Vector3 _zBasis; + private Vector3 _xBasisScaled; + private Vector3 _yBasisScaled; + private Vector3 _zBasisScaled; } -#pragma warning restore 0618 } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/Logger.cs b/ml_lme/vendor/LeapCSharp/Logger.cs index 58e7f54..720a013 100644 --- a/ml_lme/vendor/LeapCSharp/Logger.cs +++ b/ml_lme/vendor/LeapCSharp/Logger.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/Matrix.cs b/ml_lme/vendor/LeapCSharp/Matrix.cs deleted file mode 100644 index ac09e9e..0000000 --- a/ml_lme/vendor/LeapCSharp/Matrix.cs +++ /dev/null @@ -1,363 +0,0 @@ -/****************************************************************************** - * Copyright (C) Ultraleap, Inc. 2011-2021. * - * * - * Use subject to the terms of the Apache License 2.0 available at * - * http://www.apache.org/licenses/LICENSE-2.0, or another agreement * - * between Ultraleap and you, your company or other organization. * - ******************************************************************************/ - -namespace Leap -{ - using System; - - /// - /// The Matrix struct represents a transformation matrix. - /// - /// To use this struct to transform a Vector, construct a matrix containing the - /// desired transformation and then use the Matrix::transformPoint() or - /// Matrix.TransformDirection() functions to apply the transform. - /// - /// Transforms can be combined by multiplying two or more transform matrices using - /// the * operator. - /// @since 1.0 - /// - [System.Obsolete("This code will be moved to a legacy package in the next major version of the plugin. If you believe that it needs to be kept in tracking, please open a discussion on the GitHub forum (https://github.com/ultraleap/UnityPlugin/discussions)")] - public struct Matrix - { - - /// - /// Multiply two matrices. - /// - public static Matrix operator *(Matrix m1, Matrix m2) - { - return m1._operator_mul(m2); - } - - /// - /// Copy this matrix to the specified array of 9 float values in row-major order. - /// - public float[] ToArray3x3(float[] output) - { - output[0] = xBasis.x; - output[1] = xBasis.y; - output[2] = xBasis.z; - output[3] = yBasis.x; - output[4] = yBasis.y; - output[5] = yBasis.z; - output[6] = zBasis.x; - output[7] = zBasis.y; - output[8] = zBasis.z; - return output; - } - - /// - /// Copy this matrix to the specified array containing 9 double values in row-major order. - /// - public double[] ToArray3x3(double[] output) - { - output[0] = xBasis.x; - output[1] = xBasis.y; - output[2] = xBasis.z; - output[3] = yBasis.x; - output[4] = yBasis.y; - output[5] = yBasis.z; - output[6] = zBasis.x; - output[7] = zBasis.y; - output[8] = zBasis.z; - return output; - } - - /// - /// Convert this matrix to an array containing 9 float values in row-major order. - /// - public float[] ToArray3x3() - { - return ToArray3x3(new float[9]); - } - - /// - /// Copy this matrix to the specified array of 16 float values in row-major order. - /// - public float[] ToArray4x4(float[] output) - { - output[0] = xBasis.x; - output[1] = xBasis.y; - output[2] = xBasis.z; - output[3] = 0.0f; - output[4] = yBasis.x; - output[5] = yBasis.y; - output[6] = yBasis.z; - output[7] = 0.0f; - output[8] = zBasis.x; - output[9] = zBasis.y; - output[10] = zBasis.z; - output[11] = 0.0f; - output[12] = origin.x; - output[13] = origin.y; - output[14] = origin.z; - output[15] = 1.0f; - return output; - } - - /// - /// Copy this matrix to the specified array of 16 double values in row-major order. - /// - public double[] ToArray4x4(double[] output) - { - output[0] = xBasis.x; - output[1] = xBasis.y; - output[2] = xBasis.z; - output[3] = 0.0f; - output[4] = yBasis.x; - output[5] = yBasis.y; - output[6] = yBasis.z; - output[7] = 0.0f; - output[8] = zBasis.x; - output[9] = zBasis.y; - output[10] = zBasis.z; - output[11] = 0.0f; - output[12] = origin.x; - output[13] = origin.y; - output[14] = origin.z; - output[15] = 1.0f; - return output; - } - - /// - /// Convert this matrix to an array containing 16 float values in row-major order. - /// - public float[] ToArray4x4() - { - return ToArray4x4(new float[16]); - } - - /// - /// Constructs a copy of the specified Matrix object. - /// @since 1.0 - /// - public Matrix(Matrix other) : - this() - { - xBasis = other.xBasis; - yBasis = other.yBasis; - zBasis = other.zBasis; - origin = other.origin; - } - - /// - /// Constructs a transformation matrix from the specified basis vectors. - /// @since 1.0 - /// - public Matrix(Vector xBasis, Vector yBasis, Vector zBasis) : - this() - { - this.xBasis = xBasis; - this.yBasis = yBasis; - this.zBasis = zBasis; - this.origin = Vector.Zero; - } - - /// - /// Constructs a transformation matrix from the specified basis and translation vectors. - /// @since 1.0 - /// - public Matrix(Vector xBasis, Vector yBasis, Vector zBasis, Vector origin) : - this() - { - this.xBasis = xBasis; - this.yBasis = yBasis; - this.zBasis = zBasis; - this.origin = origin; - } - - /// - /// Constructs a transformation matrix specifying a rotation around the specified vector. - /// @since 1.0 - /// - public Matrix(Vector axis, float angleRadians) : - this() - { - xBasis = Vector.XAxis; - yBasis = Vector.YAxis; - zBasis = Vector.ZAxis; - origin = Vector.Zero; - SetRotation(axis, angleRadians); - } - - /// - /// Constructs a transformation matrix specifying a rotation around the specified vector - /// and a translation by the specified vector. - /// @since 1.0 - /// - public Matrix(Vector axis, float angleRadians, Vector translation) : - this() - { - xBasis = Vector.XAxis; - yBasis = Vector.YAxis; - zBasis = Vector.ZAxis; - origin = translation; - this.SetRotation(axis, angleRadians); - } - - public Matrix(float m00, - float m01, - float m02, - float m10, - float m11, - float m12, - float m20, - float m21, - float m22) : - this() - { - xBasis = new Vector(m00, m01, m02); - yBasis = new Vector(m10, m11, m12); - zBasis = new Vector(m20, m21, m22); - origin = Vector.Zero; - } - - public Matrix(float m00, - float m01, - float m02, - float m10, - float m11, - float m12, - float m20, - float m21, - float m22, - float m30, - float m31, - float m32) : - this() - { - xBasis = new Vector(m00, m01, m02); - yBasis = new Vector(m10, m11, m12); - zBasis = new Vector(m20, m21, m22); - origin = new Vector(m30, m31, m32); - } - - /// - /// Sets this transformation matrix to represent a rotation around the specified vector. - /// - /// This function erases any previous rotation and scale transforms applied - /// to this matrix, but does not affect translation. - /// - /// @since 1.0 - /// - public void SetRotation(Vector axis, float angleRadians) - { - Vector n = axis.Normalized; - float s = (float)Math.Sin(angleRadians); - float c = (float)Math.Cos(angleRadians); - float C = (1 - c); - - xBasis = new Vector(n[0] * n[0] * C + c, n[0] * n[1] * C - n[2] * s, n[0] * n[2] * C + n[1] * s); - yBasis = new Vector(n[1] * n[0] * C + n[2] * s, n[1] * n[1] * C + c, n[1] * n[2] * C - n[0] * s); - zBasis = new Vector(n[2] * n[0] * C - n[1] * s, n[2] * n[1] * C + n[0] * s, n[2] * n[2] * C + c); - } - - /// - /// Transforms a vector with this matrix by transforming its rotation, - /// scale, and translation. - /// - /// Translation is applied after rotation and scale. - /// - /// @since 1.0 - /// - public Vector TransformPoint(Vector point) - { - return xBasis * point.x + yBasis * point.y + zBasis * point.z + origin; - } - - /// - /// Transforms a vector with this matrix by transforming its rotation and - /// scale only. - /// @since 1.0 - /// - public Vector TransformDirection(Vector direction) - { - return xBasis * direction.x + yBasis * direction.y + zBasis * direction.z; - } - - /// - /// Performs a matrix inverse if the matrix consists entirely of rigid - /// transformations (translations and rotations). If the matrix is not rigid, - /// this operation will not represent an inverse. - /// - /// Note that all matrices that are directly returned by the API are rigid. - /// - /// @since 1.0 - /// - public Matrix RigidInverse() - { - Matrix rotInverse = new Matrix(new Vector(xBasis[0], yBasis[0], zBasis[0]), - new Vector(xBasis[1], yBasis[1], zBasis[1]), - new Vector(xBasis[2], yBasis[2], zBasis[2])); - rotInverse.origin = rotInverse.TransformDirection(-origin); - return rotInverse; - } - - /// - /// Multiply transform matrices. - /// Combines two transformations into a single equivalent transformation. - /// @since 1.0 - /// - private Matrix _operator_mul(Matrix other) - { - return new Matrix(TransformDirection(other.xBasis), - TransformDirection(other.yBasis), - TransformDirection(other.zBasis), - TransformPoint(other.origin)); - } - - /// - /// Compare Matrix equality component-wise. - /// @since 1.0 - /// - public bool Equals(Matrix other) - { - return xBasis == other.xBasis && - yBasis == other.yBasis && - zBasis == other.zBasis && - origin == other.origin; - } - - /// - /// Write the matrix to a string in a human readable format. - /// - public override string ToString() - { - return string.Format("xBasis: {0} yBasis: {1} zBasis: {2} origin: {3}", xBasis, yBasis, zBasis, origin); - } - - /// - /// The basis vector for the x-axis. - /// @since 1.0 - /// - public Vector xBasis { get; set; } - - /// - /// The basis vector for the y-axis. - /// @since 1.0 - /// - public Vector yBasis { get; set; } - - /// - /// The basis vector for the z-axis. - /// @since 1.0 - /// - public Vector zBasis { get; set; } - - /// - /// The translation factors for all three axes. - /// @since 1.0 - /// - public Vector origin { get; set; } - - /// - /// Returns the identity matrix specifying no translation, rotation, and scale. - /// @since 1.0 - /// - public static readonly Matrix Identity = new Matrix(Vector.XAxis, Vector.YAxis, Vector.ZAxis, Vector.Zero); - } -} \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/MemoryManager.cs b/ml_lme/vendor/LeapCSharp/MemoryManager.cs index 14529e8..d490dbb 100644 --- a/ml_lme/vendor/LeapCSharp/MemoryManager.cs +++ b/ml_lme/vendor/LeapCSharp/MemoryManager.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/MessageSeverity.cs b/ml_lme/vendor/LeapCSharp/MessageSeverity.cs index a20e516..75e135a 100644 --- a/ml_lme/vendor/LeapCSharp/MessageSeverity.cs +++ b/ml_lme/vendor/LeapCSharp/MessageSeverity.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/PointMapping.cs b/ml_lme/vendor/LeapCSharp/PointMapping.cs index 4b30417..63cae94 100644 --- a/ml_lme/vendor/LeapCSharp/PointMapping.cs +++ b/ml_lme/vendor/LeapCSharp/PointMapping.cs @@ -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 * @@ -8,13 +8,11 @@ namespace Leap { -#pragma warning disable 0618 public struct PointMapping { public long frameId; public long timestamp; - public Vector[] points; + public UnityEngine.Vector3[] points; public uint[] ids; } -#pragma warning restore 0618 } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/StructMarshal.cs b/ml_lme/vendor/LeapCSharp/StructMarshal.cs index 31ac9e9..b1458d7 100644 --- a/ml_lme/vendor/LeapCSharp/StructMarshal.cs +++ b/ml_lme/vendor/LeapCSharp/StructMarshal.cs @@ -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 * diff --git a/ml_lme/vendor/LeapCSharp/TransformExtensions.cs b/ml_lme/vendor/LeapCSharp/TransformExtensions.cs index 367ae4f..6421247 100644 --- a/ml_lme/vendor/LeapCSharp/TransformExtensions.cs +++ b/ml_lme/vendor/LeapCSharp/TransformExtensions.cs @@ -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 * @@ -11,7 +11,6 @@ using UnityEngine; namespace Leap { using System; -#pragma warning disable 0618 public static class TransformExtensions { @@ -153,7 +152,7 @@ namespace Leap if (bone.Length < float.Epsilon) { - bone.Direction = Vector.Zero; + bone.Direction = Vector3.zero; } else { @@ -175,5 +174,4 @@ namespace Leap return new Bone().CopyFrom(bone).Transform(transform); } } -#pragma warning restore 0618 } \ No newline at end of file diff --git a/ml_lme/vendor/LeapCSharp/Vector.cs b/ml_lme/vendor/LeapCSharp/Vector.cs deleted file mode 100644 index 7096505..0000000 --- a/ml_lme/vendor/LeapCSharp/Vector.cs +++ /dev/null @@ -1,427 +0,0 @@ -/****************************************************************************** - * Copyright (C) Ultraleap, Inc. 2011-2021. * - * * - * Use subject to the terms of the Apache License 2.0 available at * - * http://www.apache.org/licenses/LICENSE-2.0, or another agreement * - * between Ultraleap and you, your company or other organization. * - ******************************************************************************/ - -namespace Leap -{ - using System; - - /// - /// Constants used in Leap Motion math functions. - /// - [System.Obsolete("This code will be moved to Leap.CSharpExtensions.Constants in the next major version of the plugin.")] - public static class Constants - { - public const float PI = 3.1415926536f; - public const float DEG_TO_RAD = 0.0174532925f; - public const float RAD_TO_DEG = 57.295779513f; - public const float EPSILON = 1.192092896e-07f; - } - - /// - /// The Vector struct represents a three-component mathematical vector or point - /// such as a direction or position in three-dimensional space. - /// - /// The Leap Motion software employs a right-handed Cartesian coordinate system. - /// Values given are in units of real-world millimeters. The origin is centered - /// at the center of the Leap Motion Controller. The x- and z-axes lie in the horizontal - /// plane, with the x-axis running parallel to the long edge of the device. - /// The y-axis is vertical, with positive values increasing upwards (in contrast - /// to the downward orientation of most computer graphics coordinate systems). - /// The z-axis has positive values increasing away from the computer screen. - /// @since 1.0 - /// - [System.Obsolete("This code will be moved to a legacy package in the next major version of the plugin. Use Unity's Vector3 instead. If you believe that it needs to be kept in tracking, please open a discussion on the GitHub forum (https://github.com/ultraleap/UnityPlugin/discussions)")] - [Serializable] - public struct Vector : IEquatable - { - - public static Vector operator +(Vector v1, Vector v2) - { - return new Vector(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); - } - - public static Vector operator -(Vector v1, Vector v2) - { - return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); - } - - public static Vector operator *(Vector v1, float scalar) - { - return new Vector(v1.x * scalar, v1.y * scalar, v1.z * scalar); - } - - public static Vector operator *(float scalar, Vector v1) - { - return new Vector(v1.x * scalar, v1.y * scalar, v1.z * scalar); - } - - public static Vector operator /(Vector v1, float scalar) - { - return new Vector(v1.x / scalar, v1.y / scalar, v1.z / scalar); - } - - public static Vector operator -(Vector v1) - { - return new Vector(-v1.x, -v1.y, -v1.z); - } - - public static bool operator ==(Vector v1, Vector v2) - { - return v1.Equals(v2); - } - - public static bool operator !=(Vector v1, Vector v2) - { - return !v1.Equals(v2); - } - - public float[] ToFloatArray() - { - return new float[] { x, y, z }; - } - - /// - /// Creates a new Vector with the specified component values. - /// @since 1.0 - /// - public Vector(float x, float y, float z) : - this() - { - this.x = x; - this.y = y; - this.z = z; - } - - /// - /// Copies the specified Vector. - /// @since 1.0 - /// - public Vector(Vector vector) : - this() - { - x = vector.x; - y = vector.y; - z = vector.z; - } - - /// - /// The distance between the point represented by this Vector - /// object and a point represented by the specified Vector object. - /// - /// @since 1.0 - /// - public float DistanceTo(Vector other) - { - return (float)Math.Sqrt((x - other.x) * (x - other.x) + - (y - other.y) * (y - other.y) + - (z - other.z) * (z - other.z)); - - } - - /// - /// The angle between this vector and the specified vector in radians. - /// - /// The angle is measured in the plane formed by the two vectors. The - /// angle returned is always the smaller of the two conjugate angles. - /// Thus A.angleTo(B) == B.angleTo(A) and is always a positive - /// value less than or equal to pi radians (180 degrees). - /// - /// If either vector has zero length, then this function returns zero. - /// @since 1.0 - /// - public float AngleTo(Vector other) - { - float denom = MagnitudeSquared * other.MagnitudeSquared; - if (denom <= CSharpExtensions.Constants.EPSILON) - { - return 0.0f; - } - float val = Dot(other) / (float)Math.Sqrt(denom); - if (val >= 1.0f) - { - return 0.0f; - } - else if (val <= -1.0f) - { - return CSharpExtensions.Constants.PI; - } - return (float)Math.Acos(val); - } - - /// - /// The dot product of this vector with another vector. - /// - /// The dot product is the magnitude of the projection of this vector - /// onto the specified vector. - /// @since 1.0 - /// - public float Dot(Vector other) - { - return (x * other.x) + (y * other.y) + (z * other.z); - } - - /// - /// The cross product of this vector and the specified vector. - /// - /// The cross product is a vector orthogonal to both original vectors. - /// It has a magnitude equal to the area of a parallelogram having the - /// two vectors as sides. The direction of the returned vector is - /// determined by the right-hand rule. Thus A.cross(B) == -B.cross(A). - /// - /// @since 1.0 - /// - public Vector Cross(Vector other) - { - return new Vector((y * other.z) - (z * other.y), - (z * other.x) - (x * other.z), - (x * other.y) - (y * other.x)); - } - - /// - /// Returns a string containing this vector in a human readable format: (x, y, z). - /// @since 1.0 - /// - public override string ToString() - { - return "(" + x + ", " + y + ", " + z + ")"; - } - - /// - /// Compare Vector equality component-wise. - /// @since 1.0 - /// - public bool Equals(Vector v) - { - return x.NearlyEquals(v.x) && y.NearlyEquals(v.y) && z.NearlyEquals(v.z); - } - - public override bool Equals(Object obj) - { - return obj is Vector && Equals((Vector)obj); - } - - /// - /// Returns true if all of the vector's components are finite. If any - /// component is NaN or infinite, then this returns false. - /// @since 1.0 - /// - public bool IsValid() - { - return !(float.IsNaN(x) || float.IsInfinity(x) || - float.IsNaN(y) || float.IsInfinity(y) || - float.IsNaN(z) || float.IsInfinity(z)); - } - - /// - /// Index vector components numerically. - /// Index 0 is x, index 1 is y, and index 2 is z. - /// @since 1.0 - /// - public float this[uint index] - { - get - { - if (index == 0) - return x; - if (index == 1) - return y; - if (index == 2) - return z; - throw new IndexOutOfRangeException(); - } - set - { - if (index == 0) - x = value; - if (index == 1) - y = value; - if (index == 2) - z = value; - throw new IndexOutOfRangeException(); - } - } - - public float x; - public float y; - public float z; - - /// - /// The magnitude, or length, of this vector. - /// - /// The magnitude is the L2 norm, or Euclidean distance between the origin and - /// the point represented by the (x, y, z) components of this Vector object. - /// @since 1.0 - /// - public float Magnitude - { - get { return (float)Math.Sqrt(x * x + y * y + z * z); } - } - - /// - /// The square of the magnitude, or length, of this vector. - /// @since 1.0 - /// - public float MagnitudeSquared - { - get { return x * x + y * y + z * z; } - } - - /// - /// The pitch angle in radians. - /// - /// Pitch is the angle between the negative z-axis and the projection of - /// the vector onto the y-z plane. In other words, pitch represents rotation - /// around the x-axis. - /// If the vector points upward, the returned angle is between 0 and pi radians - /// (180 degrees); if it points downward, the angle is between 0 and -pi radians. - /// - /// @since 1.0 - /// - public float Pitch - { - get { return (float)Math.Atan2(y, -z); } - } - - /// - /// The roll angle in radians. - /// - /// Roll is the angle between the y-axis and the projection of - /// the vector onto the x-y plane. In other words, roll represents rotation - /// around the z-axis. If the vector points to the left of the y-axis, - /// then the returned angle is between 0 and pi radians (180 degrees); - /// if it points to the right, the angle is between 0 and -pi radians. - /// - /// Use this function to get roll angle of the plane to which this vector is a - /// normal. For example, if this vector represents the normal to the palm, - /// then this function returns the tilt or roll of the palm plane compared - /// to the horizontal (x-z) plane. - /// - /// @since 1.0 - /// - public float Roll - { - get { return (float)Math.Atan2(x, -y); } - } - - /// - /// The yaw angle in radians. - /// - /// Yaw is the angle between the negative z-axis and the projection of - /// the vector onto the x-z plane. In other words, yaw represents rotation - /// around the y-axis. If the vector points to the right of the negative z-axis, - /// then the returned angle is between 0 and pi radians (180 degrees); - /// if it points to the left, the angle is between 0 and -pi radians. - /// - /// @since 1.0 - /// - public float Yaw - { - get { return (float)Math.Atan2(x, -z); } - } - - /// - /// A normalized copy of this vector. - /// - /// A normalized vector has the same direction as the original vector, - /// but with a length of one. - /// - /// @since 1.0 - /// - public Vector Normalized - { - get - { - float denom = MagnitudeSquared; - if (denom <= CSharpExtensions.Constants.EPSILON) - { - return Zero; - } - denom = 1.0f / (float)Math.Sqrt(denom); - return new Vector(x * denom, y * denom, z * denom); - } - } - - /// - /// The zero vector: (0, 0, 0) - /// - public static readonly Vector Zero = new Vector(0, 0, 0); - - /// - /// The ones vector: (1, 1, 1) - /// - public static readonly Vector Ones = new Vector(1, 1, 1); - - /// - /// The x-axis unit vector: (1, 0, 0) - /// - public static readonly Vector XAxis = new Vector(1, 0, 0); - - /// - /// The y-axis unit vector: (0, 1, 0) - /// - public static readonly Vector YAxis = new Vector(0, 1, 0); - - /// - /// The z-axis unit vector: (0, 0, 1) - /// - public static readonly Vector ZAxis = new Vector(0, 0, 1); - - /// - /// The unit vector pointing forward along the negative z-axis: (0, 0, -1) - /// - public static readonly Vector Forward = new Vector(0, 0, -1); - - /// - /// The unit vector pointing backward along the positive z-axis: (0, 0, 1) - /// - public static readonly Vector Backward = new Vector(0, 0, 1); - - /// - /// The unit vector pointing left along the negative x-axis: (-1, 0, 0) - /// - public static readonly Vector Left = new Vector(-1, 0, 0); - - /// - /// The unit vector pointing right along the positive x-axis: (1, 0, 0) - /// - public static readonly Vector Right = new Vector(1, 0, 0); - - /// - /// The unit vector pointing up along the positive y-axis: (0, 1, 0) - /// - public static readonly Vector Up = new Vector(0, 1, 0); - - /// - /// The unit vector pointing down along the negative y-axis: (0, -1, 0) - /// - public static readonly Vector Down = new Vector(0, -1, 0); - - - public static Vector Lerp(Vector a, Vector b, float t) - { - return new Vector( - a.x + t * (b.x - a.x), - a.y + t * (b.y - a.y), - a.z + t * (b.z - a.z) - ); - } - - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hash = 17; - hash = hash * 23 + x.GetHashCode(); - hash = hash * 23 + y.GetHashCode(); - hash = hash * 23 + z.GetHashCode(); - - return hash; - } - } - } -} \ No newline at end of file diff --git a/ml_lme/vendor/LeapSDK/README.md b/ml_lme/vendor/LeapSDK/README.md index e71255f..404a72c 100644 --- a/ml_lme/vendor/LeapSDK/README.md +++ b/ml_lme/vendor/LeapSDK/README.md @@ -5,8 +5,6 @@ ## Package contents: LeapSDK -- docs - * API reference documentation & guidelines. - include * API headers. - lib @@ -14,9 +12,11 @@ LeapSDK - samples * Various samples demonstrating several different usages. - LICENSE.md - * Ultraleap Tracking SDK license. -- Uninstall.exe - * Program to uninstall the LeapSDK application (Windows only). + * Ultraleap Tracking SDK license. +- README.md + * Ultraleap Tracking SDK readme. +- ThirdPartyNotices.md + * Ultraleap Tracking SDK third party licenses. ## Requirements: @@ -75,7 +75,7 @@ cmake --build $env:REPOS_BUILD_ROOT/$env:BUILD_TYPE/LeapSDK/leapc_example -j --c ### x64 Linux -1. Open CMake using /usr/share/doc/ultraleap-tracking/samples as the source directory +1. Open CMake using /usr/share/doc/ultraleap-hand-tracking-service/samples as the source directory 2. Select a build directory (eg. ~/ultraleap-tracking-samples/build) to use @@ -84,7 +84,7 @@ cmake --build $env:REPOS_BUILD_ROOT/$env:BUILD_TYPE/LeapSDK/leapc_example -j --c 4. Open and build the CMake generated project files. For more help, see the CMake documentation. * An example script would be : ```bash -SRC_DIR=/usr/share/doc/ultraleap-tracking/samples +SRC_DIR=/usr/share/doc/ultraleap-hand-tracking-service/samples BUILD_TYPE='Release' REPOS_BUILD_ROOT=~/ultraleap-tracking-samples/build REPOS_INSTALL_ROOT=/usr/bin/ultraleap-tracking-samples @@ -96,6 +96,29 @@ cmake -S ${SRC_DIR} -B ${REPOS_BUILD_ROOT}/${BUILD_TYPE}/LeapSDK/leapc_example ` cmake --build ${REPOS_BUILD_ROOT}/${BUILD_TYPE}/LeapSDK/leapc_example -j --config ${BUILD_TYPE} ``` +### MacOS + +1. Open CMake using /Library/Application Support/Ultraleap/LeapSDK/samples as the source directory + +2. Select a build directory (eg. ~/ultraleap-tracking-samples/build) to use + +3. Configure & Generate CMake with the generator of your choice + +4. Open and build the CMake generated project files. For more help, see the CMake documentation. + * An example script would be : +```bash +SRC_DIR='/Library/Application Support/Ultraleap/LeapSDK/samples' +BUILD_TYPE='Release' +REPOS_BUILD_ROOT=~/ultraleap-tracking-samples/build +REPOS_INSTALL_ROOT=~/ultraleap-tracking-samples/bin + +cmake -S ${SRC_DIR} -B ${REPOS_BUILD_ROOT}/${BUILD_TYPE}/LeapSDK/leapc_example ` +-DCMAKE_INSTALL_PREFIX="${REPOS_INSTALL_ROOT}/leapc_example" ` +-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" + +cmake --build ${REPOS_BUILD_ROOT}/${BUILD_TYPE}/LeapSDK/leapc_example -j --config ${BUILD_TYPE} +``` + ## Resources: 1. Ultraleap For Developers Site (https://developer.leapmotion.com) diff --git a/ml_lme/vendor/LeapSDK/ThirdPartyNotices.md b/ml_lme/vendor/LeapSDK/ThirdPartyNotices.md index 098addd..072be3a 100644 --- a/ml_lme/vendor/LeapSDK/ThirdPartyNotices.md +++ b/ml_lme/vendor/LeapSDK/ThirdPartyNotices.md @@ -2235,518 +2235,7 @@ libtm - Apache License (2.0) ------------------------------------------------------------------------------- -libusb (1.0.23) - GNU LGPL (2.1) -=============================================================================== -``` - Note: libusb is only used on installations - supporting Ultraleap UVC cameras. - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish) that you receive source code or can get -it if you want it that you can change the software and use pieces of -it in new free programs and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty keep intact -all the notices that refer to this License and to the absence of any -warranty and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above) and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - -``` -------------------------------------------------------------------------------- libwebp (1.0.3) - New BSD License @@ -4161,192 +3650,6 @@ zlib (1.2.11) - The zlib/libpng License (Zlib) ``` ------------------------------------------------------------------------------- - -Qt (5.15.2) - GNU LGPL (3.0) -=============================================================================== -``` - Note: Qt is only used if the optional server - component 'TrackingControlPanel' is installed. - - GNU LESSER GENERAL PUBLIC LICENSE - - The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - You may use, distribute and copy the Qt Toolkit under the terms of - GNU Lesser General Public License version 3, which is displayed below. - This license makes reference to the version 3 of the GNU General - Public License, which you can find in the LICENSE.GPLv3 file. - -------------------------------------------------------------------------- - - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright © 2007 Free Software Foundation, Inc. -Everyone is permitted to copy and distribute verbatim copies of this -licensedocument, but changing it is not allowed. - -This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - -0. Additional Definitions. - - As used herein, “this License” refers to version 3 of the GNU Lesser -General Public License, and the “GNU GPL” refers to version 3 of the -GNU General Public License. - - “The Library” refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An “Application” is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A “Combined Work” is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the “Linked -Version”. - - The “Minimal Corresponding Source” for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The “Corresponding Application Code” for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - -1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - -2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort - to ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - -3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this - license document. - -4. Combined Works. - - You may convey a Combined Work under terms of your choice that, taken -together, effectively do not restrict modification of the portions of -the Library contained in the Combined Work and reverse engineering for -debugging such modifications, if you also do each of the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this - license document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of - this License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with - the Library. A suitable mechanism is one that (a) uses at run - time a copy of the Library already present on the user's - computer system, and (b) will operate properly with a modified - version of the Library that is interface-compatible with the - Linked Version. - - e) Provide Installation Information, but only if you would - otherwise be required to provide such information under section 6 - of the GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the Application - with a modified version of the Linked Version. (If you use option - 4d0, the Installation Information must accompany the Minimal - Corresponding Source and Corresponding Application Code. If you - use option 4d1, you must provide the Installation Information in - the manner specified by section 6 of the GNU GPL for conveying - Corresponding Source.) - -5. Combined Libraries. - - You may place library facilities that are a work based on the Library -side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities, conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of - it is a work based on the Library, and explaining where to find - the accompanying uncombined form of the same work. - -6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -as you received it specifies that a certain numbered version of the -GNU Lesser General Public License “or any later version” applies to -it, you have the option of following the terms and conditions either -of that published version or of any later version published by the -Free Software Foundation. If the Library as you received it does not -specify a version number of the GNU Lesser General Public License, -you may choose any version of the GNU Lesser General Public License -ever published by the Free Software Foundation. - -If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the Library. - -``` -------------------------------------------------------------------------------- - - PCRE (10.36) - BSD-3-Clause =============================================================================== ``` @@ -4550,7 +3853,7 @@ Introduction Legal Terms =========== -0. Definitions +1. Definitions -------------- Throughout this license, the terms `package', `FreeType Project', @@ -5320,77 +4623,514 @@ 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 +libusb (1.0.23) - GNU LGPL (2.1) +=============================================================================== +``` -As of March 23, 2022, the dependencies for QtCore and QtGui were listed as: + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 -#### 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 | + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. -#### Qt GUI +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] -| 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 | -------------------------------------------------------------------------------- + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish) that you receive source code or can get +it if you want it that you can change the software and use pieces of +it in new free programs and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty keep intact +all the notices that refer to this License and to the absence of any +warranty and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above) and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + +``` +------------------------------------------------------------------------------- \ No newline at end of file diff --git a/ml_lme/vendor/LeapSDK/lib/x64/LeapC.dll b/ml_lme/vendor/LeapSDK/lib/x64/LeapC.dll index c8b9f41..2a87932 100644 Binary files a/ml_lme/vendor/LeapSDK/lib/x64/LeapC.dll and b/ml_lme/vendor/LeapSDK/lib/x64/LeapC.dll differ diff --git a/ml_lme/vendor/LeapSDK/lib/x64/LeapC.lib b/ml_lme/vendor/LeapSDK/lib/x64/LeapC.lib deleted file mode 100644 index efe865e..0000000 Binary files a/ml_lme/vendor/LeapSDK/lib/x64/LeapC.lib and /dev/null differ