2015-09-30 02:56:11 +02:00
|
|
|
#ifndef _BASE_VECTOR4_HPP_
|
|
|
|
#define _BASE_VECTOR4_HPP_
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
#include "SqBase.hpp"
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
2015-09-30 02:56:11 +02:00
|
|
|
*/
|
|
|
|
struct Vector4
|
|
|
|
{
|
2015-11-01 09:55:47 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
typedef float Value;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
static const Vector4 NIL;
|
|
|
|
static const Vector4 MIN;
|
|
|
|
static const Vector4 MAX;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
static SQChar Delim;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
Value x, y, z, w;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
2015-11-01 09:55:47 +01:00
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Vector4(Value sv);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4(Value xv, Value yv, Value zv);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4(Value xv, Value yv, Value zv, Value wv);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
2015-11-01 09:55:47 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Vector4(const Vector4 & o);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
2015-11-01 09:55:47 +01:00
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
~Vector4();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
*
|
2015-11-01 09:55:47 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Vector4 & operator = (const Vector4 & o);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator = (Value s);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator = (const Vector3 & v);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator = (const Quaternion & q);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator += (const Vector4 & v);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator -= (const Vector4 & v);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator *= (const Vector4 & v);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator /= (const Vector4 & v);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator %= (const Vector4 & v);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator += (Value s);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator -= (Value s);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator *= (Value s);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator /= (Value s);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator %= (Value s);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator ++ ();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 & operator -- ();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator ++ (int);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator -- (int);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator + (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator - (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator * (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator / (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator % (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator + (Value s) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator - (Value s) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator * (Value s) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator / (Value s) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator % (Value s) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator + () const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 operator - () const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator == (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator != (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator < (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator > (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator <= (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool operator >= (const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 Cmp(const Vector4 & v) const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
CSStr ToString() const;
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(Value ns);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(Value nx, Value ny, Value nz);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(Value nx, Value ny, Value nz, Value nw);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(const Vector4 & v);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(const Vector3 & v);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Set(const Quaternion & q);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
void Set(CSStr values, SQChar delim);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Generate();
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Generate(Value min, Value max);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax);
|
2015-11-01 09:55:47 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
void Clear()
|
|
|
|
{
|
|
|
|
x = 0.0, y = 0.0, z = 0.0, w = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
Vector4 Abs() const;
|
2015-09-30 02:56:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Namespace:: SqMod
|
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
#endif // _BASE_VECTOR4_HPP_
|