mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Add a few more helper members to the Vector3 type.
This commit is contained in:
parent
9fcbf54893
commit
624606e482
@ -12,9 +12,19 @@
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const Vector3 Vector3::NIL = Vector3(0);
|
||||
const Vector3 Vector3::MIN = Vector3(std::numeric_limits< Vector3::Value >::min());
|
||||
const Vector3 Vector3::MAX = Vector3(std::numeric_limits< Vector3::Value >::max());
|
||||
#define STOVAL(v) static_cast< Vector3::Value >(v)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const Vector3 Vector3::NIL(STOVAL(0.0));
|
||||
const Vector3 Vector3::MIN(std::numeric_limits< Vector3::Value >::min());
|
||||
const Vector3 Vector3::MAX(std::numeric_limits< Vector3::Value >::max());
|
||||
const Vector3 Vector3::LEFT(STOVAL(-1.0), STOVAL(0.0), STOVAL(0.0));
|
||||
const Vector3 Vector3::RIGHT(STOVAL(1.0), STOVAL(0.0), STOVAL(0.0));
|
||||
const Vector3 Vector3::UP(STOVAL(0.0), STOVAL(1.0), STOVAL(0.0));
|
||||
const Vector3 Vector3::DOWN(STOVAL(0.0), STOVAL(-1.0), STOVAL(0.0));
|
||||
const Vector3 Vector3::FORWARD(STOVAL(0.0), STOVAL(0.0), STOVAL(1.0));
|
||||
const Vector3 Vector3::BACK(STOVAL(0.0), STOVAL(0.0), STOVAL(-1.0));
|
||||
const Vector3 Vector3::ONE(STOVAL(1.0), STOVAL(1.0), STOVAL(1.0));
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQChar Vector3::Delim = ',';
|
||||
@ -506,6 +516,17 @@ void Register_Vector3(HSQUIRRELVM vm)
|
||||
.Ctor()
|
||||
.Ctor< Val >()
|
||||
.Ctor< Val, Val, Val >()
|
||||
// Static variables
|
||||
.SetStaticValue(_SC("NIL"), &Vector3::NIL)
|
||||
.SetStaticValue(_SC("MIN"), &Vector3::MIN)
|
||||
.SetStaticValue(_SC("MAX"), &Vector3::MAX)
|
||||
.SetStaticValue(_SC("LEFT"), &Vector3::LEFT)
|
||||
.SetStaticValue(_SC("RIGHT"), &Vector3::RIGHT)
|
||||
.SetStaticValue(_SC("UP"), &Vector3::UP)
|
||||
.SetStaticValue(_SC("DOWN"), &Vector3::DOWN)
|
||||
.SetStaticValue(_SC("FORWARD"), &Vector3::FORWARD)
|
||||
.SetStaticValue(_SC("BACK"), &Vector3::BACK)
|
||||
.SetStaticValue(_SC("ONE"), &Vector3::ONE)
|
||||
// Member Variables
|
||||
.Var(_SC("x"), &Vector3::x)
|
||||
.Var(_SC("y"), &Vector3::y)
|
||||
|
@ -20,9 +20,16 @@ struct Vector3
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Helper instances for common values mostly used as return types or comparison.
|
||||
*/
|
||||
static const Vector3 NIL;
|
||||
static const Vector3 MIN;
|
||||
static const Vector3 MAX;
|
||||
static const Vector3 NIL; // ( 0, 0, 0)
|
||||
static const Vector3 MIN; // (<0, <0, <0)
|
||||
static const Vector3 MAX; // (>0, >0, >0)
|
||||
static const Vector3 LEFT; // (-1, 0, 0)
|
||||
static const Vector3 RIGHT; // ( 1, 0, 0)
|
||||
static const Vector3 UP; // ( 0, 1, 0)
|
||||
static const Vector3 DOWN; // ( 0, -1, 0)
|
||||
static const Vector3 FORWARD; // ( 0, 0, 1)
|
||||
static const Vector3 BACK; // ( 0, 0, -1)
|
||||
static const Vector3 ONE; // ( 1, 1, 1)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* The delimiter character to be used when extracting values from strings.
|
||||
@ -346,4 +353,4 @@ struct Vector3
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
#endif // _BASE_VECTOR3_HPP_
|
||||
#endif // _BASE_VECTOR3_HPP_
|
||||
|
Loading…
Reference in New Issue
Block a user