From 04ddae45b284b8f535aa6cdc6b90af2088e82334 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 3 Feb 2011 17:52:45 -0500 Subject: SH-872 WIP - restored log statements, as removing them had no effect --- indra/newview/llagentpilot.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index afeba6bdf0..13e1023185 100644 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -178,8 +178,6 @@ void LLAgentPilot::stopPlayback() } } -#define SKIP_PILOT_LOGGING 1 - void LLAgentPilot::updateTarget() { if (mPlaying) @@ -197,9 +195,7 @@ void LLAgentPilot::updateTarget() { if (!mStarted) { -#if SKIP_PILOT_LOGGING llinfos << "At start, beginning playback" << llendl; -#endif mTimer.reset(); mStarted = TRUE; } @@ -222,23 +218,17 @@ void LLAgentPilot::updateTarget() { 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(); } } -- cgit v1.2.3 From 64e017fc6b19006c893b4766be05c18ddb3b5593 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 9 Feb 2011 15:04:25 -0500 Subject: SH-915 WIP - allow flycam control in autopilot record/playback --- indra/newview/llagent.cpp | 8 ++++- indra/newview/llagentpilot.cpp | 70 ++++++++++++++++++++++++++++++++++++++++-- indra/newview/llagentpilot.h | 14 +++++++++ indra/newview/llappviewer.cpp | 11 +++++-- 4 files changed, 98 insertions(+), 5 deletions(-) mode change 100644 => 100755 indra/newview/llagent.cpp mode change 100644 => 100755 indra/newview/llagentpilot.cpp mode change 100644 => 100755 indra/newview/llagentpilot.h mode change 100644 => 100755 indra/newview/llappviewer.cpp (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp old mode 100644 new mode 100755 index de7073be24..3f1bf4c5c2 --- 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 old mode 100644 new mode 100755 index 13e1023185..92e0180b46 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -34,6 +34,8 @@ #include "llagent.h" #include "llappviewer.h" #include "llviewercontrol.h" +#include "llviewercamera.h" +#include "llviewerjoystick.h" LLAgentPilot gAgentPilot; @@ -47,7 +49,8 @@ LLAgentPilot::LLAgentPilot() : mLastRecordTime(0.f), mStarted(FALSE), mPlaying(FALSE), - mCurrentAction(0) + mCurrentAction(0), + mOverrideCamera(FALSE) { } @@ -55,6 +58,8 @@ LLAgentPilot::~LLAgentPilot() { } +#define CAM_FIELDS 1 + void LLAgentPilot::load(const std::string& filename) { if(filename.empty()) @@ -85,10 +90,30 @@ void LLAgentPilot::load(const std::string& filename) Action new_action; file >> new_action.mTime >> action_type; file >> new_action.mTarget.mdV[VX] >> new_action.mTarget.mdV[VY] >> new_action.mTarget.mdV[VZ]; +#if CAM_FIELDS + file >> new_action.mCameraView; + file >> new_action.mCameraOrigin.mV[VX] + >> new_action.mCameraOrigin.mV[VY] + >> new_action.mCameraOrigin.mV[VZ]; + + file >> new_action.mCameraXAxis.mV[VX] + >> new_action.mCameraXAxis.mV[VY] + >> new_action.mCameraXAxis.mV[VZ]; + + file >> new_action.mCameraYAxis.mV[VX] + >> new_action.mCameraYAxis.mV[VY] + >> new_action.mCameraYAxis.mV[VZ]; + + file >> new_action.mCameraZAxis.mV[VX] + >> new_action.mCameraZAxis.mV[VY] + >> new_action.mCameraZAxis.mV[VZ]; +#endif new_action.mType = (EActionType)action_type; mActions.put(new_action); } + mOverrideCamera = true; + file.close(); } @@ -108,7 +133,27 @@ 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]; +#if CAM_FIELDS + file << "\t" << mActions[i].mCameraView; + + file << "\t" << mActions[i].mCameraOrigin[VX] + << "\t" << mActions[i].mCameraOrigin[VY] + << "\t" << mActions[i].mCameraOrigin[VZ]; + + file << "\t" << mActions[i].mCameraXAxis[VX] + << "\t" << mActions[i].mCameraXAxis[VY] + << "\t" << mActions[i].mCameraXAxis[VZ]; + + file << "\t" << mActions[i].mCameraYAxis[VX] + << "\t" << mActions[i].mCameraYAxis[VY] + << "\t" << mActions[i].mCameraYAxis[VZ]; + + file << "\t" << mActions[i].mCameraZAxis[VX] + << "\t" << mActions[i].mCameraZAxis[VY] + << "\t" << mActions[i].mCameraZAxis[VZ]; +#endif + file << '\n'; } file.close(); @@ -136,6 +181,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 +202,12 @@ void LLAgentPilot::startPlayback() if (mActions.count()) { llinfos << "Starting playback, moving to waypoint 0" << llendl; + if (!LLViewerJoystick::getInstance()->getOverrideCamera()) + { + LLViewerJoystick::getInstance()->toggleFlycam(); + } gAgent.startAutoPilotGlobal(mActions[0].mTarget); + moveCamera(mActions[0]); mStarted = FALSE; } else @@ -178,6 +234,15 @@ void LLAgentPilot::stopPlayback() } } +void LLAgentPilot::moveCamera(Action& action) +{ + LLViewerCamera::getInstance()->setView(action.mCameraView); + LLViewerCamera::getInstance()->setOrigin(action.mCameraOrigin); + LLViewerCamera::getInstance()->mXAxis = LLVector3(action.mCameraXAxis); + LLViewerCamera::getInstance()->mYAxis = LLVector3(action.mCameraYAxis); + LLViewerCamera::getInstance()->mZAxis = LLVector3(action.mCameraZAxis); +} + void LLAgentPilot::updateTarget() { if (mPlaying) @@ -209,6 +274,7 @@ void LLAgentPilot::updateTarget() if (mCurrentAction < mActions.count()) { gAgent.startAutoPilotGlobal(mActions[mCurrentAction].mTarget); + moveCamera(mActions[mCurrentAction]); } else { diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h old mode 100644 new mode 100755 index f3d34246ae..fd2cb7ee32 --- a/indra/newview/llagentpilot.h +++ b/indra/newview/llagentpilot.h @@ -56,6 +56,11 @@ public: void startPlayback(); void stopPlayback(); + + bool isRecording() { return mRecording; } + bool isPlaying() { return mPlaying; } + bool getOverrideCamera() { return mOverrideCamera; } + void updateTarget(); static void startRecord(void *); @@ -78,6 +83,8 @@ private: BOOL mPlaying; S32 mCurrentAction; + BOOL mOverrideCamera; + class Action { public: @@ -85,10 +92,17 @@ private: EActionType mType; LLVector3d mTarget; F64 mTime; + F32 mCameraView; + LLVector3 mCameraOrigin; + LLVector3 mCameraXAxis; + LLVector3 mCameraYAxis; + LLVector3 mCameraZAxis; }; LLDynamicArray mActions; LLTimer mTimer; + + void moveCamera(Action& action); }; extern LLAgentPilot gAgentPilot; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp old mode 100644 new mode 100755 index c1a311b170..ec3d775dc7 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4221,8 +4221,15 @@ void LLAppViewer::idle() } if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - LLViewerJoystick::getInstance()->moveFlycam(); + { + if (gAgentPilot.isPlaying() && gAgentPilot.getOverrideCamera()) + { + // camera positioning handled inside gAgentPilot. + } + else + { + LLViewerJoystick::getInstance()->moveFlycam(); + } } else { -- cgit v1.2.3 From 3ae3a4a6cb2b23e78493ae04f365188b95efcd64 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 9 Feb 2011 17:07:13 -0500 Subject: SH-915 WIP - support pilot.xml with extended camera info --- indra/newview/app_settings/settings.xml | 11 ++++ indra/newview/llagentpilot.cpp | 111 ++++++++++++++++++++++++++++++-- indra/newview/llagentpilot.h | 8 ++- indra/newview/llstartup.cpp | 2 +- 4 files changed, 123 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6f47d9c019..d71b84739c 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10207,6 +10207,17 @@ Value pilot.txt + StatsPilotXMLFile + + Comment + Filename for stats logging extended autopilot path + Persist + 1 + Type + String + Value + pilot.xml + StatsQuitAfterRuns Comment diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 92e0180b46..1a443e62a4 100755 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -36,6 +36,8 @@ #include "llviewercontrol.h" #include "llviewercamera.h" #include "llviewerjoystick.h" +#include "llsdserialize.h" +#include "llsdutil_math.h" LLAgentPilot gAgentPilot; @@ -58,9 +60,28 @@ LLAgentPilot::~LLAgentPilot() { } -#define CAM_FIELDS 1 +#define CAM_FIELDS 0 -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()) { @@ -112,12 +133,58 @@ void LLAgentPilot::load(const std::string& filename) mActions.put(new_action); } - mOverrideCamera = true; + 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; + } + + 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); @@ -159,6 +226,34 @@ void LLAgentPilot::save(const std::string& filename) 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(); @@ -170,7 +265,7 @@ void LLAgentPilot::startRecord() void LLAgentPilot::stopRecord() { gAgentPilot.addAction(STRAIGHT); - gAgentPilot.save(gSavedSettings.getString("StatsPilotFile")); + gAgentPilot.save(); mRecording = FALSE; } @@ -202,7 +297,8 @@ void LLAgentPilot::startPlayback() if (mActions.count()) { llinfos << "Starting playback, moving to waypoint 0" << llendl; - if (!LLViewerJoystick::getInstance()->getOverrideCamera()) + if (getOverrideCamera() && + !LLViewerJoystick::getInstance()->getOverrideCamera()) { LLViewerJoystick::getInstance()->toggleFlycam(); } @@ -236,6 +332,9 @@ void LLAgentPilot::stopPlayback() void LLAgentPilot::moveCamera(Action& action) { + if (!getOverrideCamera()) + return; + LLViewerCamera::getInstance()->setView(action.mCameraView); LLViewerCamera::getInstance()->setOrigin(action.mCameraOrigin); LLViewerCamera::getInstance()->mXAxis = LLVector3(action.mCameraXAxis); diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h index fd2cb7ee32..5e045fa695 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(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index c6efaf4afe..db7e0149cc 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")); -- cgit v1.2.3 From 54bf80bf450fa6b8b50c573ca5ef902b4462d410 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 9 Feb 2011 18:23:30 -0500 Subject: SH-915 WIP - cleanup --- indra/newview/llagentpilot.cpp | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 1a443e62a4..25318c940a 100755 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -60,8 +60,6 @@ LLAgentPilot::~LLAgentPilot() { } -#define CAM_FIELDS 0 - void LLAgentPilot::load() { std::string txt_filename = gSavedSettings.getString("StatsPilotFile"); @@ -101,6 +99,7 @@ void LLAgentPilot::loadTxt(const std::string& filename) llinfos << "Opening pilot file " << filename << llendl; } + mActions.reset(); S32 num_actions; file >> num_actions; @@ -111,24 +110,6 @@ void LLAgentPilot::loadTxt(const std::string& filename) Action new_action; file >> new_action.mTime >> action_type; file >> new_action.mTarget.mdV[VX] >> new_action.mTarget.mdV[VY] >> new_action.mTarget.mdV[VZ]; -#if CAM_FIELDS - file >> new_action.mCameraView; - file >> new_action.mCameraOrigin.mV[VX] - >> new_action.mCameraOrigin.mV[VY] - >> new_action.mCameraOrigin.mV[VZ]; - - file >> new_action.mCameraXAxis.mV[VX] - >> new_action.mCameraXAxis.mV[VY] - >> new_action.mCameraXAxis.mV[VZ]; - - file >> new_action.mCameraYAxis.mV[VX] - >> new_action.mCameraYAxis.mV[VY] - >> new_action.mCameraYAxis.mV[VZ]; - - file >> new_action.mCameraZAxis.mV[VX] - >> new_action.mCameraZAxis.mV[VY] - >> new_action.mCameraZAxis.mV[VZ]; -#endif new_action.mType = (EActionType)action_type; mActions.put(new_action); } @@ -158,6 +139,7 @@ void LLAgentPilot::loadXML(const std::string& filename) llinfos << "Opening pilot file " << filename << llendl; } + mActions.reset(); LLSD record; while (!file.eof() && LLSDSerialize::fromXML(record, file)) { @@ -201,25 +183,6 @@ void LLAgentPilot::saveTxt(const std::string& filename) { 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]; -#if CAM_FIELDS - file << "\t" << mActions[i].mCameraView; - - file << "\t" << mActions[i].mCameraOrigin[VX] - << "\t" << mActions[i].mCameraOrigin[VY] - << "\t" << mActions[i].mCameraOrigin[VZ]; - - file << "\t" << mActions[i].mCameraXAxis[VX] - << "\t" << mActions[i].mCameraXAxis[VY] - << "\t" << mActions[i].mCameraXAxis[VZ]; - - file << "\t" << mActions[i].mCameraYAxis[VX] - << "\t" << mActions[i].mCameraYAxis[VY] - << "\t" << mActions[i].mCameraYAxis[VZ]; - - file << "\t" << mActions[i].mCameraZAxis[VX] - << "\t" << mActions[i].mCameraZAxis[VY] - << "\t" << mActions[i].mCameraZAxis[VZ]; -#endif file << '\n'; } -- cgit v1.2.3 From 49b8f8af026a627db47c9592fc92eccda790401e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 10 Feb 2011 15:57:08 -0500 Subject: SH-915 WIP - LLAgentPilot class cleanup, added interpolation for camera motion --- indra/newview/llagentpilot.cpp | 81 +++++++++++++++++++++++------------------- indra/newview/llagentpilot.h | 29 +++++++++------ indra/newview/llappviewer.cpp | 8 ++--- indra/newview/llstartup.cpp | 2 +- indra/newview/llviewermenu.cpp | 13 +++---- 5 files changed, 75 insertions(+), 58 deletions(-) mode change 100644 => 100755 indra/newview/llviewermenu.cpp (limited to 'indra/newview') diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 25318c940a..f96db0a5df 100755 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -41,9 +41,6 @@ LLAgentPilot gAgentPilot; -BOOL LLAgentPilot::sLoop = TRUE; -BOOL LLAgentPilot::sReplaySession = FALSE; - LLAgentPilot::LLAgentPilot() : mNumRuns(-1), mQuitAfterRuns(FALSE), @@ -52,7 +49,9 @@ LLAgentPilot::LLAgentPilot() : mStarted(FALSE), mPlaying(FALSE), mCurrentAction(0), - mOverrideCamera(FALSE) + mOverrideCamera(FALSE), + mLoop(TRUE), + mReplaySession(FALSE) { } @@ -266,7 +265,7 @@ void LLAgentPilot::startPlayback() LLViewerJoystick::getInstance()->toggleFlycam(); } gAgent.startAutoPilotGlobal(mActions[0].mTarget); - moveCamera(mActions[0]); + moveCamera(); mStarted = FALSE; } else @@ -287,22 +286,51 @@ void LLAgentPilot::stopPlayback() gAgent.stopAutoPilot(); } - if (sReplaySession) + if (mReplaySession) { LLAppViewer::instance()->forceQuit(); } } -void LLAgentPilot::moveCamera(Action& action) +void LLAgentPilot::moveCamera() { if (!getOverrideCamera()) return; + + if (mCurrentAction 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(action.mCameraView); - LLViewerCamera::getInstance()->setOrigin(action.mCameraOrigin); - LLViewerCamera::getInstance()->mXAxis = LLVector3(action.mCameraXAxis); - LLViewerCamera::getInstance()->mYAxis = LLVector3(action.mCameraYAxis); - LLViewerCamera::getInstance()->mZAxis = LLVector3(action.mCameraZAxis); + 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() @@ -336,13 +364,13 @@ void LLAgentPilot::updateTarget() if (mCurrentAction < mActions.count()) { gAgent.startAutoPilotGlobal(mActions[mCurrentAction].mTarget); - moveCamera(mActions[mCurrentAction]); + moveCamera(); } else { stopPlayback(); mNumRuns--; - if (sLoop) + if (mLoop) { if ((mNumRuns < 0) || (mNumRuns > 0)) { @@ -377,29 +405,8 @@ void LLAgentPilot::updateTarget() } } -// static -void LLAgentPilot::startRecord(void *) -{ - gAgentPilot.startRecord(); -} - -void LLAgentPilot::saveRecord(void *) -{ - gAgentPilot.stopRecord(); -} - -void LLAgentPilot::addWaypoint(void *) +void LLAgentPilot::addWaypoint() { - 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 5e045fa695..dd1709ec0c 100755 --- a/indra/newview/llagentpilot.h +++ b/indra/newview/llagentpilot.h @@ -60,24 +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; @@ -106,7 +116,6 @@ private: LLDynamicArray mActions; LLTimer mTimer; - void moveCamera(Action& action); }; extern LLAgentPilot gAgentPilot; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ec3d775dc7..0118d2dfc1 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")) @@ -4224,7 +4224,7 @@ void LLAppViewer::idle() { if (gAgentPilot.isPlaying() && gAgentPilot.getOverrideCamera()) { - // camera positioning handled inside gAgentPilot. + gAgentPilot.moveCamera(); } else { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index db7e0149cc..b98cbd5b78 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -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 old mode 100644 new mode 100755 index e9e0268587..eb022851e7 --- 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; } }; -- cgit v1.2.3 From 2111bb8eff0469647028a5a8102ee5201321ac10 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 10 Feb 2011 18:39:02 -0600 Subject: SH-958 Fix for entire scene being in shadow when shadows + SSAO disabled but "Lighting and Shadows" enabled. --- .../app_settings/shaders/class1/deferred/softenLightF.glsl | 10 +++------- indra/newview/llviewershadermgr.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'indra/newview') 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/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); } -- cgit v1.2.3