1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 16:57:16 +01:00
SqMod/source/Base/Vector3.hpp

112 lines
5.6 KiB
C++
Raw Normal View History

2015-09-30 02:56:11 +02:00
#ifndef _BASE_VECTOR3_HPP_
#define _BASE_VECTOR3_HPP_
// ------------------------------------------------------------------------------------------------
#include "Config.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
/* ------------------------------------------------------------------------------------------------
* ...
*/
struct Vector3
{
// --------------------------------------------------------------------------------------------
typedef SQFloat Value;
// --------------------------------------------------------------------------------------------
static const Vector3 NIL;
static const Vector3 MIN;
static const Vector3 MAX;
// --------------------------------------------------------------------------------------------
static SQChar Delim;
// --------------------------------------------------------------------------------------------
Value x, y, z;
// --------------------------------------------------------------------------------------------
Vector3();
Vector3(Value s);
Vector3(Value xv, Value yv, Value zv);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3(const Vector4 & v);
Vector3(const Quaternion & q);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3(const SQChar * values, char delim);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3(const Vector3 & v);
Vector3(Vector3 && v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
~Vector3();
// --------------------------------------------------------------------------------------------
Vector3 & operator = (const Vector3 & v);
Vector3 & operator = (Vector3 && v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 & operator = (Value s);
Vector3 & operator = (const Vector4 & v);
Vector3 & operator = (const Quaternion & q);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 & operator += (const Vector3 & v);
Vector3 & operator -= (const Vector3 & v);
Vector3 & operator *= (const Vector3 & v);
Vector3 & operator /= (const Vector3 & v);
Vector3 & operator %= (const Vector3 & v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 & operator += (Value s);
Vector3 & operator -= (Value s);
Vector3 & operator *= (Value s);
Vector3 & operator /= (Value s);
Vector3 & operator %= (Value s);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 & operator ++ ();
Vector3 & operator -- ();
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 operator ++ (int);
Vector3 operator -- (int);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 operator + (const Vector3 & v) const;
Vector3 operator - (const Vector3 & v) const;
Vector3 operator * (const Vector3 & v) const;
Vector3 operator / (const Vector3 & v) const;
Vector3 operator % (const Vector3 & v) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 operator + (Value s) const;
Vector3 operator - (Value s) const;
Vector3 operator * (Value s) const;
Vector3 operator / (Value s) const;
Vector3 operator % (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 operator + () const;
Vector3 operator - () const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
bool operator == (const Vector3 & v) const;
bool operator != (const Vector3 & v) const;
bool operator < (const Vector3 & v) const;
bool operator > (const Vector3 & v) const;
bool operator <= (const Vector3 & v) const;
bool operator >= (const Vector3 & v) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Vector3 & v) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Set(Value ns);
void Set(Value nx, Value ny, Value nz);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Set(const Vector3 & v);
void Set(const Vector4 & v);
void Set(const Quaternion & q);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, char delim);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Generate();
void Generate(Value min, Value max);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Clear() { x = 0.0, y = 0.0, z = 0.0; }
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector3 Abs() const;
2015-09-30 02:56:11 +02:00
};
} // Namespace:: SqMod
#endif // _BASE_VECTOR3_HPP_