diff --git a/interface/resources/shaders/vertical_blur.frag b/interface/resources/shaders/vertical_blur.frag index 5d136a29c9..012389622e 100644 --- a/interface/resources/shaders/vertical_blur.frag +++ b/interface/resources/shaders/vertical_blur.frag @@ -32,5 +32,5 @@ void main(void) { texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 11.5)) + texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 13.5)) + texture2D(horizontallyBlurredTexture, gl_TexCoord[0].st + vec2(0.0, dt * 15.5))) / 16.0; - gl_FragColor = blurred * blurred.a + texture2D(originalTexture, gl_TexCoord[0].st); + gl_FragColor = blurred * blurred.a + texture2D(originalTexture, gl_TexCoord[0].st) * (1.0 + blurred.a * 0.5); } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index af103d4c28..7fae6ffbf9 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2334,13 +2334,21 @@ void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& which renderCircle(haloOrigin, INDICATOR_RADIUS, IDENTITY_UP, NUM_SEGMENTS); } +void maybeBeginFollowIndicator(bool& began) { + if (!began) { + Application::getInstance()->getGlowEffect()->begin(); + glLineWidth(5); + glBegin(GL_LINES); + began = true; + } +} + void Application::renderFollowIndicator() { NodeList* nodeList = NodeList::getInstance(); - _glowEffect.begin(); + // initialize lazily so that we don't enable the glow effect unnecessarily + bool began = false; - glLineWidth(5); - glBegin(GL_LINES); for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); ++node) { if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { Avatar* avatar = (Avatar *) node->getLinkedData(); @@ -2359,6 +2367,7 @@ void Application::renderFollowIndicator() { } if (leader != NULL) { + maybeBeginFollowIndicator(began); glColor3f(1.f, 0.f, 0.f); glVertex3f((avatar->getHead().getPosition().x + avatar->getPosition().x) / 2.f, (avatar->getHead().getPosition().y + avatar->getPosition().y) / 2.f, @@ -2373,6 +2382,7 @@ void Application::renderFollowIndicator() { } if (_myAvatar.getLeadingAvatar() != NULL) { + maybeBeginFollowIndicator(began); glColor3f(1.f, 0.f, 0.f); glVertex3f((_myAvatar.getHead().getPosition().x + _myAvatar.getPosition().x) / 2.f, (_myAvatar.getHead().getPosition().y + _myAvatar.getPosition().y) / 2.f, @@ -2383,9 +2393,10 @@ void Application::renderFollowIndicator() { (_myAvatar.getLeadingAvatar()->getHead().getPosition().z + _myAvatar.getLeadingAvatar()->getPosition().z) / 2.f); } - glEnd(); - - _glowEffect.end(); + if (began) { + glEnd(); + _glowEffect.end(); + } } void Application::update(float deltaTime) { diff --git a/interface/src/Application.h b/interface/src/Application.h index bbd1b3ed7b..862207302b 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -119,6 +119,7 @@ public: QNetworkAccessManager* getNetworkAccessManager() { return _networkAccessManager; } GeometryCache* getGeometryCache() { return &_geometryCache; } TextureCache* getTextureCache() { return &_textureCache; } + GlowEffect* getGlowEffect() { return &_glowEffect; } void resetSongMixMenuItem(); void setupWorldLight(Camera& whichCamera); diff --git a/interface/src/VoxelFade.cpp b/interface/src/VoxelFade.cpp index f7ec97ae30..8ce68c9724 100644 --- a/interface/src/VoxelFade.cpp +++ b/interface/src/VoxelFade.cpp @@ -10,6 +10,7 @@ #include +#include "Application.h" #include "VoxelFade.h" const float VoxelFade::FADE_OUT_START = 0.5f; @@ -32,6 +33,8 @@ VoxelFade::VoxelFade(FadeDirection direction, float red, float green, float blue } void VoxelFade::render() { + Application::getInstance()->getGlowEffect()->begin(); + glDisable(GL_LIGHTING); glPushMatrix(); glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE); @@ -45,6 +48,9 @@ void VoxelFade::render() { glPopMatrix(); glEnable(GL_LIGHTING); + + Application::getInstance()->getGlowEffect()->end(); + opacity *= (direction == FADE_OUT) ? FADE_OUT_STEP : FADE_IN_STEP; } @@ -55,4 +61,4 @@ bool VoxelFade::isDone() const { return opacity >= FADE_IN_END; } return true; // unexpected case, assume we're done -} \ No newline at end of file +}