mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 07:20:40 +00:00
round utility functions
add mRoundF to return nearest floating value to stepsize
This commit is contained in:
parent
f0e7a27c16
commit
f7ed077d82
4 changed files with 27 additions and 24 deletions
|
|
@ -1895,18 +1895,8 @@ Point3F Gizmo::_snapPoint( const Point3F &pnt ) const
|
|||
}
|
||||
|
||||
F32 Gizmo::_snapFloat( const F32 &val, const F32 &snap ) const
|
||||
{
|
||||
if ( snap == 0.0f )
|
||||
return val;
|
||||
|
||||
F32 a = mFmod( val, snap );
|
||||
|
||||
F32 temp = val;
|
||||
|
||||
if ( mFabs(a) > (snap / 2) )
|
||||
val < 0.0f ? temp -= snap : temp += snap;
|
||||
|
||||
return(temp - a);
|
||||
{
|
||||
return mRoundF(val, snap);
|
||||
}
|
||||
|
||||
GizmoAlignment Gizmo::_filteredAlignment()
|
||||
|
|
|
|||
|
|
@ -320,17 +320,7 @@ void WorldEditorSelection::offset( const Point3F& offset, F32 gridSnap )
|
|||
|
||||
F32 WorldEditorSelection::_snapFloat(const F32 &val, const F32 &snap) const
|
||||
{
|
||||
if (snap == 0.0f)
|
||||
return val;
|
||||
|
||||
F32 a = mFmod(val, snap);
|
||||
|
||||
F32 temp = val;
|
||||
|
||||
if (mFabs(a) > (snap / 2))
|
||||
val < 0.0f ? temp -= snap : temp += snap;
|
||||
|
||||
return(temp - a);
|
||||
return mRoundF(val, snap);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue