aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llagent.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-05-27 02:46:02 -0700
committerJacek Antonelli2010-06-19 02:43:02 -0500
commit98a21e2d491fc12808751db7edc960810226bccd (patch)
tree5e73b4525cf0fec1fe324feb9428af9ab77948d3 /linden/indra/newview/llagent.cpp
parentAdded some debug lines to llviewermessage for animations (diff)
downloadmeta-impy-98a21e2d491fc12808751db7edc960810226bccd.zip
meta-impy-98a21e2d491fc12808751db7edc960810226bccd.tar.gz
meta-impy-98a21e2d491fc12808751db7edc960810226bccd.tar.bz2
meta-impy-98a21e2d491fc12808751db7edc960810226bccd.tar.xz
Added checkbox in Preferences > Input and Camera to disable the minimum zoom in distance (DisableMinZoomDist)
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llagent.cpp43
1 files changed, 26 insertions, 17 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp
index 4753bc8..e2be0d0 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -1780,12 +1780,12 @@ void LLAgent::setCameraZoomFraction(F32 fraction)
1780 // 0.f -> camera zoomed all the way out 1780 // 0.f -> camera zoomed all the way out
1781 // 1.f -> camera zoomed all the way in 1781 // 1.f -> camera zoomed all the way in
1782 LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); 1782 LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
1783 1783 BOOL disable_min = gSavedSettings.getBOOL("DisableMinZoomDist");
1784 if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) 1784 if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
1785 { 1785 {
1786 mHUDTargetZoom = fraction; 1786 mHUDTargetZoom = fraction;
1787 } 1787 }
1788 else if (mFocusOnAvatar && cameraThirdPerson()) 1788 else if (mFocusOnAvatar && cameraThirdPerson() && !disable_min)
1789 { 1789 {
1790 mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION); 1790 mCameraZoomFraction = rescale(fraction, 0.f, 1.f, MAX_ZOOM_FRACTION, MIN_ZOOM_FRACTION);
1791 } 1791 }
@@ -1802,7 +1802,7 @@ void LLAgent::setCameraZoomFraction(F32 fraction)
1802 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, 1802 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE,
1803 MAX_CAMERA_DISTANCE_FROM_AGENT); 1803 MAX_CAMERA_DISTANCE_FROM_AGENT);
1804 1804
1805 if (mFocusObject.notNull()) 1805 if (!disable_min)
1806 { 1806 {
1807 if (mFocusObject.notNull()) 1807 if (mFocusObject.notNull())
1808 { 1808 {
@@ -1816,6 +1816,10 @@ void LLAgent::setCameraZoomFraction(F32 fraction)
1816 } 1816 }
1817 } 1817 }
1818 } 1818 }
1819 else
1820 {
1821 min_zoom = 0.f;
1822 }
1819 1823
1820 LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; 1824 LLVector3d camera_offset_dir = mCameraFocusOffsetTarget;
1821 camera_offset_dir.normalize(); 1825 camera_offset_dir.normalize();
@@ -1906,30 +1910,34 @@ void LLAgent::cameraZoomIn(const F32 fraction)
1906 1910
1907 LLVector3d camera_offset(mCameraFocusOffsetTarget); 1911 LLVector3d camera_offset(mCameraFocusOffsetTarget);
1908 LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); 1912 LLVector3d camera_offset_unit(mCameraFocusOffsetTarget);
1909 F32 min_zoom = LAND_MIN_ZOOM; 1913 F32 min_zoom = 0.f;//LAND_MIN_ZOOM;
1910 F32 current_distance = (F32)camera_offset_unit.normalize(); 1914 F32 current_distance = (F32)camera_offset_unit.normalize();
1911 F32 new_distance = current_distance * fraction; 1915 F32 new_distance = current_distance * fraction;
1912 1916
1913 // Don't move through focus point 1917 // Don't move through focus point
1914 if (mFocusObject) 1918
1919 if (!gSavedSettings.getBOOL("DisableMinZoomDist"))
1915 { 1920 {
1916 LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]); 1921 if (mFocusObject)
1917
1918 if (mFocusObject->isAvatar())
1919 {
1920 calcCameraMinDistance(min_zoom);
1921 }
1922 else
1923 { 1922 {
1924 min_zoom = OBJECT_MIN_ZOOM; 1923 LLVector3 camera_offset_dir((F32)camera_offset_unit.mdV[VX], (F32)camera_offset_unit.mdV[VY], (F32)camera_offset_unit.mdV[VZ]);
1924 if (mFocusObject->isAvatar())
1925 {
1926 calcCameraMinDistance(min_zoom);
1927 }
1928 else
1929 {
1930 min_zoom = OBJECT_MIN_ZOOM;
1931 }
1925 } 1932 }
1933 new_distance = llmax(new_distance, min_zoom);
1926 } 1934 }
1927 1935
1928 // Don't zoom too far back 1936 // Don't zoom too far back
1929 // Actually, let's when disable camera constraints is active -- McCabe 1937 // Actually, let's when disable camera constraints is active -- McCabe
1930 if (!gSavedSettings.getBOOL("DisableCameraConstraints")) 1938 if (!gSavedSettings.getBOOL("DisableCameraConstraints"))
1931 { 1939 {
1932 new_distance = llmax(new_distance, min_zoom); 1940 //new_distance = llmax(new_distance, min_zoom);
1933 1941
1934 F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, 1942 F32 max_distance = llmin(mDrawDistance - DIST_FUDGE,
1935 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); 1943 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE );
@@ -1947,7 +1955,7 @@ void LLAgent::cameraZoomIn(const F32 fraction)
1947 */ 1955 */
1948 } 1956 }
1949 1957
1950 if( cameraCustomizeAvatar() ) 1958 if( cameraCustomizeAvatar() && !gSavedSettings.getBOOL("DisableMinZoomDist"))
1951 { 1959 {
1952 new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); 1960 new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM );
1953 } 1961 }
@@ -3679,7 +3687,8 @@ F32 LLAgent::calcCameraFOVZoomFactor()
3679 // don't FOV zoom on mostly transparent objects 3687 // don't FOV zoom on mostly transparent objects
3680 LLVector3 focus_offset = mFocusObjectOffset; 3688 LLVector3 focus_offset = mFocusObjectOffset;
3681 F32 obj_min_dist = 0.f; 3689 F32 obj_min_dist = 0.f;
3682 calcCameraMinDistance(obj_min_dist); 3690 if (!gSavedSettings.getBOOL("DisableMinZoomDist"))
3691 calcCameraMinDistance(obj_min_dist);
3683 F32 current_distance = llmax(0.001f, camera_offset_dir.magVec()); 3692 F32 current_distance = llmax(0.001f, camera_offset_dir.magVec());
3684 3693
3685 mFocusObjectDist = obj_min_dist - current_distance; 3694 mFocusObjectDist = obj_min_dist - current_distance;
@@ -3825,7 +3834,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
3825 camera_distance = local_camera_offset.normalize(); 3834 camera_distance = local_camera_offset.normalize();
3826 } 3835 }
3827 3836
3828 mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); 3837 mTargetCameraDistance = (gSavedSettings.getBOOL("DisableMinZoomDist")) ? camera_distance : llmax(camera_distance, MIN_CAMERA_DISTANCE);
3829 3838
3830 if (mTargetCameraDistance != mCurrentCameraDistance) 3839 if (mTargetCameraDistance != mCurrentCameraDistance)
3831 { 3840 {