diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index c0fcac9775..d7ac332243 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -181,7 +181,7 @@ LLAgentCamera::LLAgentCamera() : // FIRE-7758: Save/load camera position mStoredCameraPos(), mStoredCameraFocus(), - mStoredCameraFocusObject(NULL), + mStoredCameraFocusObjectId(), mHasStoredCameraPos(false), // @@ -2881,29 +2881,32 @@ S32 LLAgentCamera::directionToKey(S32 direction) return 0; } -// FIRE-7758: Save/load camera position +// FIRE-7758: Save/load camera position feature +// Copyright (C) 2012, Ansariel Hiller @ Second Life for Phoenix Firestorm Viewer +// This code is licensed unter the GNU Lesser General Public License version 2.1 void LLAgentCamera::storeCameraPosition() { mStoredCameraPos = getCameraPositionGlobal(); mStoredCameraFocus = getFocusTargetGlobal(); - mStoredCameraFocusObject = getFocusObject(); + mStoredCameraFocusObjectId = LLUUID::null; + if (mFocusObject) + { + mStoredCameraFocusObjectId = mFocusObject->getID(); + } mHasStoredCameraPos = true; } void LLAgentCamera::loadCameraPosition() { - if (mHasStoredCameraPos) + F32 renderFarClip = gSavedSettings.getF32("RenderFarClip"); + F32 far_clip_squared = renderFarClip * renderFarClip; + if (mHasStoredCameraPos && dist_vec_squared(gAgent.getPositionGlobal(), mStoredCameraPos) <= far_clip_squared) { unlockView(); - LLUUID focus_object_id; - if (mStoredCameraFocusObject) - { - focus_object_id = mStoredCameraFocusObject->getID(); - } - setCameraPosAndFocusGlobal(mStoredCameraPos, mStoredCameraFocus, focus_object_id); + setCameraPosAndFocusGlobal(mStoredCameraPos, mStoredCameraFocus, mStoredCameraFocusObjectId); } } -// FIRE-7758: Save/load camera position feature // EOF diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index fbdf44891e..dcec7a616f 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -389,7 +389,9 @@ private: ** ** *******************************************************************************/ -// FIRE-7758: Save/load camera position +// FIRE-7758: Save/load camera position feature +// Copyright (C) 2012, Ansariel Hiller @ Second Life for Phoenix Firestorm Viewer +// This code is licensed unter the GNU Lesser General Public License version 2.1 public: void storeCameraPosition(); void loadCameraPosition(); @@ -397,9 +399,9 @@ public: private: LLVector3d mStoredCameraPos; LLVector3d mStoredCameraFocus; - LLPointer mStoredCameraFocusObject; + LLUUID mStoredCameraFocusObjectId; bool mHasStoredCameraPos; -// +// FIRE-7758: Save/load camera position feature }; extern LLAgentCamera gAgentCamera;