mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Update the Quaternion type to use the new dynamic dispatching system for metamethods.
This commit is contained in:
parent
b05b6409b8
commit
1b95fba086
@ -3,6 +3,7 @@
|
|||||||
#include "Base/Vector3.hpp"
|
#include "Base/Vector3.hpp"
|
||||||
#include "Base/Vector4.hpp"
|
#include "Base/Vector4.hpp"
|
||||||
#include "Base/Shared.hpp"
|
#include "Base/Shared.hpp"
|
||||||
|
#include "Base/DynArg.hpp"
|
||||||
#include "Library/Numeric/Random.hpp"
|
#include "Library/Numeric/Random.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -809,13 +810,13 @@ void Register_Quaternion(HSQUIRRELVM vm)
|
|||||||
// Core Meta-methods
|
// Core Meta-methods
|
||||||
.Func(_SC("_tostring"), &Quaternion::ToString)
|
.Func(_SC("_tostring"), &Quaternion::ToString)
|
||||||
.SquirrelFunc(_SC("_typename"), &Quaternion::Typename)
|
.SquirrelFunc(_SC("_typename"), &Quaternion::Typename)
|
||||||
.Func(_SC("_cmp"), &Quaternion::Cmp)
|
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||||
// Meta-methods
|
// Meta-methods
|
||||||
.Func< Quaternion (Quaternion::*)(const Quaternion &) const >(_SC("_add"), &Quaternion::operator +)
|
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||||
.Func< Quaternion (Quaternion::*)(const Quaternion &) const >(_SC("_sub"), &Quaternion::operator -)
|
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||||
.Func< Quaternion (Quaternion::*)(const Quaternion &) const >(_SC("_mul"), &Quaternion::operator *)
|
.SquirrelFunc(_SC("_mul"), &SqDynArgFwd< SqDynArgMulFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||||
.Func< Quaternion (Quaternion::*)(const Quaternion &) const >(_SC("_div"), &Quaternion::operator /)
|
.SquirrelFunc(_SC("_div"), &SqDynArgFwd< SqDynArgDivFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||||
.Func< Quaternion (Quaternion::*)(const Quaternion &) const >(_SC("_modulo"), &Quaternion::operator %)
|
.SquirrelFunc(_SC("_modulo"), &SqDynArgFwd< SqDynArgModFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||||
.Func< Quaternion (Quaternion::*)(void) const >(_SC("_unm"), &Quaternion::operator -)
|
.Func< Quaternion (Quaternion::*)(void) const >(_SC("_unm"), &Quaternion::operator -)
|
||||||
// Properties
|
// Properties
|
||||||
.Prop(_SC("Abs"), &Quaternion::Abs)
|
.Prop(_SC("Abs"), &Quaternion::Abs)
|
||||||
|
@ -260,6 +260,30 @@ struct Quaternion
|
|||||||
*/
|
*/
|
||||||
Int32 Cmp(const Quaternion & q) const;
|
Int32 Cmp(const Quaternion & q) const;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Used by the script engine to compare an instance of this type with a scalar value.
|
||||||
|
*/
|
||||||
|
Int32 Cmp(Value s) const
|
||||||
|
{
|
||||||
|
return Cmp(Quaternion(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Used by the script engine to compare an instance of this type with a scalar value.
|
||||||
|
*/
|
||||||
|
Int32 Cmp(Int32 s) const
|
||||||
|
{
|
||||||
|
return Cmp(Quaternion(static_cast< Value >(s)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Used by the script engine to compare an instance of this type with a scalar value.
|
||||||
|
*/
|
||||||
|
Int32 Cmp(std::nullptr_t) const
|
||||||
|
{
|
||||||
|
return Cmp(Quaternion(static_cast< Value >(0)));
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Used by the script engine to convert an instance of this type to a string.
|
* Used by the script engine to convert an instance of this type to a string.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user