mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Adds some console methods to the non-class namespace Rotation for some convenient utility functions for dealing with rotations.
This commit is contained in:
parent
8568ed19be
commit
c1f02c05e1
|
|
@ -20,6 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "math/mRotation.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
#ifdef TORQUE_TESTS_ENABLED
|
||||
#include "testing/unitTesting.h"
|
||||
|
|
@ -296,4 +298,51 @@ TEST(Maths, RotationF_Calculations)
|
|||
{
|
||||
//TODO: implement unit test
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DefineConsoleStaticMethod(Rotation, Add, RotationF, (RotationF a, RotationF b), ,
|
||||
"Adds two rotations together.\n"
|
||||
"@param a Rotation one."
|
||||
"@param b Rotation two."
|
||||
"@returns v sum of both rotations."
|
||||
"@ingroup Math")
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
DefineConsoleStaticMethod(Rotation, Subtract, RotationF, (RotationF a, RotationF b), ,
|
||||
"Subtracts two rotations.\n"
|
||||
"@param a Rotation one."
|
||||
"@param b Rotation two."
|
||||
"@returns v difference of both rotations."
|
||||
"@ingroup Math")
|
||||
{
|
||||
return a - b;
|
||||
}
|
||||
|
||||
DefineConsoleStaticMethod(Rotation, Interpolate, RotationF, (RotationF a, RotationF b, F32 factor), ,
|
||||
"Interpolates between two rotations.\n"
|
||||
"@param a Rotation one."
|
||||
"@param b Rotation two."
|
||||
"@param factor The amount to interpolate between the two."
|
||||
"@returns v, interpolated result."
|
||||
"@ingroup Math")
|
||||
{
|
||||
RotationF result;
|
||||
result.interpolate(a, b, factor);
|
||||
return result;
|
||||
}
|
||||
|
||||
DefineConsoleStaticMethod(Rotation, LookAt, RotationF, (Point3F origin, Point3F target, Point3F up),
|
||||
(Point3F(0, 0, 0), Point3F(0, 0, 0), Point3F(0, 0, 1)),
|
||||
"Provides a rotation orientation to look at a target from a given position.\n"
|
||||
"@param origin Position of the object doing the looking."
|
||||
"@param target Position to be looked at."
|
||||
"@param up The up angle to orient the rotation."
|
||||
"@returns v orientation result."
|
||||
"@ingroup Math")
|
||||
{
|
||||
RotationF result;
|
||||
result.lookAt(origin, target, up);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -583,7 +583,7 @@ ConsoleSetType( TypeEaseF )
|
|||
// TypeRotationF
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleType(RotationF, TypeRotationF, RotationF, "")
|
||||
//ImplementConsoleTypeCasters( TypeRotationF, RotationF )
|
||||
ImplementConsoleTypeCasters( TypeRotationF, RotationF )
|
||||
|
||||
ConsoleGetType(TypeRotationF)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue