MCPcopy Create free account
hub / github.com/DFHack/dfhack / parseMaterials

Method parseMaterials

plugins/rendermax/renderer_light.cpp:963–990  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961 return ret;
962}
963int lightingEngineViewscreen::parseMaterials(lua_State* L)
964{
965 auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1);
966 engine->matDefs.clear();
967 //color_ostream* os=Lua::GetOutput(L);
968 Lua::StackUnwinder unwinder(L);
969 lua_getfield(L,2,"materials");
970 if(!lua_istable(L,-1))
971 {
972 luaL_error(L,"Materials table not found.");
973 return 0;
974 }
975 lua_pushnil(L);
976 while (lua_next(L, -2) != 0) {
977 int type=lua_tonumber(L,-2);
978 //os->print("Processing type:%d\n",type);
979 lua_pushnil(L);
980 while (lua_next(L, -2) != 0) {
981 int index=lua_tonumber(L,-2);
982 //os->print("\tProcessing index:%d\n",index);
983 engine->matDefs[std::make_pair(type,index)]=lua_parseMatDef(L);
984
985 lua_pop(L, 1);
986 }
987 lua_pop(L, 1);
988 }
989 return 0;
990}
991#define LOAD_SPECIAL(lua_name,class_name) \
992 lua_getfield(L,-1,#lua_name);\
993 if(!lua_isnil(L,-1))engine->class_name=lua_parseMatDef(L);\

Callers

nothing calls this directly

Calls 7

lua_touserdataFunction · 0.85
lua_getfieldFunction · 0.85
luaL_errorFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_parseMatDefFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected