SL-9698 [EEP] Add beacons that point to sun & moon position
parent
cf7658ca3b
commit
ca336f26db
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 ;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue