summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]indra/llvfs/lldir_win32.h0
-rwxr-xr-xindra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl10
-rwxr-xr-x[-rw-r--r--]indra/newview/llagent.cpp8
-rwxr-xr-x[-rw-r--r--]indra/newview/llagentpilot.cpp209
-rwxr-xr-x[-rw-r--r--]indra/newview/llagentpilot.h47
-rwxr-xr-x[-rw-r--r--]indra/newview/llappviewer.cpp17
-rwxr-xr-xindra/newview/llstartup.cpp4
-rwxr-xr-x[-rw-r--r--]indra/newview/llviewermenu.cpp13
-rw-r--r--indra/newview/llviewershadermgr.cpp7
10 files changed, 253 insertions, 73 deletions
diff --git a/indra/llvfs/lldir_win32.h b/indra/llvfs/lldir_win32.h
index 9a07150f0f..9a07150f0f 100644..100755
--- a/indra/llvfs/lldir_win32.h
+++ b/indra/llvfs/lldir_win32.h
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 051f981e8d..74181d9764 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10207,6 +10207,17 @@
<key>Value</key>
<string>pilot.txt</string>
</map>
+ <key>StatsPilotXMLFile</key>
+ <map>
+ <key>Comment</key>
+ <string>Filename for stats logging extended autopilot path</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>pilot.xml</string>
+ </map>
<key>StatsQuitAfterRuns</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 0fb26bd9a1..29340c7e9f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -270,14 +270,10 @@ void main()
vec4 diffuse = texture2DRect(diffuseRect, tc);
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
- vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
- float scol = max(scol_ambocc.r, diffuse.a);
- float ambocc = scol_ambocc.g;
-
- calcAtmospherics(pos.xyz, ambocc);
+ calcAtmospherics(pos.xyz, 1.0);
vec3 col = atmosAmbient(vec3(0));
- col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a));
+ col += atmosAffectDirectionalLight(max(min(da, 1.0), diffuse.a));
col *= diffuse.rgb;
@@ -287,7 +283,7 @@ void main()
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, vary_light.xyz);
- vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
+ vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a;
/*
// screen-space cheap fakey reflection map
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index de7073be24..3f1bf4c5c2 100644..100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -1213,7 +1213,13 @@ BOOL LLAgent::getBusy() const
//-----------------------------------------------------------------------------
// startAutoPilotGlobal()
//-----------------------------------------------------------------------------
-void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, F32 stop_distance, F32 rot_threshold)
+void LLAgent::startAutoPilotGlobal(
+ const LLVector3d &target_global,
+ const std::string& behavior_name,
+ const LLQuaternion *target_rotation,
+ void (*finish_callback)(BOOL, void *),
+ void *callback_data,
+ F32 stop_distance, F32 rot_threshold)
{
if (!isAgentAvatarValid())
{
diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp
index afeba6bdf0..f96db0a5df 100644..100755
--- a/indra/newview/llagentpilot.cpp
+++ b/indra/newview/llagentpilot.cpp
@@ -34,12 +34,13 @@
#include "llagent.h"
#include "llappviewer.h"
#include "llviewercontrol.h"
+#include "llviewercamera.h"
+#include "llviewerjoystick.h"
+#include "llsdserialize.h"
+#include "llsdutil_math.h"
LLAgentPilot gAgentPilot;
-BOOL LLAgentPilot::sLoop = TRUE;
-BOOL LLAgentPilot::sReplaySession = FALSE;
-
LLAgentPilot::LLAgentPilot() :
mNumRuns(-1),
mQuitAfterRuns(FALSE),
@@ -47,7 +48,10 @@ LLAgentPilot::LLAgentPilot() :
mLastRecordTime(0.f),
mStarted(FALSE),
mPlaying(FALSE),
- mCurrentAction(0)
+ mCurrentAction(0),
+ mOverrideCamera(FALSE),
+ mLoop(TRUE),
+ mReplaySession(FALSE)
{
}
@@ -55,7 +59,26 @@ LLAgentPilot::~LLAgentPilot()
{
}
-void LLAgentPilot::load(const std::string& filename)
+void LLAgentPilot::load()
+{
+ std::string txt_filename = gSavedSettings.getString("StatsPilotFile");
+ std::string xml_filename = gSavedSettings.getString("StatsPilotXMLFile");
+ if (LLFile::isfile(xml_filename))
+ {
+ loadXML(xml_filename);
+ }
+ else if (LLFile::isfile(txt_filename))
+ {
+ loadTxt(txt_filename);
+ }
+ else
+ {
+ lldebugs << "no autopilot file found" << llendl;
+ return;
+ }
+}
+
+void LLAgentPilot::loadTxt(const std::string& filename)
{
if(filename.empty())
{
@@ -75,6 +98,7 @@ void LLAgentPilot::load(const std::string& filename)
llinfos << "Opening pilot file " << filename << llendl;
}
+ mActions.reset();
S32 num_actions;
file >> num_actions;
@@ -89,10 +113,59 @@ void LLAgentPilot::load(const std::string& filename)
mActions.put(new_action);
}
+ mOverrideCamera = false;
+
file.close();
}
-void LLAgentPilot::save(const std::string& filename)
+void LLAgentPilot::loadXML(const std::string& filename)
+{
+ if(filename.empty())
+ {
+ return;
+ }
+
+ llifstream file(filename);
+
+ if (!file)
+ {
+ lldebugs << "Couldn't open " << filename
+ << ", aborting agentpilot load!" << llendl;
+ return;
+ }
+ else
+ {
+ llinfos << "Opening pilot file " << filename << llendl;
+ }
+
+ mActions.reset();
+ LLSD record;
+ while (!file.eof() && LLSDSerialize::fromXML(record, file))
+ {
+ Action action;
+ action.mTime = record["time"].asReal();
+ action.mType = (EActionType)record["type"].asInteger();
+ action.mCameraView = record["camera_view"].asReal();
+ action.mTarget = ll_vector3d_from_sd(record["target"]);
+ action.mCameraOrigin = ll_vector3_from_sd(record["camera_origin"]);
+ action.mCameraXAxis = ll_vector3_from_sd(record["camera_xaxis"]);
+ action.mCameraYAxis = ll_vector3_from_sd(record["camera_yaxis"]);
+ action.mCameraZAxis = ll_vector3_from_sd(record["camera_zaxis"]);
+ mActions.put(action);
+ }
+ mOverrideCamera = true;
+ file.close();
+}
+
+void LLAgentPilot::save()
+{
+ std::string txt_filename = gSavedSettings.getString("StatsPilotFile");
+ std::string xml_filename = gSavedSettings.getString("StatsPilotXMLFile");
+ saveTxt(txt_filename);
+ saveXML(xml_filename);
+}
+
+void LLAgentPilot::saveTxt(const std::string& filename)
{
llofstream file;
file.open(filename);
@@ -108,12 +181,41 @@ void LLAgentPilot::save(const std::string& filename)
for (i = 0; i < mActions.count(); i++)
{
file << mActions[i].mTime << "\t" << mActions[i].mType << "\t";
- file << std::setprecision(32) << mActions[i].mTarget.mdV[VX] << "\t" << mActions[i].mTarget.mdV[VY] << "\t" << mActions[i].mTarget.mdV[VZ] << '\n';
+ file << std::setprecision(32) << mActions[i].mTarget.mdV[VX] << "\t" << mActions[i].mTarget.mdV[VY] << "\t" << mActions[i].mTarget.mdV[VZ];
+ file << '\n';
}
file.close();
}
+void LLAgentPilot::saveXML(const std::string& filename)
+{
+ llofstream file;
+ file.open(filename);
+
+ if (!file)
+ {
+ llinfos << "Couldn't open " << filename << ", aborting agentpilot save!" << llendl;
+ }
+
+ S32 i;
+ for (i = 0; i < mActions.count(); i++)
+ {
+ Action& action = mActions[i];
+ LLSD record;
+ record["time"] = (LLSD::Real)action.mTime;
+ record["type"] = (LLSD::Integer)action.mType;
+ record["camera_view"] = (LLSD::Real)action.mCameraView;
+ record["target"] = ll_sd_from_vector3d(action.mTarget);
+ record["camera_origin"] = ll_sd_from_vector3(action.mCameraOrigin);
+ record["camera_xaxis"] = ll_sd_from_vector3(action.mCameraXAxis);
+ record["camera_yaxis"] = ll_sd_from_vector3(action.mCameraYAxis);
+ record["camera_zaxis"] = ll_sd_from_vector3(action.mCameraZAxis);
+ LLSDSerialize::toXML(record, file);
+ }
+ file.close();
+}
+
void LLAgentPilot::startRecord()
{
mActions.reset();
@@ -125,7 +227,7 @@ void LLAgentPilot::startRecord()
void LLAgentPilot::stopRecord()
{
gAgentPilot.addAction(STRAIGHT);
- gAgentPilot.save(gSavedSettings.getString("StatsPilotFile"));
+ gAgentPilot.save();
mRecording = FALSE;
}
@@ -136,6 +238,12 @@ void LLAgentPilot::addAction(enum EActionType action_type)
action.mType = action_type;
action.mTarget = gAgent.getPositionGlobal();
action.mTime = mTimer.getElapsedTimeF32();
+ LLViewerCamera *cam = LLViewerCamera::getInstance();
+ action.mCameraView = cam->getView();
+ action.mCameraOrigin = cam->getOrigin();
+ action.mCameraXAxis = cam->getXAxis();
+ action.mCameraYAxis = cam->getYAxis();
+ action.mCameraZAxis = cam->getZAxis();
mLastRecordTime = (F32)action.mTime;
mActions.put(action);
}
@@ -151,7 +259,13 @@ void LLAgentPilot::startPlayback()
if (mActions.count())
{
llinfos << "Starting playback, moving to waypoint 0" << llendl;
+ if (getOverrideCamera() &&
+ !LLViewerJoystick::getInstance()->getOverrideCamera())
+ {
+ LLViewerJoystick::getInstance()->toggleFlycam();
+ }
gAgent.startAutoPilotGlobal(mActions[0].mTarget);
+ moveCamera();
mStarted = FALSE;
}
else
@@ -172,13 +286,52 @@ void LLAgentPilot::stopPlayback()
gAgent.stopAutoPilot();
}
- if (sReplaySession)
+ if (mReplaySession)
{
LLAppViewer::instance()->forceQuit();
}
}
-#define SKIP_PILOT_LOGGING 1
+void LLAgentPilot::moveCamera()
+{
+ if (!getOverrideCamera())
+ return;
+
+ if (mCurrentAction<mActions.count())
+ {
+ S32 start_index = llmax(mCurrentAction-1,0);
+ S32 end_index = mCurrentAction;
+ F32 t = 0.0;
+ F32 timedelta = mActions[end_index].mTime - mActions[start_index].mTime;
+ F32 tickelapsed = mTimer.getElapsedTimeF32()-mActions[start_index].mTime;
+ if (timedelta > 0.0)
+ {
+ t = tickelapsed/timedelta;
+ }
+
+ if ((t<0.0)||(t>1.0))
+ {
+ llwarns << "mCurrentAction is invalid, t = " << t << llendl;
+ return;
+ }
+
+ Action& start = mActions[start_index];
+ Action& end = mActions[end_index];
+
+ F32 view = lerp(start.mCameraView, end.mCameraView, t);
+ LLVector3 origin = lerp(start.mCameraOrigin, end.mCameraOrigin, t);
+ LLQuaternion start_quat(start.mCameraXAxis, start.mCameraYAxis, start.mCameraZAxis);
+ LLQuaternion end_quat(end.mCameraXAxis, end.mCameraYAxis, end.mCameraZAxis);
+ LLQuaternion quat = nlerp(t, start_quat, end_quat);
+ LLMatrix3 mat(quat);
+
+ LLViewerCamera::getInstance()->setView(view);
+ LLViewerCamera::getInstance()->setOrigin(origin);
+ LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]);
+ LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]);
+ LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]);
+ }
+}
void LLAgentPilot::updateTarget()
{
@@ -197,9 +350,7 @@ void LLAgentPilot::updateTarget()
{
if (!mStarted)
{
-#if SKIP_PILOT_LOGGING
llinfos << "At start, beginning playback" << llendl;
-#endif
mTimer.reset();
mStarted = TRUE;
}
@@ -213,32 +364,27 @@ void LLAgentPilot::updateTarget()
if (mCurrentAction < mActions.count())
{
gAgent.startAutoPilotGlobal(mActions[mCurrentAction].mTarget);
+ moveCamera();
}
else
{
stopPlayback();
mNumRuns--;
- if (sLoop)
+ if (mLoop)
{
if ((mNumRuns < 0) || (mNumRuns > 0))
{
-#if SKIP_PILOT_LOGGING
llinfos << "Looping, restarting playback" << llendl;
-#endif
startPlayback();
}
else if (mQuitAfterRuns)
{
-#if SKIP_PILOT_LOGGING
llinfos << "Done with all runs, quitting viewer!" << llendl;
-#endif
LLAppViewer::instance()->forceQuit();
}
else
{
-#if SKIP_PILOT_LOGGING
llinfos << "Done with all runs, disabling pilot" << llendl;
-#endif
stopPlayback();
}
}
@@ -259,29 +405,8 @@ void LLAgentPilot::updateTarget()
}
}
-// static
-void LLAgentPilot::startRecord(void *)
-{
- gAgentPilot.startRecord();
-}
-
-void LLAgentPilot::saveRecord(void *)
+void LLAgentPilot::addWaypoint()
{
- gAgentPilot.stopRecord();
-}
-
-void LLAgentPilot::addWaypoint(void *)
-{
- gAgentPilot.addAction(STRAIGHT);
-}
-
-void LLAgentPilot::startPlayback(void *)
-{
- gAgentPilot.mNumRuns = -1;
- gAgentPilot.startPlayback();
+ addAction(STRAIGHT);
}
-void LLAgentPilot::stopPlayback(void *)
-{
- gAgentPilot.stopPlayback();
-}
diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h
index f3d34246ae..dd1709ec0c 100644..100755
--- a/indra/newview/llagentpilot.h
+++ b/indra/newview/llagentpilot.h
@@ -46,8 +46,12 @@ public:
LLAgentPilot();
virtual ~LLAgentPilot();
- void load(const std::string& filename);
- void save(const std::string& filename);
+ void load();
+ void loadTxt(const std::string& filename);
+ void loadXML(const std::string& filename);
+ void save();
+ void saveTxt(const std::string& filename);
+ void saveXML(const std::string& filename);
void startRecord();
void stopRecord();
@@ -56,19 +60,34 @@ public:
void startPlayback();
void stopPlayback();
+ bool isRecording() { return mRecording; }
+ bool isPlaying() { return mPlaying; }
+ bool getOverrideCamera() { return mOverrideCamera; }
+
void updateTarget();
- static void startRecord(void *);
- static void addWaypoint(void *);
- static void saveRecord(void *);
- static void startPlayback(void *);
- static void stopPlayback(void *);
- static BOOL sLoop;
- static BOOL sReplaySession;
+ void addWaypoint();
+ void moveCamera();
+
+ void setReplaySession(BOOL new_val) { mReplaySession = new_val; }
+ BOOL getReplaySession() { return mReplaySession; }
+
+ void setLoop(BOOL new_val) { mLoop = new_val; }
+ BOOL getLoop() { return mLoop; }
+
+ void setQuitAfterRuns(BOOL quit_val) { mQuitAfterRuns = quit_val; }
+ void setNumRuns(S32 num_runs) { mNumRuns = num_runs; }
+
+private:
+
+
+
+ BOOL mLoop;
+ BOOL mReplaySession;
S32 mNumRuns;
BOOL mQuitAfterRuns;
-private:
+
void setAutopilotTarget(const S32 id);
BOOL mRecording;
@@ -78,6 +97,8 @@ private:
BOOL mPlaying;
S32 mCurrentAction;
+ BOOL mOverrideCamera;
+
class Action
{
public:
@@ -85,10 +106,16 @@ private:
EActionType mType;
LLVector3d mTarget;
F64 mTime;
+ F32 mCameraView;
+ LLVector3 mCameraOrigin;
+ LLVector3 mCameraXAxis;
+ LLVector3 mCameraYAxis;
+ LLVector3 mCameraZAxis;
};
LLDynamicArray<Action> mActions;
LLTimer mTimer;
+
};
extern LLAgentPilot gAgentPilot;
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index c1a311b170..0118d2dfc1 100644..100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -468,8 +468,8 @@ static void settings_to_globals()
LLSelectMgr::sRenderHiddenSelections = gSavedSettings.getBOOL("RenderHiddenSelections");
LLSelectMgr::sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius");
- gAgentPilot.mNumRuns = gSavedSettings.getS32("StatsNumRuns");
- gAgentPilot.mQuitAfterRuns = gSavedSettings.getBOOL("StatsQuitAfterRuns");
+ gAgentPilot.setNumRuns(gSavedSettings.getS32("StatsNumRuns"));
+ gAgentPilot.setQuitAfterRuns(gSavedSettings.getBOOL("StatsQuitAfterRuns"));
gAgent.setHideGroupTitle(gSavedSettings.getBOOL("RenderHideGroupTitle"));
gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc");
@@ -2289,7 +2289,7 @@ bool LLAppViewer::initConfiguration()
if (clp.hasOption("replaysession"))
{
- LLAgentPilot::sReplaySession = TRUE;
+ gAgentPilot.setReplaySession(TRUE);
}
if (clp.hasOption("nonotifications"))
@@ -4221,8 +4221,15 @@ void LLAppViewer::idle()
}
if (LLViewerJoystick::getInstance()->getOverrideCamera())
- {
- LLViewerJoystick::getInstance()->moveFlycam();
+ {
+ if (gAgentPilot.isPlaying() && gAgentPilot.getOverrideCamera())
+ {
+ gAgentPilot.moveCamera();
+ }
+ else
+ {
+ LLViewerJoystick::getInstance()->moveFlycam();
+ }
}
else
{
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index c6efaf4afe..b98cbd5b78 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -424,7 +424,7 @@ bool idle_startup()
//
// Load autopilot and stats stuff
- gAgentPilot.load(gSavedSettings.getString("StatsPilotFile"));
+ gAgentPilot.load();
//gErrorStream.setTime(gSavedSettings.getBOOL("LogTimestamps"));
@@ -1989,7 +1989,7 @@ bool idle_startup()
}
// Start automatic replay if the flag is set.
- if (gSavedSettings.getBOOL("StatsAutoRun") || LLAgentPilot::sReplaySession)
+ if (gSavedSettings.getBOOL("StatsAutoRun") || gAgentPilot.getReplaySession())
{
LLUUID id;
LL_DEBUGS("AppInit") << "Starting automatic playback" << LL_ENDL;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index e9e0268587..eb022851e7 100644..100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -1901,19 +1901,20 @@ class LLAdvancedAgentPilot : public view_listener_t
std::string command = userdata.asString();
if ("start playback" == command)
{
- LLAgentPilot::startPlayback(NULL);
+ gAgentPilot.setNumRuns(-1);
+ gAgentPilot.startPlayback();
}
else if ("stop playback" == command)
{
- LLAgentPilot::stopPlayback(NULL);
+ gAgentPilot.stopPlayback();
}
else if ("start record" == command)
{
- LLAgentPilot::startRecord(NULL);
+ gAgentPilot.startRecord();
}
else if ("stop record" == command)
{
- LLAgentPilot::saveRecord(NULL);
+ gAgentPilot.stopRecord();
}
return true;
@@ -1931,7 +1932,7 @@ class LLAdvancedToggleAgentPilotLoop : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- LLAgentPilot::sLoop = !(LLAgentPilot::sLoop);
+ gAgentPilot.setLoop(!gAgentPilot.getLoop());
return true;
}
};
@@ -1940,7 +1941,7 @@ class LLAdvancedCheckAgentPilotLoop : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- bool new_value = LLAgentPilot::sLoop;
+ bool new_value = gAgentPilot.getLoop();
return new_value;
}
};
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 7c84357de8..a9462c9d50 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -1149,7 +1149,14 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSoftenProgram.mShaderFiles.clear();
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB));
+
gDeferredSoftenProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+
+ if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
+ { //if using SSAO, take screen space light map into account as if shadows are enabled
+ gDeferredSoftenProgram.mShaderLevel = llmax(gDeferredSoftenProgram.mShaderLevel, 2);
+ }
+
success = gDeferredSoftenProgram.createShader(NULL, NULL);
}