mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 13:12:39 +02:00
Set up Leap Motion plugin container
This commit is contained in:
parent
a8501a7ac6
commit
9c431a11af
7 changed files with 141 additions and 4 deletions
8
interface/external/leapmotion/readme.txt
vendored
8
interface/external/leapmotion/readme.txt
vendored
|
@ -10,7 +10,7 @@ Interface has been tested with SDK versions:
|
|||
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.
|
||||
|
||||
The files neeeded in the folders are:
|
||||
The files needed in the folders are:
|
||||
|
||||
include/
|
||||
- Leap.h
|
||||
|
@ -21,8 +21,8 @@ Interface has been tested with SDK versions:
|
|||
x86/
|
||||
- Leap.dll
|
||||
- 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)
|
||||
- mscvcp120.dll (optional if you already have the Msdev 2012 SDK redistributable installed)
|
||||
- mscvcr120.dll (optional if you already have the Msdev 2012 SDK redistributable installed)
|
||||
- lipLeap.dylib
|
||||
libc++/
|
||||
-libLeap.dylib
|
||||
|
@ -30,4 +30,4 @@ Interface has been tested with SDK versions:
|
|||
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).
|
||||
|
||||
2. Clear your build directory, run cmake and build, and you should be all set.
|
||||
2. Clear your build directory, run cmake and build, and you should be all set.
|
||||
|
|
|
@ -30,6 +30,8 @@ if (NOT SERVER_ONLY AND NOT ANDROID)
|
|||
add_subdirectory(${DIR})
|
||||
set(DIR "steamClient")
|
||||
add_subdirectory(${DIR})
|
||||
set(DIR "hifiLeapMotion")
|
||||
add_subdirectory(${DIR})
|
||||
endif()
|
||||
|
||||
# server-side plugins
|
||||
|
|
16
plugins/hifiLeapMotion/CMakeLists.txt
Normal file
16
plugins/hifiLeapMotion/CMakeLists.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# Created by David Rowe on 15 Jun 2017.
|
||||
# Copyright 2017 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
|
||||
#
|
||||
|
||||
if (WIN32)
|
||||
find_package(LEAPMOTION)
|
||||
if (LEAPMOTION_FOUND)
|
||||
set(TARGET_NAME hifiLeapMotion)
|
||||
setup_hifi_plugin(Script Qml Widgets)
|
||||
link_hifi_libraries(shared controllers ui plugins input-plugins)
|
||||
endif()
|
||||
endif()
|
25
plugins/hifiLeapMotion/src/LeapMotionPlugin.cpp
Normal file
25
plugins/hifiLeapMotion/src/LeapMotionPlugin.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// LeapMotionPlugin.cpp
|
||||
//
|
||||
// Created by David Rowe on 15 Jun 2017.
|
||||
// Copyright 2017 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 "LeapMotionPlugin.h"
|
||||
|
||||
const char* LeapMotionPlugin::NAME = "Leap Motion";
|
||||
|
||||
void LeapMotionPlugin::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
controller::Input::NamedVector LeapMotionPlugin::InputDevice::getAvailableInputs() const {
|
||||
static controller::Input::NamedVector availableInputs;
|
||||
|
||||
// TODO
|
||||
|
||||
return availableInputs;
|
||||
}
|
42
plugins/hifiLeapMotion/src/LeapMotionPlugin.h
Normal file
42
plugins/hifiLeapMotion/src/LeapMotionPlugin.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// LeapMotionPlugin.h
|
||||
//
|
||||
// Created by David Rowe on 15 Jun 2017.
|
||||
// Copyright 2017 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_LeapMotionPlugin_h
|
||||
#define hifi_LeapMotionPlugin_h
|
||||
|
||||
#include <controllers/InputDevice.h>
|
||||
#include <plugins/InputPlugin.h>
|
||||
|
||||
class LeapMotionPlugin : public InputPlugin {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
virtual const QString getName() const override { return NAME; }
|
||||
|
||||
virtual void pluginFocusOutEvent() override { _inputDevice->focusOutEvent(); }
|
||||
virtual void pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) override;
|
||||
|
||||
protected:
|
||||
static const char* NAME;
|
||||
|
||||
class InputDevice : public controller::InputDevice {
|
||||
public:
|
||||
friend class LeapMotionPlugin;
|
||||
|
||||
InputDevice() : controller::InputDevice("Leap Motion") {}
|
||||
|
||||
// Device functions
|
||||
virtual controller::Input::NamedVector getAvailableInputs() const override;
|
||||
};
|
||||
|
||||
std::shared_ptr<InputDevice> _inputDevice{ std::make_shared<InputDevice>() };
|
||||
};
|
||||
|
||||
#endif // hifi_LeapMotionPlugin_h
|
51
plugins/hifiLeapMotion/src/LeapMotionProvider.cpp
Normal file
51
plugins/hifiLeapMotion/src/LeapMotionProvider.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// LeapMotionProvider.cpp
|
||||
//
|
||||
// Created by David Rowe on 15 Jun 2017.
|
||||
// Copyright 2017 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 <mutex>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
#include <plugins/RuntimePlugin.h>
|
||||
#include <plugins/InputPlugin.h>
|
||||
|
||||
#include "LeapMotionPlugin.h"
|
||||
|
||||
class LeapMotionProvider : public QObject, public InputProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID InputProvider_iid FILE "plugin.json")
|
||||
Q_INTERFACES(InputProvider)
|
||||
|
||||
public:
|
||||
LeapMotionProvider(QObject* parent = nullptr) : QObject(parent) {}
|
||||
virtual ~LeapMotionProvider() {}
|
||||
|
||||
virtual InputPluginList getInputPlugins() override {
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [&] {
|
||||
InputPluginPointer plugin(new LeapMotionPlugin());
|
||||
if (plugin->isSupported()) {
|
||||
_inputPlugins.push_back(plugin);
|
||||
}
|
||||
});
|
||||
return _inputPlugins;
|
||||
}
|
||||
|
||||
virtual void destroyInputPlugins() override {
|
||||
_inputPlugins.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
InputPluginList _inputPlugins;
|
||||
};
|
||||
|
||||
#include "LeapMotionProvider.moc"
|
1
plugins/hifiLeapMotion/src/plugin.json
Normal file
1
plugins/hifiLeapMotion/src/plugin.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"name":"Leap Motion"}
|
Loading…
Reference in a new issue