Epic failures in the game development field.
This blog covers funny/weird issues and bugs from games that happened during development.
Send your own contributions to igetyourfail at repi.se (can be anonymous if specified)
Tuesday, July 21, 2009
Saturday, July 4, 2009
For those times when (int)(v + 0.5f) just isn't enough
inline int MyMath::floatToIntRounded(hkReal value)
{
const hkReal lowerWhole = floor(value);
const hkReal upperWhole = ceil(value);
if((value - lowerWhole) < (upperWhole - value))
{
return floatToInt(lowerWhole + MY_EPSILON);
}
else
{
return floatToInt(upperWhole + MY_EPSILON);
}
}
(Thanks Dan)
Friday, July 3, 2009
isNumber - Special optimized version
bool isNumber(const char number)
{
std::string tmp;
tmp += number;
return std::string::npos != findIgnoreCase("0123456789", tmp);
}
Subscribe to:
Posts (Atom)