aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llagent.cpp')
-rw-r--r--linden/indra/newview/llagent.cpp111
1 files changed, 66 insertions, 45 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp
index e6438f4..08fd35d 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -187,6 +187,9 @@ const F32 OBJECT_MIN_ZOOM = 0.02f;
187const F32 APPEARANCE_MIN_ZOOM = 0.39f; 187const F32 APPEARANCE_MIN_ZOOM = 0.39f;
188const F32 APPEARANCE_MAX_ZOOM = 8.f; 188const F32 APPEARANCE_MAX_ZOOM = 8.f;
189 189
190const F32 DIST_FUDGE = 16.f; // meters
191const F32 MAX_CAMERA_DIST_NO_CONSTRANT = 65535.f*4.f;
192
190// fidget constants 193// fidget constants
191const F32 MIN_FIDGET_TIME = 8.f; // seconds 194const F32 MIN_FIDGET_TIME = 8.f; // seconds
192const F32 MAX_FIDGET_TIME = 20.f; // seconds 195const F32 MAX_FIDGET_TIME = 20.f; // seconds
@@ -1728,10 +1731,17 @@ F32 LLAgent::getCameraZoomFraction()
1728 else 1731 else
1729 { 1732 {
1730 F32 min_zoom; 1733 F32 min_zoom;
1731 const F32 DIST_FUDGE = 16.f; // meters 1734 F32 max_zoom;
1732 F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, 1735 if (gSavedSettings.getBOOL("DisableCameraConstraints"))
1736 {
1737 max_zoom = MAX_CAMERA_DIST_NO_CONSTRANT;
1738 }
1739 else
1740 {
1741 max_zoom = llmin(mDrawDistance - DIST_FUDGE,
1733 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, 1742 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE,
1734 MAX_CAMERA_DISTANCE_FROM_AGENT); 1743 MAX_CAMERA_DISTANCE_FROM_AGENT);
1744 }
1735 1745
1736 F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); 1746 F32 distance = (F32)mCameraFocusOffsetTarget.magVec();
1737 if (mFocusObject.notNull()) 1747 if (mFocusObject.notNull())
@@ -1777,10 +1787,17 @@ void LLAgent::setCameraZoomFraction(F32 fraction)
1777 else 1787 else
1778 { 1788 {
1779 F32 min_zoom = LAND_MIN_ZOOM; 1789 F32 min_zoom = LAND_MIN_ZOOM;
1780 const F32 DIST_FUDGE = 16.f; // meters 1790 F32 max_zoom;
1781 F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, 1791 if (gSavedSettings.getBOOL("DisableCameraConstraints"))
1792 {
1793 max_zoom = MAX_CAMERA_DIST_NO_CONSTRANT;
1794 }
1795 else
1796 {
1797 max_zoom = llmin(mDrawDistance - DIST_FUDGE,
1782 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, 1798 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE,
1783 MAX_CAMERA_DISTANCE_FROM_AGENT); 1799 MAX_CAMERA_DISTANCE_FROM_AGENT);
1800 }
1784 1801
1785 if (mFocusObject.notNull()) 1802 if (mFocusObject.notNull())
1786 { 1803 {
@@ -1898,29 +1915,32 @@ void LLAgent::cameraZoomIn(const F32 fraction)
1898 } 1915 }
1899 } 1916 }
1900 1917
1901 new_distance = llmax(new_distance, min_zoom);
1902
1903 // Don't zoom too far back 1918 // Don't zoom too far back
1904 const F32 DIST_FUDGE = 16.f; // meters 1919 // Actually, let's when disable camera constraints is active -- McCabe
1905 F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, 1920 if (!gSavedSettings.getBOOL("DisableCameraConstraints"))
1906 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE );
1907
1908 if (new_distance > max_distance)
1909 { 1921 {
1910 new_distance = max_distance; 1922 new_distance = llmax(new_distance, min_zoom);
1911 1923
1912 /* 1924 F32 max_distance = llmin(mDrawDistance - DIST_FUDGE,
1913 // Unless camera is unlocked 1925 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE );
1914 if (!LLViewerCamera::sDisableCameraConstraints) 1926
1927 if (new_distance > max_distance)
1915 { 1928 {
1916 return; 1929 new_distance = max_distance;
1930
1931 /*
1932 // Unless camera is unlocked
1933 if (!LLViewerCamera::sDisableCameraConstraints)
1934 {
1935 return;
1936 }
1937 */
1917 } 1938 }
1918 */
1919 }
1920 1939
1921 if( cameraCustomizeAvatar() ) 1940 if( cameraCustomizeAvatar() )
1922 { 1941 {
1923 new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); 1942 new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM );
1943 }
1924 } 1944 }
1925 1945
1926 mCameraFocusOffsetTarget = new_distance * camera_offset_unit; 1946 mCameraFocusOffsetTarget = new_distance * camera_offset_unit;
@@ -1951,40 +1971,41 @@ void LLAgent::cameraOrbitIn(const F32 meters)
1951 LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); 1971 LLVector3d camera_offset_unit(mCameraFocusOffsetTarget);
1952 F32 current_distance = (F32)camera_offset_unit.normalize(); 1972 F32 current_distance = (F32)camera_offset_unit.normalize();
1953 F32 new_distance = current_distance - meters; 1973 F32 new_distance = current_distance - meters;
1954 F32 min_zoom = LAND_MIN_ZOOM; 1974
1955 1975 // Don't zoom too far back
1956 // Don't move through focus point 1976 // Actually, let's when disable camera constraints is active -- McCabe
1957 if (mFocusObject.notNull()) 1977 if (!gSavedSettings.getBOOL("DisableCameraConstraints"))
1958 { 1978 {
1959 if (mFocusObject->isAvatar()) 1979 F32 min_zoom = LAND_MIN_ZOOM;
1960 { 1980 F32 max_distance;
1961 min_zoom = AVATAR_MIN_ZOOM; 1981
1962 } 1982 // Don't move through focus point
1963 else 1983 if (mFocusObject.notNull())
1964 { 1984 {
1965 min_zoom = OBJECT_MIN_ZOOM; 1985 if (mFocusObject->isAvatar())
1986 {
1987 min_zoom = AVATAR_MIN_ZOOM;
1988 }
1989 else
1990 {
1991 min_zoom = OBJECT_MIN_ZOOM;
1992 }
1966 } 1993 }
1967 }
1968 1994
1969 new_distance = llmax(new_distance, min_zoom); 1995 new_distance = llmax(new_distance, min_zoom);
1970 1996
1971 // Don't zoom too far back 1997 max_distance = llmin(mDrawDistance - DIST_FUDGE,
1972 const F32 DIST_FUDGE = 16.f; // meters 1998 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE );
1973 F32 max_distance = llmin(mDrawDistance - DIST_FUDGE,
1974 LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE );
1975 1999
1976 if (new_distance > max_distance) 2000 if (new_distance > max_distance)
1977 {
1978 // Unless camera is unlocked
1979 if (!gSavedSettings.getBOOL("DisableCameraConstraints"))
1980 { 2001 {
1981 return; 2002 return;
1982 } 2003 }
1983 }
1984 2004
1985 if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() ) 2005 if( CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode() )
1986 { 2006 {
1987 new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM ); 2007 new_distance = llclamp( new_distance, APPEARANCE_MIN_ZOOM, APPEARANCE_MAX_ZOOM );
2008 }
1988 } 2009 }
1989 2010
1990 // Compute new camera offset 2011 // Compute new camera offset