mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-21 20:27:13 +01:00
Implement the pure typename meta-methods in Quaternion type using the standard method.
This commit is contained in:
parent
b04b7c6d84
commit
0f2967aa05
@ -15,6 +15,9 @@ namespace SqMod {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define STOVAL(v) static_cast< Quaternion::Value >(v)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMODE_DECL_TYPENAME(Typename, _SC("Quaternion"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const Quaternion Quaternion::NIL(0);
|
||||
const Quaternion Quaternion::MIN(std::numeric_limits< Quaternion::Value >::min());
|
||||
@ -24,14 +27,6 @@ const Quaternion Quaternion::IDENTITY(1.0, 0.0, 0.0, 0.0);
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQChar Quaternion::Delim = ',';
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Quaternion::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static const SQChar name[] = _SC("Quaternion");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Quaternion::Quaternion()
|
||||
: x(0.0), y(0.0), z(0.0), w(0.0)
|
||||
@ -792,7 +787,7 @@ void Register_Quaternion(HSQUIRRELVM vm)
|
||||
{
|
||||
typedef Quaternion::Value Val;
|
||||
|
||||
RootTable(vm).Bind(_SC("Quaternion"), Class< Quaternion >(vm, _SC("Quaternion"))
|
||||
RootTable(vm).Bind(Typename::Str, Class< Quaternion >(vm, Typename::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< Val >()
|
||||
@ -808,9 +803,9 @@ void Register_Quaternion(HSQUIRRELVM vm)
|
||||
.Var(_SC("Z"), &Quaternion::z)
|
||||
.Var(_SC("W"), &Quaternion::w)
|
||||
// Core Meta-methods
|
||||
.Func(_SC("_tostring"), &Quaternion::ToString)
|
||||
.SquirrelFunc(_SC("_typename"), &Quaternion::Typename)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Quaternion::ToString)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||
|
@ -297,11 +297,6 @@ struct Quaternion
|
||||
*/
|
||||
CSStr ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to retrieve the name from instances of this type.
|
||||
*/
|
||||
static SQInteger Typename(HSQUIRRELVM vm);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user