Mesh:setDrawRange now takes start and count parameters, instead of min and max.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-09-21 19:44:53 -03:00
parent cc0cfac66c
commit 7ab76b1ef6
3 changed files with 45 additions and 41 deletions
+8 -10
View File
@@ -480,9 +480,9 @@ int w_Mesh_setDrawRange(lua_State *L)
t->setDrawRange();
else
{
int rangemin = (int) luaL_checknumber(L, 2) - 1;
int rangemax = (int) luaL_checknumber(L, 3) - 1;
luax_catchexcept(L, [&](){ t->setDrawRange(rangemin, rangemax); });
int start = (int) luaL_checknumber(L, 2) - 1;
int count = (int) luaL_checknumber(L, 3);
luax_catchexcept(L, [&](){ t->setDrawRange(start, count); });
}
return 0;
@@ -492,15 +492,13 @@ int w_Mesh_getDrawRange(lua_State *L)
{
Mesh *t = luax_checkmesh(L, 1);
int rangemin = -1;
int rangemax = -1;
t->getDrawRange(rangemin, rangemax);
if (rangemin < 0 || rangemax < 0)
int start = 0;
int count = 1;
if (!t->getDrawRange(start, count))
return 0;
lua_pushinteger(L, rangemin + 1);
lua_pushinteger(L, rangemax + 1);
lua_pushinteger(L, start + 1);
lua_pushinteger(L, count);
return 2;
}