mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-04-25 21:57:12 +02:00
Adjust the AABB type functions to use the new method of receiving formatted strings.
This commit is contained in:
parent
5f8c2f6cc5
commit
b9a23d9137
@ -307,9 +307,9 @@ CSStr AABB::ToString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void AABB::SetStr(CSStr values, SQChar delim)
|
void AABB::SetStr(SQChar delim, const StackStrF & values)
|
||||||
{
|
{
|
||||||
DefineAABB(AABB::Get(values, delim));
|
DefineAABB(AABB::GetEx(delim, values));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -734,13 +734,13 @@ Int32 AABB::IsSphereInsideFastEx(Value x, Value y, Value z, Value r) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const AABB & AABB::Get(CSStr str)
|
const AABB & AABB::Get(const StackStrF & str)
|
||||||
{
|
{
|
||||||
return AABB::Get(str, AABB::Delim);
|
return AABB::GetEx(AABB::Delim, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const AABB & AABB::Get(CSStr str, SQChar delim)
|
const AABB & AABB::GetEx(SQChar delim, const StackStrF & str)
|
||||||
{
|
{
|
||||||
// The format specifications that will be used to scan the string
|
// The format specifications that will be used to scan the string
|
||||||
static SQChar fs[] = _SC(" %f , %f , %f , %f , %f , %f ");
|
static SQChar fs[] = _SC(" %f , %f , %f , %f , %f , %f ");
|
||||||
@ -748,7 +748,7 @@ const AABB & AABB::Get(CSStr str, SQChar delim)
|
|||||||
// Clear previous values, if any
|
// Clear previous values, if any
|
||||||
box.Clear();
|
box.Clear();
|
||||||
// Is the specified string empty?
|
// Is the specified string empty?
|
||||||
if (!str || *str == '\0')
|
if (str.mLen <= 0)
|
||||||
{
|
{
|
||||||
return box; // Return the value as is!
|
return box; // Return the value as is!
|
||||||
}
|
}
|
||||||
@ -759,7 +759,7 @@ const AABB & AABB::Get(CSStr str, SQChar delim)
|
|||||||
fs[19] = delim;
|
fs[19] = delim;
|
||||||
fs[24] = delim;
|
fs[24] = delim;
|
||||||
// Attempt to extract the component values from the specified string
|
// Attempt to extract the component values from the specified string
|
||||||
std::sscanf(str, fs, &box.min.x, &box.min.y, &box.min.z, &box.max.x, &box.max.y, &box.max.z);
|
std::sscanf(str.mPtr, fs, &box.min.x, &box.min.y, &box.min.z, &box.max.x, &box.max.y, &box.max.z);
|
||||||
// Return the resulted value
|
// Return the resulted value
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
@ -853,7 +853,7 @@ void Register_AABB(HSQUIRRELVM vm)
|
|||||||
.Prop(_SC("Volume"), &AABB::Volume)
|
.Prop(_SC("Volume"), &AABB::Volume)
|
||||||
.Prop(_SC("Area"), &AABB::Area)
|
.Prop(_SC("Area"), &AABB::Area)
|
||||||
// Member Methods
|
// Member Methods
|
||||||
.Func(_SC("SetStr"), &AABB::SetStr)
|
.FmtFunc(_SC("SetStr"), &AABB::SetStr)
|
||||||
.Func(_SC("Clear"), &AABB::Clear)
|
.Func(_SC("Clear"), &AABB::Clear)
|
||||||
.Func(_SC("DefineScalar"), &AABB::DefineScalar)
|
.Func(_SC("DefineScalar"), &AABB::DefineScalar)
|
||||||
.Func(_SC("DefineVector3"), &AABB::DefineVector3)
|
.Func(_SC("DefineVector3"), &AABB::DefineVector3)
|
||||||
@ -879,12 +879,11 @@ void Register_AABB(HSQUIRRELVM vm)
|
|||||||
.Func(_SC("IsSphereInsideEx"), &AABB::IsSphereInsideEx)
|
.Func(_SC("IsSphereInsideEx"), &AABB::IsSphereInsideEx)
|
||||||
.Func(_SC("IsSphereInsideFast"), &AABB::IsSphereInsideFast)
|
.Func(_SC("IsSphereInsideFast"), &AABB::IsSphereInsideFast)
|
||||||
.Func(_SC("IsSphereInsideFastEx"), &AABB::IsSphereInsideFastEx)
|
.Func(_SC("IsSphereInsideFastEx"), &AABB::IsSphereInsideFastEx)
|
||||||
// Static Overloads
|
|
||||||
.StaticOverload< const AABB & (*)(CSStr) >(_SC("FromStr"), &AABB::Get)
|
|
||||||
.StaticOverload< const AABB & (*)(CSStr, SQChar) >(_SC("FromStr"), &AABB::Get)
|
|
||||||
// Static Functions
|
// Static Functions
|
||||||
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< AABB >)
|
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< AABB >)
|
||||||
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< AABB >)
|
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< AABB >)
|
||||||
|
.StaticFmtFunc(_SC("FromStr"), &AABB::Get)
|
||||||
|
.StaticFmtFunc(_SC("FromStrEx"), &AABB::GetEx)
|
||||||
// Operator Exposure
|
// Operator Exposure
|
||||||
.Func< AABB & (AABB::*)(const AABB &) >(_SC("opAddAssign"), &AABB::operator +=)
|
.Func< AABB & (AABB::*)(const AABB &) >(_SC("opAddAssign"), &AABB::operator +=)
|
||||||
.Func< AABB & (AABB::*)(const AABB &) >(_SC("opSubAssign"), &AABB::operator -=)
|
.Func< AABB & (AABB::*)(const AABB &) >(_SC("opSubAssign"), &AABB::operator -=)
|
||||||
|
@ -300,7 +300,7 @@ struct AABB
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* 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 SetStr(CSStr values, SQChar delim);
|
void SetStr(SQChar delim, const StackStrF & values);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Clear the component values to default.
|
* Clear the component values to default.
|
||||||
@ -470,12 +470,12 @@ struct AABB
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Extract the values for components of the AABB type from a string.
|
* Extract the values for components of the AABB type from a string.
|
||||||
*/
|
*/
|
||||||
static const AABB & Get(CSStr str);
|
static const AABB & Get(const StackStrF & str);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Extract the values for components of the AABB type from a string.
|
* Extract the values for components of the AABB type from a string.
|
||||||
*/
|
*/
|
||||||
static const AABB & Get(CSStr str, SQChar delim);
|
static const AABB & GetEx(SQChar delim, const StackStrF & str);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace:: SqMod
|
} // Namespace:: SqMod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user