diff --git a/interface/src/OculusManager.cpp b/interface/src/OculusManager.cpp index 046e1684fb..17775b9f9c 100644 --- a/interface/src/OculusManager.cpp +++ b/interface/src/OculusManager.cpp @@ -46,7 +46,6 @@ void OculusManager::updateYawOffset() { } void OculusManager::getEulerAngles(float& yaw, float& pitch, float& roll) { - yaw = pitch = roll = 0.0f; #ifdef __APPLE__ _sensorFusion.GetOrientation().GetEulerAngles(&yaw, &pitch, &roll); diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 7cd3e4d7c8..91e8d97c82 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -1477,7 +1477,17 @@ void Avatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) { if (isMyAvatar() && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_FIRST_PERSON) { // Dont display body - } else if (_head.getFace().isFullFrame()) { + return; + } + + // glow when moving + const float MIN_GLOW_SPEED = 0.01f; + bool glowing = _speed > MIN_GLOW_SPEED; + if (glowing) { + Application::getInstance()->getGlowEffect()->begin(); + } + + if (_head.getFace().isFullFrame()) { // Render the full-frame video float alpha = getBallRenderAlpha(BODY_BALL_HEAD_BASE, lookingInMirror); if (alpha > 0.0f) { @@ -1558,6 +1568,10 @@ void Avatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) { } } _hand.render(lookingInMirror); + + if (glowing) { + Application::getInstance()->getGlowEffect()->end(); + } } diff --git a/interface/src/renderer/GlowEffect.cpp b/interface/src/renderer/GlowEffect.cpp index e35896c975..782bda2a06 100644 --- a/interface/src/renderer/GlowEffect.cpp +++ b/interface/src/renderer/GlowEffect.cpp @@ -15,7 +15,7 @@ #include "ProgramObject.h" #include "RenderUtil.h" -GlowEffect::GlowEffect() : _renderMode(DIFFUSE_ADD_MODE), _isOddFrame(false) { +GlowEffect::GlowEffect() : _renderMode(DIFFUSE_ADD_MODE), _isOddFrame(false), _intensity(0.0f) { } QOpenGLFramebufferObject* GlowEffect::getFreeFramebufferObject() const { @@ -70,12 +70,14 @@ void GlowEffect::prepare() { } void GlowEffect::begin(float intensity) { - glBlendColor(0.0f, 0.0f, 0.0f, intensity); + // store the current intensity and add the new amount + _intensityStack.push(_intensity); + glBlendColor(0.0f, 0.0f, 0.0f, _intensity += intensity); _isEmpty = false; } void GlowEffect::end() { - glBlendColor(0.0f, 0.0f, 0.0f, 0.0f); + glBlendColor(0.0f, 0.0f, 0.0f, _intensity = _intensityStack.pop()); } static void maybeBind(QOpenGLFramebufferObject* fbo) { diff --git a/interface/src/renderer/GlowEffect.h b/interface/src/renderer/GlowEffect.h index 2cf1efe9d7..81acd0c108 100644 --- a/interface/src/renderer/GlowEffect.h +++ b/interface/src/renderer/GlowEffect.h @@ -10,6 +10,7 @@ #define __interface__GlowEffect__ #include +#include class QOpenGLFramebufferObject; @@ -63,6 +64,9 @@ private: bool _isEmpty; ///< set when nothing in the scene is currently glowing bool _isOddFrame; ///< controls the alternation between texture targets in diffuse add mode + + float _intensity; + QStack _intensityStack; }; #endif /* defined(__interface__GlowEffect__) */