mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 21:42:31 +02:00
Stub Perception Neuron input plugin
This commit is contained in:
parent
f55445bb88
commit
dcde640acd
6 changed files with 198 additions and 0 deletions
7
interface/resources/controllers/neuron.json
Normal file
7
interface/resources/controllers/neuron.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "Neuron to Standard",
|
||||
"channels": [
|
||||
{ "from": "Hydra.LeftHand", "to": "Standard.LeftHand" },
|
||||
{ "from": "Hydra.RightHand", "to": "Standard.RightHand" }
|
||||
]
|
||||
}
|
13
plugins/neuron/CMakeLists.txt
Normal file
13
plugins/neuron/CMakeLists.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# Created by Anthony Thibault on 2015/12/18
|
||||
# Copyright 2015 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
|
||||
#
|
||||
|
||||
set(TARGET_NAME neuron)
|
||||
setup_hifi_plugin(Script Qml Widgets)
|
||||
link_hifi_libraries(shared controllers plugins input-plugins)
|
||||
# target_neuron()
|
||||
|
75
plugins/neuron/src/NeuronPlugin.cpp
Normal file
75
plugins/neuron/src/NeuronPlugin.cpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
//
|
||||
// NeuronPlugin.h
|
||||
// input-plugins/src/input-plugins
|
||||
//
|
||||
// Created by Anthony Thibault on 12/18/2015.
|
||||
// Copyright 2015 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 "NeuronPlugin.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <PathUtils.h>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(inputplugins)
|
||||
Q_LOGGING_CATEGORY(inputplugins, "hifi.inputplugins")
|
||||
|
||||
const QString NeuronPlugin::NAME = "Neuron";
|
||||
const QString NeuronPlugin::NEURON_ID_STRING = "Perception Neuron";
|
||||
|
||||
bool NeuronPlugin::isSupported() const {
|
||||
// TODO:
|
||||
return true;
|
||||
}
|
||||
|
||||
void NeuronPlugin::activate() {
|
||||
// TODO:
|
||||
qCDebug(inputplugins) << "NeuronPlugin::activate";
|
||||
}
|
||||
|
||||
void NeuronPlugin::deactivate() {
|
||||
// TODO:
|
||||
qCDebug(inputplugins) << "NeuronPlugin::deactivate";
|
||||
}
|
||||
|
||||
void NeuronPlugin::pluginUpdate(float deltaTime, bool jointsCaptured) {
|
||||
// TODO:
|
||||
qCDebug(inputplugins) << "NeuronPlugin::pluginUpdate";
|
||||
}
|
||||
|
||||
void NeuronPlugin::saveSettings() const {
|
||||
// TODO:
|
||||
qCDebug(inputplugins) << "NeuronPlugin::saveSettings";
|
||||
}
|
||||
|
||||
void NeuronPlugin::loadSettings() {
|
||||
// TODO:
|
||||
qCDebug(inputplugins) << "NeuronPlugin::loadSettings";
|
||||
}
|
||||
|
||||
controller::Input::NamedVector NeuronPlugin::InputDevice::getAvailableInputs() const {
|
||||
// TODO:
|
||||
static const controller::Input::NamedVector availableInputs {
|
||||
makePair(controller::LEFT_HAND, "LeftHand"),
|
||||
makePair(controller::RIGHT_HAND, "RightHand")
|
||||
};
|
||||
return availableInputs;
|
||||
}
|
||||
|
||||
QString NeuronPlugin::InputDevice::getDefaultMappingConfig() const {
|
||||
static const QString MAPPING_JSON = PathUtils::resourcesPath() + "/controllers/neuron.json";
|
||||
return MAPPING_JSON;
|
||||
}
|
||||
|
||||
void NeuronPlugin::InputDevice::update(float deltaTime, bool jointsCaptured) {
|
||||
// TODO:
|
||||
qCDebug(inputplugins) << "NeuronPlugin::InputDevice::update";
|
||||
}
|
||||
|
||||
void NeuronPlugin::InputDevice::focusOutEvent() {
|
||||
// TODO:
|
||||
qCDebug(inputplugins) << "NeuronPlugin::InputDevice::focusOutEvent";
|
||||
}
|
57
plugins/neuron/src/NeuronPlugin.h
Normal file
57
plugins/neuron/src/NeuronPlugin.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
//
|
||||
// NeuronPlugin.h
|
||||
// input-plugins/src/input-plugins
|
||||
//
|
||||
// Created by Anthony Thibault on 12/18/2015.
|
||||
// Copyright 2015 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_NeuronPlugin_h
|
||||
#define hifi_NeuronPlugin_h
|
||||
|
||||
#include <controllers/InputDevice.h>
|
||||
#include <controllers/StandardControls.h>
|
||||
#include <plugins/InputPlugin.h>
|
||||
|
||||
// Handles interaction with the Neuron SDK
|
||||
class NeuronPlugin : public InputPlugin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
// Plugin functions
|
||||
virtual bool isSupported() const override;
|
||||
virtual bool isJointController() const override { return true; }
|
||||
const QString& getName() const override { return NAME; }
|
||||
const QString& getID() const override { return NEURON_ID_STRING; }
|
||||
|
||||
virtual void activate() override;
|
||||
virtual void deactivate() override;
|
||||
|
||||
virtual void pluginFocusOutEvent() override { _inputDevice->focusOutEvent(); }
|
||||
virtual void pluginUpdate(float deltaTime, bool jointsCaptured) override;
|
||||
|
||||
virtual void saveSettings() const override;
|
||||
virtual void loadSettings() override;
|
||||
|
||||
private:
|
||||
class InputDevice : public controller::InputDevice {
|
||||
public:
|
||||
InputDevice() : controller::InputDevice("Neuron") {}
|
||||
|
||||
// Device functions
|
||||
virtual controller::Input::NamedVector getAvailableInputs() const override;
|
||||
virtual QString getDefaultMappingConfig() const override;
|
||||
virtual void update(float deltaTime, bool jointsCaptured) override;
|
||||
virtual void focusOutEvent() override;
|
||||
};
|
||||
|
||||
std::shared_ptr<InputDevice> _inputDevice { std::make_shared<InputDevice>() };
|
||||
|
||||
static const QString NAME;
|
||||
static const QString NEURON_ID_STRING;
|
||||
};
|
||||
|
||||
#endif // hifi_NeuronPlugin_h
|
||||
|
45
plugins/neuron/src/NeuronProvider.cpp
Normal file
45
plugins/neuron/src/NeuronProvider.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// Created by Anthony Thibault on 2015/12/18
|
||||
// Copyright 2015 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 "NeuronPlugin.h"
|
||||
|
||||
class NeuronProvider : public QObject, public InputProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID InputProvider_iid FILE "plugin.json")
|
||||
Q_INTERFACES(InputProvider)
|
||||
|
||||
public:
|
||||
NeuronProvider(QObject* parent = nullptr) : QObject(parent) {}
|
||||
virtual ~NeuronProvider() {}
|
||||
|
||||
virtual InputPluginList getInputPlugins() override {
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [&] {
|
||||
InputPluginPointer plugin(new NeuronPlugin());
|
||||
if (plugin->isSupported()) {
|
||||
_inputPlugins.push_back(plugin);
|
||||
}
|
||||
});
|
||||
return _inputPlugins;
|
||||
}
|
||||
|
||||
private:
|
||||
InputPluginList _inputPlugins;
|
||||
};
|
||||
|
||||
#include "NeuronProvider.moc"
|
1
plugins/neuron/src/plugin.json
Normal file
1
plugins/neuron/src/plugin.json
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
Loading…
Reference in a new issue