summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llmanipscale.cpp97
-rwxr-xr-xindra/newview/llmanipscale.h12
2 files changed, 56 insertions, 53 deletions
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index e93420ae21..ea4235efde 100755
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -564,7 +564,7 @@ void LLManipScale::renderFaces( const LLBBox& bbox )
// +------------+ | (texture coordinates)
// | | |
// | 1 | (*) --->s
- // | +X |
+ // | +X |
// | |
// (+++) (+-+)| |(+--) (++-) (+++)
// +------------+------------+------------+------------+
@@ -784,7 +784,7 @@ void LLManipScale::renderAxisHandle( const LLVector3& start, const LLVector3& en
{
// Draws a single "jacks" style handle: a long, retangular box from start to end.
LLVector3 offset_start = end - start;
- offset_start.normallize();
+ offset_start.normalize();
offset_start = start + mBoxHandleSize * offset_start;
LLVector3 delta = end - offset_start;
@@ -836,7 +836,7 @@ void LLManipScale::drag( S32 x, S32 y )
selectNode->mLastScale = cur->getScale();
selectNode->mLastPositionLocal = cur->getPosition();
}
- }
+ }
LLSelectMgr::getInstance()->updateSelectionCenter();
gAgentCamera.clearFocusObject();
@@ -872,7 +872,7 @@ void LLManipScale::dragCorner( S32 x, S32 y )
}
mDragPointGlobal = lerp(mDragStartCenterGlobal, mDragStartPointGlobal, t);
- LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
+ LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection();
F32 scale_factor = 1.f;
F32 max_scale = partToMaxScale(mManipPart, bbox);
F32 min_scale = partToMinScale(mManipPart, bbox);
@@ -1039,6 +1039,7 @@ void LLManipScale::dragCorner( S32 x, S32 y )
rebuild(cur);
}
}
+
}
@@ -1322,7 +1323,7 @@ void LLManipScale::renderGuidelinesPart( const LLBBox& bbox )
}
guideline_end -= guideline_start;
- guideline_end.normallize();
+ guideline_end.normalize();
guideline_end *= LLWorld::getInstance()->getRegionWidthInMeters();
guideline_end += guideline_start;
@@ -1348,7 +1349,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
LLVector3 box_corner_agent = bbox.localToAgent(unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ));
mScaleCenter = uniform ? bbox.getCenterAgent() : bbox.localToAgent(unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox ));
mScaleDir = box_corner_agent - mScaleCenter;
- mScaleDir.normallize();
+ mScaleDir.normalize();
if(mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
@@ -1376,7 +1377,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
mSnapGuideLength = snap_guide_length / llmax(0.1f, (llmin(mSnapGuideDir1 * cam_at_axis, mSnapGuideDir2 * cam_at_axis)));
LLVector3 off_axis_dir = mScaleDir % cam_at_axis;
- off_axis_dir.normallize();
+ off_axis_dir.normalize();
if( (LL_FACE_MIN <= (S32)mManipPart) && ((S32)mManipPart <= LL_FACE_MAX) )
{
@@ -1413,7 +1414,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
else
{
local_camera_dir = (LLViewerCamera::getInstance()->getOrigin() - box_corner_agent) * ~bbox.getRotation();
- local_camera_dir.normallize();
+ local_camera_dir.normalize();
}
LLVector3 axis_flip;
@@ -1546,10 +1547,10 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
}
mScalePlaneNormal1 = mSnapGuideDir1 % mScaleDir;
- mScalePlaneNormal1.normallize();
+ mScalePlaneNormal1.normalize();
mScalePlaneNormal2 = mSnapGuideDir2 % mScaleDir;
- mScalePlaneNormal2.normallize();
+ mScalePlaneNormal2.normalize();
mScaleSnapUnit1 = mScaleSnapUnit1 / (mSnapDir1 * mScaleDir);
mScaleSnapUnit2 = mScaleSnapUnit2 / (mSnapDir2 * mScaleDir);
@@ -1571,7 +1572,6 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
return;
}
- F32 max_subdivisions = sGridMaxSubdivisionLevel;
F32 grid_alpha = gSavedSettings.getF32("GridOpacity");
F32 max_point_on_scale_line = partToMaxScale(mManipPart, bbox);
@@ -1613,24 +1613,28 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
LLGLDepthTest gls_depth(GL_FALSE);
F32 dist_grid_axis = (drag_point - mScaleCenter) * mScaleDir;
+
+ F32 smallest_subdivision1 = mScaleSnapUnit1 / sGridMaxSubdivisionLevel;
+ F32 smallest_subdivision2 = mScaleSnapUnit2 / sGridMaxSubdivisionLevel;
+
// find distance to nearest smallest grid unit
- F32 grid_multiple1 = llfloor(llmax(0.f, dist_grid_axis) / (mScaleSnapUnit1 / max_subdivisions));
- F32 grid_multiple2 = llfloor(llmax(0.f, dist_grid_axis) / (mScaleSnapUnit2 / max_subdivisions));
- F32 grid_offset1 = fmodf(dist_grid_axis, mScaleSnapUnit1 / max_subdivisions);
- F32 grid_offset2 = fmodf(dist_grid_axis, mScaleSnapUnit2 / max_subdivisions);
+ F32 grid_multiple1 = llfloor(llmax(0.f, dist_grid_axis) / smallest_subdivision1);
+ F32 grid_multiple2 = llfloor(llmax(0.f, dist_grid_axis) / smallest_subdivision2);
+ F32 grid_offset1 = fmodf(dist_grid_axis, smallest_subdivision1);
+ F32 grid_offset2 = fmodf(dist_grid_axis, smallest_subdivision2);
// how many smallest grid units are we away from largest grid scale?
- S32 sub_div_offset_1 = llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 / sGridMinSubdivisionLevel) / (mScaleSnapUnit1 / max_subdivisions));
- S32 sub_div_offset_2 = llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 / sGridMinSubdivisionLevel) / (mScaleSnapUnit2 / max_subdivisions));
+ S32 sub_div_offset_1 = llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 / sGridMinSubdivisionLevel) / smallest_subdivision1);
+ S32 sub_div_offset_2 = llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 / sGridMinSubdivisionLevel) / smallest_subdivision2);
- S32 num_ticks_per_side1 = llmax(1, lltrunc(0.5f * mSnapGuideLength / (mScaleSnapUnit1 / max_subdivisions)));
- S32 num_ticks_per_side2 = llmax(1, lltrunc(0.5f * mSnapGuideLength / (mScaleSnapUnit2 / max_subdivisions)));
- F32 dist_scale_units_1 = dist_grid_axis / (mScaleSnapUnit1 / max_subdivisions);
- F32 dist_scale_units_2 = dist_grid_axis / (mScaleSnapUnit2 / max_subdivisions);
+ S32 num_ticks_per_side1 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision1));
+ S32 num_ticks_per_side2 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision2));
+ F32 dist_scale_units_1 = dist_grid_axis / smallest_subdivision1;
+ F32 dist_scale_units_2 = dist_grid_axis / smallest_subdivision2;
S32 ticks_from_scale_center_1 = lltrunc(dist_scale_units_1);
S32 ticks_from_scale_center_2 = lltrunc(dist_scale_units_2);
- S32 max_ticks1 = llceil(max_point_on_scale_line / (mScaleSnapUnit1 / max_subdivisions) - dist_scale_units_1);
- S32 max_ticks2 = llceil(max_point_on_scale_line / (mScaleSnapUnit2 / max_subdivisions) - dist_scale_units_2);
+ S32 max_ticks1 = llceil(max_point_on_scale_line / smallest_subdivision1 - dist_scale_units_1);
+ S32 max_ticks2 = llceil(max_point_on_scale_line / smallest_subdivision2 - dist_scale_units_2);
S32 start_tick = 0;
S32 stop_tick = 0;
@@ -1660,13 +1664,13 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
LLVector3 arrow_span = mScaleDir;
arrow_dir = snap_line_start - snap_line_center;
- arrow_dir.normallize();
+ arrow_dir.normalize();
gGL.vertex3fv((snap_line_start + arrow_dir * mBoxHandleSize).mV);
gGL.vertex3fv((snap_line_start + arrow_span * mBoxHandleSize).mV);
gGL.vertex3fv((snap_line_start - arrow_span * mBoxHandleSize).mV);
arrow_dir = snap_line_end - snap_line_center;
- arrow_dir.normallize();
+ arrow_dir.normalize();
gGL.vertex3fv((snap_line_end + arrow_dir * mBoxHandleSize).mV);
gGL.vertex3fv((snap_line_end + arrow_span * mBoxHandleSize).mV);
gGL.vertex3fv((snap_line_end - arrow_span * mBoxHandleSize).mV);
@@ -1675,7 +1679,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
}
LLVector2 screen_translate_axis(llabs(mScaleDir * LLViewerCamera::getInstance()->getLeftAxis()), llabs(mScaleDir * LLViewerCamera::getInstance()->getUpAxis()));
- screen_translate_axis.normallize();
+ screen_translate_axis.normalize();
S32 tick_label_spacing = llround(screen_translate_axis * sTickLabelSpacing);
@@ -1691,17 +1695,17 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
for (S32 i = start_tick; i <= stop_tick; i++)
{
F32 alpha = (1.f - (1.f * ((F32)llabs(i) / (F32)num_ticks_per_side1)));
- LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple1 + i) * (mScaleSnapUnit1 / max_subdivisions));
+ LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple1 + i) * smallest_subdivision1);
F32 cur_subdivisions = llclamp(getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, mTickPixelSpacing1), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
- if (fmodf((F32)(i + sub_div_offset_1), (max_subdivisions / cur_subdivisions)) != 0.f)
+ if (fmodf((F32)(i + sub_div_offset_1), (sGridMaxSubdivisionLevel / cur_subdivisions)) != 0.f)
{
continue;
}
F32 tick_scale = 1.f;
- for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
{
if (fmodf((F32)(i + sub_div_offset_1), division_level) == 0.f)
{
@@ -1724,17 +1728,17 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
for (S32 i = start_tick; i <= stop_tick; i++)
{
F32 alpha = (1.f - (1.f * ((F32)llabs(i) / (F32)num_ticks_per_side2)));
- LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple2 + i) * (mScaleSnapUnit2 / max_subdivisions));
+ LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple2 + i) * smallest_subdivision2);
F32 cur_subdivisions = llclamp(getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit2, mTickPixelSpacing2), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel);
- if (fmodf((F32)(i + sub_div_offset_2), (max_subdivisions / cur_subdivisions)) != 0.f)
+ if (fmodf((F32)(i + sub_div_offset_2), (sGridMaxSubdivisionLevel / cur_subdivisions)) != 0.f)
{
continue;
}
F32 tick_scale = 1.f;
- for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
{
if (fmodf((F32)(i + sub_div_offset_2), division_level) == 0.f)
{
@@ -1757,16 +1761,16 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
stop_tick = llmin(max_ticks1, num_ticks_per_side1);
F32 grid_resolution = mObjectSelection->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax(gSavedSettings.getF32("GridResolution"), 0.001f);
- S32 label_sub_div_offset_1 = llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / (mScaleSnapUnit1 / max_subdivisions));
- S32 label_sub_div_offset_2 = llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / (mScaleSnapUnit2 / max_subdivisions));
+ S32 label_sub_div_offset_1 = llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / smallest_subdivision1);
+ S32 label_sub_div_offset_2 = llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / smallest_subdivision2);
for (S32 i = start_tick; i <= stop_tick; i++)
{
F32 tick_scale = 1.f;
F32 alpha = grid_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side1)));
- LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple1 + i) * (mScaleSnapUnit1 / max_subdivisions));
+ LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple1 + i) * smallest_subdivision1);
- for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
{
if (fmodf((F32)(i + label_sub_div_offset_1), division_level) == 0.f)
{
@@ -1775,16 +1779,15 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
tick_scale *= 0.7f;
}
- if (fmodf((F32)(i + label_sub_div_offset_1), (max_subdivisions / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, tick_label_spacing)))) == 0.f)
+ if (fmodf((F32)(i + label_sub_div_offset_1), (sGridMaxSubdivisionLevel / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit1, tick_label_spacing)))) == 0.f)
{
- LLVector3 text_origin = tick_pos +
- (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale));
+ LLVector3 text_origin = tick_pos + (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale));
EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
F32 tick_value;
if (grid_mode == GRID_MODE_WORLD)
{
- tick_value = (grid_multiple1 + i) / (max_subdivisions / grid_resolution);
+ tick_value = (grid_multiple1 + i) / (sGridMaxSubdivisionLevel / grid_resolution);
}
else
{
@@ -1811,9 +1814,9 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
{
F32 tick_scale = 1.f;
F32 alpha = grid_alpha * (1.f - (0.5f * ((F32)llabs(i) / (F32)num_ticks_per_side2)));
- LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple2 + i) * (mScaleSnapUnit2 / max_subdivisions));
+ LLVector3 tick_pos = mScaleCenter + (mScaleDir * (grid_multiple2 + i) * smallest_subdivision2);
- for (F32 division_level = max_subdivisions; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
+ for (F32 division_level = sGridMaxSubdivisionLevel; division_level >= sGridMinSubdivisionLevel; division_level /= 2.f)
{
if (fmodf((F32)(i + label_sub_div_offset_2), division_level) == 0.f)
{
@@ -1822,22 +1825,22 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
tick_scale *= 0.7f;
}
- if (fmodf((F32)(i + label_sub_div_offset_2), (max_subdivisions / llmin(max_subdivisions, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit2, tick_label_spacing)))) == 0.f)
+ if (fmodf((F32)(i + label_sub_div_offset_2), (sGridMaxSubdivisionLevel / llmin(sGridMaxSubdivisionLevel, getSubdivisionLevel(tick_pos, mScaleDir, mScaleSnapUnit2, tick_label_spacing)))) == 0.f)
{
- LLVector3 text_origin = tick_pos +
- (mSnapGuideDir2 * mSnapRegimeOffset * (1.f + tick_scale));
+ LLVector3 text_origin = tick_pos + (mSnapGuideDir2 * mSnapRegimeOffset * (1.f + tick_scale));
EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode();
F32 tick_value;
if (grid_mode == GRID_MODE_WORLD)
{
- tick_value = (grid_multiple2 + i) / (max_subdivisions / grid_resolution);
+ tick_value = (grid_multiple2 + i) / (sGridMaxSubdivisionLevel / grid_resolution);
}
else
{
- tick_value = (grid_multiple2 + i) / (2.f * max_subdivisions);
+ tick_value = (grid_multiple2 + i) / (2.f * sGridMaxSubdivisionLevel);
}
+
F32 text_highlight = 0.8f;
if (is_approx_equal(tick_value, mScaleSnappedValue) && mInSnapRegime)
diff --git a/indra/newview/llmanipscale.h b/indra/newview/llmanipscale.h
index 13b510c9ff..2874c5dcd5 100755
--- a/indra/newview/llmanipscale.h
+++ b/indra/newview/llmanipscale.h
@@ -148,10 +148,10 @@ private:
typedef std::set<ManipulatorHandle*, compare_manipulators> minpulator_list_t;
minpulator_list_t mProjectedManipulators;
LLVector4 mManipulatorVertices[14];
- F32 mScaleSnapUnit1; // size of snap multiples for axis 1
- F32 mScaleSnapUnit2; // size of snap multiples for axis 2
- LLVector3 mScalePlaneNormal1; // normal of plane in which scale occurs that most faces camera
- LLVector3 mScalePlaneNormal2; // normal of plane in which scale occurs that most faces camera
+ F32 mScaleSnapUnit1; //!< Size of snap multiples for axis 1.
+ F32 mScaleSnapUnit2; //!< Size of snap multiples for axis 2.
+ LLVector3 mScalePlaneNormal1; //!< Normal of plane in which scale occurs that most faces camera.
+ LLVector3 mScalePlaneNormal2; //!< Normal of plane in which scale occurs that most faces camera.
LLVector3 mSnapGuideDir1;
LLVector3 mSnapGuideDir2;
LLVector3 mSnapDir1;
@@ -161,8 +161,8 @@ private:
F32 mTickPixelSpacing2;
F32 mSnapGuideLength;
LLVector3 mScaleCenter;
- LLVector3 mScaleDir;
- F32 mScaleSnappedValue;
+ LLVector3 mScaleDir; //!< The direction of the scaling action. In face-dragging this is aligned with one of the cardinal axis relative to the prim, but in corner-dragging this is along the diagonal.
+ F32 mScaleSnappedValue; //!< The distance of the current position nearest the mouse location, measured along mScaleDir. Is measured either from the center or from the far face/corner depending upon whether uniform scaling is true or false respectively.
BOOL mInSnapRegime;
F32* mManipulatorScales;
};