replace objects scale clamp by a more readable clamp. Simplify GroupResize and let rescale factors < 1 also be checked for size limits, Set new scales directly not checking them again.

This commit is contained in:
UbitUmarov
2015-10-23 01:39:53 +01:00
parent 8ed17f745d
commit 28d4afbe3a
2 changed files with 84 additions and 140 deletions

View File

@@ -3073,18 +3073,17 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup.Scene != null)
{
scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
float minsize = ParentGroup.Scene.m_minNonphys;
float maxsize = ParentGroup.Scene.m_maxNonphys;
if (pa != null && pa.IsPhysical)
{
scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X));
scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y));
scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z));
}
{
minsize = ParentGroup.Scene.m_minPhys;
maxsize = ParentGroup.Scene.m_maxPhys;
}
scale.X = Util.Clamp(scale.X, minsize, maxsize);
scale.Y = Util.Clamp(scale.Y, minsize, maxsize);
scale.Z = Util.Clamp(scale.Z, minsize, maxsize);
}
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
Scale = scale;