Use the standard library swap() function instead
This commit is contained in:
parent
a89b258418
commit
ebf13c3366
|
@ -90,7 +90,7 @@ bool BoxShape::raycast(const Ray& ray, ProxyShape* proxyShape) const {
|
||||||
|
|
||||||
// Swap t1 and t2 if need so that t1 is intersection with near plane and
|
// Swap t1 and t2 if need so that t1 is intersection with near plane and
|
||||||
// t2 with far plane
|
// t2 with far plane
|
||||||
if (t1 > t2) swap(t1, t2);
|
if (t1 > t2) std::swap(t1, t2);
|
||||||
|
|
||||||
// If t1 is negative, the origin is inside the box and therefore, there is no hit
|
// If t1 is negative, the origin is inside the box and therefore, there is no hit
|
||||||
if (t1 < decimal(0.0)) return false;
|
if (t1 < decimal(0.0)) return false;
|
||||||
|
@ -141,7 +141,7 @@ bool BoxShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, ProxyShape* pro
|
||||||
// Swap t1 and t2 if need so that t1 is intersection with near plane and
|
// Swap t1 and t2 if need so that t1 is intersection with near plane and
|
||||||
// t2 with far plane
|
// t2 with far plane
|
||||||
if (t1 > t2) {
|
if (t1 > t2) {
|
||||||
swap(t1, t2);
|
std::swap(t1, t2);
|
||||||
currentNormal = -currentNormal;
|
currentNormal = -currentNormal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,13 +51,6 @@ inline decimal clamp(decimal value, decimal lowerLimit, decimal upperLimit) {
|
||||||
return std::min(std::max(value, lowerLimit), upperLimit);
|
return std::min(std::max(value, lowerLimit), upperLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function that swaps two values
|
|
||||||
inline void swap(decimal& a, decimal& b) {
|
|
||||||
decimal temp = a;
|
|
||||||
a = b;
|
|
||||||
b = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user