mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Moved visage and dde over to DependencyManager
This commit is contained in:
parent
65094f2165
commit
738f23f326
7 changed files with 39 additions and 33 deletions
|
@ -77,11 +77,13 @@
|
|||
#include "ModelUploader.h"
|
||||
#include "Util.h"
|
||||
|
||||
#include "devices/DdeFaceTracker.h"
|
||||
#include "devices/Faceshift.h"
|
||||
#include "devices/Leapmotion.h"
|
||||
#include "devices/MIDIManager.h"
|
||||
#include "devices/OculusManager.h"
|
||||
#include "devices/TV3DManager.h"
|
||||
#include "devices/Visage.h"
|
||||
|
||||
#include "renderer/ProgramObject.h"
|
||||
#include "gpu/Batch.h"
|
||||
|
@ -1693,10 +1695,12 @@ int Application::getMouseDragStartedY() const {
|
|||
|
||||
FaceTracker* Application::getActiveFaceTracker() {
|
||||
Faceshift* faceshift = DependencyManager::get<Faceshift>();
|
||||
Visage* visage = DependencyManager::get<Visage>();
|
||||
DdeFaceTracker* dde = DependencyManager::get<DdeFaceTracker>();
|
||||
|
||||
return (_dde.isActive() ? static_cast<FaceTracker*>(&_dde) :
|
||||
return (dde->isActive() ? static_cast<FaceTracker*>(dde) :
|
||||
(faceshift->isActive() ? static_cast<FaceTracker*>(faceshift) :
|
||||
(_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL)));
|
||||
(visage->isActive() ? static_cast<FaceTracker*>(visage) : NULL)));
|
||||
}
|
||||
|
||||
struct SendVoxelsOperationArgs {
|
||||
|
@ -1981,7 +1985,7 @@ void Application::init() {
|
|||
|
||||
// initialize our face trackers after loading the menu settings
|
||||
DependencyManager::get<Faceshift>()->init();
|
||||
_visage.init();
|
||||
DependencyManager::get<Visage>()->init();
|
||||
|
||||
Leapmotion::init();
|
||||
|
||||
|
@ -2120,7 +2124,7 @@ void Application::updateVisage() {
|
|||
PerformanceWarning warn(showWarnings, "Application::updateVisage()");
|
||||
|
||||
// Update Visage
|
||||
_visage.update();
|
||||
DependencyManager::get<Visage>()->update();
|
||||
}
|
||||
|
||||
void Application::updateDDE() {
|
||||
|
@ -2128,7 +2132,7 @@ void Application::updateDDE() {
|
|||
PerformanceWarning warn(showWarnings, "Application::updateDDE()");
|
||||
|
||||
// Update Cara
|
||||
_dde.update();
|
||||
DependencyManager::get<DdeFaceTracker>()->update();
|
||||
}
|
||||
|
||||
void Application::updateMyAvatarLookAtPosition() {
|
||||
|
@ -3554,8 +3558,8 @@ void Application::deleteVoxelAt(const VoxelDetail& voxel) {
|
|||
|
||||
void Application::resetSensors() {
|
||||
DependencyManager::get<Faceshift>()->reset();
|
||||
_visage.reset();
|
||||
_dde.reset();
|
||||
DependencyManager::get<Visage>()->reset();
|
||||
DependencyManager::get<DdeFaceTracker>()->reset();
|
||||
|
||||
OculusManager::reset();
|
||||
|
||||
|
|
|
@ -56,8 +56,6 @@
|
|||
#include "avatar/MyAvatar.h"
|
||||
#include "devices/PrioVR.h"
|
||||
#include "devices/SixenseManager.h"
|
||||
#include "devices/Visage.h"
|
||||
#include "devices/DdeFaceTracker.h"
|
||||
#include "entities/EntityTreeRenderer.h"
|
||||
#include "renderer/AmbientOcclusionEffect.h"
|
||||
#include "renderer/DeferredLightingEffect.h"
|
||||
|
@ -99,6 +97,7 @@ class QMouseEvent;
|
|||
class QSettings;
|
||||
class QWheelEvent;
|
||||
|
||||
class FaceTracker;
|
||||
class Node;
|
||||
class ProgramObject;
|
||||
|
||||
|
@ -220,8 +219,6 @@ public:
|
|||
int getTrueMouseDragStartedX() const { return _mouseDragStartedX; }
|
||||
int getTrueMouseDragStartedY() const { return _mouseDragStartedY; }
|
||||
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
|
||||
Visage* getVisage() { return &_visage; }
|
||||
DdeFaceTracker* getDDE() { return &_dde; }
|
||||
FaceTracker* getActiveFaceTracker();
|
||||
PrioVR* getPrioVR() { return &_prioVR; }
|
||||
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
|
||||
|
@ -530,9 +527,6 @@ private:
|
|||
AvatarManager _avatarManager;
|
||||
MyAvatar* _myAvatar; // TODO: move this and relevant code to AvatarManager (or MyAvatar as the case may be)
|
||||
|
||||
Visage _visage;
|
||||
DdeFaceTracker _dde;
|
||||
|
||||
PrioVR _prioVR;
|
||||
|
||||
Camera _myCamera; // My view onto the world
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include "Application.h"
|
||||
#include "AccountManager.h"
|
||||
#include "devices/Faceshift.h"
|
||||
#include "devices/OculusManager.h"
|
||||
#include "devices/Visage.h"
|
||||
#include "Menu.h"
|
||||
#include "scripting/LocationScriptingInterface.h"
|
||||
#include "scripting/MenuScriptingInterface.h"
|
||||
|
@ -51,7 +53,6 @@
|
|||
#include "ui/ModelsBrowser.h"
|
||||
#include "ui/LoginDialog.h"
|
||||
#include "ui/NodeBounds.h"
|
||||
#include "devices/OculusManager.h"
|
||||
|
||||
|
||||
Menu* Menu::_instance = NULL;
|
||||
|
@ -439,7 +440,7 @@ Menu::Menu() :
|
|||
#endif
|
||||
#ifdef HAVE_VISAGE
|
||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Visage, 0, false,
|
||||
appInstance->getVisage(), SLOT(updateEnabled()));
|
||||
DependencyManager::get<Visage>(), SLOT(updateEnabled()));
|
||||
#endif
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderSkeletonCollisionShapes);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <DependencyManager.h>
|
||||
#include <devices/Faceshift.h>
|
||||
#include <devices/DdeFaceTracker.h>
|
||||
#include <NodeList.h>
|
||||
|
||||
#include "Application.h"
|
||||
|
@ -77,11 +78,13 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) {
|
|||
// Only use face trackers when not playing back a recording.
|
||||
if (!myAvatar->isPlaying()) {
|
||||
FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker();
|
||||
if ((_isFaceshiftConnected = faceTracker)) {
|
||||
DdeFaceTracker* dde = DependencyManager::get<DdeFaceTracker>();
|
||||
Faceshift* faceshift = DependencyManager::get<Faceshift>();
|
||||
|
||||
if ((_isFaceshiftConnected = (faceshift == faceTracker))) {
|
||||
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
||||
_isFaceshiftConnected = true;
|
||||
} else if (Application::getInstance()->getDDE()->isActive()) {
|
||||
faceTracker = Application::getInstance()->getDDE();
|
||||
} else if (dde->isActive()) {
|
||||
faceTracker = dde;
|
||||
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,16 +14,14 @@
|
|||
|
||||
#include <QUdpSocket>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
|
||||
#include "FaceTracker.h"
|
||||
|
||||
class DdeFaceTracker : public FaceTracker {
|
||||
class DdeFaceTracker : public FaceTracker, public DependencyManager::Dependency {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DdeFaceTracker();
|
||||
DdeFaceTracker(const QHostAddress& host, quint16 port);
|
||||
~DdeFaceTracker();
|
||||
|
||||
//initialization
|
||||
void init();
|
||||
void reset();
|
||||
|
@ -57,6 +55,11 @@ private slots:
|
|||
void socketStateChanged(QAbstractSocket::SocketState socketState);
|
||||
|
||||
private:
|
||||
DdeFaceTracker();
|
||||
DdeFaceTracker(const QHostAddress& host, quint16 port);
|
||||
~DdeFaceTracker();
|
||||
friend DependencyManager;
|
||||
|
||||
float getBlendshapeCoefficient(int index) const;
|
||||
void decodePacket(const QByteArray& buffer);
|
||||
|
||||
|
|
|
@ -28,9 +28,6 @@ class Faceshift : public FaceTracker, public DependencyManager::Dependency {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Faceshift();
|
||||
virtual ~Faceshift() {}
|
||||
|
||||
void init();
|
||||
|
||||
bool isConnectedOrConnecting() const;
|
||||
|
@ -90,6 +87,9 @@ private slots:
|
|||
void readFromSocket();
|
||||
|
||||
private:
|
||||
Faceshift();
|
||||
virtual ~Faceshift() {}
|
||||
friend DependencyManager;
|
||||
|
||||
float getBlendshapeCoefficient(int index) const;
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include <QPair>
|
||||
#include <QVector>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
|
||||
#include "FaceTracker.h"
|
||||
|
||||
namespace VisageSDK {
|
||||
|
@ -24,14 +26,10 @@ namespace VisageSDK {
|
|||
}
|
||||
|
||||
/// Handles input from the Visage webcam feature tracking software.
|
||||
class Visage : public FaceTracker {
|
||||
class Visage : public FaceTracker, public DependencyManager::Dependency {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
Visage();
|
||||
virtual ~Visage();
|
||||
|
||||
void init();
|
||||
|
||||
bool isActive() const { return _active; }
|
||||
|
@ -44,6 +42,9 @@ public slots:
|
|||
void updateEnabled();
|
||||
|
||||
private:
|
||||
Visage();
|
||||
virtual ~Visage();
|
||||
friend DependencyManager;
|
||||
|
||||
#ifdef HAVE_VISAGE
|
||||
VisageSDK::VisageTracker2* _tracker;
|
||||
|
|
Loading…
Reference in a new issue