Detabbed.

This commit is contained in:
Andrzej Kapolka 2014-04-17 13:42:29 -07:00
parent a12b90c65b
commit 0a2670ea23
3 changed files with 29 additions and 29 deletions

View file

@ -3020,7 +3020,7 @@ void Application::resetSensors() {
_mouseX = _glWidget->width() / 2; _mouseX = _glWidget->width() / 2;
_mouseY = _glWidget->height() / 2; _mouseY = _glWidget->height() / 2;
_faceplus.reset(); _faceplus.reset();
_faceshift.reset(); _faceshift.reset();
_visage.reset(); _visage.reset();

View file

@ -41,15 +41,15 @@ void Faceplus::init() {
} }
void Faceplus::reset() { void Faceplus::reset() {
if (_enabled) { if (_enabled) {
QMetaObject::invokeMethod(_reader, "reset"); QMetaObject::invokeMethod(_reader, "reset");
} }
} }
void Faceplus::setState(const glm::vec3& headTranslation, const glm::quat& headRotation, void Faceplus::setState(const glm::vec3& headTranslation, const glm::quat& headRotation,
float estimatedEyePitch, float estimatedEyeYaw, const QVector<float>& blendshapeCoefficients) { float estimatedEyePitch, float estimatedEyeYaw, const QVector<float>& blendshapeCoefficients) {
_headTranslation = headTranslation; _headTranslation = headTranslation;
_headRotation = headRotation; _headRotation = headRotation;
_estimatedEyePitch = estimatedEyePitch; _estimatedEyePitch = estimatedEyePitch;
_estimatedEyeYaw = estimatedEyeYaw; _estimatedEyeYaw = estimatedEyeYaw;
_blendshapeCoefficients = blendshapeCoefficients; _blendshapeCoefficients = blendshapeCoefficients;
@ -211,23 +211,23 @@ void FaceplusReader::shutdown() {
void FaceplusReader::update() { void FaceplusReader::update() {
#ifdef HAVE_FACEPLUS #ifdef HAVE_FACEPLUS
float x, y, rotation, scale; float x, y, rotation, scale;
if (!(faceplus_synchronous_track() && faceplus_current_face_location(&x, &y, &rotation, &scale) && !glm::isnan(x) && if (!(faceplus_synchronous_track() && faceplus_current_face_location(&x, &y, &rotation, &scale) && !glm::isnan(x) &&
faceplus_current_output_vector(_outputVector.data()))) { faceplus_current_output_vector(_outputVector.data()))) {
QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection);
return; return;
} }
if (!_referenceInitialized) { if (!_referenceInitialized) {
_referenceX = x; _referenceX = x;
_referenceY = y; _referenceY = y;
_referenceScale = scale; _referenceScale = scale;
_referenceInitialized = true; _referenceInitialized = true;
} }
const float TRANSLATION_SCALE = 10.0f; const float TRANSLATION_SCALE = 10.0f;
const float REFERENCE_DISTANCE = 10.0f; const float REFERENCE_DISTANCE = 10.0f;
float depthScale = _referenceScale / scale; float depthScale = _referenceScale / scale;
float z = REFERENCE_DISTANCE * (depthScale - 1.0f); float z = REFERENCE_DISTANCE * (depthScale - 1.0f);
glm::vec3 headTranslation((x - _referenceX) * depthScale * TRANSLATION_SCALE, glm::vec3 headTranslation((x - _referenceX) * depthScale * TRANSLATION_SCALE,
(y - _referenceY) * depthScale * TRANSLATION_SCALE, z); (y - _referenceY) * depthScale * TRANSLATION_SCALE, z);
glm::quat headRotation(glm::radians(glm::vec3(-_outputVector.at(_headRotationIndices[0]), glm::quat headRotation(glm::radians(glm::vec3(-_outputVector.at(_headRotationIndices[0]),
_outputVector.at(_headRotationIndices[1]), -_outputVector.at(_headRotationIndices[2])))); _outputVector.at(_headRotationIndices[1]), -_outputVector.at(_headRotationIndices[2]))));
float estimatedEyePitch = (_outputVector.at(_leftEyeRotationIndices[0]) + float estimatedEyePitch = (_outputVector.at(_leftEyeRotationIndices[0]) +
@ -244,8 +244,8 @@ void FaceplusReader::update() {
} }
QMetaObject::invokeMethod(Application::getInstance()->getFaceplus(), "setState", Q_ARG(const glm::vec3&, headTranslation), QMetaObject::invokeMethod(Application::getInstance()->getFaceplus(), "setState", Q_ARG(const glm::vec3&, headTranslation),
Q_ARG(const glm::quat&, headRotation), Q_ARG(float, estimatedEyePitch), Q_ARG(float, estimatedEyeYaw), Q_ARG(const glm::quat&, headRotation), Q_ARG(float, estimatedEyePitch), Q_ARG(float, estimatedEyeYaw),
Q_ARG(const QVector<float>&, _blendshapeCoefficients)); Q_ARG(const QVector<float>&, _blendshapeCoefficients));
QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection);
#endif #endif
@ -253,6 +253,6 @@ void FaceplusReader::update() {
void FaceplusReader::reset() { void FaceplusReader::reset() {
#ifdef HAVE_FACEPLUS #ifdef HAVE_FACEPLUS
_referenceInitialized = false; _referenceInitialized = false;
#endif #endif
} }

View file

@ -35,7 +35,7 @@ public:
bool isActive() const { return _active; } bool isActive() const { return _active; }
Q_INVOKABLE void setState(const glm::vec3& headTranslation, const glm::quat& headRotation, Q_INVOKABLE void setState(const glm::vec3& headTranslation, const glm::quat& headRotation,
float estimatedEyePitch, float estimatedEyeYaw, const QVector<float>& blendshapeCoefficients); float estimatedEyePitch, float estimatedEyeYaw, const QVector<float>& blendshapeCoefficients);
public slots: public slots:
@ -64,7 +64,7 @@ public:
Q_INVOKABLE void init(); Q_INVOKABLE void init();
Q_INVOKABLE void shutdown(); Q_INVOKABLE void shutdown();
Q_INVOKABLE void update(); Q_INVOKABLE void update();
Q_INVOKABLE void reset(); Q_INVOKABLE void reset();
private: private:
@ -75,10 +75,10 @@ private:
int _leftEyeRotationIndices[2]; int _leftEyeRotationIndices[2];
int _rightEyeRotationIndices[2]; int _rightEyeRotationIndices[2];
float _referenceX; float _referenceX;
float _referenceY; float _referenceY;
float _referenceScale; float _referenceScale;
bool _referenceInitialized; bool _referenceInitialized;
QVector<float> _blendshapeCoefficients; QVector<float> _blendshapeCoefficients;
#endif #endif
}; };