1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-19 12:07:13 +01:00

Improve the Vector4 registration code to avoid using overloads where not necessary.

Also restructured the registration code a bit.
This commit is contained in:
Sandu Liviu Catalin 2016-07-25 00:28:37 +03:00
parent 2857e0e4be
commit d30e1210ac
2 changed files with 99 additions and 56 deletions

View File

@ -65,6 +65,7 @@ Vector4 & Vector4::operator = (Value s)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator = (const Vector3 & v) Vector4 & Vector4::operator = (const Vector3 & v)
{ {
x = v.x; x = v.x;
@ -74,6 +75,7 @@ Vector4 & Vector4::operator = (const Vector3 & v)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator = (const Quaternion & q) Vector4 & Vector4::operator = (const Quaternion & q)
{ {
x = q.x; x = q.x;
@ -93,6 +95,7 @@ Vector4 & Vector4::operator += (const Vector4 & v)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator -= (const Vector4 & v) Vector4 & Vector4::operator -= (const Vector4 & v)
{ {
x -= v.x; x -= v.x;
@ -102,6 +105,7 @@ Vector4 & Vector4::operator -= (const Vector4 & v)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator *= (const Vector4 & v) Vector4 & Vector4::operator *= (const Vector4 & v)
{ {
x *= v.x; x *= v.x;
@ -111,6 +115,7 @@ Vector4 & Vector4::operator *= (const Vector4 & v)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator /= (const Vector4 & v) Vector4 & Vector4::operator /= (const Vector4 & v)
{ {
x /= v.x; x /= v.x;
@ -120,6 +125,7 @@ Vector4 & Vector4::operator /= (const Vector4 & v)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator %= (const Vector4 & v) Vector4 & Vector4::operator %= (const Vector4 & v)
{ {
x = std::fmod(x, v.x); x = std::fmod(x, v.x);
@ -139,6 +145,7 @@ Vector4 & Vector4::operator += (Value s)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator -= (Value s) Vector4 & Vector4::operator -= (Value s)
{ {
x -= s; x -= s;
@ -148,6 +155,7 @@ Vector4 & Vector4::operator -= (Value s)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator *= (Value s) Vector4 & Vector4::operator *= (Value s)
{ {
x *= s; x *= s;
@ -166,6 +174,7 @@ Vector4 & Vector4::operator /= (Value s)
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator %= (Value s) Vector4 & Vector4::operator %= (Value s)
{ {
x = std::fmod(x, s); x = std::fmod(x, s);
@ -185,6 +194,7 @@ Vector4 & Vector4::operator ++ ()
return *this; return *this;
} }
// ------------------------------------------------------------------------------------------------
Vector4 & Vector4::operator -- () Vector4 & Vector4::operator -- ()
{ {
--x; --x;
@ -205,6 +215,7 @@ Vector4 Vector4::operator ++ (int)
return state; return state;
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator -- (int) Vector4 Vector4::operator -- (int)
{ {
Vector4 state(*this); Vector4 state(*this);
@ -221,21 +232,25 @@ Vector4 Vector4::operator + (const Vector4 & v) const
return Vector4(x + v.x, y + v.y, z + v.z, w + v.w); return Vector4(x + v.x, y + v.y, z + v.z, w + v.w);
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator - (const Vector4 & v) const Vector4 Vector4::operator - (const Vector4 & v) const
{ {
return Vector4(x - v.x, y - v.y, z - v.z, w - v.w); return Vector4(x - v.x, y - v.y, z - v.z, w - v.w);
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator * (const Vector4 & v) const Vector4 Vector4::operator * (const Vector4 & v) const
{ {
return Vector4(x * v.x, y * v.y, z * v.z, w * v.w); return Vector4(x * v.x, y * v.y, z * v.z, w * v.w);
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator / (const Vector4 & v) const Vector4 Vector4::operator / (const Vector4 & v) const
{ {
return Vector4(x / v.x, y / v.y, z / v.z, w / v.w); return Vector4(x / v.x, y / v.y, z / v.z, w / v.w);
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator % (const Vector4 & v) const Vector4 Vector4::operator % (const Vector4 & v) const
{ {
return Vector4(std::fmod(x, v.x), std::fmod(y, v.y), std::fmod(z, v.z), std::fmod(w, v.w)); return Vector4(std::fmod(x, v.x), std::fmod(y, v.y), std::fmod(z, v.z), std::fmod(w, v.w));
@ -247,21 +262,25 @@ Vector4 Vector4::operator + (Value s) const
return Vector4(x + s, y + s, z + s, w + s); return Vector4(x + s, y + s, z + s, w + s);
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator - (Value s) const Vector4 Vector4::operator - (Value s) const
{ {
return Vector4(x - s, y - s, z - s, w - s); return Vector4(x - s, y - s, z - s, w - s);
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator * (Value s) const Vector4 Vector4::operator * (Value s) const
{ {
return Vector4(x * s, y * s, z * s, w * s); return Vector4(x * s, y * s, z * s, w * s);
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator / (Value s) const Vector4 Vector4::operator / (Value s) const
{ {
return Vector4(x / s, y / s, z / s, w / s); return Vector4(x / s, y / s, z / s, w / s);
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator % (Value s) const Vector4 Vector4::operator % (Value s) const
{ {
return Vector4(std::fmod(x, s), std::fmod(y, s), std::fmod(z, s), std::fmod(w, s)); return Vector4(std::fmod(x, s), std::fmod(y, s), std::fmod(z, s), std::fmod(w, s));
@ -273,6 +292,7 @@ Vector4 Vector4::operator + () const
return Vector4(std::fabs(x), std::fabs(y), std::fabs(z), std::fabs(w)); return Vector4(std::fabs(x), std::fabs(y), std::fabs(z), std::fabs(w));
} }
// ------------------------------------------------------------------------------------------------
Vector4 Vector4::operator - () const Vector4 Vector4::operator - () const
{ {
return Vector4(-x, -y, -z, -w); return Vector4(-x, -y, -z, -w);
@ -284,26 +304,31 @@ bool Vector4::operator == (const Vector4 & v) const
return EpsEq(x, v.x) && EpsEq(y, v.y) && EpsEq(z, v.z) && EpsEq(w, v.w); return EpsEq(x, v.x) && EpsEq(y, v.y) && EpsEq(z, v.z) && EpsEq(w, v.w);
} }
// ------------------------------------------------------------------------------------------------
bool Vector4::operator != (const Vector4 & v) const bool Vector4::operator != (const Vector4 & v) const
{ {
return !EpsEq(x, v.x) && !EpsEq(y, v.y) && !EpsEq(z, v.z) && !EpsEq(w, v.w); return !EpsEq(x, v.x) && !EpsEq(y, v.y) && !EpsEq(z, v.z) && !EpsEq(w, v.w);
} }
// ------------------------------------------------------------------------------------------------
bool Vector4::operator < (const Vector4 & v) const bool Vector4::operator < (const Vector4 & v) const
{ {
return EpsLt(x, v.x) && EpsLt(y, v.y) && EpsLt(z, v.z) && EpsLt(w, v.w); return EpsLt(x, v.x) && EpsLt(y, v.y) && EpsLt(z, v.z) && EpsLt(w, v.w);
} }
// ------------------------------------------------------------------------------------------------
bool Vector4::operator > (const Vector4 & v) const bool Vector4::operator > (const Vector4 & v) const
{ {
return EpsGt(x, v.x) && EpsGt(y, v.y) && EpsGt(z, v.z) && EpsGt(w, v.w); return EpsGt(x, v.x) && EpsGt(y, v.y) && EpsGt(z, v.z) && EpsGt(w, v.w);
} }
// ------------------------------------------------------------------------------------------------
bool Vector4::operator <= (const Vector4 & v) const bool Vector4::operator <= (const Vector4 & v) const
{ {
return EpsLtEq(x, v.x) && EpsLtEq(y, v.y) && EpsLtEq(z, v.z) && EpsLtEq(w, v.w); return EpsLtEq(x, v.x) && EpsLtEq(y, v.y) && EpsLtEq(z, v.z) && EpsLtEq(w, v.w);
} }
// ------------------------------------------------------------------------------------------------
bool Vector4::operator >= (const Vector4 & v) const bool Vector4::operator >= (const Vector4 & v) const
{ {
return EpsGtEq(x, v.x) && EpsGtEq(y, v.y) && EpsGtEq(z, v.z) && EpsGtEq(w, v.w); return EpsGtEq(x, v.x) && EpsGtEq(y, v.y) && EpsGtEq(z, v.z) && EpsGtEq(w, v.w);
@ -333,7 +358,7 @@ CSStr Vector4::ToString() const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Vector4::Set(Value ns) void Vector4::SetScalar(Value ns)
{ {
x = ns; x = ns;
y = ns; y = ns;
@ -341,14 +366,17 @@ void Vector4::Set(Value ns)
w = ns; w = ns;
} }
void Vector4::Set(Value nx, Value ny, Value nz) // ------------------------------------------------------------------------------------------------
void Vector4::SetVector4(const Vector4 & v)
{ {
x = nx; x = v.x;
y = ny; y = v.y;
z = nz; z = v.z;
w = v.w;
} }
void Vector4::Set(Value nx, Value ny, Value nz, Value nw) // ------------------------------------------------------------------------------------------------
void Vector4::SetVector4Ex(Value nx, Value ny, Value nz, Value nw)
{ {
x = nx; x = nx;
y = ny; y = ny;
@ -357,15 +385,7 @@ void Vector4::Set(Value nx, Value ny, Value nz, Value nw)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Vector4::Set(const Vector4 & v) void Vector4::SetVector3(const Vector3 & v)
{
x = v.x;
y = v.y;
z = v.z;
w = v.w;
}
void Vector4::Set(const Vector3 & v)
{ {
x = v.x; x = v.x;
y = v.y; y = v.y;
@ -373,7 +393,16 @@ void Vector4::Set(const Vector3 & v)
w = 0.0; w = 0.0;
} }
void Vector4::Set(const Quaternion & q) // ------------------------------------------------------------------------------------------------
void Vector4::SetVector3Ex(Value nx, Value ny, Value nz)
{
x = nx;
y = ny;
z = nz;
}
// ------------------------------------------------------------------------------------------------
void Vector4::SetQuaternion(const Quaternion & q)
{ {
x = q.x; x = q.x;
y = q.y; y = q.y;
@ -382,9 +411,18 @@ void Vector4::Set(const Quaternion & q)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Vector4::Set(CSStr values, SQChar delim) void Vector4::SetQuaternionEx(Value nx, Value ny, Value nz, Value nw)
{ {
Set(Vector4::Get(values, delim)); x = nx;
y = ny;
z = nz;
w = nw;
}
// ------------------------------------------------------------------------------------------------
void Vector4::SetStr(CSStr values, SQChar delim)
{
SetVector4(Vector4::Get(values, delim));
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -396,6 +434,7 @@ void Vector4::Generate()
w = GetRandomFloat32(); w = GetRandomFloat32();
} }
// ------------------------------------------------------------------------------------------------
void Vector4::Generate(Value min, Value max) void Vector4::Generate(Value min, Value max)
{ {
if (max < min) if (max < min)
@ -409,6 +448,7 @@ void Vector4::Generate(Value min, Value max)
y = GetRandomFloat32(min, max); y = GetRandomFloat32(min, max);
} }
// ------------------------------------------------------------------------------------------------
void Vector4::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax) void Vector4::Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax)
{ {
if (EpsLt(xmax, xmin) || EpsLt(ymax, ymin) || EpsLt(zmax, zmin) || EpsLt(wmax, wmin)) if (EpsLt(xmax, xmin) || EpsLt(ymax, ymin) || EpsLt(zmax, zmin) || EpsLt(wmax, wmin))
@ -465,31 +505,35 @@ const Vector4 & GetVector4()
return vec; return vec;
} }
// ------------------------------------------------------------------------------------------------
const Vector4 & GetVector4(Float32 sv) const Vector4 & GetVector4(Float32 sv)
{ {
static Vector4 vec; static Vector4 vec;
vec.Set(sv); vec.SetScalar(sv);
return vec; return vec;
} }
// ------------------------------------------------------------------------------------------------
const Vector4 & GetVector4(Float32 xv, Float32 yv, Float32 zv) const Vector4 & GetVector4(Float32 xv, Float32 yv, Float32 zv)
{ {
static Vector4 vec; static Vector4 vec;
vec.Set(xv, yv, zv); vec.SetVector3Ex(xv, yv, zv);
return vec; return vec;
} }
// ------------------------------------------------------------------------------------------------
const Vector4 & GetVector4(Float32 xv, Float32 yv, Float32 zv, Float32 wv) const Vector4 & GetVector4(Float32 xv, Float32 yv, Float32 zv, Float32 wv)
{ {
static Vector4 vec; static Vector4 vec;
vec.Set(xv, yv, zv, wv); vec.SetVector4Ex(xv, yv, zv, wv);
return vec; return vec;
} }
// ------------------------------------------------------------------------------------------------
const Vector4 & GetVector4(const Vector4 & o) const Vector4 & GetVector4(const Vector4 & o)
{ {
static Vector4 vec; static Vector4 vec;
vec.Set(o); vec.SetVector4(o);
return vec; return vec;
} }
@ -513,8 +557,6 @@ void Register_Vector4(HSQUIRRELVM vm)
.Var(_SC("Y"), &Vector4::y) .Var(_SC("Y"), &Vector4::y)
.Var(_SC("Z"), &Vector4::z) .Var(_SC("Z"), &Vector4::z)
.Var(_SC("W"), &Vector4::w) .Var(_SC("W"), &Vector4::w)
// Properties
.Prop(_SC("Abs"), &Vector4::Abs)
// Core Meta-methods // Core Meta-methods
.Func(_SC("_tostring"), &Vector4::ToString) .Func(_SC("_tostring"), &Vector4::ToString)
.SquirrelFunc(_SC("_typename"), &Vector4::Typename) .SquirrelFunc(_SC("_typename"), &Vector4::Typename)
@ -526,20 +568,22 @@ void Register_Vector4(HSQUIRRELVM vm)
.Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("_div"), &Vector4::operator /) .Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("_div"), &Vector4::operator /)
.Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("_modulo"), &Vector4::operator %) .Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("_modulo"), &Vector4::operator %)
.Func< Vector4 (Vector4::*)(void) const >(_SC("_unm"), &Vector4::operator -) .Func< Vector4 (Vector4::*)(void) const >(_SC("_unm"), &Vector4::operator -)
// Setters // Properties
.Overload< void (Vector4::*)(Val) >(_SC("Set"), &Vector4::Set) .Prop(_SC("Abs"), &Vector4::Abs)
.Overload< void (Vector4::*)(Val, Val, Val) >(_SC("Set"), &Vector4::Set) // Member Methods
.Overload< void (Vector4::*)(Val, Val, Val, Val) >(_SC("Set"), &Vector4::Set) .Func(_SC("SetScalar"), &Vector4::SetScalar)
.Overload< void (Vector4::*)(const Vector4 &) >(_SC("SetVec4"), &Vector4::Set) .Func(_SC("SetVector4"), &Vector4::SetVector4)
.Overload< void (Vector4::*)(const Vector3 &) >(_SC("SetVec3"), &Vector4::Set) .Func(_SC("SetVector4Ex"), &Vector4::SetVector4Ex)
.Overload< void (Vector4::*)(const Quaternion &) >(_SC("SetQuat"), &Vector4::Set) .Func(_SC("SetVector3"), &Vector4::SetVector3)
.Overload< void (Vector4::*)(CSStr, SQChar) >(_SC("SetStr"), &Vector4::Set) .Func(_SC("SetVector3Ex"), &Vector4::SetVector3Ex)
// Random Generators .Func(_SC("SetQuaternion"), &Vector4::SetQuaternion)
.Func(_SC("SetQuaternionEx"), &Vector4::SetQuaternionEx)
.Func(_SC("SetStr"), &Vector4::SetStr)
.Func(_SC("Clear"), &Vector4::Clear)
// Member Overloads
.Overload< void (Vector4::*)(void) >(_SC("Generate"), &Vector4::Generate) .Overload< void (Vector4::*)(void) >(_SC("Generate"), &Vector4::Generate)
.Overload< void (Vector4::*)(Val, Val) >(_SC("Generate"), &Vector4::Generate) .Overload< void (Vector4::*)(Val, Val) >(_SC("Generate"), &Vector4::Generate)
.Overload< void (Vector4::*)(Val, Val, Val, Val, Val, Val, Val, Val) >(_SC("Generate"), &Vector4::Generate) .Overload< void (Vector4::*)(Val, Val, Val, Val, Val, Val, Val, Val) >(_SC("Generate"), &Vector4::Generate)
// Utility Methods
.Func(_SC("Clear"), &Vector4::Clear)
// Static Overloads // Static Overloads
.StaticOverload< const Vector4 & (*)(CSStr) >(_SC("FromStr"), &Vector4::Get) .StaticOverload< const Vector4 & (*)(CSStr) >(_SC("FromStr"), &Vector4::Get)
.StaticOverload< const Vector4 & (*)(CSStr, SQChar) >(_SC("FromStr"), &Vector4::Get) .StaticOverload< const Vector4 & (*)(CSStr, SQChar) >(_SC("FromStr"), &Vector4::Get)
@ -552,33 +596,27 @@ void Register_Vector4(HSQUIRRELVM vm)
.Func< Vector4 & (Vector4::*)(const Vector4 &) >(_SC("opMulAssign"), &Vector4::operator *=) .Func< Vector4 & (Vector4::*)(const Vector4 &) >(_SC("opMulAssign"), &Vector4::operator *=)
.Func< Vector4 & (Vector4::*)(const Vector4 &) >(_SC("opDivAssign"), &Vector4::operator /=) .Func< Vector4 & (Vector4::*)(const Vector4 &) >(_SC("opDivAssign"), &Vector4::operator /=)
.Func< Vector4 & (Vector4::*)(const Vector4 &) >(_SC("opModAssign"), &Vector4::operator %=) .Func< Vector4 & (Vector4::*)(const Vector4 &) >(_SC("opModAssign"), &Vector4::operator %=)
.Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opAddAssignS"), &Vector4::operator +=) .Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opAddAssignS"), &Vector4::operator +=)
.Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opSubAssignS"), &Vector4::operator -=) .Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opSubAssignS"), &Vector4::operator -=)
.Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opMulAssignS"), &Vector4::operator *=) .Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opMulAssignS"), &Vector4::operator *=)
.Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opDivAssignS"), &Vector4::operator /=) .Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opDivAssignS"), &Vector4::operator /=)
.Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opModAssignS"), &Vector4::operator %=) .Func< Vector4 & (Vector4::*)(Vector4::Value) >(_SC("opModAssignS"), &Vector4::operator %=)
.Func< Vector4 & (Vector4::*)(void) >(_SC("opPreInc"), &Vector4::operator ++) .Func< Vector4 & (Vector4::*)(void) >(_SC("opPreInc"), &Vector4::operator ++)
.Func< Vector4 & (Vector4::*)(void) >(_SC("opPreDec"), &Vector4::operator --) .Func< Vector4 & (Vector4::*)(void) >(_SC("opPreDec"), &Vector4::operator --)
.Func< Vector4 (Vector4::*)(int) >(_SC("opPostInc"), &Vector4::operator ++) .Func< Vector4 (Vector4::*)(int) >(_SC("opPostInc"), &Vector4::operator ++)
.Func< Vector4 (Vector4::*)(int) >(_SC("opPostDec"), &Vector4::operator --) .Func< Vector4 (Vector4::*)(int) >(_SC("opPostDec"), &Vector4::operator --)
.Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opAdd"), &Vector4::operator +) .Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opAdd"), &Vector4::operator +)
.Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opSub"), &Vector4::operator -) .Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opSub"), &Vector4::operator -)
.Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opMul"), &Vector4::operator *) .Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opMul"), &Vector4::operator *)
.Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opDiv"), &Vector4::operator /) .Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opDiv"), &Vector4::operator /)
.Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opMod"), &Vector4::operator %) .Func< Vector4 (Vector4::*)(const Vector4 &) const >(_SC("opMod"), &Vector4::operator %)
.Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opAddS"), &Vector4::operator +) .Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opAddS"), &Vector4::operator +)
.Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opSubS"), &Vector4::operator -) .Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opSubS"), &Vector4::operator -)
.Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opMulS"), &Vector4::operator *) .Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opMulS"), &Vector4::operator *)
.Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opDivS"), &Vector4::operator /) .Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opDivS"), &Vector4::operator /)
.Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opModS"), &Vector4::operator %) .Func< Vector4 (Vector4::*)(Vector4::Value) const >(_SC("opModS"), &Vector4::operator %)
.Func< Vector4 (Vector4::*)(void) const >(_SC("opUnPlus"), &Vector4::operator +) .Func< Vector4 (Vector4::*)(void) const >(_SC("opUnPlus"), &Vector4::operator +)
.Func< Vector4 (Vector4::*)(void) const >(_SC("opUnMinus"), &Vector4::operator -) .Func< Vector4 (Vector4::*)(void) const >(_SC("opUnMinus"), &Vector4::operator -)
.Func< bool (Vector4::*)(const Vector4 &) const >(_SC("opEqual"), &Vector4::operator ==) .Func< bool (Vector4::*)(const Vector4 &) const >(_SC("opEqual"), &Vector4::operator ==)
.Func< bool (Vector4::*)(const Vector4 &) const >(_SC("opNotEqual"), &Vector4::operator !=) .Func< bool (Vector4::*)(const Vector4 &) const >(_SC("opNotEqual"), &Vector4::operator !=)
.Func< bool (Vector4::*)(const Vector4 &) const >(_SC("opLessThan"), &Vector4::operator <) .Func< bool (Vector4::*)(const Vector4 &) const >(_SC("opLessThan"), &Vector4::operator <)

View File

@ -272,37 +272,42 @@ struct Vector4
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Set all components to the specified scalar value. * Set all components to the specified scalar value.
*/ */
void Set(Value ns); void SetScalar(Value ns);
/* --------------------------------------------------------------------------------------------
* Set all components to the specified values.
*/
void Set(Value nx, Value ny, Value nz);
/* --------------------------------------------------------------------------------------------
* Set all components to the specified values.
*/
void Set(Value nx, Value ny, Value nz, Value nw);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Copy the values from another instance of this type. * Copy the values from another instance of this type.
*/ */
void Set(const Vector4 & v); void SetVector4(const Vector4 & v);
/* --------------------------------------------------------------------------------------------
* Set all components to the specified values.
*/
void SetVector4Ex(Value nx, Value ny, Value nz, Value nw);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Copy the values from a three-dimensional vector. * Copy the values from a three-dimensional vector.
*/ */
void Set(const Vector3 & v); void SetVector3(const Vector3 & v);
/* --------------------------------------------------------------------------------------------
* Set all components to the specified values.
*/
void SetVector3Ex(Value nx, Value ny, Value nz);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Copy the values from a quaternion rotation. * Copy the values from a quaternion rotation.
*/ */
void Set(const Quaternion & q); void SetQuaternion(const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* Copy the values from a quaternion rotation.
*/
void SetQuaternionEx(Value nx, Value ny, Value nz, Value nw);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter. * Set the values extracted from the specified string using the specified delimiter.
*/ */
void Set(CSStr values, SQChar delim); void SetStr(CSStr values, SQChar delim);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Generate random values for all components of this instance. * Generate random values for all components of this instance.