mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 20:14:22 +02:00
Final cleaning, ready to publish
- Removed the LEapmotion sdk from the external folder and validated that it can be installed in the "HIFI_LIB_DIRS", fixed the FIndLeapmotion.cmake for that - Cleared the HandTracker class not needed Ready for publish !
This commit is contained in:
parent
3ecaaa5a85
commit
d6104e5d48
16 changed files with 10 additions and 6709 deletions
|
@ -18,13 +18,13 @@ if (LEAPMOTION_LIBRARIES AND LEAPMOTION_INCLUDE_DIRS)
|
|||
else (LEAPMOTION_LIBRARIES AND LEAPMOTION_INCLUDE_DIRS)
|
||||
set(LEAPMOTION_SEARCH_DIRS "${LEAPMOTION_ROOT_DIR}" "$ENV{HIFI_LIB_DIR}/leapmotion")
|
||||
|
||||
find_path(LEAPMOTION_INCLUDE_DIRS Leap.h ${LEAPMOTION_ROOT_DIR}/include)
|
||||
find_path(LEAPMOTION_INCLUDE_DIRS Leap.h PATH_SUFFIXES include HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
|
||||
if (WIN32)
|
||||
find_library(LEAPMOTION_LIBRARIES Leap.lib ${LEAPMOTION_ROOT_DIR}/lib/x86)
|
||||
find_library(LEAPMOTION_LIBRARIES "lib/x86/Leap.lib" HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
endif (WIN32)
|
||||
if (APPLE)
|
||||
find_library(LEAPMOTION_LIBRARIES libLeap.dylib ${LEAPMOTION_ROOT_DIR}/lib)
|
||||
find_library(LEAPMOTION_LIBRARIES "lib/libLeap.dylib" HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
endif (APPLE)
|
||||
|
||||
if (LEAPMOTION_INCLUDE_DIRS AND LEAPMOTION_LIBRARIES)
|
||||
|
|
4792
interface/external/leapmotion/include/Leap.h
vendored
4792
interface/external/leapmotion/include/Leap.h
vendored
File diff suppressed because it is too large
Load diff
787
interface/external/leapmotion/include/Leap.i
vendored
787
interface/external/leapmotion/include/Leap.i
vendored
|
@ -1,787 +0,0 @@
|
|||
################################################################################
|
||||
# Copyright (C) 2012-2013 Leap Motion, Inc. All rights reserved. #
|
||||
# Leap Motion proprietary and confidential. Not for distribution. #
|
||||
# Use subject to the terms of the Leap Motion SDK Agreement available at #
|
||||
# https://developer.leapmotion.com/sdk_agreement, or another agreement #
|
||||
# between Leap Motion and you, your company or other organization. #
|
||||
################################################################################
|
||||
|
||||
# usage:
|
||||
# swig -c++ -python -o LeapPython.cpp -interface LeapPython Leap.i
|
||||
# swig -c++ -java -o LeapJava.cpp -package com.leapmotion.leap -outdir com/leapmotion/leap Leap.i
|
||||
# swig -c++ -csharp -o LeapCSharp.cpp -dllimport LeapCSharp -namespace Leap Leap.i
|
||||
|
||||
%module(directors="1", threads="1") Leap
|
||||
#pragma SWIG nowarn=325
|
||||
|
||||
%include "std_string.i"
|
||||
%include "std_vector.i"
|
||||
%include "stdint.i"
|
||||
%include "attribute.i"
|
||||
|
||||
################################################################################
|
||||
# Ignore constructors for internal use only #
|
||||
################################################################################
|
||||
|
||||
%ignore Leap::Pointable::Pointable(PointableImplementation*);
|
||||
%ignore Leap::Pointable::Pointable(FingerImplementation*);
|
||||
%ignore Leap::Pointable::Pointable(ToolImplementation*);
|
||||
%ignore Leap::Finger::Finger(FingerImplementation*);
|
||||
%ignore Leap::Tool::Tool(ToolImplementation*);
|
||||
%ignore Leap::Bone::Bone(BoneImplementation*);
|
||||
%ignore Leap::Hand::Hand(HandImplementation*);
|
||||
%ignore Leap::Gesture::Gesture(GestureImplementation*);
|
||||
%ignore Leap::Screen::Screen(ScreenImplementation*);
|
||||
%ignore Leap::Frame::Frame(FrameImplementation*);
|
||||
%ignore Leap::Controller::Controller(ControllerImplementation*);
|
||||
%ignore Leap::Device::Device(DeviceImplementation*);
|
||||
%ignore Leap::InteractionBox::InteractionBox(InteractionBoxImplementation*);
|
||||
|
||||
#####################################################################################
|
||||
# Set Attributes (done after functions are uppercased, but before vars are lowered) #
|
||||
#####################################################################################
|
||||
#TODO: If possible, figure out how to auomatically make any C++ function
|
||||
# that is const and takes no arguments be defined as a property in C#
|
||||
|
||||
%define %constattrib( Class, Type, Name )
|
||||
%attribute( Class, Type, Name, Name )
|
||||
%enddef
|
||||
|
||||
%define %staticattrib(Class, AttributeType, AttributeName)
|
||||
%ignore Class::AttributeName();
|
||||
%ignore Class::AttributeName() const;
|
||||
%immutable Class::AttributeName;
|
||||
%extend Class {
|
||||
AttributeType AttributeName;
|
||||
}
|
||||
%{
|
||||
#define %mangle(Class) ##_## AttributeName ## _get() Class::AttributeName()
|
||||
%}
|
||||
%enddef
|
||||
|
||||
%define %leapattrib( Class, Type, Name )
|
||||
%attributeval(Class, Leap::Type, Name, Name)
|
||||
%enddef
|
||||
|
||||
#if SWIGCSHARP || SWIGPYTHON
|
||||
|
||||
%rename(GestureType) Leap::Gesture::Type;
|
||||
%rename(GestureState) Leap::Gesture::State;
|
||||
%rename(FingerJoint) Leap::Finger::Joint;
|
||||
%rename(FingerType) Leap::Finger::Type;
|
||||
%rename(BoneType) Leap::Bone::Type;
|
||||
%rename(DeviceType) Leap::Device::Type;
|
||||
|
||||
#endif
|
||||
|
||||
# Apply language specific caseing
|
||||
#if SWIGCSHARP
|
||||
|
||||
%rename("%(camelcase)s", %$not %$isenumitem) "";
|
||||
|
||||
#elif SWIGPYTHON
|
||||
|
||||
%typemap(varout, noblock=1) SWIGTYPE & {
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1()), $descriptor, %newpointer_flags));
|
||||
}
|
||||
|
||||
%rename("%(undercase)s", notregexmatch$name="^[A-Z0-9_]+$") "";
|
||||
|
||||
#endif
|
||||
|
||||
#if SWIGCSHARP || SWIGPYTHON
|
||||
|
||||
%constattrib( Leap::Pointable, int, id );
|
||||
%leapattrib( Leap::Pointable, Hand, hand );
|
||||
%leapattrib( Leap::Pointable, Vector, tipPosition );
|
||||
%leapattrib( Leap::Pointable, Vector, tipVelocity );
|
||||
%leapattrib( Leap::Pointable, Vector, direction );
|
||||
%constattrib( Leap::Pointable, float, width );
|
||||
%constattrib( Leap::Pointable, float, length );
|
||||
%constattrib( Leap::Pointable, bool, isTool );
|
||||
%constattrib( Leap::Pointable, bool, isFinger );
|
||||
%constattrib( Leap::Pointable, bool, isExtended );
|
||||
%constattrib( Leap::Pointable, bool, isValid );
|
||||
%constattrib( Leap::Pointable, Leap::Pointable::Zone, touchZone )
|
||||
%constattrib( Leap::Pointable, float, touchDistance )
|
||||
%leapattrib( Leap::Pointable, Vector, stabilizedTipPosition )
|
||||
%constattrib( Leap::Pointable, float, timeVisible );
|
||||
%leapattrib( Leap::Pointable, Frame, frame );
|
||||
|
||||
%leapattrib( Leap::Bone, Vector, prevJoint );
|
||||
%leapattrib( Leap::Bone, Vector, nextJoint );
|
||||
%leapattrib( Leap::Bone, Vector, center );
|
||||
%leapattrib( Leap::Bone, Vector, direction );
|
||||
%constattrib( Leap::Bone, float, length );
|
||||
%constattrib( Leap::Bone, float, width );
|
||||
%constattrib( Leap::Bone, Leap::Bone::Type, type )
|
||||
%leapattrib( Leap::Bone, Matrix, basis )
|
||||
%constattrib( Leap::Bone, bool, isValid );
|
||||
|
||||
%constattrib( Leap::Hand, int, id );
|
||||
%leapattrib( Leap::Hand, PointableList, pointables );
|
||||
%leapattrib( Leap::Hand, FingerList, fingers );
|
||||
%leapattrib( Leap::Hand, ToolList, tools );
|
||||
%leapattrib( Leap::Hand, Vector, palmPosition );
|
||||
%leapattrib( Leap::Hand, Vector, palmVelocity );
|
||||
%leapattrib( Leap::Hand, Vector, palmNormal );
|
||||
%leapattrib( Leap::Hand, Vector, direction );
|
||||
%leapattrib( Leap::Hand, Matrix, basis )
|
||||
%constattrib( Leap::Hand, bool, isValid );
|
||||
%leapattrib( Leap::Hand, Vector, sphereCenter );
|
||||
%constattrib( Leap::Hand, float, sphereRadius );
|
||||
%constattrib( Leap::Hand, float, grabStrength );
|
||||
%constattrib( Leap::Hand, float, pinchStrength );
|
||||
%constattrib( Leap::Hand, float, palmWidth );
|
||||
%leapattrib( Leap::Hand, Vector, stabilizedPalmPosition )
|
||||
%constattrib( Leap::Hand, float, timeVisible );
|
||||
%constattrib( Leap::Hand, float, confidence );
|
||||
%constattrib( Leap::Hand, bool, isLeft );
|
||||
%constattrib( Leap::Hand, bool, isRight );
|
||||
%leapattrib( Leap::Hand, Frame, frame );
|
||||
|
||||
%constattrib( Leap::Gesture, Leap::Gesture::Type, type )
|
||||
%constattrib( Leap::Gesture, Leap::Gesture::State, state )
|
||||
%constattrib( Leap::Gesture, int32_t, id );
|
||||
%constattrib( Leap::Gesture, int64_t, duration );
|
||||
%constattrib( Leap::Gesture, float, durationSeconds );
|
||||
%leapattrib( Leap::Gesture, Frame, frame );
|
||||
%leapattrib( Leap::Gesture, HandList, hands );
|
||||
%leapattrib( Leap::Gesture, PointableList, pointables );
|
||||
%constattrib( Leap::Gesture, bool, isValid );
|
||||
%leapattrib( Leap::CircleGesture, Vector, center );
|
||||
%leapattrib( Leap::CircleGesture, Vector, normal );
|
||||
%constattrib( Leap::CircleGesture, float, progress );
|
||||
%constattrib( Leap::CircleGesture, float, radius );
|
||||
%leapattrib( Leap::CircleGesture, Pointable, pointable );
|
||||
%leapattrib( Leap::SwipeGesture, Vector, startPosition );
|
||||
%leapattrib( Leap::SwipeGesture, Vector, position );
|
||||
%leapattrib( Leap::SwipeGesture, Vector, direction );
|
||||
%constattrib( Leap::SwipeGesture, float, speed );
|
||||
%leapattrib( Leap::SwipeGesture, Pointable, pointable );
|
||||
%leapattrib( Leap::ScreenTapGesture, Vector, position );
|
||||
%leapattrib( Leap::ScreenTapGesture, Vector, direction );
|
||||
%constattrib( Leap::ScreenTapGesture, float, progress );
|
||||
%leapattrib( Leap::ScreenTapGesture, Pointable, pointable );
|
||||
%leapattrib( Leap::KeyTapGesture, Vector, position );
|
||||
%leapattrib( Leap::KeyTapGesture, Vector, direction );
|
||||
%constattrib( Leap::KeyTapGesture, float, progress );
|
||||
%leapattrib( Leap::KeyTapGesture, Pointable, pointable );
|
||||
|
||||
# Count is made a const attribute in C# but renamed to __len__ in Python
|
||||
#if SWIGCSHARP
|
||||
%constattrib( Leap::PointableList, int, count );
|
||||
%constattrib( Leap::FingerList, int, count );
|
||||
%constattrib( Leap::ToolList, int, count );
|
||||
%constattrib( Leap::HandList, int, count );
|
||||
%constattrib( Leap::GestureList, int, count );
|
||||
%constattrib( Leap::ScreenList, int, count );
|
||||
%constattrib( Leap::DeviceList, int, count );
|
||||
#endif
|
||||
|
||||
%constattrib( Leap::PointableList, bool, isEmpty );
|
||||
%constattrib( Leap::FingerList, bool, isEmpty );
|
||||
%constattrib( Leap::ToolList, bool, isEmpty );
|
||||
%constattrib( Leap::HandList, bool, isEmpty );
|
||||
%constattrib( Leap::GestureList, bool, isEmpty );
|
||||
%constattrib( Leap::ScreenList, bool, isEmpty );
|
||||
%constattrib( Leap::DeviceList, bool, isEmpty );
|
||||
|
||||
%leapattrib( Leap::PointableList, Pointable, leftmost );
|
||||
%leapattrib( Leap::PointableList, Pointable, rightmost );
|
||||
%leapattrib( Leap::PointableList, Pointable, frontmost );
|
||||
%leapattrib( Leap::FingerList, Finger, leftmost );
|
||||
%leapattrib( Leap::FingerList, Finger, rightmost );
|
||||
%leapattrib( Leap::FingerList, Finger, frontmost );
|
||||
%leapattrib( Leap::ToolList, Tool, leftmost );
|
||||
%leapattrib( Leap::ToolList, Tool, rightmost );
|
||||
%leapattrib( Leap::ToolList, Tool, frontmost );
|
||||
%leapattrib( Leap::HandList, Hand, leftmost );
|
||||
%leapattrib( Leap::HandList, Hand, rightmost );
|
||||
%leapattrib( Leap::HandList, Hand, frontmost );
|
||||
|
||||
%constattrib( Leap::Frame, int64_t, id );
|
||||
%constattrib( Leap::Frame, int64_t, timestamp );
|
||||
%constattrib( Leap::Frame, float, currentFramesPerSecond );
|
||||
%leapattrib( Leap::Frame, PointableList, pointables );
|
||||
%leapattrib( Leap::Frame, FingerList, fingers );
|
||||
%leapattrib( Leap::Frame, ToolList, tools );
|
||||
%leapattrib( Leap::Frame, HandList, hands );
|
||||
%constattrib( Leap::Frame, bool, isValid );
|
||||
%leapattrib( Leap::Frame, InteractionBox, interactionBox );
|
||||
|
||||
%constattrib( Leap::Screen, int32_t, id );
|
||||
%leapattrib( Leap::Screen, Vector, horizontalAxis );
|
||||
%leapattrib( Leap::Screen, Vector, verticalAxis );
|
||||
%leapattrib( Leap::Screen, Vector, bottomLeftCorner );
|
||||
%constattrib( Leap::Screen, int, widthPixels );
|
||||
%constattrib( Leap::Screen, int, heightPixels );
|
||||
%constattrib( Leap::Screen, bool, isValid );
|
||||
|
||||
%constattrib( Leap::Device, float, horizontalViewAngle );
|
||||
%constattrib( Leap::Device, float, verticalViewAngle );
|
||||
%constattrib( Leap::Device, float, range );
|
||||
%constattrib( Leap::Device, bool, isValid );
|
||||
%constattrib( Leap::Device, bool, isEmbedded );
|
||||
%constattrib( Leap::Device, bool, isStreaming );
|
||||
%constattrib( Leap::Device, Leap::Device::Type, type );
|
||||
|
||||
%leapattrib( Leap::InteractionBox, Vector, center );
|
||||
%constattrib( Leap::InteractionBox, float, width );
|
||||
%constattrib( Leap::InteractionBox, float, height );
|
||||
%constattrib( Leap::InteractionBox, float, depth );
|
||||
%constattrib( Leap::InteractionBox, bool, isValid );
|
||||
|
||||
#if SWIGCSHARP
|
||||
%csmethodmodifiers Leap::Finger::invalid "public new";
|
||||
%csmethodmodifiers Leap::Tool::invalid "public new";
|
||||
#endif
|
||||
%staticattrib( Leap::Pointable, static const Pointable&, invalid);
|
||||
%staticattrib( Leap::Finger, static const Finger&, invalid);
|
||||
%staticattrib( Leap::Tool, static const Tool&, invalid);
|
||||
%staticattrib( Leap::Bone, static const Bone&, invalid);
|
||||
%staticattrib( Leap::Hand, static const Hand&, invalid);
|
||||
%staticattrib( Leap::Gesture, static const Gesture&, invalid);
|
||||
%staticattrib( Leap::Screen, static const Screen&, invalid );
|
||||
%staticattrib( Leap::Device, static const Device&, invalid );
|
||||
%staticattrib( Leap::InteractionBox, static const InteractionBox&, invalid );
|
||||
%staticattrib( Leap::Frame, static const Frame&, invalid);
|
||||
|
||||
%constattrib( Leap::Vector, float, magnitude );
|
||||
%constattrib( Leap::Vector, float, magnitudeSquared );
|
||||
%constattrib( Leap::Vector, float, pitch );
|
||||
%constattrib( Leap::Vector, float, roll );
|
||||
%constattrib( Leap::Vector, float, yaw );
|
||||
%leapattrib( Leap::Vector, Vector, normalized );
|
||||
|
||||
%constattrib( Leap::Controller, bool, isConnected );
|
||||
%constattrib( Leap::Controller, bool, hasFocus );
|
||||
%constattrib( Leap::Controller, Controller::PolicyFlag, policyFlags );
|
||||
%leapattrib( Leap::Controller, Config, config );
|
||||
%leapattrib( Leap::Controller, ScreenList, locatedScreens );
|
||||
%leapattrib( Leap::Controller, DeviceList, devices );
|
||||
|
||||
%staticattrib( Leap::Vector, static const Vector&, zero );
|
||||
%staticattrib( Leap::Vector, static const Vector&, xAxis );
|
||||
%staticattrib( Leap::Vector, static const Vector&, yAxis );
|
||||
%staticattrib( Leap::Vector, static const Vector&, zAxis );
|
||||
%staticattrib( Leap::Vector, static const Vector&, forward );
|
||||
%staticattrib( Leap::Vector, static const Vector&, backward );
|
||||
%staticattrib( Leap::Vector, static const Vector&, left );
|
||||
%staticattrib( Leap::Vector, static const Vector&, right );
|
||||
%staticattrib( Leap::Vector, static const Vector&, up );
|
||||
%staticattrib( Leap::Vector, static const Vector&, down );
|
||||
|
||||
%staticattrib( Leap::Matrix, static const Matrix&, identity );
|
||||
|
||||
#endif
|
||||
|
||||
#if SWIGCSHARP
|
||||
|
||||
%rename("%(lowercamelcase)s", %$isvariable) "";
|
||||
%ignore Leap::DEG_TO_RAD;
|
||||
%ignore Leap::RAD_TO_DEG;
|
||||
%ignore Leap::PI;
|
||||
|
||||
SWIG_CSBODY_PROXY(public, public, SWIGTYPE)
|
||||
|
||||
#elif SWIGPYTHON
|
||||
|
||||
%rename("%(camelcase)s", %$isclass) "";
|
||||
%rename("%(camelcase)s", %$isconstructor) "";
|
||||
|
||||
#elif SWIGJAVA
|
||||
|
||||
%ignore Leap::DEG_TO_RAD;
|
||||
%ignore Leap::RAD_TO_DEG;
|
||||
%ignore Leap::PI;
|
||||
|
||||
# Use proper Java enums
|
||||
%include "enums.swg"
|
||||
%javaconst(1);
|
||||
|
||||
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
|
||||
|
||||
#endif
|
||||
|
||||
# Ignore C++ streaming operator
|
||||
%ignore operator<<;
|
||||
# Ignore C++ equal operator
|
||||
%ignore operator=;
|
||||
|
||||
#if SWIGPYTHON
|
||||
%begin %{
|
||||
#if defined(_WIN32) && defined(_DEBUG)
|
||||
// Workaround for obscure STL template error
|
||||
#include <vector>
|
||||
// Workaround for non-existent Python debug library
|
||||
#define _TMP_DEBUG _DEBUG
|
||||
#undef _DEBUG
|
||||
#include <Python.h>
|
||||
#define _DEBUG _TMP_DEBUG
|
||||
#undef _TMP_DEBUG
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
#pragma GCC diagnostic ignored "-Wself-assign"
|
||||
#endif
|
||||
%}
|
||||
#endif
|
||||
|
||||
#if SWIGCSHARP || SWIGJAVA
|
||||
%begin %{
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
// When dynamically loading the Leap C# DLL, set the DLL search path to look in
|
||||
// the same the directory. This will allow loading the Leap.dll. Create the
|
||||
// Leap C# DLL with the /DELAYLOAD:Leap.dll link option.
|
||||
extern "C" BOOL WINAPI DllMain(
|
||||
_In_ HINSTANCE hinstDLL,
|
||||
_In_ DWORD fdwReason,
|
||||
_In_ LPVOID lpvReserved)
|
||||
{
|
||||
if (lpvReserved == 0) {
|
||||
static TCHAR lpPrevPathName[1024];
|
||||
static BOOL restore = FALSE;
|
||||
|
||||
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||
TCHAR lpPathName[1024];
|
||||
int len;
|
||||
|
||||
len = GetDllDirectory(static_cast<DWORD>(sizeof(lpPrevPathName) - 1),
|
||||
lpPrevPathName);
|
||||
if (len < 0 && len >= sizeof(lpPrevPathName)) {
|
||||
len = 0;
|
||||
}
|
||||
lpPrevPathName[len] = '\0';
|
||||
len = static_cast<int>(GetModuleFileName(static_cast<HMODULE>(hinstDLL),
|
||||
lpPathName, static_cast<DWORD>(sizeof(lpPathName))));
|
||||
if (len > 0 && len < sizeof(lpPathName)) {
|
||||
for (int i = len; i >= 0; i--) {
|
||||
if (lpPathName[i] == '\\' || lpPathName[i] == '/') {
|
||||
lpPathName[i] = '\0';
|
||||
restore = SetDllDirectory(lpPathName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
||||
if (restore && lpPrevPathName[0] != '\0') {
|
||||
SetDllDirectory(lpPrevPathName);
|
||||
restore = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
#endif
|
||||
|
||||
%typemap(csin, pre=" lock(arg0) {", post=" $csinput.Dispose();\n }") const Leap::Controller& "Controller.getCPtr($csinput)"
|
||||
|
||||
%header %{
|
||||
#define SWIG
|
||||
#include "Leap.h"
|
||||
%}
|
||||
|
||||
%feature("director") Leap::Listener;
|
||||
#if SWIGPYTHON
|
||||
%feature("director:except") {
|
||||
if ($error != NULL) {
|
||||
PyErr_Print();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
%pragma(java) jniclasscode=%{
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("LeapJava");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. \n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
################################################################################
|
||||
# Operator overloading #
|
||||
################################################################################
|
||||
|
||||
#if SWIGCSHARP
|
||||
|
||||
%ignore *::operator+=;
|
||||
%ignore *::operator-=;
|
||||
%ignore *::operator*=;
|
||||
%ignore *::operator/=;
|
||||
%ignore *::operator!=;
|
||||
%ignore Leap::Vector::toFloatPointer;
|
||||
%ignore Leap::Matrix::toArray3x3;
|
||||
%ignore Leap::Matrix::toArray4x4;
|
||||
%ignore Leap::FloatArray;
|
||||
|
||||
%rename(Equals) *::operator ==;
|
||||
%rename(_operator_add) *::operator +;
|
||||
%rename(_operator_sub) *::operator -;
|
||||
%rename(_operator_mul) *::operator *;
|
||||
%rename(_operator_div) *::operator /;
|
||||
%rename(_operator_get) *::operator [];
|
||||
%rename(_operator_to_float) *::operator const float*;
|
||||
%csmethodmodifiers *::operator + "private";
|
||||
%csmethodmodifiers *::operator - "private";
|
||||
%csmethodmodifiers *::operator * "private";
|
||||
%csmethodmodifiers *::operator / "private";
|
||||
%csmethodmodifiers *::operator [] "private";
|
||||
%csmethodmodifiers *::operator const float* "private";
|
||||
|
||||
%typemap(cscode) Leap::Vector
|
||||
%{
|
||||
/** Add vectors component-wise. */
|
||||
public static Vector operator + (Vector v1, Vector v2) {
|
||||
return v1._operator_add(v2);
|
||||
}
|
||||
/** Subtract vectors component-wise. */
|
||||
public static Vector operator - (Vector v1, Vector v2) {
|
||||
return v1._operator_sub(v2);
|
||||
}
|
||||
/** Multiply vector by a scalar. */
|
||||
public static Vector operator * (Vector v1, float scalar) {
|
||||
return v1._operator_mul(scalar);
|
||||
}
|
||||
/** Multiply vector by a scalar on the left-hand side. */
|
||||
public static Vector operator * (float scalar, Vector v1) {
|
||||
return v1._operator_mul(scalar);
|
||||
}
|
||||
/** Divide vector by a scalar. */
|
||||
public static Vector operator / (Vector v1, float scalar) {
|
||||
return v1._operator_div(scalar);
|
||||
}
|
||||
/** Negate a vector. */
|
||||
public static Vector operator - (Vector v1) {
|
||||
return v1._operator_sub();
|
||||
}
|
||||
/** Convert this vector to an array of three float values: [x,y,z]. */
|
||||
public float[] ToFloatArray() {
|
||||
return new float[] {x, y, z};
|
||||
}
|
||||
%}
|
||||
%typemap(cscode) Leap::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]);
|
||||
}
|
||||
%}
|
||||
|
||||
#elif SWIGJAVA
|
||||
|
||||
%ignore *::operator+=;
|
||||
%ignore *::operator-=;
|
||||
%ignore *::operator*=;
|
||||
%ignore *::operator/=;
|
||||
%ignore *::operator!=;
|
||||
%ignore Leap::Vector::toFloatPointer;
|
||||
%ignore Leap::Matrix::toArray3x3;
|
||||
%ignore Leap::Matrix::toArray4x4;
|
||||
%ignore Leap::FloatArray;
|
||||
|
||||
%rename(plus) *::operator+;
|
||||
%rename(minus) *::operator-;
|
||||
%rename(opposite) *::operator-() const;
|
||||
%rename(times) *::operator*;
|
||||
%rename(divide) *::operator/;
|
||||
%rename(get) *::operator [];
|
||||
%rename(equals) *::operator==;
|
||||
|
||||
%typemap(javacode) Leap::Vector
|
||||
%{
|
||||
public float[] toFloatArray() {
|
||||
return new float[] {getX(), getY(), getZ()};
|
||||
}
|
||||
%}
|
||||
%typemap(javacode) Leap::Matrix
|
||||
%{
|
||||
public float[] toArray3x3(float[] output) {
|
||||
output[0] = getXBasis().getX(); output[1] = getXBasis().getY(); output[2] = getXBasis().getZ();
|
||||
output[3] = getYBasis().getX(); output[4] = getYBasis().getY(); output[5] = getYBasis().getZ();
|
||||
output[6] = getZBasis().getX(); output[7] = getZBasis().getY(); output[8] = getZBasis().getZ();
|
||||
return output;
|
||||
}
|
||||
public double[] toArray3x3(double[] output) {
|
||||
output[0] = getXBasis().getX(); output[1] = getXBasis().getY(); output[2] = getXBasis().getZ();
|
||||
output[3] = getYBasis().getX(); output[4] = getYBasis().getY(); output[5] = getYBasis().getZ();
|
||||
output[6] = getZBasis().getX(); output[7] = getZBasis().getY(); output[8] = getZBasis().getZ();
|
||||
return output;
|
||||
}
|
||||
public float[] toArray3x3() {
|
||||
return toArray3x3(new float[9]);
|
||||
}
|
||||
public float[] toArray4x4(float[] output) {
|
||||
output[0] = getXBasis().getX(); output[1] = getXBasis().getY(); output[2] = getXBasis().getZ(); output[3] = 0.0f;
|
||||
output[4] = getYBasis().getX(); output[5] = getYBasis().getY(); output[6] = getYBasis().getZ(); output[7] = 0.0f;
|
||||
output[8] = getZBasis().getX(); output[9] = getZBasis().getY(); output[10] = getZBasis().getZ(); output[11] = 0.0f;
|
||||
output[12] = getOrigin().getX(); output[13] = getOrigin().getY(); output[14] = getOrigin().getZ(); output[15] = 1.0f;
|
||||
return output;
|
||||
}
|
||||
public double[] toArray4x4(double[] output) {
|
||||
output[0] = getXBasis().getX(); output[1] = getXBasis().getY(); output[2] = getXBasis().getZ(); output[3] = 0.0f;
|
||||
output[4] = getYBasis().getX(); output[5] = getYBasis().getY(); output[6] = getYBasis().getZ(); output[7] = 0.0f;
|
||||
output[8] = getZBasis().getX(); output[9] = getZBasis().getY(); output[10] = getZBasis().getZ(); output[11] = 0.0f;
|
||||
output[12] = getOrigin().getX(); output[13] = getOrigin().getY(); output[14] = getOrigin().getZ(); output[15] = 1.0f;
|
||||
return output;
|
||||
}
|
||||
public float[] toArray4x4() {
|
||||
return toArray4x4(new float[16]);
|
||||
}
|
||||
%}
|
||||
|
||||
#elif SWIGPYTHON
|
||||
|
||||
%ignore Leap::Interface::operator=;
|
||||
%ignore Leap::ConstListIterator::operator++;
|
||||
%ignore Leap::Vector::toFloatPointer;
|
||||
%ignore Leap::Matrix::toArray3x3;
|
||||
%ignore Leap::Matrix::toArray4x4;
|
||||
%ignore Leap::FloatArray;
|
||||
|
||||
%rename(__getitem__) *::operator [];
|
||||
|
||||
%extend Leap::Vector {
|
||||
%pythoncode {
|
||||
def to_float_array(self): return [self.x, self.y, self.z]
|
||||
def to_tuple(self): return (self.x, self.y, self.z)
|
||||
%}}
|
||||
%extend Leap::Matrix {
|
||||
%pythoncode {
|
||||
def to_array_3x3(self, output = None):
|
||||
if output is None:
|
||||
output = [0]*9
|
||||
output[0], output[1], output[2] = self.x_basis.x, self.x_basis.y, self.x_basis.z
|
||||
output[3], output[4], output[5] = self.y_basis.x, self.y_basis.y, self.y_basis.z
|
||||
output[6], output[7], output[8] = self.z_basis.x, self.z_basis.y, self.z_basis.z
|
||||
return output
|
||||
def to_array_4x4(self, output = None):
|
||||
if output is None:
|
||||
output = [0]*16
|
||||
output[0], output[1], output[2], output[3] = self.x_basis.x, self.x_basis.y, self.x_basis.z, 0.0
|
||||
output[4], output[5], output[6], output[7] = self.y_basis.x, self.y_basis.y, self.y_basis.z, 0.0
|
||||
output[8], output[9], output[10], output[11] = self.z_basis.x, self.z_basis.y, self.z_basis.z, 0.0
|
||||
output[12], output[13], output[14], output[15] = self.origin.x, self.origin.y, self.origin.z, 1.0
|
||||
return output
|
||||
%}}
|
||||
|
||||
#endif
|
||||
|
||||
################################################################################
|
||||
# List Helpers #
|
||||
################################################################################
|
||||
|
||||
#if SWIGCSHARP
|
||||
|
||||
%define %leap_iterator_helper(BaseType)
|
||||
%typemap(csinterfaces_derived) Leap::BaseType##List "System.Collections.Generic.IEnumerable<BaseType>"
|
||||
%typemap(cscode) Leap::BaseType##List
|
||||
%{
|
||||
private class BaseType##List##Enumerator : System.Collections.Generic.IEnumerator<BaseType> {
|
||||
private BaseType##List _list;
|
||||
private int _index;
|
||||
public BaseType##List##Enumerator(BaseType##List list) {
|
||||
_list = list;
|
||||
_index = -1;
|
||||
}
|
||||
public void Reset() {
|
||||
_index = -1;
|
||||
}
|
||||
public BaseType Current {
|
||||
get {
|
||||
return _list._operator_get(_index);
|
||||
}
|
||||
}
|
||||
object System.Collections.IEnumerator.Current {
|
||||
get {
|
||||
return this.Current;
|
||||
}
|
||||
}
|
||||
public bool MoveNext() {
|
||||
_index++;
|
||||
return (_index < _list.Count);
|
||||
}
|
||||
public void Dispose() {
|
||||
//No cleanup needed
|
||||
}
|
||||
}
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
public System.Collections.Generic.IEnumerator<BaseType> GetEnumerator() {
|
||||
return new BaseType##List##Enumerator(this);
|
||||
}
|
||||
public BaseType this[int index] {
|
||||
get { return _operator_get(index); }
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
#elif SWIGJAVA
|
||||
|
||||
%define %leap_iterator_helper(BaseType)
|
||||
%typemap(javainterfaces) Leap::BaseType##List "Iterable<BaseType>"
|
||||
%typemap(javacode) Leap::BaseType##List
|
||||
%{
|
||||
public class BaseType##ListIterator implements java.util.Iterator<BaseType> {
|
||||
int index = 0;
|
||||
@Override public boolean hasNext() {
|
||||
return index < count();
|
||||
}
|
||||
@Override public BaseType next() {
|
||||
return get(index++);
|
||||
}
|
||||
@Override public void remove() {
|
||||
}
|
||||
}
|
||||
@Override public java.util.Iterator<BaseType> iterator() {
|
||||
return new BaseType##ListIterator();
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
#elif SWIGPYTHON
|
||||
|
||||
%define %leap_iterator_helper(BaseType)
|
||||
%rename(__len__) Leap::BaseType##List::count;
|
||||
%extend Leap::BaseType##List {
|
||||
%pythoncode {
|
||||
def __iter__(self):
|
||||
_pos = 0
|
||||
while _pos < len(self):
|
||||
yield self[_pos]
|
||||
_pos += 1
|
||||
%}}
|
||||
%enddef
|
||||
|
||||
#else
|
||||
|
||||
%define %leap_iterator_helper(BaseType)
|
||||
%enddef
|
||||
|
||||
#endif
|
||||
|
||||
%define %leap_list_helper(BaseType)
|
||||
%ignore Leap::BaseType##List::BaseType##List(const ListBaseImplementation<BaseType>&);
|
||||
%ignore Leap::BaseType##List::const_iterator;
|
||||
%ignore Leap::BaseType##List::begin() const;
|
||||
%ignore Leap::BaseType##List::end() const;
|
||||
%leap_iterator_helper(BaseType)
|
||||
%enddef
|
||||
|
||||
%leap_list_helper(Pointable);
|
||||
%leap_list_helper(Finger);
|
||||
%leap_list_helper(Tool);
|
||||
%leap_list_helper(Gesture);
|
||||
%leap_list_helper(Hand);
|
||||
%leap_list_helper(Screen);
|
||||
%leap_list_helper(Device);
|
||||
|
||||
################################################################################
|
||||
# Config Helpers #
|
||||
################################################################################
|
||||
|
||||
#if SWIGPYTHON
|
||||
|
||||
// Use dynamic typing to get or set any type of config value with one function
|
||||
%extend Leap::Config {
|
||||
%pythoncode {
|
||||
def get(self, *args):
|
||||
type = LeapPython.Config_type(self, *args)
|
||||
if type == LeapPython.Config_TYPE_BOOLEAN:
|
||||
return LeapPython.Config_get_bool(self, *args)
|
||||
elif type == LeapPython.Config_TYPE_INT32:
|
||||
return LeapPython.Config_get_int_32(self, *args)
|
||||
elif type == LeapPython.Config_TYPE_FLOAT:
|
||||
return LeapPython.Config_get_float(self, *args)
|
||||
elif type == LeapPython.Config_TYPE_STRING:
|
||||
return LeapPython.Config_get_string(self, *args)
|
||||
return None
|
||||
def set(self, *args):
|
||||
type = LeapPython.Config_type(self, *args[:-1]) # Do not pass value through
|
||||
if type == LeapPython.Config_TYPE_BOOLEAN:
|
||||
return LeapPython.Config_set_bool(self, *args)
|
||||
elif type == LeapPython.Config_TYPE_INT32:
|
||||
return LeapPython.Config_set_int_32(self, *args)
|
||||
elif type == LeapPython.Config_TYPE_FLOAT:
|
||||
return LeapPython.Config_set_float(self, *args)
|
||||
elif type == LeapPython.Config_TYPE_STRING:
|
||||
return LeapPython.Config_set_string(self, *args)
|
||||
return False
|
||||
%}}
|
||||
// Ignore methods that are unnecessary due to get and set functions defined above
|
||||
%feature("shadow") Leap::Config::type(const std::string& key) const %{%}
|
||||
%feature("shadow") Leap::Config::getBool(const std::string& key) const %{%}
|
||||
%feature("shadow") Leap::Config::setBool(const std::string& key, bool value) %{%}
|
||||
%feature("shadow") Leap::Config::getInt32(const std::string& key) const %{%}
|
||||
%feature("shadow") Leap::Config::setInt32(const std::string& key, int32_t value) %{%}
|
||||
%feature("shadow") Leap::Config::getFloat(const std::string& key) const %{%}
|
||||
%feature("shadow") Leap::Config::setFloat(const std::string& key, float value) %{%}
|
||||
%feature("shadow") Leap::Config::getString(const std::string& key) const %{%}
|
||||
%feature("shadow") Leap::Config::setString(const std::string& key, const std::string& value) %{%}
|
||||
|
||||
#endif
|
||||
|
||||
################################################################################
|
||||
# ToString methods #
|
||||
################################################################################
|
||||
|
||||
#if SWIGCSHARP
|
||||
|
||||
%csmethodmodifiers *::toString "public override";
|
||||
|
||||
#elif SWIGJAVA
|
||||
|
||||
%javamethodmodifiers *::toString "@Override public";
|
||||
|
||||
#elif SWIGPYTHON
|
||||
|
||||
%rename(__str__) *::toString;
|
||||
|
||||
#endif
|
||||
|
||||
%include "LeapMath.h"
|
||||
%include "Leap.h"
|
1050
interface/external/leapmotion/include/LeapMath.h
vendored
1050
interface/external/leapmotion/include/LeapMath.h
vendored
File diff suppressed because it is too large
Load diff
BIN
interface/external/leapmotion/lib/x64/Leap.dll
vendored
BIN
interface/external/leapmotion/lib/x64/Leap.dll
vendored
Binary file not shown.
BIN
interface/external/leapmotion/lib/x64/Leap.lib
vendored
BIN
interface/external/leapmotion/lib/x64/Leap.lib
vendored
Binary file not shown.
BIN
interface/external/leapmotion/lib/x64/msvcp120.dll
vendored
BIN
interface/external/leapmotion/lib/x64/msvcp120.dll
vendored
Binary file not shown.
BIN
interface/external/leapmotion/lib/x64/msvcr120.dll
vendored
BIN
interface/external/leapmotion/lib/x64/msvcr120.dll
vendored
Binary file not shown.
BIN
interface/external/leapmotion/lib/x86/Leap.dll
vendored
BIN
interface/external/leapmotion/lib/x86/Leap.dll
vendored
Binary file not shown.
BIN
interface/external/leapmotion/lib/x86/Leap.lib
vendored
BIN
interface/external/leapmotion/lib/x86/Leap.lib
vendored
Binary file not shown.
BIN
interface/external/leapmotion/lib/x86/msvcp120.dll
vendored
BIN
interface/external/leapmotion/lib/x86/msvcp120.dll
vendored
Binary file not shown.
BIN
interface/external/leapmotion/lib/x86/msvcr120.dll
vendored
BIN
interface/external/leapmotion/lib/x86/msvcr120.dll
vendored
Binary file not shown.
9
interface/external/leapmotion/readme.txt
vendored
9
interface/external/leapmotion/readme.txt
vendored
|
@ -3,7 +3,9 @@ Instructions for adding the Leap Motion library (LeapSDK) to Interface
|
|||
Sam Cake, June 10, 2014
|
||||
|
||||
You can download the Leap Developer Kit from https://developer.leapmotion.com/ (account creation required).
|
||||
Interface has been tested with SDK version LeapDeveloperKit_2.0.2+16391_win.
|
||||
Interface has been tested with SDK versions:
|
||||
- LeapDeveloperKit_2.0.3+17004_win
|
||||
- LeapDeveloperKit_2.0.3+17004_mac
|
||||
|
||||
1. Copy the LeapSDK folders from the LeapDeveloperKit installation directory (Lib, Include) into the interface/externals/leapmotion folder.
|
||||
This readme.txt should be there as well.
|
||||
|
@ -21,7 +23,10 @@ Interface has been tested with SDK version LeapDeveloperKit_2.0.2+16391_win.
|
|||
- Leap.lib
|
||||
- mscvcp120.dll (optional if you already have the Msdev 2012 SDK redistriuable installed)
|
||||
- mscvcr120.dll (optional if you already have the Msdev 2012 SDK redistriuable installed)
|
||||
|
||||
- lipLeap.dylib
|
||||
libc++/
|
||||
-libLeap.dylib
|
||||
|
||||
You may optionally choose to copy the SDK folders to a location outside the repository (so you can re-use with different checkouts and different projects).
|
||||
If so our CMake find module expects you to set the ENV variable 'HIFI_LIB_DIR' to a directory containing a subfolder 'leapmotion' that contains the 2 folders mentioned above (Include, Lib).
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
//
|
||||
// HandTracker.cpp
|
||||
// interface/src/devices
|
||||
//
|
||||
// Created by Sam Cake on 6/10/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "HandTracker.h"
|
||||
|
||||
HandTracker::HandTracker() {
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
//
|
||||
// HandTracker.h
|
||||
// interface/src/devices
|
||||
//
|
||||
// Created by Sam Cake on 6/10/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_HandTracker_h
|
||||
#define hifi_HandTracker_h
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
/// Base class for face trackers (Faceshift, Visage, Faceplus).
|
||||
class HandTracker {
|
||||
|
||||
public:
|
||||
|
||||
struct PalmData
|
||||
{
|
||||
glm::vec3 _translation;
|
||||
glm::quat _rotation;
|
||||
int _lastUpdate;
|
||||
|
||||
PalmData() :
|
||||
_translation(),
|
||||
_rotation(),
|
||||
_lastUpdate(0)
|
||||
{}
|
||||
};
|
||||
|
||||
enum Side
|
||||
{
|
||||
SIDE_LEFT =0,
|
||||
SIDE_RIGHT,
|
||||
SIDE_NUMSIDES, // Not a valid Side, the number of sides
|
||||
};
|
||||
|
||||
HandTracker();
|
||||
|
||||
const glm::vec3& getPalmTranslation(Side side) const { return _palms[side]._translation; }
|
||||
const glm::quat& getPalmRotation(Side side) const { return _palms[side]._rotation; }
|
||||
bool isPalmActive(Side side) const { return _palms[side]._lastUpdate == 0; }
|
||||
|
||||
protected:
|
||||
|
||||
PalmData _palms[SIDE_NUMSIDES];
|
||||
|
||||
};
|
||||
|
||||
#endif // hifi_HandTracker_h
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include <QDateTime>
|
||||
|
||||
#include "HandTracker.h"
|
||||
#include "MotionTracker.h"
|
||||
|
||||
#ifdef HAVE_LEAPMOTION
|
||||
|
|
Loading…
Reference in a new issue