diff options
author | maxim_productengine <mnikolenko@productengine.com> | 2018-12-10 17:35:29 +0200 |
---|---|---|
committer | maxim_productengine <mnikolenko@productengine.com> | 2018-12-10 17:35:29 +0200 |
commit | ca336f26db4446b016ab89654bf75f7651294533 (patch) | |
tree | 55a447b277575a8c673d75041497b99aaa92c151 /indra/newview | |
parent | cf7658ca3b7731e83ebf424b9c4b7a4c36ce328f (diff) |
SL-9698 [EEP] Add beacons that point to sun & moon position
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 22 | ||||
-rw-r--r-- | indra/newview/llglsandbox.cpp | 55 | ||||
-rw-r--r-- | indra/newview/llsky.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llsky.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 16 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_beacons.xml | 41 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 2 |
9 files changed, 151 insertions, 17 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d7b90e0691..94ce4f6df7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14805,6 +14805,28 @@ <key>Value</key> <integer>1</integer> </map> + <key>sunbeacon</key> + <map> + <key>Comment</key> + <string>Show direction to the Sun</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>moonbeacon</key> + <map> + <key>Comment</key> + <string>Show direction to the Moon</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>ShowDeviceSettings</key> <map> <key>Comment</key> diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index a9b15fc8b6..eb417106b6 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -44,6 +44,7 @@ #include "llviewercamera.h" #include "llvoavatarself.h" +#include "llsky.h" #include "llagent.h" #include "lltoolmgr.h" #include "llselectmgr.h" @@ -771,6 +772,16 @@ void draw_line_cube(F32 width, const LLVector3& center) gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width); } +void draw_cross_lines(const LLVector3& center, F32 dx, F32 dy, F32 dz) +{ + gGL.vertex3f(center.mV[VX] - dx, center.mV[VY], center.mV[VZ]); + gGL.vertex3f(center.mV[VX] + dx, center.mV[VY], center.mV[VZ]); + gGL.vertex3f(center.mV[VX], center.mV[VY] - dy, center.mV[VZ]); + gGL.vertex3f(center.mV[VX], center.mV[VY] + dy, center.mV[VZ]); + gGL.vertex3f(center.mV[VX], center.mV[VY], center.mV[VZ] - dz); + gGL.vertex3f(center.mV[VX], center.mV[VY], center.mV[VZ] + dz); +} + void LLViewerObjectList::renderObjectBeacons() { if (mDebugBeacons.empty()) @@ -808,13 +819,7 @@ void LLViewerObjectList::renderObjectBeacons() gGL.begin(LLRender::LINES); gGL.color4fv(color.mV); - gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 50.f); - gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 50.f); - gGL.vertex3f(thisline.mV[VX] - 2.f,thisline.mV[VY],thisline.mV[VZ]); - gGL.vertex3f(thisline.mV[VX] + 2.f,thisline.mV[VY],thisline.mV[VZ]); - gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] - 2.f,thisline.mV[VZ]); - gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 2.f,thisline.mV[VZ]); - + draw_cross_lines(thisline, 2.0f, 2.0f, 50.f); draw_line_cube(0.10f, thisline); gGL.end(); @@ -843,13 +848,7 @@ void LLViewerObjectList::renderObjectBeacons() const LLVector3 &thisline = debug_beacon.mPositionAgent; gGL.begin(LLRender::LINES); gGL.color4fv(debug_beacon.mColor.mV); - gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 0.5f); - gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 0.5f); - gGL.vertex3f(thisline.mV[VX] - 0.5f,thisline.mV[VY],thisline.mV[VZ]); - gGL.vertex3f(thisline.mV[VX] + 0.5f,thisline.mV[VY],thisline.mV[VZ]); - gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] - 0.5f,thisline.mV[VZ]); - gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 0.5f,thisline.mV[VZ]); - + draw_cross_lines(thisline, 0.5f, 0.5f, 0.5f); draw_line_cube(0.10f, thisline); gGL.end(); @@ -880,6 +879,34 @@ void LLViewerObjectList::renderObjectBeacons() } } +void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& direction, LLColor4 color) +{ + LLGLSUIDefault gls_ui; + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + LLVector3 pos_end; + for (S32 i = 0; i < 3; ++i) + { + pos_end.mV[i] = pos_agent.mV[i] + (50 * direction.mV[i]); + } + glLineWidth(LLPipeline::DebugBeaconLineWidth); + gGL.begin(LLRender::LINES); + color.mV[3] *= 0.5f; + gGL.color4fv(color.mV); + draw_cross_lines(pos_agent, 0.5f, 0.5f, 0.5f); + draw_cross_lines(pos_end, 2.f, 2.f, 2.f); + gGL.vertex3fv(pos_agent.mV); + gGL.vertex3fv(pos_end.mV); + gGL.end(); + + gGL.flush(); + glLineWidth(1.f); + +} //----------------------------------------------------------------------------- // gpu_benchmark() helper classes diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp index 0740878901..71de99b4ec 100644 --- a/indra/newview/llsky.cpp +++ b/indra/newview/llsky.cpp @@ -52,7 +52,7 @@ #include "llcubemap.h" #include "llviewercontrol.h" #include "llenvironment.h" - +#include "llvoavatarself.h" #include "llvowlsky.h" F32 azimuth_from_vector(const LLVector3 &v); @@ -234,6 +234,23 @@ void LLSky::setWind(const LLVector3& average_wind) } } +void LLSky::addSunMoonBeacons() +{ + if (!gAgentAvatarp || !mVOSkyp) return; + + static LLUICachedControl<bool> show_sun_beacon("sunbeacon", false); + static LLUICachedControl<bool> show_moon_beacon("moonbeacon", false); + + if (show_sun_beacon) + { + renderSunMoonBeacons(gAgentAvatarp->getPositionAgent(), mVOSkyp->getSun().getDirection(), LLColor4(1.f, 0.5f, 0.f, 0.5f)); + } + if (show_moon_beacon) + { + renderSunMoonBeacons(gAgentAvatarp->getPositionAgent(), mVOSkyp->getMoon().getDirection(), LLColor4(1.f, 0.f, 0.8f, 0.5f)); + } +} + ////////////////////////////////////////////////////////////////////// // Private Methods ////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h index e3cc567888..8c0d70c16c 100644 --- a/indra/newview/llsky.h +++ b/indra/newview/llsky.h @@ -84,6 +84,9 @@ public: void restoreGL(); void resetVertexBuffers(); + void addSunMoonBeacons(); + void renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& direction, LLColor4 color); + public: LLPointer<LLVOSky> mVOSkyp; // Pointer to the LLVOSky object (only one, ever!) LLPointer<LLVOGround> mVOGroundp; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 00189f0b11..6e500f7962 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8258,6 +8258,14 @@ class LLViewToggleBeacon : public view_listener_t gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() ); } } + else if (beacon == "sunbeacon") + { + gSavedSettings.setBOOL("sunbeacon", !gSavedSettings.getBOOL("sunbeacon")); + } + else if (beacon == "moonbeacon") + { + gSavedSettings.setBOOL("moonbeacon", !gSavedSettings.getBOOL("moonbeacon")); + } else if (beacon == "renderbeacons") { LLPipeline::toggleRenderBeacons(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 26678775fb..9be2e905a2 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -357,6 +357,8 @@ public: static const std::string beacon_scripted_touch = LLTrans::getString("BeaconScriptedTouch"); static const std::string beacon_sound = LLTrans::getString("BeaconSound"); static const std::string beacon_media = LLTrans::getString("BeaconMedia"); + static const std::string beacon_sun = LLTrans::getString("BeaconSun"); + static const std::string beacon_moon = LLTrans::getString("BeaconMoon"); static const std::string particle_hiding = LLTrans::getString("ParticleHiding"); // Draw the statistics in a light gray @@ -791,6 +793,20 @@ public: } } + static LLUICachedControl<bool> show_sun_beacon("sunbeacon", false); + static LLUICachedControl<bool> show_moon_beacon("moonbeacon", false); + + if (show_sun_beacon) + { + addText(xpos, ypos, beacon_sun); + ypos += y_inc; + } + if (show_moon_beacon) + { + addText(xpos, ypos, beacon_moon); + ypos += y_inc; + } + if(log_texture_traffic) { U32 old_y = ypos ; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index cd2146ab4e..7cb6d37cff 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4578,6 +4578,7 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate) // Render debugging beacons. gObjectList.renderObjectBeacons(); gObjectList.resetObjectBeacons(); + gSky.addSunMoonBeacons(); } else { @@ -9078,6 +9079,7 @@ void LLPipeline::renderDeferredLighting() // Render debugging beacons. gObjectList.renderObjectBeacons(); gObjectList.resetObjectBeacons(); + gSky.addSunMoonBeacons(); } } diff --git a/indra/newview/skins/default/xui/en/floater_beacons.xml b/indra/newview/skins/default/xui/en/floater_beacons.xml index 3d29356b22..d5947fc0af 100644 --- a/indra/newview/skins/default/xui/en/floater_beacons.xml +++ b/indra/newview/skins/default/xui/en/floater_beacons.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater legacy_header_height="18" - height="245" + height="310" layout="topleft" name="beacons" help_topic="beacons" @@ -12,7 +12,7 @@ width="240"> <panel follows="left|top|right|bottom" - height="240" + height="305" layout="topleft" left="10" name="beacons_panel" @@ -143,6 +143,43 @@ <check_box.commit_callback function="Beacons.UICheck" /> </check_box> + <view_border + bevel_style="in" + height="0" + layout="topleft" + left="0" + name="cost_text_border" + top_pad="5" + width="220"/> + <text + follows="all" + height="16" + font="SansSerif" + left="0" + top_pad="7" + name="label_objects" + text_color="White" + type="string"> + Show direction to: + </text> + <check_box + control_name="sunbeacon" + height="16" + label="Sun" + layout="topleft" + name="sun" > + <check_box.commit_callback + function="Beacons.UICheck" /> + </check_box> + <check_box + control_name="moonbeacon" + height="16" + label="Moon" + layout="topleft" + name="moon" > + <check_box.commit_callback + function="Beacons.UICheck" /> + </check_box> </panel> </floater> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 33c2224b9d..10e98719a4 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4094,6 +4094,8 @@ Try enclosing path to the editor with double quotes. <string name="BeaconScriptedTouch">Viewing scripted object with touch function beacons (red)</string> <string name="BeaconSound">Viewing sound beacons (yellow)</string> <string name="BeaconMedia">Viewing media beacons (white)</string> + <string name="BeaconSun">Viewing sun direction beacon (orange)</string> + <string name="BeaconMoon">Viewing moon direction beacon (purple)</string> <string name="ParticleHiding">Hiding Particles</string> <!-- commands --> |