VideoCommon/VertexLoader: Remove duplicate point min and max calculation

This commit is contained in:
Jens Nyberg 2014-03-27 00:24:48 +01:00
parent 0c62ae9c1a
commit 478a27e052
1 changed files with 9 additions and 13 deletions

View File

@ -307,22 +307,18 @@ void LOADERDECL UpdateBoundingBox()
// If the polygon is inside viewport, let's update the bounding box and be done with it // If the polygon is inside viewport, let's update the bounding box and be done with it
if ((b0 == 3) && (b0 == b1) && (b0 == b2)) if ((b0 == 3) && (b0 == b1) && (b0 == b2))
{ {
// Line left = std::min(p0.x, p1.x);
if (numPoints == 2) top = std::min(p0.y, p1.y);
{ right = std::max(p0.x, p1.x);
left = (p0.x < p1.x) ? p0.x : p1.x; bottom = std::max(p0.y, p1.y);
top = (p0.y < p1.y) ? p0.y : p1.y;
right = (p0.x > p1.x) ? p0.x : p1.x;
bottom = (p0.y > p1.y) ? p0.y : p1.y;
}
// Triangle // Triangle
else if (numPoints == 3)
{ {
left = (p0.x < p1.x) ? (p0.x < p2.x) ? p0.x : p2.x : (p1.x < p2.x) ? p1.x : p2.x; left = std::min(left, p2.x);
top = (p0.y < p1.y) ? (p0.y < p2.y) ? p0.y : p2.y : (p1.y < p2.y) ? p1.y : p2.y; top = std::min(top, p2.y);
right = (p0.x > p1.x) ? (p0.x > p2.x) ? p0.x : p2.x : (p1.x > p2.x) ? p1.x : p2.x; right = std::max(right, p2.x);
bottom = (p0.y > p1.y) ? (p0.y > p2.y) ? p0.y : p2.y : (p1.y > p2.y) ? p1.y : p2.y; bottom = std::max(bottom, p2.y);
} }
// Update bounding box // Update bounding box