Have the glow effect add half of the original texture, too, and use it on the

follow indicator.
This commit is contained in:
Andrzej Kapolka 2013-08-13 14:22:29 -07:00
parent f6209b702c
commit 01cd0d2a1f
4 changed files with 26 additions and 8 deletions

View file

@ -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);
}

View file

@ -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) {

View file

@ -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);

View file

@ -10,6 +10,7 @@
#include <VoxelConstants.h>
#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
}
}