3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 23:35:33 +02:00

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

View file

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

View file

@ -24,7 +24,7 @@
#include "FaceTracker.h"
/// 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
public: