Selaa lähdekoodia

Removed Leap

Removed Leap from the code base and VS2017 project and solutions. Other
platforms to follow.
Peter Robinson 7 vuotta sitten
vanhempi
commit
2351cf8e4e

BIN
Leap.dll


BIN
Leapd.dll


BIN
engine/compilers/VisualStudio 2017/.vs/Torque 2D/v15/Browse.VC.db


BIN
engine/compilers/VisualStudio 2017/.vs/Torque 2D/v15/Solution.VC.db


+ 6 - 12
engine/compilers/VisualStudio 2017/Torque 2D.vcxproj

@@ -101,10 +101,10 @@
       <AdditionalIncludeDirectories>../../Lib/MSPlatformSDK/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalIncludeDirectories>../../Lib/MSPlatformSDK/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>
     </ResourceCompile>
     <Link>
     <Link>
-      <AdditionalDependencies>Leap.lib;COMCTL32.LIB;COMDLG32.LIB;USER32.LIB;ADVAPI32.LIB;GDI32.LIB;RPCRT4.LIB;WINMM.LIB;WS2_32.LIB;vfw32.lib;Imm32.lib;shell32.lib;shlwapi.lib;ole32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>COMCTL32.LIB;COMDLG32.LIB;USER32.LIB;ADVAPI32.LIB;GDI32.LIB;RPCRT4.LIB;WINMM.LIB;WS2_32.LIB;vfw32.lib;Imm32.lib;shell32.lib;shlwapi.lib;ole32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../Torque2D_DEBUG.exe</OutputFile>
       <OutputFile>../../../Torque2D_DEBUG.exe</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>../../lib/LeapSDK/lib/x86;../../Lib/unicode;../../lib/MSPlatformSDK/Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>../../Lib/unicode;../../lib/MSPlatformSDK/Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
       <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
       <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
@@ -150,10 +150,10 @@
       <AdditionalIncludeDirectories>../../Lib/MSPlatformSDK/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalIncludeDirectories>../../Lib/MSPlatformSDK/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>
     </ResourceCompile>
     <Link>
     <Link>
-      <AdditionalDependencies>Leap.lib;COMCTL32.LIB;COMDLG32.LIB;USER32.LIB;ADVAPI32.LIB;GDI32.LIB;WINMM.LIB;WS2_32.LIB;vfw32.lib;Imm32.lib;shell32.lib;shlwapi.lib;ole32.lib;RPCRT4.LIB;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>COMCTL32.LIB;COMDLG32.LIB;USER32.LIB;ADVAPI32.LIB;GDI32.LIB;WINMM.LIB;WS2_32.LIB;vfw32.lib;Imm32.lib;shell32.lib;shlwapi.lib;ole32.lib;RPCRT4.LIB;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../Torque2D.exe</OutputFile>
       <OutputFile>../../../Torque2D.exe</OutputFile>
       <SuppressStartupBanner>false</SuppressStartupBanner>
       <SuppressStartupBanner>false</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>../../lib/LeapSDK/lib/x86;../../Lib/unicode;../../Lib/MSPlatformSDK/Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>../../Lib/unicode;../../Lib/MSPlatformSDK/Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
       <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
       <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
@@ -210,10 +210,10 @@
       <AdditionalIncludeDirectories>../../Lib/MSPlatformSDK/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <AdditionalIncludeDirectories>../../Lib/MSPlatformSDK/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>
     </ResourceCompile>
     <Link>
     <Link>
-      <AdditionalDependencies>Leap.lib;COMCTL32.LIB;COMDLG32.LIB;USER32.LIB;ADVAPI32.LIB;GDI32.LIB;WINMM.LIB;WS2_32.LIB;vfw32.lib;Imm32.lib;shell32.lib;shlwapi.lib;ole32.lib;RPCRT4.LIB;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>COMCTL32.LIB;COMDLG32.LIB;USER32.LIB;ADVAPI32.LIB;GDI32.LIB;WINMM.LIB;WS2_32.LIB;vfw32.lib;Imm32.lib;shell32.lib;shlwapi.lib;ole32.lib;RPCRT4.LIB;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>../../../Torque2D.exe</OutputFile>
       <OutputFile>../../../Torque2D.exe</OutputFile>
       <SuppressStartupBanner>false</SuppressStartupBanner>
       <SuppressStartupBanner>false</SuppressStartupBanner>
-      <AdditionalLibraryDirectories>../../lib/LeapSDK/lib/x86;../../Lib/unicode;../../Lib/MSPlatformSDK/Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>../../Lib/unicode;../../Lib/MSPlatformSDK/Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
       <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <GenerateDebugInformation>false</GenerateDebugInformation>
       <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
       <ProgramDatabaseFile>$(IntDir)$(ProjectName).pdb</ProgramDatabaseFile>
@@ -419,8 +419,6 @@
     <ClCompile Include="..\..\source\gui\language\lang.cc" />
     <ClCompile Include="..\..\source\gui\language\lang.cc" />
     <ClCompile Include="..\..\source\gui\messageVector.cc" />
     <ClCompile Include="..\..\source\gui\messageVector.cc" />
     <ClCompile Include="..\..\source\input\actionMap.cc" />
     <ClCompile Include="..\..\source\input\actionMap.cc" />
-    <ClCompile Include="..\..\source\input\leapMotion\leapMotionManager.cc" />
-    <ClCompile Include="..\..\source\input\leapMotion\leapMotionUtil.cpp" />
     <ClCompile Include="..\..\source\io\bitStream.cc" />
     <ClCompile Include="..\..\source\io\bitStream.cc" />
     <ClCompile Include="..\..\source\io\bufferStream.cc" />
     <ClCompile Include="..\..\source\io\bufferStream.cc" />
     <ClCompile Include="..\..\source\io\byteBuffer.cpp" />
     <ClCompile Include="..\..\source\io\byteBuffer.cpp" />
@@ -932,10 +930,6 @@
     <ClInclude Include="..\..\source\gui\messageVector.h" />
     <ClInclude Include="..\..\source\gui\messageVector.h" />
     <ClInclude Include="..\..\source\input\actionMap.h" />
     <ClInclude Include="..\..\source\input\actionMap.h" />
     <ClInclude Include="..\..\source\input\actionMap_ScriptBinding.h" />
     <ClInclude Include="..\..\source\input\actionMap_ScriptBinding.h" />
-    <ClInclude Include="..\..\source\input\leapMotion\leapMotionConstants.h" />
-    <ClInclude Include="..\..\source\input\leapMotion\leapMotionManager.h" />
-    <ClInclude Include="..\..\source\input\leapMotion\LeapMotionManager_ScriptBinding.h" />
-    <ClInclude Include="..\..\source\input\leapMotion\leapMotionUtil.h" />
     <ClInclude Include="..\..\source\io\bitStream.h" />
     <ClInclude Include="..\..\source\io\bitStream.h" />
     <ClInclude Include="..\..\source\io\bufferStream.h" />
     <ClInclude Include="..\..\source\io\bufferStream.h" />
     <ClInclude Include="..\..\source\io\byteBuffer.h" />
     <ClInclude Include="..\..\source\io\byteBuffer.h" />

+ 0 - 21
engine/compilers/VisualStudio 2017/Torque 2D.vcxproj.filters

@@ -193,9 +193,6 @@
     <Filter Include="persistence\taml\xml">
     <Filter Include="persistence\taml\xml">
       <UniqueIdentifier>{cc1c1416-376b-4686-a4ac-21d1a35c9390}</UniqueIdentifier>
       <UniqueIdentifier>{cc1c1416-376b-4686-a4ac-21d1a35c9390}</UniqueIdentifier>
     </Filter>
     </Filter>
-    <Filter Include="input\leapMotion">
-      <UniqueIdentifier>{addcb993-5059-42bf-a1ea-871f700c67c3}</UniqueIdentifier>
-    </Filter>
     <Filter Include="spine">
     <Filter Include="spine">
       <UniqueIdentifier>{bb776838-ed6f-477c-b366-dd0c5c60ae5f}</UniqueIdentifier>
       <UniqueIdentifier>{bb776838-ed6f-477c-b366-dd0c5c60ae5f}</UniqueIdentifier>
     </Filter>
     </Filter>
@@ -1338,12 +1335,6 @@
     <ClCompile Include="..\..\source\console\Package.cc">
     <ClCompile Include="..\..\source\console\Package.cc">
       <Filter>console</Filter>
       <Filter>console</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\source\input\leapMotion\leapMotionManager.cc">
-      <Filter>input\leapMotion</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\source\input\leapMotion\leapMotionUtil.cpp">
-      <Filter>input\leapMotion</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\source\math\mPoint.cpp">
     <ClCompile Include="..\..\source\math\mPoint.cpp">
       <Filter>math</Filter>
       <Filter>math</Filter>
     </ClCompile>
     </ClCompile>
@@ -3067,18 +3058,6 @@
     <ClInclude Include="..\..\source\console\Package.h">
     <ClInclude Include="..\..\source\console\Package.h">
       <Filter>console</Filter>
       <Filter>console</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\source\input\leapMotion\leapMotionConstants.h">
-      <Filter>input\leapMotion</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\source\input\leapMotion\leapMotionManager.h">
-      <Filter>input\leapMotion</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\source\input\leapMotion\LeapMotionManager_ScriptBinding.h">
-      <Filter>input\leapMotion</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\source\input\leapMotion\leapMotionUtil.h">
-      <Filter>input\leapMotion</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\source\spine\Animation.h">
     <ClInclude Include="..\..\source\spine\Animation.h">
       <Filter>spine</Filter>
       <Filter>spine</Filter>
     </ClInclude>
     </ClInclude>

+ 0 - 125
engine/source/input/actionMap.cc

@@ -812,11 +812,6 @@ bool ActionMap::getDeviceTypeAndInstance(const char *pDeviceName, U32 &deviceTyp
       deviceType = GamepadDeviceType;
       deviceType = GamepadDeviceType;
       offset     = dStrlen("gamepad");
       offset     = dStrlen("gamepad");
    }
    }
-   else if (dStrnicmp(pDeviceName, "leapdevice", dStrlen("leapdevice")) == 0)
-   {
-       deviceType = LeapMotionDeviceType;
-       offset = dStrlen("leapdevice");
-   }
    else
    else
       return false;
       return false;
     
     
