From 6b1d835f95c66f09caaafd073780dcbd5eb07907 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 24 Nov 2013 15:46:21 -0500 Subject: STORM-1981 Rough initial changes for evaluation purposes. --- indra/newview/lltracker.cpp | 87 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 76 insertions(+), 11 deletions(-) (limited to 'indra/newview/lltracker.cpp') diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index cbd16e873d..1aa61cf50e 100755 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -412,7 +412,7 @@ const std::string& LLTracker::getTrackedLocationName() return instance()->mTrackedLocationName; } -F32 pulse_func(F32 t, F32 z) +F32 pulse_func(F32 t, F32 z, bool tracking_avatar) { if (!LLTracker::sCheesyBeacon) { @@ -420,8 +420,15 @@ F32 pulse_func(F32 t, F32 z) } t *= F_PI; - z -= t*64.f - 256.f; - + if (tracking_avatar) + { + z += t*64.f - 256.f; + } + else + { + z -= t*64.f - 256.f; + } + F32 a = cosf(z*F_PI/512.f)*10.0f; a = llmax(a, 9.9f); a -= 9.9f; @@ -497,9 +504,11 @@ void LLTracker::renderBeacon(LLVector3d pos_global, } LLColor4 fogged_color = color_frac * color + (1 - color_frac)*gSky.getFogColor(); + LLColor4 under_color = color_frac * LLColor4::blue + (1 - color_frac) * gSky.getFogColor(); F32 FADE_DIST = 3.f; fogged_color.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST)); + under_color.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST)); LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(pos_global); @@ -508,22 +517,21 @@ void LLTracker::renderBeacon(LLVector3d pos_global, LLGLDisable cull_face(GL_CULL_FACE); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - gGL.matrixMode(LLRender::MM_MODELVIEW); 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; - + const F32 step = (5020.0f - pos_agent.mV[2]) / 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]; @@ -531,9 +539,10 @@ void LLTracker::renderBeacon(LLVector3d pos_global, F32 z = i * step; F32 z_next = (i+1)*step; - - F32 a = pulse_func(t, z); - F32 an = pulse_func(t, z_next); + + bool tracking_avatar = getTrackingStatus() == TRACKING_AVATAR; + F32 a = pulse_func(t, z, tracking_avatar); + F32 an = pulse_func(t, z_next, tracking_avatar); LLColor4 c_col = fogged_color + LLColor4(a,a,a,a); LLColor4 col_next = fogged_color + LLColor4(an,an,an,an); @@ -561,7 +570,63 @@ void LLTracker::renderBeacon(LLVector3d pos_global, 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(); + + gGL.pushMatrix(); + { + gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], 0); + +// draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, under_color); + + gGL.color4fv(under_color.mV); + const U32 BEACON_VERTS = 256; + const F32 step = pos_agent.mV[2] / 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; + + bool tracking_avatar = getTrackingStatus() == TRACKING_AVATAR; + F32 a = pulse_func(t, z, tracking_avatar); + F32 an = pulse_func(t, z_next, tracking_avatar); + + LLColor4 c_col = under_color + LLColor4(a,a,a,a); + LLColor4 col_next = under_color + LLColor4(an,an,an,an); + LLColor4 col_edge = under_color * LLColor4(a,a,a,0.0f); + LLColor4 col_edge_next = under_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(); } } -- cgit v1.2.3 From f04c2a781ce1ff65f17bee24187a1ea1fc667787 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 25 Nov 2013 13:54:43 -0500 Subject: STORM-1981 Make pulse operate properly in both directions. Move duplicated common code into its own function. --- indra/newview/lltracker.cpp | 202 ++++++++++++++++++-------------------------- 1 file changed, 80 insertions(+), 122 deletions(-) (limited to 'indra/newview/lltracker.cpp') diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 1aa61cf50e..e242cd6f5e 100755 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -167,6 +167,7 @@ void LLTracker::render3D() } static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white); + static LLUIColor map_track_color_under = LLUIColorTable::instance().getColor("MapTrackColorUnder", LLColor4::white); // Arbitary location beacon if( instance()->mIsTrackingLocation ) @@ -187,7 +188,7 @@ void LLTracker::render3D() } else { - renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, + renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, map_track_color_under, instance()->mBeaconText, instance()->mTrackedLocationName ); } } @@ -229,7 +230,7 @@ void LLTracker::render3D() // and back again instance()->mHasReachedLandmark = FALSE; } - renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, + renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, map_track_color_under, instance()->mBeaconText, instance()->mTrackedLandmarkName ); } } @@ -258,7 +259,7 @@ void LLTracker::render3D() } else { - renderBeacon( av_tracker.getGlobalPos(), map_track_color, + renderBeacon( av_tracker.getGlobalPos(), map_track_color, map_track_color_under, instance()->mBeaconText, av_tracker.getName() ); } } @@ -412,7 +413,7 @@ const std::string& LLTracker::getTrackedLocationName() return instance()->mTrackedLocationName; } -F32 pulse_func(F32 t, F32 z, bool tracking_avatar) +F32 pulse_func(F32 t, F32 z, bool tracking_avatar, std::string direction) { if (!LLTracker::sCheesyBeacon) { @@ -420,7 +421,7 @@ F32 pulse_func(F32 t, F32 z, bool tracking_avatar) } t *= F_PI; - if (tracking_avatar) + if ("DOWN" == direction) { z += t*64.f - 256.f; } @@ -481,10 +482,79 @@ void draw_shockwave(F32 center_z, F32 t, S32 steps, LLColor4 color) gGL.end(); } +void LLTracker::drawBeacon(LLVector3 pos_agent, std::string direction, LLColor4 fogged_color, F32 dist) +{ + const U32 BEACON_VERTS = 256; + F32 step; + + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + + if ("DOWN" == direction) + { + gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]); + draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color); + step = (5020.0f - pos_agent.mV[2]) / BEACON_VERTS; + } + else + { + gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], 0); + step = pos_agent.mV[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; + + bool tracking_avatar = getTrackingStatus() == TRACKING_AVATAR; + F32 a = pulse_func(t, z, tracking_avatar, direction); + F32 an = pulse_func(t, z_next, tracking_avatar, direction); + + 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 void LLTracker::renderBeacon(LLVector3d pos_global, - const LLColor4& color, + const LLColor4& color, + const LLColor4& color_under, LLHUDText* hud_textp, const std::string& label ) { @@ -504,11 +574,11 @@ void LLTracker::renderBeacon(LLVector3d pos_global, } LLColor4 fogged_color = color_frac * color + (1 - color_frac)*gSky.getFogColor(); - LLColor4 under_color = color_frac * LLColor4::blue + (1 - color_frac) * gSky.getFogColor(); + LLColor4 fogged_color_under = color_frac * color_under + (1 - color_frac) * gSky.getFogColor(); F32 FADE_DIST = 3.f; fogged_color.mV[3] = llmax(0.2f, llmin(0.5f,(dist-FADE_DIST)/FADE_DIST)); - under_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); @@ -517,120 +587,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global, LLGLDisable cull_face(GL_CULL_FACE); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - gGL.matrixMode(LLRender::MM_MODELVIEW); - 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 = (5020.0f - pos_agent.mV[2]) / 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; - - bool tracking_avatar = getTrackingStatus() == TRACKING_AVATAR; - F32 a = pulse_func(t, z, tracking_avatar); - F32 an = pulse_func(t, z_next, tracking_avatar); - - 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(); - - gGL.pushMatrix(); - { - gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], 0); - -// draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, under_color); - - gGL.color4fv(under_color.mV); - const U32 BEACON_VERTS = 256; - const F32 step = pos_agent.mV[2] / 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; - - bool tracking_avatar = getTrackingStatus() == TRACKING_AVATAR; - F32 a = pulse_func(t, z, tracking_avatar); - F32 an = pulse_func(t, z_next, tracking_avatar); - - LLColor4 c_col = under_color + LLColor4(a,a,a,a); - LLColor4 col_next = under_color + LLColor4(an,an,an,an); - LLColor4 col_edge = under_color * LLColor4(a,a,a,0.0f); - LLColor4 col_edge_next = under_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(); + LLTracker::drawBeacon(pos_agent, "DOWN", fogged_color, dist); + LLTracker::drawBeacon(pos_agent, "UP", fogged_color_under, dist); std::string text; text = llformat( "%.0f m", to_vec.magVec()); -- cgit v1.2.3 From 44ea72848fd64201ceef344e4136b9323c258615 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 26 Nov 2013 09:30:53 -0500 Subject: STORM-1981 Eliminate beam spreading --- indra/newview/lltracker.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/lltracker.cpp') diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index e242cd6f5e..73ceb783b5 100755 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -506,7 +506,6 @@ void LLTracker::drawBeacon(LLVector3 pos_agent, std::string direction, LLColor4 LLVector3 x_axis = LLViewerCamera::getInstance()->getLeftAxis(); F32 t = gRenderStartTime.getElapsedTimeF32(); - F32 dr = dist/LLViewerCamera::getInstance()->getFar(); for (U32 i = 0; i < BEACON_VERTS; i++) { @@ -526,10 +525,10 @@ void LLTracker::drawBeacon(LLVector3 pos_agent, std::string direction, LLColor4 LLColor4 col_edge_next = fogged_color * LLColor4(an,an,an,0.0f); a *= 2.f; - a += 1.0f+dr; + a += 1.0f; an *= 2.f; - an += 1.0f+dr; + an += 1.0f; gGL.begin(LLRender::TRIANGLE_STRIP); gGL.color4fv(col_edge.mV); -- cgit v1.2.3