mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
Use love::Vector (8 bytes) instead of love::Vertex (20 bytes) for love.math.triangulate and love.math.isConvex.
This commit is contained in:
@@ -119,7 +119,7 @@ int w_newBezierCurve(lua_State *L)
|
||||
|
||||
int w_triangulate(lua_State *L)
|
||||
{
|
||||
std::vector<Vertex> vertices;
|
||||
std::vector<love::Vector> vertices;
|
||||
if (lua_istable(L, 1))
|
||||
{
|
||||
int top = (int) luax_objlen(L, 1);
|
||||
@@ -129,7 +129,7 @@ int w_triangulate(lua_State *L)
|
||||
lua_rawgeti(L, 1, i);
|
||||
lua_rawgeti(L, 1, i+1);
|
||||
|
||||
Vertex v;
|
||||
Vector v;
|
||||
v.x = (float) luaL_checknumber(L, -2);
|
||||
v.y = (float) luaL_checknumber(L, -1);
|
||||
vertices.push_back(v);
|
||||
@@ -143,7 +143,7 @@ int w_triangulate(lua_State *L)
|
||||
vertices.reserve(top / 2);
|
||||
for (int i = 1; i <= top; i += 2)
|
||||
{
|
||||
Vertex v;
|
||||
Vector v;
|
||||
v.x = (float) luaL_checknumber(L, i);
|
||||
v.y = (float) luaL_checknumber(L, i+1);
|
||||
vertices.push_back(v);
|
||||
@@ -189,7 +189,7 @@ int w_triangulate(lua_State *L)
|
||||
|
||||
int w_isConvex(lua_State *L)
|
||||
{
|
||||
std::vector<Vertex> vertices;
|
||||
std::vector<love::Vector> vertices;
|
||||
if (lua_istable(L, 1))
|
||||
{
|
||||
int top = (int) luax_objlen(L, 1);
|
||||
@@ -199,7 +199,7 @@ int w_isConvex(lua_State *L)
|
||||
lua_rawgeti(L, 1, i);
|
||||
lua_rawgeti(L, 1, i+1);
|
||||
|
||||
Vertex v;
|
||||
love::Vector v;
|
||||
v.x = (float) luaL_checknumber(L, -2);
|
||||
v.y = (float) luaL_checknumber(L, -1);
|
||||
vertices.push_back(v);
|
||||
@@ -213,7 +213,7 @@ int w_isConvex(lua_State *L)
|
||||
vertices.reserve(top / 2);
|
||||
for (int i = 1; i <= top; i += 2)
|
||||
{
|
||||
Vertex v;
|
||||
love::Vector v;
|
||||
v.x = (float) luaL_checknumber(L, i);
|
||||
v.y = (float) luaL_checknumber(L, i+1);
|
||||
vertices.push_back(v);
|
||||
|
||||
Reference in New Issue
Block a user