@@ -869,10 +864,6 @@ bool ActionMap::getDeviceName(const U32 deviceType, const U32 deviceInstance, ch
       dSprintf(buffer, 16, "gamepad%d", deviceInstance);
       dSprintf(buffer, 16, "gamepad%d", deviceInstance);
       break;
       break;
 
 
-     case LeapMotionDeviceType:
-      dStrcpy(buffer, "leapdevice");
-      break;
-
      default:
      default:
       Con::errorf( "ActionMap::getDeviceName: unknown device type specified, %d (inst: %d)", deviceType, deviceInstance);
       Con::errorf( "ActionMap::getDeviceName: unknown device type specified, %d (inst: %d)", deviceType, deviceInstance);
       return false;
       return false;
@@ -1199,112 +1190,6 @@ bool ActionMap::processBind(const U32 argc, const char** argv, SimObject* object
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 
 
-bool ActionMap::processLeap(const InputEvent* pEvent)
-{
-    static const char *argv[5];
-    char buffer[64];
-
-    const Node* pNode = findNode( pEvent->deviceType, pEvent->deviceInst, pEvent->modifier, pEvent->objType );
-
-    if (pNode == NULL)
-    {
-        // Check to see if we clear the modifiers, do we find an action?
-        if (pEvent->modifier != 0)
-            pNode = findNode(pEvent->deviceType, pEvent->deviceInst, 0, pEvent->objInst);
-
-        if (pNode == NULL)
-            return false;
-    }
-
-    // "Do nothing" bind:
-    if ( !pNode->consoleFunction[0] )
-        return( true );
-
-    argv[0] = pNode->consoleFunction;
-
-    float values[3];
-    values[0] = pEvent->fValues[0];
-    values[1] = pEvent->fValues[1];
-    values[2] = pEvent->fValues[2];
-
-    if ( pNode->flags & Node::HasDeadZone )
-    {
-        if ( pEvent->fValues[0] >= pNode->deadZoneBegin && pEvent->fValues[0] <= pNode->deadZoneEnd )
-            values[0] = 0.0f;
-        if ( pEvent->fValues[1] >= pNode->deadZoneBegin && pEvent->fValues[1] <= pNode->deadZoneEnd )
-            values[1] = 0.0f;
-        if ( pEvent->fValues[2] >= pNode->deadZoneBegin && pEvent->fValues[2] <= pNode->deadZoneEnd )
-            values[2] = 0.0f;
-
-        // All values are all null, so don't bother executing the function
-        if (!values[0] && !values[1] && !values[2])
-            return true;
-    }
-
-    switch(pEvent->objType)
-    {
-        case LM_HANDPOS:
-
-            // ID
-            argv[1] = Con::getIntArg(pEvent->iValue);
-
-            // Position
-            dSprintf(buffer, sizeof(buffer), "%f %f %f", values[0], values[1], values[2]);
-
-            argv[2] = buffer;
-
-            if (pNode->object)
-                Con::executef(pNode->object, 3, argv[0], argv[1], argv[2]);
-            else
-                Con::execute(3, argv);
-            break;
-
-        case LM_HANDROT:
-            
-            // ID
-            argv[1] = Con::getIntArg(pEvent->iValue);
-
-            // Rotation
-            dSprintf(buffer, sizeof(buffer), "%f %f %f", values[0], values[1], values[2]);
-
-            argv[2] = buffer;
-
-            if (pNode->object)
-                Con::executef(pNode->object, 3, argv[0], argv[1], argv[2]);
-            else
-                Con::execute(3, argv);
-            break;
-
-        case LM_FINGERPOS:
-            
-            // IDs
-            argv[1] = pEvent->fingerIDs;
-
-            // X-coordinates
-            argv[2] = pEvent->fingersX;
-
-            // Y-coordinates
-            argv[3] = pEvent->fingersY;
-
-            // Z-coordinates
-            argv[4] = pEvent->fingersZ;
-
-            if (pNode->object)
-                Con::executef(pNode->object, 5, argv[0], argv[1], argv[2], argv[3], argv[4]);
-            else
-                Con::execute(5, argv);
-            break;
-
-        case LM_HANDAXIS:
-        default:
-            return false;
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
 bool ActionMap::processGesture(const InputEvent* pEvent)
 bool ActionMap::processGesture(const InputEvent* pEvent)
 {
 {
     static const char *argv[6];
     static const char *argv[6];
@@ -1849,9 +1734,6 @@ bool ActionMap::processAction(const InputEvent* pEvent)
 {
 {
     switch(pEvent->action)
     switch(pEvent->action)
     {
     {
-    case SI_LEAP:
-        return processLeap(pEvent);
-        break;
     case SI_GESTURE:
     case SI_GESTURE:
         return processGesture(pEvent);
         return processGesture(pEvent);
         break;
         break;
@@ -2263,13 +2145,6 @@ CodeMapping gVirtualMap[] =
    { "keyTapGesture",      SI_GESTURE,  SI_KEYTAP_GESTURE    },
    { "keyTapGesture",      SI_GESTURE,  SI_KEYTAP_GESTURE    },
    { "pinchGesture",       SI_GESTURE,  SI_PINCH_GESTURE     },
    { "pinchGesture",       SI_GESTURE,  SI_PINCH_GESTURE     },
    { "scaleGesture",       SI_GESTURE,  SI_SCALE_GESTURE     },
    { "scaleGesture",       SI_GESTURE,  SI_SCALE_GESTURE     },
-
-   //-------------------------------------- GESTURE EVENTS
-   // Preset gesture events:
-   { "leapHandAxis",    SI_LEAP,     LM_HANDAXIS    },
-   { "leapHandPos",     SI_LEAP,     LM_HANDPOS     },
-   { "leapHandRot",     SI_LEAP,     LM_HANDROT     },
-   { "leapFingerPos",   SI_LEAP,     LM_FINGERPOS   },
    
    
    //-------------------------------------- MISCELLANEOUS EVENTS
    //-------------------------------------- MISCELLANEOUS EVENTS
    //
    //

+ 0 - 1
engine/source/input/actionMap.h

@@ -166,7 +166,6 @@ class ActionMap : public SimObject
    static const char* buildActionString( const InputEvent* event );
    static const char* buildActionString( const InputEvent* event );
 
 
    bool processAction(const InputEvent*);
    bool processAction(const InputEvent*);
-   bool processLeap(const InputEvent*);
    bool processGesture(const InputEvent*);
    bool processGesture(const InputEvent*);
    bool processTouch(const InputEvent*);
    bool processTouch(const InputEvent*);
    bool processButton(const InputEvent*);
    bool processButton(const InputEvent*);

+ 0 - 176
engine/source/input/leapMotion/LeapMotionManager_ScriptBinding.h

@@ -1,176 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-ConsoleFunction(initLeapMotionManager, void, 1, 1, "() Initialize the LeapMotionManager")
-{
-    if (gLeapMotionManager != NULL)
-    {
-        Con::printf("LeapMotionManager already initialized");
-    }
-    else
-    {
-        gLeapMotionManager = new LeapMotionManager();
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-ConsoleFunction(enableLeapMotionManager, void, 2, 2, "(bool enabledState) Run or pause the LeapMotionManager.\n"
-                                                     "@param enabledState True to turn it on, false otherwise")
-{
-    if (gLeapMotionManager == NULL)
-    {
-        Con::printf("LeapMotionManager not initialized. Call initLeapMotionManager() first");
-    }
-    else
-    {
-        gLeapMotionManager->enable(dAtob(argv[1]));
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-ConsoleFunction(isLeapMotionManagerEnabled, bool, 1, 1, "() Checks the LeapMotionManager to see if it is enabled.\n"
-                                                        "@return True if it's running, false otherwise")
-{
-    if (gLeapMotionManager == NULL)
-    {
-        Con::printf("LeapMotionManager not initialized. Call initLeapMotionManager() first");
-        return false;
-    }
-    else
-    {
-        return gLeapMotionManager->getEnabled();
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-ConsoleFunction(enableLeapCursorControl, void, 2, 2, "(bool enabledState) Toggles the manager to act like a mouse.\n"
-                                                        "@param enabledState True to act like a mouse, false otherwise")
-{
-    if (gLeapMotionManager == NULL)
-    {
-        Con::printf("LeapMotionManager not initialized. Call initLeapMotionManager() first");
-    }
-    else
-    {
-        return gLeapMotionManager->toggleMouseControl(dAtob(argv[1]));
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-ConsoleFunction(isLeapCursorControlled, bool, 1, 1, "() Checks the LeapMotionManager to see if it is controlling the mouse.\n"
-        "@return True if it's acting as a mouse, false otherwise")
-{
-    if (gLeapMotionManager == NULL)
-    {
-        Con::printf("LeapMotionManager not initialized. Call initLeapMotionManager() first");
-        return false;
-    }
-    else
-    {
-        return gLeapMotionManager->getMouseControlToggle();
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-ConsoleFunction(configureLeapGesture, bool, 3, 3,   "(gestureString, value) Modified a Config string on the main "
-                                                    "Controller, via the LeapMotionManager. The following strings are allowed:\n"
-                                                    "Gesture.Circle.MinProgress\n"
-                                                    "Gesture.Circle.MinRadius\n"
-                                                    "Gesture.Circle.MinArc\n"
-                                                    "Gesture.Swipe.MinLength\n"
-                                                    "Gesture.Swipe.MinVelocity\n"
-                                                    "Gesture.KeyTap.MinDownVelocity\n"
-                                                    "Gesture.KeyTap.HistorySeconds\n"
-                                                    "Gesture.KeyTap.MinDistance\n"
-                                                    "Gesture.ScreenTap.MinForwardVelocity\n"
-                                                    "Gesture.ScreenTap.HistorySeconds\n"
-                                                    "Gesture.ScreenTap.MinDistance\n"
-                                                    "@param gestureString The Config string to be set\n"
-                                                    "@param value The new value for the Config string\n"
-                                                    "@return True if string was successfully set, false otherwise")
-{
-    if (gLeapMotionManager == NULL)
-    {
-        Con::printf("LeapMotionManager not initialized. Call initLeapMotionManager() first");
-        return false;
-    }
-    else
-    {
-        if (!dStrcmp("Gesture.Circle.MinProgress", argv[1]))
-        {
-            return gLeapMotionManager->setMinCircleProgress(dAtof(argv[2]));
-        }
-        else
-        {
-            return gLeapMotionManager->configureLeapGesture(argv[1], dAtof(argv[2]));
-        }
-    }
-}
-
-ConsoleFunction(getPointFromProjection, const char*, 2, 4, "(x, y, z) - Gets the closest point on the screen to a point in space using Leap::Screen::project().\n"
-                                                             "@param x The x component of the finger position.\n"
-                                                             "@param y The y component of the finger position.\n"
-                                                             "@param z The z component of the finger position.\n\n"
-                                                             "@return An \"x y\" position of where the finger intersects with the screen.")
-{
-    // The new position.
-    Point3F pos;
-
-    if(argc == 2)
-    {
-        dSscanf(argv[1], "%g %g %g", &pos.x, &pos.y, &pos.z);
-    }
-    else if (argc == 4)
-    {
-        pos.x = dAtof(argv[1]);
-        pos.y = dAtof(argv[2]);
-        pos.z = dAtof(argv[3]);
-    }
-    else
-    {
-        Con::warnf("getPointFromProjection() - Invalid number of parameters!");
-        return "";
-    }
-
-   return gLeapMotionManager->getPointFromProjection(pos).scriptThis();
-   
-   
-}
-
-ConsoleFunction(getPointFromIntersection, const char*, 2, 2, "(fingerID) - Gets the point of intersection between the screen and a ray "
-                                                             "projected from a Pointable object using the Screen::intersect() function\n"
-                                                             "@param fingerID The finger ID, which will be grabbed from the last frame.\n\n"
-                                                             "@return An \"x y\" position of where the finger intersects with the screen.")
-{
-    if(argc < 2)
-    {
-        Con::warnf("getPointFromIntersection() - Invalid number of parameters!");
-        return "";
-    }
-
-    return gLeapMotionManager->getPointFromIntersection(dAtoi(argv[1])).scriptThis();
-}

+ 0 - 35
engine/source/input/leapMotion/leapMotionConstants.h

@@ -1,35 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2012 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#ifndef _LEAPMOTIONCONSTANTS_H_
-#define _LEAPMOTIONCONSTANTS_H_
-
-namespace LeapMotionConstants
-{
-    enum Constants
-    {
-        MaxHands             = 2,
-        MaxPointablesPerHand = 5,
-    };
-}
-
-#endif   // _LEAPMOTIONCONSTANTS_H_

+ 0 - 674
engine/source/input/leapMotion/leapMotionManager.cc

@@ -1,674 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#ifndef _LEAPMOTIONMANAGER_H_
-#include "input/leapMotion/leapMotionManager.h"
-#endif
-
-#ifndef _PLATFORM_MEMORY_H_
-#include "platform/platformMemory.h"
-#endif 
-
-#ifndef _CONSOLETYPES_H_
-#include "console/consoleTypes.h"
-#endif
-
-#ifndef _EVENT_H_
-#include "platform/event.h"
-#endif
-
-#ifndef _GAMEINTERFACE_H_
-#include "game/gameInterface.h"
-#endif
-
-#ifndef _GUICANVAS_H_
-#include "gui/guiCanvas.h"
-#endif
-
-#ifndef _LEAPMOTIONUTIL_H_
-#include "leapMotionUtil.h"
-#endif
-
-#ifndef _VECTOR2_H_
-#include "2d/core/Vector2.h"
-#endif
-
-#include "input/leapMotion/LeapMotionManager_ScriptBinding.h"
-
-//-----------------------------------------------------------------------------
-
-bool LeapMotionManager::smEnableDevice = true;
-
-bool LeapMotionManager::smGenerateIndividualEvents = true;
-bool LeapMotionManager::smKeepHandIndexPersistent = false;
-bool LeapMotionManager::smKeepPointableIndexPersistent = false;
-
-bool LeapMotionManager::smGenerateSingleHandRotationAsAxisEvents = false;
-
-F32 LeapMotionManager::smMaximumHandAxisAngle = 25.0f;
-
-bool LeapMotionManager::smGenerateWholeFrameEvents = false;
-
-U32 LeapMotionManager::LM_FRAMEVALIDDATA = 0;
-U32 LeapMotionManager::LM_HAND[LeapMotionConstants::MaxHands] = {0};
-//U32 LeapMotionManager::LM_HANDROT[LeapMotionConstants::MaxHands] = {0};
-U32 LeapMotionManager::LM_HANDAXISX = 0;
-U32 LeapMotionManager::LM_HANDAXISY = 0;
-U32 LeapMotionManager::LM_HANDPOINTABLE[LeapMotionConstants::MaxHands][LeapMotionConstants::MaxPointablesPerHand] = {0};
-U32 LeapMotionManager::LM_HANDPOINTABLEROT[LeapMotionConstants::MaxHands][LeapMotionConstants::MaxPointablesPerHand] = {0};
-U32 LeapMotionManager::LM_FRAME = 0;
-
-//-----------------------------------------------------------------------------
-
-LeapMotionManager::LeapMotionManager()
-{
-    // Initialize the console variables
-    staticInit();
-
-    // Create our controller and listener
-    mListener = new MotionListener();
-    mController = new Leap::Controller();
-    mController->addListener(*mListener);
-
-    // Allocate a mutex to use later
-    mActiveMutex = Mutex::createMutex();
-
-    // Nothing is ready yet
-    mEnabled = false;
-    mActive = false;
-    mMouseControl = false;
-    mMinCircleProgress = 0.0;
-}
-
-//-----------------------------------------------------------------------------
-
-LeapMotionManager::~LeapMotionManager()
-{
-    // Disable and delete internal members
-    disable();
-
-    // Get rid of the mutex
-    Mutex::destroyMutex(mActiveMutex);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::staticInit()
-{
-    // If true, the Leap Motion device will be enabled, if present
-    Con::addVariable("pref::LeapMotion::EnableDevice", TypeBool, &smEnableDevice);
-   
-    // Indicates that events for each hand and pointable will be created.
-    Con::addVariable("LeapMotion::GenerateIndividualEvents", TypeBool, &smGenerateIndividualEvents);
-      
-	// Indicates that we track hand IDs and will ensure that the same hand will remain at the same index between frames.   
-    Con::addVariable("LeapMotion::KeepHandIndexPersistent", TypeBool, &smKeepHandIndexPersistent);
-    
-	// Indicates that we track pointable IDs and will ensure that the same pointable will remain at the same index between frames.   
-    Con::addVariable("LeapMotion::KeepPointableIndexPersistent", TypeBool, &smKeepPointableIndexPersistent);
-    
-	// If true, broadcast single hand rotation as axis events.
-    Con::addVariable("LeapMotion::GenerateSingleHandRotationAsAxisEvents", TypeBool, &smGenerateSingleHandRotationAsAxisEvents);
-    
-	// The maximum hand angle when used as an axis event as measured from a vector pointing straight up (in degrees).
-    // Shoud range from 0 to 90 degrees.   
-    Con::addVariable("LeapMotion::MaximumHandAxisAngle", TypeF32, &smMaximumHandAxisAngle);
-    
-    // Indicates that a whole frame event should be generated and frames should be buffered.
-    Con::addVariable("LeapMotion::GenerateWholeFrameEvents", TypeBool, &smGenerateWholeFrameEvents);   
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::enable(bool enabledState)
-{
-    Mutex::lockMutex(mActiveMutex);
-    mEnabled = enabledState;
-    Mutex::unlockMutex(mActiveMutex);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::disable()
-{
-    if (mController)
-    {
-        delete mController;
-        mController = NULL;
-
-        if (mListener)
-        {
-            delete mListener;
-            mListener = NULL;
-        }
-    }
-
-    setActive(false);
-    mEnabled = false;
-}
-
-//-----------------------------------------------------------------------------
-
-bool LeapMotionManager::getActive()
-{
-    Mutex::lockMutex(mActiveMutex);
-    bool active = mActive;
-    Mutex::unlockMutex(mActiveMutex);
-
-    return active;
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::setActive(bool state)
-{
-    Mutex::lockMutex(mActiveMutex);
-    mActive = state;
-    Mutex::unlockMutex(mActiveMutex);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::toggleMouseControl(bool enabledState)
-{
-    Mutex::lockMutex(mActiveMutex);
-    mMouseControl = enabledState;
-    Mutex::unlockMutex(mActiveMutex);
-}
-
-//-----------------------------------------------------------------------------
-
-bool LeapMotionManager::getMouseControlToggle()
-{
-    Mutex::lockMutex(mActiveMutex);
-    bool mouseControlled = mMouseControl;
-    Mutex::unlockMutex(mActiveMutex);
-
-    return mouseControlled;
-}
-
-//-----------------------------------------------------------------------------
-// You can get and set gesture configuration parameters using the Config object
-// obtained from a connected Controller object. The key strings required to
-// * identify a configuration parameter include:
-//*
-//* Key string | Value type | Default value | Units
-//* -----------|------------|---------------|------
-//* Gesture.Circle.MinRadius | float | 5.0 | mm
-//* Gesture.Circle.MinArc | float | 1.5 | radians
-//* Gesture.Swipe.MinLength | float | 150 | mm
-//* Gesture.Swipe.MinVelocity | float | 1000 | mm/s
-//* Gesture.KeyTap.MinDownVelocity | float | 50 | mm/s
-//* Gesture.KeyTap.HistorySeconds | float | 0.1 | s
-//* Gesture.KeyTap.MinDistance | float | 3.0 | mm
-//* Gesture.ScreenTap.MinForwardVelocity  | float | 50 | mm/s
-//* Gesture.ScreenTap.HistorySeconds | float | 0.1 | s
-//* Gesture.ScreenTap.MinDistance | float | 5.0 | mm
-bool LeapMotionManager::configureLeapGesture(const char* configString, const F32 value)
-{
-    // Get this controller's config.
-    Leap::Config config = mController->config();
-    
-    // Convert and pass the key, along with the value.
-    std::string *keyString = new std::string(configString);
-    bool success = config.setFloat(*keyString, value);
-    
-    // Free memory and return the result.
-    delete keyString;
-    return success;
-}
-
-//-----------------------------------------------------------------------------
-
-bool LeapMotionManager::setMinCircleProgress(const F32 value)
-{
-    mMinCircleProgress = value;
-    return true;
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::processHand(const Leap::Hand& hand, S32 id)
-{
-    // Get hand (palm) position
-    /*Point3F rawHandPosition;
-    Point3I convertedHandPosition;
-    
-    LeapMotionUtil::convertPosition(hand.palmPosition(), rawHandPosition);
-    convertedHandPosition.x = (S32)mFloor(rawHandPosition.x);
-    convertedHandPosition.y = (S32)mFloor(rawHandPosition.y);
-    convertedHandPosition.z = (S32)mFloor(rawHandPosition.z);*/
-
-    // Get the hand's normal vector and direction
-    const Leap::Vector normal = hand.palmNormal();
-    const Leap::Vector direction = hand.direction();
-
-    F32 pitch = direction.pitch() * Leap::RAD_TO_DEG;
-    F32 roll = normal.roll() * Leap::RAD_TO_DEG;
-    F32 yaw = direction.yaw() * Leap::RAD_TO_DEG;
-
-    // Position Event
-    InputEvent handPosEvent;
-
-    handPosEvent.deviceInst = 0;
-    handPosEvent.iValue = id;
-    handPosEvent.fValues[0] = hand.palmPosition().x;
-    handPosEvent.fValues[1] = hand.palmPosition().y;
-    handPosEvent.fValues[2] = hand.palmPosition().z;
-    handPosEvent.deviceType = LeapMotionDeviceType;
-    handPosEvent.objType = LM_HANDPOS;
-    handPosEvent.objInst = 0;
-    handPosEvent.action = SI_LEAP;
-    handPosEvent.modifier = 0;
-
-    InputEvent handRotEvent;
-
-    handRotEvent.deviceInst = 0;
-    handRotEvent.iValue = id;
-    handRotEvent.fValues[0] = yaw;
-    handRotEvent.fValues[1] = pitch;
-    handRotEvent.fValues[2] = roll;
-    handRotEvent.objType = LM_HANDROT;
-    handRotEvent.deviceType = LeapMotionDeviceType;
-    handRotEvent.objInst = 0;
-    handRotEvent.action = SI_LEAP;
-    handRotEvent.modifier = 0;
-
-    Game->postEvent(handPosEvent);
-    Game->postEvent(handRotEvent);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::processHandPointables(const Leap::PointableList& pointables)
-{
-    InputEvent pointablePositionEvent;
-    pointablePositionEvent.deviceInst = 0;
-    pointablePositionEvent.objInst = 0;
-    pointablePositionEvent.modifier = 0;
-    pointablePositionEvent.deviceType = LeapMotionDeviceType;
-    pointablePositionEvent.objType = LM_FINGERPOS;    
-    pointablePositionEvent.action = SI_LEAP;
-    
-    for (int f = 0; f < pointables.count(); ++f)
-    {
-        Leap::Pointable pointable = pointables[f];
-        
-        char charHolder[10];
-        Leap::Vector tipPosition = pointables[f].tipPosition();
-
-        dItoa((S32)tipPosition.x, charHolder);
-        dStrcat(pointablePositionEvent.fingersX, charHolder);
-        dStrcat(pointablePositionEvent.fingersX, " ");
-
-        dItoa((S32)tipPosition.y, charHolder);
-        dStrcat(pointablePositionEvent.fingersY, charHolder);
-        dStrcat(pointablePositionEvent.fingersY, " ");
-
-        dItoa((S32)tipPosition.z, charHolder);
-        dStrcat(pointablePositionEvent.fingersZ, charHolder);
-        dStrcat(pointablePositionEvent.fingersZ, " ");
-
-        dItoa(pointables[f].id(), charHolder);
-        dStrcat(pointablePositionEvent.fingerIDs, charHolder);
-        dStrcat(pointablePositionEvent.fingerIDs, " ");        
-    }
-    
-    // Post
-    Game->postEvent(pointablePositionEvent);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::processGestures(const Leap::GestureList& gestures)
-{
-    for (int g = 0; g < gestures.count(); ++g)
-    {
-        Leap::Gesture gesture = gestures[g];
-
-        switch (gesture.type())
-        {
-            case Leap::Gesture::TYPE_CIRCLE:
-            {
-                Leap::CircleGesture circle = gesture;
-
-                if (circle.progress() < mMinCircleProgress)
-                    break;
-
-                bool clockWise;
-
-                if (circle.pointable().direction().angleTo(circle.normal()) <= Leap::PI/4) 
-                    clockWise = true;
-                else 
-                    clockWise = false;
-
-                InputEvent event;
-            
-                event.deviceInst = 0;
-                event.iValue = g;
-                event.fValues[0] = circle.progress();
-                event.fValues[1] = circle.radius();
-                event.fValues[2] = clockWise;
-                event.fValues[3] = (F32)circle.state();
-                event.deviceType = LeapMotionDeviceType;
-                event.objType = SI_CIRCLE_GESTURE;
-                event.objInst = 0;
-                event.action = SI_GESTURE;
-                event.modifier = 0;
-            
-                Game->postEvent(event);
-                break;
-            }
-            case Leap::Gesture::TYPE_SWIPE:
-            {
-                Leap::SwipeGesture swipe = gesture;
-
-                // Comment to post begin and update swipes
-                if (swipe.state() != Leap::Gesture::STATE_STOP)
-                {
-                    break;
-                }
-
-                InputEvent event;
-            
-                event.deviceInst = 0;
-                event.iValue = g;
-                event.fValues[0] = (F32)swipe.state();
-                event.fValues[1] = swipe.direction().x;
-                event.fValues[2] = swipe.direction().y;
-                event.fValues[3] = swipe.direction().z;
-                event.fValues[4] = swipe.speed();
-                event.deviceType = LeapMotionDeviceType;
-                event.objType = SI_SWIPE_GESTURE;
-                event.objInst = 0;
-                event.action = SI_GESTURE;
-                event.modifier = 0;
-            
-                Game->postEvent(event);
-                break;
-            }
-            case Leap::Gesture::TYPE_KEY_TAP:
-            {
-                Leap::KeyTapGesture tap = gesture;
-
-                InputEvent event;
-            
-                event.deviceInst = 0;
-                event.iValue = g;
-                event.fValues[0] = tap.position().x;
-                event.fValues[1] = tap.position().y;
-                event.fValues[2] = tap.position().z;
-                event.fValues[3] = tap.direction().x;
-                event.fValues[4] = tap.direction().y;
-                event.fValues[5] = tap.direction().z;
-                event.deviceType = LeapMotionDeviceType;
-                event.objType = SI_KEYTAP_GESTURE;
-                event.objInst = 0;
-                event.action = SI_GESTURE;
-                event.modifier = 0;
-            
-                Game->postEvent(event);
-                break;
-            }
-            case Leap::Gesture::TYPE_SCREEN_TAP:
-            {
-                Leap::ScreenTapGesture screentap = gesture;
-
-                InputEvent event;
-            
-                event.deviceInst = 0;
-                event.iValue = g;
-                event.fValues[0] = screentap.position().x;
-                event.fValues[1] = screentap.position().y;
-                event.fValues[2] = screentap.position().z;
-                event.fValues[3] = screentap.direction().x;
-                event.fValues[4] = screentap.direction().y;
-                event.fValues[5] = screentap.direction().z;
-                event.deviceType = LeapMotionDeviceType;
-                event.objType = SI_SCREENTAP_GESTURE;
-                event.objInst = 0;
-                event.action = SI_GESTURE;
-                event.modifier = 0;
-            
-                Game->postEvent(event);
-                break;
-            }
-            default:
-                Con::warnf("LeapMotionManager::process() - Unknown gesture detected");
-                break;
-        }
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::process(const Leap::Controller& controller)
-{
-    // Is the manager enabled?
-    if (!mEnabled)
-        return;
-
-    // Was the leap device activated
-    if (!getActive())
-        return;
-
-    // Get the current frame
-    const Leap::Frame frame = controller.frame();
-
-    if (!frame.isValid())
-        return;
-
-    mLastFrame = frame;
-
-    // Get gestures
-    const Leap::GestureList gestures = frame.gestures();
-
-    if (!gestures.isEmpty())
-        processGestures(gestures);
-
-    if (getMouseControlToggle())
-    {
-        generateMouseEvent(controller);
-        return;
-    }
-
-    // Is a hand present?
-    if ( !frame.hands().isEmpty() ) 
-    {
-        for (int h = 0; h < frame.hands().count(); ++h)
-        {
-            const Leap::Hand hand = frame.hands()[h];
-
-            processHand(hand, h);
-            
-        }
-    }
-    
-    if (frame.pointables().count())
-    {
-        const Leap::PointableList pointables = frame.pointables();
-        
-        if (pointables.count())
-            processHandPointables(pointables);
-    }
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::generateMouseEvent(Leap::Controller const & controller)
-{
-    
-    const Leap::ScreenList screens = controller.locatedScreens();
-
-    // make sure we have a detected screen
-    if (screens.isEmpty())
-        return;
-
-    const Leap::Screen screen = screens[0];
-
-    // find the first finger or tool
-    const Leap::Frame frame = controller.frame();
-    const Leap::HandList hands = frame.hands();
-
-    if (hands.isEmpty())
-        return;
-
-    const Leap::PointableList pointables = hands[0].pointables();
-
-    if (pointables.isEmpty())
-        return;
-
-    const Leap::Pointable firstPointable = pointables[0];
-
-    // get x, y coordinates on the first screen
-    const Leap::Vector intersection = screen.intersect( firstPointable, true, 1.0f );
-
-    // if the user is not pointing at the screen all components of
-    // the returned vector will be Not A Number (NaN)
-    // isValid() returns true only if all components are finite
-    if (!intersection.isValid())
-        return;
-
-    F32 x = screen.widthPixels() * intersection.x;
-
-    // flip y coordinate to standard top-left origin
-    F32 y = screen.heightPixels() * (1.0f - intersection.y);
-
-    // Move the cursor
-    Point2I location((S32)x, (S32)y);
-    Canvas->setCursorPos(location);
-
-    // Build and postthe mouse event
-    MouseMoveEvent TorqueEvent;
-    TorqueEvent.xPos = (S32) location.x;
-    TorqueEvent.yPos = (S32) location.y;
-    Game->postEvent(TorqueEvent);
-}
-
-//-----------------------------------------------------------------------------
-
-Vector2 LeapMotionManager::getPointFromProjection(Point3F position)
-{
-    // Get the screen and projection
-    const Leap::Vector pointablePosition(position.x, position.y, position.z);
-    const Leap::Screen screen = mController->locatedScreens()[0];
-    const Leap::Vector projectedPosition = screen.project(pointablePosition, true, 1.0f);    
-
-    // if the user is not pointing at the screen all components of
-    // the returned vector will be Not A Number (NaN)
-    // isValid() returns true only if all components are finite
-    if (!projectedPosition.isValid())
-        return Vector2("");
-        
-    // Get the screen coordinates
-    F32 x = screen.widthPixels() * projectedPosition.x;
-        
-    // flip y coordinate to standard top-left origin
-    F32 y = screen.heightPixels() * (1.0f - projectedPosition.y);
-    
-    // Build the screenPosition and return it
-    Vector2 screenPosition;
-    screenPosition.x = x;
-    screenPosition.y = y;
-
-    return screenPosition;
-}
-
-//-----------------------------------------------------------------------------
-
-Vector2 LeapMotionManager::getPointFromIntersection(S32 pointableID)
-{
-    // Get the finger via ID and check for validity
-    Leap::Pointable lastPointable = mLastFrame.pointable(pointableID);
-
-    if (!lastPointable.isValid())
-        return Vector2("");
-
-    // Get the screen and intersection
-    const Leap::Screen screen = mController->locatedScreens()[0];
-    const Leap::Vector intersection = screen.intersect( lastPointable, true, 1.0f );
-    
-    // if the user is not pointing at the screen all components of
-    // the returned vector will be Not A Number (NaN)
-    // isValid() returns true only if all components are finite
-    if (!intersection.isValid())
-        return Vector2("");
-        
-    // Get the screen coordinates
-    F32 x = screen.widthPixels() * intersection.x;
-        
-    // flip y coordinate to standard top-left origin
-    F32 y = screen.heightPixels() * (1.0f - intersection.y);
-    
-    // Build the screenPosition and return it
-    Vector2 screenPosition;
-    screenPosition.x = x;
-    screenPosition.y = y;
-
-    return screenPosition;
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::MotionListener::onInit(const Leap::Controller& controller)
-{
-    //Con::printf("MotionListener::onInit()");
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::MotionListener::onFrame(const Leap::Controller& controller)
-{
-    gLeapMotionManager->process(controller);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::MotionListener::onConnect(const Leap::Controller& controller)
-{
-    gLeapMotionManager->setActive(true);
-    controller.enableGesture(Leap::Gesture::TYPE_CIRCLE);
-    controller.enableGesture(Leap::Gesture::TYPE_KEY_TAP);
-    controller.enableGesture(Leap::Gesture::TYPE_SCREEN_TAP);
-    controller.enableGesture(Leap::Gesture::TYPE_SWIPE);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::MotionListener::onDisconnect (const Leap::Controller& controller)
-{
-    gLeapMotionManager->setActive(false);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::MotionListener::onFocusGained(const Leap::Controller& controller)
-{
-    gLeapMotionManager->setActive(true);
-}
-
-//-----------------------------------------------------------------------------
-
-void LeapMotionManager::MotionListener::onFocusLost(const Leap::Controller& controller)
-{
-    gLeapMotionManager->setActive(false);
-}

+ 0 - 162
engine/source/input/leapMotion/leapMotionManager.h

@@ -1,162 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-#ifndef _LEAPMOTIONMANAGER_H_
-#define _LEAPMOTIONMANAGER_H_
-
-#ifndef _UTILITY_H_
-#include "2d/core/Utility.h"
-#endif
-
-#ifndef _LEAPMOTIONCONSTANTS_H_
-#include "input/leapMotion/leapMotionConstants.h"
-#endif
-
-#ifndef __Leap_h__
-#include "Leap.h"
-#endif
-
-
-class LeapMotionManager
-{
-protected:
-    
-    bool mEnabled;
-    F32 mMinCircleProgress;
-
-    struct FingerEvent
-    {
-        S32 id;
-        F32 x;
-        F32 y;
-        F32 z;
-
-        FingerEvent( S32 ID, F32 X, F32 Y, F32 Z)
-        {
-            id = ID;
-            x = X;
-            y = Y;
-            z = Z;
-        }
-    };
-
-    class MotionListener : public Leap::Listener
-    {
-    public:
-        MotionListener() {}
-        virtual ~MotionListener() {}
-
-        virtual void onConnect (const Leap::Controller& controller);
-        virtual void onDisconnect (const Leap::Controller& controller);
-        virtual void onInit(const Leap::Controller& controller);
-        virtual void onFrame(const Leap::Controller& controller);
-        virtual void onFocusGained(const Leap::Controller& controller);
-        virtual void onFocusLost(const Leap::Controller& controller);
-   };
-
-    /// The connection to the Leap Motion
-    Leap::Controller* mController;
-
-    /// Our Leap Motion listener class
-    MotionListener* mListener;
-
-    /// Used with the LM listener object
-    void* mActiveMutex;
-
-    /// Is the Leap Motion active
-    bool mActive;
-
-    /// Is the Manager acting like a mouse
-    bool mMouseControl;
-
-    /// Last stored frame
-    Leap::Frame mLastFrame;
-
-public:
-    static bool smEnableDevice;
-
-    // Indicates that events for each hand and pointable will be created
-    static bool smGenerateIndividualEvents;
-
-    // Indicates that we track hand IDs and will ensure that the same hand
-    // will remain at the same index between frames.
-    static bool smKeepHandIndexPersistent;
-
-    // Indicates that we track pointable IDs and will ensure that the same
-    // pointable will remain at the same index between frames.
-    static bool smKeepPointableIndexPersistent;
-
-    // Broadcast single hand rotation as axis
-    static bool smGenerateSingleHandRotationAsAxisEvents;
-
-    // The maximum hand angle when used as an axis event
-    // as measured from a vector pointing straight up (in degrees)
-    static F32 smMaximumHandAxisAngle;
-
-    // Indicates that a whole frame event should be generated and frames
-    // should be buffered.
-    static bool smGenerateWholeFrameEvents;
-
-    // Frame action codes
-    static U32 LM_FRAMEVALIDDATA;    // SI_BUTTON
-
-    // Hand action codes
-    static U32 LM_HAND[LeapMotionConstants::MaxHands];    // SI_POS
-    //static U32 LM_HANDROT[LeapMotionConstants::MaxHands]; // SI_ROT
-
-    static U32 LM_HANDAXISX;   // SI_AXIS
-    static U32 LM_HANDAXISY;
-
-    // Pointables action codes
-    static U32 LM_HANDPOINTABLE[LeapMotionConstants::MaxHands][LeapMotionConstants::MaxPointablesPerHand];    // SI_POS
-    static U32 LM_HANDPOINTABLEROT[LeapMotionConstants::MaxHands][LeapMotionConstants::MaxPointablesPerHand]; // SI_ROT
-
-    // Whole frame
-    static U32 LM_FRAME;    // SI_INT
-
-public:
-    LeapMotionManager();
-    ~LeapMotionManager();
-
-    static void staticInit();
-
-    void enable(bool enabledState);
-    void disable();
-    bool getEnabled() { return mEnabled; }
-    bool getActive();
-    void setActive(bool enabledState);
-    void toggleMouseControl(bool enabledState);
-    bool getMouseControlToggle();
-    bool setMinCircleProgress(const F32 value);
-    F32 getMinCircleProgress() { return mMinCircleProgress; }
-    bool configureLeapGesture(const char* configString, const F32 value);
-    void process(const Leap::Controller& controller);
-    void processHand(const Leap::Hand& hand, S32 id);
-    void processHandPointables(const Leap::PointableList& pointables);
-    void processGestures(const Leap::GestureList& gestures);
-    void generateMouseEvent(const Leap::Controller& controller);
-    Vector2 getPointFromProjection(Point3F position);
-    Vector2 getPointFromIntersection(S32 pointableID);
-};
-
-static LeapMotionManager* gLeapMotionManager;
-
-#endif

+ 0 - 109
engine/source/input/leapMotion/leapMotionUtil.cpp

@@ -1,109 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2012 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#include "input/leapMotion/leapMotionUtil.h"
-
-namespace LeapMotionUtil
-{
-
-void convertPosition(const Leap::Vector& inPosition, F32& x, F32& y, F32& z)
-{
-    // Convert to Torque coordinates.  The conversion is:
-    //
-    // Motion       Torque
-    // x y z   -->  x -z y
-    x = inPosition.x;    // x = x
-    y = -inPosition.z;   // y = -z
-    z = inPosition.y;    // z = y;
-}
-
-void convertPosition(const Leap::Vector& inPosition, Point3F& outPosition)
-{
-    // Convert to Torque coordinates.  The conversion is:
-    //
-    // Motion       Torque
-    // x y z   -->  x -z y
-    outPosition.x = inPosition.x;    // x = x
-    outPosition.y = -inPosition.z;   // y = -z
-    outPosition.z = inPosition.y;    // z = y;
-}
-
-void convertHandRotation(const Leap::Hand& hand, MatrixF& outRotation)
-{
-    // We need to convert from Motion coordinates to
-    // Torque coordinates.  The conversion is:
-    //
-    // Motion                       Torque
-    // a b c         a  b  c        a -c  b
-    // d e f   -->  -g -h -i  -->  -g  i -h
-    // g h i         d  e  f        d -f  e
-    const Leap::Vector& handToFingers = hand.direction();
-    Leap::Vector handFront = -handToFingers;
-    const Leap::Vector& handDown = hand.palmNormal();
-    Leap::Vector handUp = -handDown;
-    Leap::Vector handRight = handUp.cross(handFront);
-
-    outRotation.setColumn(0, Point4F(  handRight.x, -handRight.z,  handRight.y,  0.0f));
-    outRotation.setColumn(1, Point4F( -handFront.x,  handFront.z, -handFront.y,  0.0f));
-    outRotation.setColumn(2, Point4F(  handUp.x,    -handUp.z,     handUp.y,     0.0f));
-    outRotation.setPosition(Point3F::Zero);
-}
-
-void calculateHandAxisRotation(const MatrixF& handRotation, const F32& maxHandAxisRadius, Point2F& outRotation)
-{
-    const VectorF& controllerUp = handRotation.getUpVector();
-    outRotation.x = controllerUp.x;
-    outRotation.y = controllerUp.y;
-
-    // Limit the axis angle to that given to us
-    if (outRotation.len() > maxHandAxisRadius)
-    {
-        outRotation.normalize(maxHandAxisRadius);
-    }
-
-    // Renormalize to the range of 0..1
-    if (maxHandAxisRadius != 0.0f)
-    {
-        outRotation /= maxHandAxisRadius;
-    }
-}
-
-void convertPointableRotation(const Leap::Pointable& pointable, MatrixF& outRotation)
-{
-    // We need to convert from Motion coordinates to
-    // Torque coordinates.  The conversion is:
-    //
-    // Motion                       Torque
-    // a b c         a  b  c        a -c  b
-    // d e f   -->  -g -h -i  -->  -g  i -h
-    // g h i         d  e  f        d -f  e
-    Leap::Vector pointableFront = -pointable.direction();
-    Leap::Vector pointableRight = Leap::Vector::up().cross(pointableFront);
-    Leap::Vector pointableUp = pointableFront.cross(pointableRight);
-
-    outRotation.setColumn(0, Point4F(  pointableRight.x, -pointableRight.z,  pointableRight.y,  0.0f));
-    outRotation.setColumn(1, Point4F( -pointableFront.x,  pointableFront.z, -pointableFront.y,  0.0f));
-    outRotation.setColumn(2, Point4F(  pointableUp.x,    -pointableUp.z,     pointableUp.y,     0.0f));
-    outRotation.setPosition(Point3F::Zero);
-}
-
-}

+ 0 - 48
engine/source/input/leapMotion/leapMotionUtil.h

@@ -1,48 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2012 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#ifndef _LEAPMOTIONUTIL_H_
-#define _LEAPMOTIONUTIL_H_
-
-#include "math/mPoint.h"
-#include "math/mMatrix.h"
-#include "Leap.h"
-
-namespace LeapMotionUtil
-{
-    /// Convert from a Leap Motion position to a Torque 3D position
-    void convertPosition(const Leap::Vector& inPosition, F32& x, F32& y, F32& z);
-
-    /// Convert from a Leap Motion position to a Torque 3D Point3F
-    void convertPosition(const Leap::Vector& inPosition, Point3F& outPosition);
-
-    /// Convert a Leap Motion hand's rotation to a Torque 3D matrix
-    void convertHandRotation(const Leap::Hand& hand, MatrixF& outRotation);
-
-    /// Calcualte a hand's rotation as if it were a thumb stick axis
-    void calculateHandAxisRotation(const MatrixF& handRotation, const F32& maxHandAxisRadius, Point2F& outRotation);
-
-    /// Convert a Leap Motion pointable's rotation to a Torque 3D matrix
-    void convertPointableRotation(const Leap::Pointable& pointable, MatrixF& outRotation);
-}
-
-#endif

+ 3 - 3
engine/source/network/serverQuery.cc

@@ -1445,7 +1445,7 @@ static void handleMasterServerListResponse( BitStream* stream, U32 key, U8 /*fla
    else
    else
    {
    {
       // Remove the packet we just received from the status list:
       // Remove the packet we just received from the status list:
-      for ( i = 0; i < gPacketStatusList.size(); i++ )
+      for ( i = 0; i < (U32)gPacketStatusList.size(); i++ )
       {
       {
          if ( gPacketStatusList[i].index == packetIndex )
          if ( gPacketStatusList[i].index == packetIndex )
          {
          {
@@ -1472,7 +1472,7 @@ static void handleExtendedMasterServerListResponse(BitStream* stream, U32 key, U
    U32 packetKey = gMasterServerPing.key;
    U32 packetKey = gMasterServerPing.key;
    if (gGotFirstListPacket)
    if (gGotFirstListPacket)
    {
    {
-      for (i = 0; i < gPacketStatusList.size(); i++)
+      for (i = 0; i < (U32)gPacketStatusList.size(); i++)
       {
       {
          if (gPacketStatusList[i].index == packetIndex)
          if (gPacketStatusList[i].index == packetIndex)
          {
          {
@@ -1537,7 +1537,7 @@ static void handleExtendedMasterServerListResponse(BitStream* stream, U32 key, U
    else
    else
    {
    {
       // Remove the packet we just received from the status list:
       // Remove the packet we just received from the status list:
-      for (i = 0; i < gPacketStatusList.size(); i++)
+      for (i = 0; i < (U32)gPacketStatusList.size(); i++)
       {
       {
          if ( gPacketStatusList[i].index == packetIndex )
          if ( gPacketStatusList[i].index == packetIndex )
          {
          {

+ 1 - 11
engine/source/platform/event.h

@@ -452,14 +452,6 @@ enum GestureCodes
     SI_SCALE_GESTURE     = 0x408
     SI_SCALE_GESTURE     = 0x408
 };
 };
 
 
-enum LeapMotionCodes
-{
-    LM_HANDAXIS          = 0x409,
-    LM_HANDROT           = 0x40A,
-    LM_HANDPOS           = 0x40B,
-    LM_FINGERPOS         = 0x40C,
-};
-
 /// Input device types
 /// Input device types
 enum InputDeviceTypes
 enum InputDeviceTypes
 {
 {
@@ -471,8 +463,7 @@ enum InputDeviceTypes
    XInputDeviceType,
    XInputDeviceType,
    ScreenTouchDeviceType,
    ScreenTouchDeviceType,
    AccelerometerDeviceType,
    AccelerometerDeviceType,
-   GyroscopeDeviceType,
-   LeapMotionDeviceType
+   GyroscopeDeviceType
 };
 };
 
 
 /// Device Event Action Types
 /// Device Event Action Types
@@ -491,7 +482,6 @@ enum InputDeviceTypes
 #define SI_TOUCH             0x0C
 #define SI_TOUCH             0x0C
 #define SI_GESTURE           0x0D
 #define SI_GESTURE           0x0D
 #define SI_MOTION            0x0F
 #define SI_MOTION            0x0F
-#define SI_LEAP              0x11
 
 
 /// Event SubTypes
 /// Event SubTypes
 #define SI_ANY       0xff
 #define SI_ANY       0xff