aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmanipscale.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llmanipscale.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/linden/indra/newview/llmanipscale.cpp b/linden/indra/newview/llmanipscale.cpp
index 10cb0c3..5a67937 100644
--- a/linden/indra/newview/llmanipscale.cpp
+++ b/linden/indra/newview/llmanipscale.cpp
@@ -69,6 +69,8 @@ const F32 SNAP_GUIDE_SCREEN_LENGTH = 0.7f;
69const F32 SELECTED_MANIPULATOR_SCALE = 1.2f; 69const F32 SELECTED_MANIPULATOR_SCALE = 1.2f;
70const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; 70const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f;
71const S32 NUM_MANIPULATORS = 14; 71const S32 NUM_MANIPULATORS = 14;
72const F32 DEFAULT_LL_MAX_PRIM_SCALE = 10.f;
73const F32 DEFAULT_OPENSIM_MAX_PRIM_SCALE = 128.f;
72 74
73const LLManip::EManipPart MANIPULATOR_IDS[NUM_MANIPULATORS] = 75const LLManip::EManipPart MANIPULATOR_IDS[NUM_MANIPULATORS] =
74{ 76{
@@ -173,6 +175,7 @@ LLManipScale::LLManipScale( LLToolComposite* composite )
173 mScaledBoxHandleSize( 1.f ), 175 mScaledBoxHandleSize( 1.f ),
174 mLastMouseX( -1 ), 176 mLastMouseX( -1 ),
175 mLastMouseY( -1 ), 177 mLastMouseY( -1 ),
178 mMaxPrimSize(0.f),
176 mSendUpdateOnMouseUp( FALSE ), 179 mSendUpdateOnMouseUp( FALSE ),
177 mLastUpdateFlags( 0 ), 180 mLastUpdateFlags( 0 ),
178 mScaleSnapUnit1(1.f), 181 mScaleSnapUnit1(1.f),
@@ -201,6 +204,7 @@ void LLManipScale::render()
201 LLGLDepthTest gls_depth(GL_TRUE); 204 LLGLDepthTest gls_depth(GL_TRUE);
202 LLGLEnable gl_blend(GL_BLEND); 205 LLGLEnable gl_blend(GL_BLEND);
203 LLGLEnable gls_alpha_test(GL_ALPHA_TEST); 206 LLGLEnable gls_alpha_test(GL_ALPHA_TEST);
207 mMaxPrimSize = gSavedSettings.getBOOL("LoggedIntoOpenSim") ? DEFAULT_OPENSIM_MAX_PRIM_SCALE : DEFAULT_LL_MAX_PRIM_SCALE;
204 208
205 if( canAffectSelection() ) 209 if( canAffectSelection() )
206 { 210 {
@@ -952,8 +956,8 @@ void LLManipScale::dragCorner( S32 x, S32 y )
952 mInSnapRegime = FALSE; 956 mInSnapRegime = FALSE;
953 } 957 }
954 958
955 F32 max_scale_factor = DEFAULT_MAX_PRIM_SCALE / MIN_PRIM_SCALE; 959 F32 max_scale_factor = mMaxPrimSize / MIN_PRIM_SCALE;
956 F32 min_scale_factor = MIN_PRIM_SCALE / DEFAULT_MAX_PRIM_SCALE; 960 F32 min_scale_factor = MIN_PRIM_SCALE / mMaxPrimSize;
957 961
958 // find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale 962 // find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale
959 for (LLObjectSelection::iterator iter = mObjectSelection->begin(); 963 for (LLObjectSelection::iterator iter = mObjectSelection->begin();
@@ -965,7 +969,7 @@ void LLManipScale::dragCorner( S32 x, S32 y )
965 { 969 {
966 const LLVector3& scale = selectNode->mSavedScale; 970 const LLVector3& scale = selectNode->mSavedScale;
967 971
968 F32 cur_max_scale_factor = llmin( DEFAULT_MAX_PRIM_SCALE / scale.mV[VX], DEFAULT_MAX_PRIM_SCALE / scale.mV[VY], DEFAULT_MAX_PRIM_SCALE / scale.mV[VZ] ); 972 F32 cur_max_scale_factor = llmin( mMaxPrimSize / scale.mV[VX], mMaxPrimSize / scale.mV[VY], mMaxPrimSize / scale.mV[VZ] );
969 max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor ); 973 max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor );
970 974
971 F32 cur_min_scale_factor = llmax( MIN_PRIM_SCALE / scale.mV[VX], MIN_PRIM_SCALE / scale.mV[VY], MIN_PRIM_SCALE / scale.mV[VZ] ); 975 F32 cur_min_scale_factor = llmax( MIN_PRIM_SCALE / scale.mV[VX], MIN_PRIM_SCALE / scale.mV[VY], MIN_PRIM_SCALE / scale.mV[VZ] );
@@ -1262,7 +1266,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto
1262 1266
1263 F32 denom = axis * dir_local; 1267 F32 denom = axis * dir_local;
1264 F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters 1268 F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters
1265 F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); 1269 F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_PRIM_SCALE, mMaxPrimSize);
1266 // propagate scale constraint back to position offset 1270 // propagate scale constraint back to position offset
1267 desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position 1271 desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position
1268 1272
@@ -1962,7 +1966,7 @@ F32 LLManipScale::partToMaxScale( S32 part, const LLBBox &bbox ) const
1962 max_extent = bbox_extents.mV[i]; 1966 max_extent = bbox_extents.mV[i];
1963 } 1967 }
1964 } 1968 }
1965 max_scale_factor = bbox_extents.magVec() * DEFAULT_MAX_PRIM_SCALE / max_extent; 1969 max_scale_factor = bbox_extents.magVec() * mMaxPrimSize / max_extent;
1966 1970
1967 if (getUniform()) 1971 if (getUniform())
1968 { 1972 {
@@ -1977,7 +1981,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const
1977{ 1981{
1978 LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox ); 1982 LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox );
1979 bbox_extents.abs(); 1983 bbox_extents.abs();
1980 F32 min_extent = DEFAULT_MAX_PRIM_SCALE; 1984 F32 min_extent = mMaxPrimSize;
1981 for (U32 i = VX; i <= VZ; i++) 1985 for (U32 i = VX; i <= VZ; i++)
1982 { 1986 {
1983 if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent) 1987 if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent)
@@ -2052,3 +2056,13 @@ BOOL LLManipScale::canAffectSelection()
2052 } 2056 }
2053 return can_scale; 2057 return can_scale;
2054} 2058}
2059
2060//static
2061F32 LLManipScale::getMaxPrimSize()
2062{
2063 if (gSavedSettings.getBOOL("LoggedIntoOpenSim"))
2064 {
2065 return DEFAULT_OPENSIM_MAX_PRIM_SCALE;
2066 }
2067 return DEFAULT_LL_MAX_PRIM_SCALE;
2068}