Switched meFaceshifto DependencyManager for Faceshift

This commit is contained in:
Atlante45 2014-12-14 19:56:42 -08:00
parent 39a19a297f
commit 1db3592d4c
3 changed files with 12 additions and 11 deletions

View file

@ -55,6 +55,7 @@
#include <AddressManager.h> #include <AddressManager.h>
#include <AccountManager.h> #include <AccountManager.h>
#include <AudioInjector.h> #include <AudioInjector.h>
#include <DependencyManager.h>
#include <EntityScriptingInterface.h> #include <EntityScriptingInterface.h>
#include <HFActionEvent.h> #include <HFActionEvent.h>
#include <HFBackEvent.h> #include <HFBackEvent.h>
@ -1690,8 +1691,10 @@ int Application::getMouseDragStartedY() const {
} }
FaceTracker* Application::getActiveFaceTracker() { FaceTracker* Application::getActiveFaceTracker() {
Faceshift* faceshift = DependencyManager::get<Faceshift>();
return (_dde.isActive() ? static_cast<FaceTracker*>(&_dde) : return (_dde.isActive() ? static_cast<FaceTracker*>(&_dde) :
(_faceshift.isActive() ? static_cast<FaceTracker*>(&_faceshift) : (faceshift->isActive() ? static_cast<FaceTracker*>(faceshift) :
(_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL))); (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL)));
} }
@ -1976,7 +1979,7 @@ void Application::init() {
#endif #endif
// initialize our face trackers after loading the menu settings // initialize our face trackers after loading the menu settings
_faceshift.init(); DependencyManager::get<Faceshift>()->init();
_visage.init(); _visage.init();
Leapmotion::init(); Leapmotion::init();
@ -2101,13 +2104,13 @@ void Application::updateMouseRay() {
void Application::updateFaceshift() { void Application::updateFaceshift() {
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); PerformanceWarning warn(showWarnings, "Application::updateFaceshift()");
Faceshift* faceshift = DependencyManager::get<Faceshift>();
// Update faceshift // Update faceshift
_faceshift.update(); faceshift->update();
// Copy angular velocity if measured by faceshift, to the head // Copy angular velocity if measured by faceshift, to the head
if (_faceshift.isActive()) { if (faceshift->isActive()) {
_myAvatar->getHead()->setAngularVelocity(_faceshift.getHeadAngularVelocity()); _myAvatar->getHead()->setAngularVelocity(faceshift->getHeadAngularVelocity());
} }
} }
@ -3549,7 +3552,7 @@ void Application::deleteVoxelAt(const VoxelDetail& voxel) {
} }
void Application::resetSensors() { void Application::resetSensors() {
_faceshift.reset(); DependencyManager::get<Faceshift>()->reset();
_visage.reset(); _visage.reset();
_dde.reset(); _dde.reset();

View file

@ -220,8 +220,7 @@ public:
int getMouseDragStartedY() const; int getMouseDragStartedY() const;
int getTrueMouseDragStartedX() const { return _mouseDragStartedX; } int getTrueMouseDragStartedX() const { return _mouseDragStartedX; }
int getTrueMouseDragStartedY() const { return _mouseDragStartedY; } int getTrueMouseDragStartedY() const { return _mouseDragStartedY; }
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated;; } bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
Faceshift* getFaceshift() { return &_faceshift; }
Visage* getVisage() { return &_visage; } Visage* getVisage() { return &_visage; }
DdeFaceTracker* getDDE() { return &_dde; } DdeFaceTracker* getDDE() { return &_dde; }
FaceTracker* getActiveFaceTracker(); FaceTracker* getActiveFaceTracker();
@ -532,7 +531,6 @@ private:
AvatarManager _avatarManager; AvatarManager _avatarManager;
MyAvatar* _myAvatar; // TODO: move this and relevant code to AvatarManager (or MyAvatar as the case may be) MyAvatar* _myAvatar; // TODO: move this and relevant code to AvatarManager (or MyAvatar as the case may be)
Faceshift _faceshift;
Visage _visage; Visage _visage;
DdeFaceTracker _dde; DdeFaceTracker _dde;

View file

@ -24,7 +24,7 @@
#include "FaceTracker.h" #include "FaceTracker.h"
/// Handles interaction with the Faceshift software, which provides head position/orientation and facial features. /// Handles interaction with the Faceshift software, which provides head position/orientation and facial features.
class Faceshift : public FaceTracker { class Faceshift : public FaceTracker, public DependencyManager::Dependency {
Q_OBJECT Q_OBJECT
public: public: