sim.framerender function to simulate a certain number of frames

also remove particle debugging lua function now that there are key shortcuts
This commit is contained in:
jacob1 2015-02-06 20:34:07 -05:00
parent 2c0287b71d
commit 6cb78186be
2 changed files with 12 additions and 8 deletions

View File

@ -591,7 +591,7 @@ void LuaScriptInterface::initSimulationAPI()
{"photons", simulation_photons}, {"photons", simulation_photons},
{"neighbours", simulation_neighbours}, {"neighbours", simulation_neighbours},
{"neighbors", simulation_neighbours}, {"neighbors", simulation_neighbours},
{"updateParticles", simulation_update_particles}, {"framerender", simulation_framerender},
{NULL, NULL} {NULL, NULL}
}; };
luaL_register(l, "simulation", simulationAPIMethods); luaL_register(l, "simulation", simulationAPIMethods);
@ -1780,13 +1780,17 @@ int LuaScriptInterface::simulation_neighbours(lua_State * l)
return 1; return 1;
} }
int LuaScriptInterface::simulation_update_particles(lua_State * l) int LuaScriptInterface::simulation_framerender(lua_State * l)
{ {
int start = luaL_optint(l, 1, 0); if (lua_gettop(l) == 0)
int end = luaL_optint(l, 2, luacon_sim->parts_lastActiveIndex); {
if (start < 0 || end >= NPART || start > end) lua_pushinteger(l, luacon_sim->framerender);
return luaL_error(l, "Invalid start / end positions: (%d, %d)", start, end); return 1;
luacon_sim->UpdateParticles(start, end); }
int frames = luaL_checkinteger(l, 1);
if (frames < 0)
return luaL_error(l, "Can't simulate a negative number of frames");
luacon_sim->framerender = frames;
return 0; return 0;
} }

View File

@ -99,7 +99,7 @@ class LuaScriptInterface: public CommandInterface
static int simulation_pmap(lua_State * l); static int simulation_pmap(lua_State * l);
static int simulation_photons(lua_State * l); static int simulation_photons(lua_State * l);
static int simulation_neighbours(lua_State * l); static int simulation_neighbours(lua_State * l);
static int simulation_update_particles(lua_State * l); static int simulation_framerender(lua_State * l);
//Renderer //Renderer
void initRendererAPI(); void initRendererAPI();