mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:58:56 +02:00
Working on getting the head translation, too.
This commit is contained in:
parent
f83254882a
commit
ada2594ad1
3 changed files with 18 additions and 5 deletions
|
@ -3831,6 +3831,7 @@ void Application::resetSensors() {
|
||||||
_mouseY = _glWidget->height() / 2;
|
_mouseY = _glWidget->height() / 2;
|
||||||
|
|
||||||
_faceshift.reset();
|
_faceshift.reset();
|
||||||
|
_visage.reset();
|
||||||
|
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
OculusManager::reset();
|
OculusManager::reset();
|
||||||
|
|
|
@ -24,11 +24,15 @@ namespace VisageSDK {
|
||||||
|
|
||||||
using namespace VisageSDK;
|
using namespace VisageSDK;
|
||||||
|
|
||||||
|
const glm::vec3 DEFAULT_HEAD_ORIGIN(0.0f, 0.0f, 0.3f);
|
||||||
|
|
||||||
Visage::Visage() :
|
Visage::Visage() :
|
||||||
_active(false) {
|
_active(false),
|
||||||
|
_headOrigin(DEFAULT_HEAD_ORIGIN) {
|
||||||
#ifdef HAVE_VISAGE
|
#ifdef HAVE_VISAGE
|
||||||
switchToResourcesParentIfRequired();
|
switchToResourcesParentIfRequired();
|
||||||
initializeLicenseManager("resources/visage/license.vlc");
|
QByteArray licensePath = "resources/visage/license.vlc";
|
||||||
|
initializeLicenseManager(licensePath);
|
||||||
_tracker = new VisageTracker2("resources/visage/Facial Features Tracker - Asymmetric.cfg");
|
_tracker = new VisageTracker2("resources/visage/Facial Features Tracker - Asymmetric.cfg");
|
||||||
if (_tracker->trackFromCam()) {
|
if (_tracker->trackFromCam()) {
|
||||||
_data = new FaceData();
|
_data = new FaceData();
|
||||||
|
@ -52,10 +56,15 @@ Visage::~Visage() {
|
||||||
|
|
||||||
void Visage::update() {
|
void Visage::update() {
|
||||||
#ifdef HAVE_VISAGE
|
#ifdef HAVE_VISAGE
|
||||||
_active = (_tracker->getTrackingData(_data) == TRACK_STAT_OK);
|
_active = (_tracker && _tracker->getTrackingData(_data) == TRACK_STAT_OK);
|
||||||
if (!_active) {
|
if (!_active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_headRotation = glm::quat(glm::vec3(_data->faceRotation[0], _data->faceRotation[1], _data->faceRotation[2]));
|
_headRotation = glm::quat(glm::vec3(-_data->faceRotation[0], -_data->faceRotation[1], _data->faceRotation[2]));
|
||||||
|
_headTranslation = glm::vec3(_data->faceTranslation[0], _data->faceTranslation[1], _data->faceTranslation[2]) - _headOrigin;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Visage::reset() {
|
||||||
|
_headOrigin += _headTranslation;
|
||||||
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
|
||||||
namespace VisageSDK {
|
namespace VisageSDK {
|
||||||
class FaceData;
|
|
||||||
class VisageTracker2;
|
class VisageTracker2;
|
||||||
|
struct FaceData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles input from the Visage webcam feature tracking software.
|
/// Handles input from the Visage webcam feature tracking software.
|
||||||
|
@ -30,6 +30,7 @@ public:
|
||||||
const glm::vec3& getHeadTranslation() const { return _headTranslation; }
|
const glm::vec3& getHeadTranslation() const { return _headTranslation; }
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -39,6 +40,8 @@ private:
|
||||||
bool _active;
|
bool _active;
|
||||||
glm::quat _headRotation;
|
glm::quat _headRotation;
|
||||||
glm::vec3 _headTranslation;
|
glm::vec3 _headTranslation;
|
||||||
|
|
||||||
|
glm::vec3 _headOrigin;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__Visage__) */
|
#endif /* defined(__interface__Visage__) */
|
||||||
|
|
Loading…
Reference in a new issue