SL-12424 Allow saving offsets based on current camera position
parent
65ea59904c
commit
fcbccd59d9
|
|
@ -1985,6 +1985,22 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
|||
}
|
||||
|
||||
|
||||
LLVector3 LLAgentCamera::getCurrentCameraOffset()
|
||||
{
|
||||
LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - gAgentAvatarp->getRenderPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion();
|
||||
return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale");
|
||||
}
|
||||
|
||||
LLVector3d LLAgentCamera::getCurrentFocusOffset()
|
||||
{
|
||||
return (mFocusTargetGlobal - gAgent.getPositionGlobal()) * ~gAgent.getFrameAgent().getQuaternion();
|
||||
}
|
||||
|
||||
bool LLAgentCamera::isJoystickCameraUsed()
|
||||
{
|
||||
return ((mOrbitAroundRadians != 0) || (mOrbitOverAngle != 0) || !mPanFocusDiff.isNull());
|
||||
}
|
||||
|
||||
LLVector3 LLAgentCamera::getCameraOffsetInitial()
|
||||
{
|
||||
return convert_from_llsd<LLVector3>(mCameraOffsetInitial->get(), TYPE_VEC3, "");
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@ public:
|
|||
/** Determines default focus offset depending on the current camera preset */
|
||||
LLVector3d getFocusOffsetInitial();
|
||||
|
||||
LLVector3 getCurrentCameraOffset();
|
||||
LLVector3d getCurrentFocusOffset();
|
||||
bool isJoystickCameraUsed();
|
||||
|
||||
private:
|
||||
/** Determines maximum camera distance from target for mouselook, opposite to LAND_MIN_ZOOM */
|
||||
F32 getCameraMaxZoomDistance();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "llfloatersavecamerapreset.h"
|
||||
|
||||
#include "llagentcamera.h"
|
||||
#include "llbutton.h"
|
||||
#include "llcombobox.h"
|
||||
#include "llfloaterpreference.h"
|
||||
|
|
@ -101,6 +102,11 @@ void LLFloaterSaveCameraPreset::onBtnSave()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (gAgentCamera.isJoystickCameraUsed())
|
||||
{
|
||||
gSavedSettings.setVector3("CameraOffsetRearView", gAgentCamera.getCurrentCameraOffset());
|
||||
gSavedSettings.setVector3d("FocusOffsetRearView", gAgentCamera.getCurrentFocusOffset());
|
||||
}
|
||||
if (is_saving_new)
|
||||
{
|
||||
std::list<std::string> preset_names;
|
||||
|
|
|
|||
Loading…
Reference in New Issue