[STORM-1981] Change tracking beacons to extend to the ground and (optionally) vertically indicate direction
Jonathan Yap's beacon enhancements, with a Singular twist!
This commit is contained in:
@@ -427,7 +427,7 @@ const std::string& LLTracker::getTrackedLocationName()
|
|||||||
return instance()->mTrackedLocationName;
|
return instance()->mTrackedLocationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 pulse_func(F32 t, F32 z)
|
F32 pulse_func(F32 t, F32 z, bool down)
|
||||||
{
|
{
|
||||||
if (!LLTracker::sCheesyBeacon)
|
if (!LLTracker::sCheesyBeacon)
|
||||||
{
|
{
|
||||||
@@ -435,7 +435,14 @@ F32 pulse_func(F32 t, F32 z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
t *= F_PI;
|
t *= F_PI;
|
||||||
z -= t*64.f - 256.f;
|
if (down)
|
||||||
|
{
|
||||||
|
z += t*64.f - 256.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
z -= t*64.f - 256.f;
|
||||||
|
}
|
||||||
|
|
||||||
F32 a = cosf(z*F_PI/512.f)*10.0f;
|
F32 a = cosf(z*F_PI/512.f)*10.0f;
|
||||||
a = llmax(a, 9.9f);
|
a = llmax(a, 9.9f);
|
||||||
@@ -489,6 +496,74 @@ void draw_shockwave(F32 center_z, F32 t, S32 steps, LLColor4 color)
|
|||||||
gGL.end();
|
gGL.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw_beacon(LLVector3 pos_agent, bool down, LLColor4 fogged_color, F32 dist)
|
||||||
|
{
|
||||||
|
const U32 BEACON_VERTS = 256;
|
||||||
|
F32 step;
|
||||||
|
|
||||||
|
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||||
|
gGL.pushMatrix();
|
||||||
|
|
||||||
|
if (down)
|
||||||
|
{
|
||||||
|
gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
|
||||||
|
draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color);
|
||||||
|
step = (8192.0f - pos_agent.mV[2]) / BEACON_VERTS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], 0);
|
||||||
|
step = pos_agent[2] / BEACON_VERTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
gGL.color4fv(fogged_color.mV);
|
||||||
|
|
||||||
|
LLVector3 x_axis = LLViewerCamera::getInstance()->getLeftAxis();
|
||||||
|
F32 t = gRenderStartTime.getElapsedTimeF32();
|
||||||
|
F32 dr = dist/LLViewerCamera::getInstance()->getFar();
|
||||||
|
|
||||||
|
for (U32 i = 0; i < BEACON_VERTS; i++)
|
||||||
|
{
|
||||||
|
F32 x = x_axis.mV[0];
|
||||||
|
F32 y = x_axis.mV[1];
|
||||||
|
|
||||||
|
F32 z = i * step;
|
||||||
|
F32 z_next = (i+1)*step;
|
||||||
|
|
||||||
|
F32 a = pulse_func(t, z, down);
|
||||||
|
F32 an = pulse_func(t, z_next, down);
|
||||||
|
|
||||||
|
LLColor4 c_col = fogged_color + LLColor4(a,a,a,a);
|
||||||
|
LLColor4 col_next = fogged_color + LLColor4(an,an,an,an);
|
||||||
|
LLColor4 col_edge = fogged_color * LLColor4(a,a,a,0.0f);
|
||||||
|
LLColor4 col_edge_next = fogged_color * LLColor4(an,an,an,0.0f);
|
||||||
|
|
||||||
|
a *= 2.f;
|
||||||
|
a += 1.0f+dr;
|
||||||
|
|
||||||
|
an *= 2.f;
|
||||||
|
an += 1.0f+dr;
|
||||||
|
|
||||||
|
gGL.begin(LLRender::TRIANGLE_STRIP);
|
||||||
|
gGL.color4fv(col_edge.mV);
|
||||||
|
gGL.vertex3f(-x*a, -y*a, z);
|
||||||
|
gGL.color4fv(col_edge_next.mV);
|
||||||
|
gGL.vertex3f(-x*an, -y*an, z_next);
|
||||||
|
|
||||||
|
gGL.color4fv(c_col.mV);
|
||||||
|
gGL.vertex3f(0, 0, z);
|
||||||
|
gGL.color4fv(col_next.mV);
|
||||||
|
gGL.vertex3f(0, 0, z_next);
|
||||||
|
|
||||||
|
gGL.color4fv(col_edge.mV);
|
||||||
|
gGL.vertex3f(x*a,y*a,z);
|
||||||
|
gGL.color4fv(col_edge_next.mV);
|
||||||
|
gGL.vertex3f(x*an,y*an,z_next);
|
||||||
|
|
||||||
|
gGL.end();
|
||||||
|
}
|
||||||
|
gGL.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLTracker::renderBeacon(LLVector3d pos_global,
|
void LLTracker::renderBeacon(LLVector3d pos_global,
|
||||||
@@ -496,6 +571,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
|
|||||||
LLHUDText* hud_textp,
|
LLHUDText* hud_textp,
|
||||||
const std::string& label )
|
const std::string& label )
|
||||||
{
|
{
|
||||||
|
const LLColor4& color_under(LLColor4::blue);
|
||||||
sCheesyBeacon = gSavedSettings.getBOOL("CheesyBeacon");
|
sCheesyBeacon = gSavedSettings.getBOOL("CheesyBeacon");
|
||||||
LLVector3d to_vec = pos_global - gAgentCamera.getCameraPositionGlobal();
|
LLVector3d to_vec = pos_global - gAgentCamera.getCameraPositionGlobal();
|
||||||
|
|
||||||
@@ -512,9 +588,11 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLColor4 fogged_color = color_frac * color + (1 - color_frac)*gSky.getFogColor();
|
LLColor4 fogged_color = color_frac * color + (1 - color_frac)*gSky.getFogColor();
|
||||||
|
LLColor4 fogged_color_under = color_frac * color_under + (1 - color_frac) * gSky.getFogColor();
|
||||||
|
|
||||||
F32 FADE_DIST = 3.f;
|
F32 FADE_DIST = 3.f;
|
||||||
fogged_color.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST));
|
fogged_color.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST));
|
||||||
|
fogged_color_under.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST));
|
||||||
|
|
||||||
LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(pos_global);
|
LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(pos_global);
|
||||||
|
|
||||||
@@ -523,64 +601,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
|
|||||||
LLGLDisable cull_face(GL_CULL_FACE);
|
LLGLDisable cull_face(GL_CULL_FACE);
|
||||||
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
|
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
|
||||||
|
|
||||||
|
draw_beacon(pos_agent, true, fogged_color, dist);
|
||||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
draw_beacon(pos_agent, false, fogged_color_under, dist);
|
||||||
gGL.pushMatrix();
|
|
||||||
{
|
|
||||||
gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
|
|
||||||
|
|
||||||
draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color);
|
|
||||||
|
|
||||||
gGL.color4fv(fogged_color.mV);
|
|
||||||
const U32 BEACON_VERTS = 256;
|
|
||||||
const F32 step = 1024.0f/BEACON_VERTS;
|
|
||||||
|
|
||||||
LLVector3 x_axis = LLViewerCamera::getInstance()->getLeftAxis();
|
|
||||||
F32 t = gRenderStartTime.getElapsedTimeF32();
|
|
||||||
F32 dr = dist/LLViewerCamera::getInstance()->getFar();
|
|
||||||
|
|
||||||
for (U32 i = 0; i < BEACON_VERTS; i++)
|
|
||||||
{
|
|
||||||
F32 x = x_axis.mV[0];
|
|
||||||
F32 y = x_axis.mV[1];
|
|
||||||
|
|
||||||
F32 z = i * step;
|
|
||||||
F32 z_next = (i+1)*step;
|
|
||||||
|
|
||||||
F32 a = pulse_func(t, z);
|
|
||||||
F32 an = pulse_func(t, z_next);
|
|
||||||
|
|
||||||
LLColor4 c_col = fogged_color + LLColor4(a,a,a,a);
|
|
||||||
LLColor4 col_next = fogged_color + LLColor4(an,an,an,an);
|
|
||||||
LLColor4 col_edge = fogged_color * LLColor4(a,a,a,0.0f);
|
|
||||||
LLColor4 col_edge_next = fogged_color * LLColor4(an,an,an,0.0f);
|
|
||||||
|
|
||||||
a *= 2.f;
|
|
||||||
a += 1.0f+dr;
|
|
||||||
|
|
||||||
an *= 2.f;
|
|
||||||
an += 1.0f+dr;
|
|
||||||
|
|
||||||
gGL.begin(LLRender::TRIANGLE_STRIP);
|
|
||||||
gGL.color4fv(col_edge.mV);
|
|
||||||
gGL.vertex3f(-x*a, -y*a, z);
|
|
||||||
gGL.color4fv(col_edge_next.mV);
|
|
||||||
gGL.vertex3f(-x*an, -y*an, z_next);
|
|
||||||
|
|
||||||
gGL.color4fv(c_col.mV);
|
|
||||||
gGL.vertex3f(0, 0, z);
|
|
||||||
gGL.color4fv(col_next.mV);
|
|
||||||
gGL.vertex3f(0, 0, z_next);
|
|
||||||
|
|
||||||
gGL.color4fv(col_edge.mV);
|
|
||||||
gGL.vertex3f(x*a,y*a,z);
|
|
||||||
gGL.color4fv(col_edge_next.mV);
|
|
||||||
gGL.vertex3f(x*an,y*an,z_next);
|
|
||||||
|
|
||||||
gGL.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gGL.popMatrix();
|
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
text = llformat( "%.0f m", to_vec.magVec());
|
text = llformat( "%.0f m", to_vec.magVec());
|
||||||
|
|||||||
Reference in New Issue
Block a user