mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Disallow concave shapes as geometry.
This commit is contained in:
@@ -592,7 +592,7 @@ void Canvas::drawg(love::graphics::Geometry *geom, float x, float y, float angle
|
||||
t.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
|
||||
|
||||
// flip texture coordinates vertically
|
||||
size_t vcount = geom->getVertexArraySize();
|
||||
size_t vcount = geom->getVertexCount();
|
||||
const vertex *w = geom->getVertexArray();
|
||||
vertex *v = new vertex[vcount];
|
||||
for (size_t i = 0; i < vcount; ++i)
|
||||
@@ -608,7 +608,7 @@ void Canvas::drawg(love::graphics::Geometry *geom, float x, float y, float angle
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vertex), (GLvoid *)&v->r);
|
||||
}
|
||||
|
||||
drawv(t, v, vcount, GL_TRIANGLES);
|
||||
drawv(t, v, vcount, GL_TRIANGLE_FAN);
|
||||
|
||||
if (geom->hasVertexColors())
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ void Image::drawg(love::graphics::Geometry *geom, float x, float y, float angle,
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vertex), (GLvoid *) &v[0].r);
|
||||
}
|
||||
|
||||
drawv(t, v, geom->getVertexArraySize(), GL_TRIANGLES);
|
||||
drawv(t, v, geom->getVertexCount(), GL_TRIANGLE_FAN);
|
||||
|
||||
if (geom->hasVertexColors())
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ int SpriteBatch::addg(Geometry *geom, float x, float y, float a, float sx, float
|
||||
if ((index == -1 && next >= size) || index < -1 || index >= next)
|
||||
return -1;
|
||||
|
||||
if (geom->getNumVertices() != 4)
|
||||
if (geom->getVertexCount() != 4)
|
||||
throw love::Exception("Can only add quadliteral geometries to SpriteBatch");
|
||||
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
|
||||
@@ -38,7 +38,7 @@ Geometry *luax_checkgeometry(lua_State *L, int idx)
|
||||
int w_Geometry_getVertexCount(lua_State *L)
|
||||
{
|
||||
Geometry *geom = luax_checkgeometry(L, 1);
|
||||
lua_pushinteger(L, geom->getNumVertices());
|
||||
lua_pushinteger(L, geom->getVertexCount());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user