Use love::Vector (8 bytes) instead of love::Vertex (20 bytes) for love.math.triangulate and love.math.isConvex.

This commit is contained in:
Alex Szpakowski
2016-08-24 18:02:27 -03:00
parent acde58d311
commit 677a8d60b8
4 changed files with 32 additions and 35 deletions
+6 -6
View File
@@ -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);