Set up Leap Motion plugin container

This commit is contained in:
David Rowe 2017-06-15 17:50:07 +12:00
parent a8501a7ac6
commit 9c431a11af
7 changed files with 141 additions and 4 deletions

View file

@ -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

View file

@ -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

View 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()

View 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;
}

View 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

View 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"

View file

@ -0,0 +1 @@
{"name":"Leap Motion"}