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