mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Optimized Geometry:setVertex
This commit is contained in:
@@ -122,7 +122,13 @@ void Geometry::setVertex(size_t i, const vertex &v)
|
|||||||
if (i >= polygon.size())
|
if (i >= polygon.size())
|
||||||
throw Exception("Invalid vertex index");
|
throw Exception("Invalid vertex index");
|
||||||
|
|
||||||
|
float oldx = polygon[i].x;
|
||||||
|
float oldy = polygon[i].y;
|
||||||
|
|
||||||
polygon[i] = v;
|
polygon[i] = v;
|
||||||
|
|
||||||
|
if (oldx != v.x || oldy != v.y)
|
||||||
|
{
|
||||||
x_min = v.x < x_min ? v.x : x_min;
|
x_min = v.x < x_min ? v.x : x_min;
|
||||||
x_max = v.x > x_max ? v.x : x_max;
|
x_max = v.x > x_max ? v.x : x_max;
|
||||||
y_min = v.y < y_min ? v.y : y_min;
|
y_min = v.y < y_min ? v.y : y_min;
|
||||||
@@ -130,6 +136,7 @@ void Geometry::setVertex(size_t i, const vertex &v)
|
|||||||
|
|
||||||
triangulate();
|
triangulate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Geometry::flip(bool x, bool y)
|
void Geometry::flip(bool x, bool y)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user