mirror of https://github.com/bjornbytes/lovr.git
luax_readmesh supports Model again;
This commit is contained in:
parent
f894c87723
commit
2c4f5a13df
|
@ -5,6 +5,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifndef LOVR_DISABLE_GRAPHICS
|
||||||
|
#include "data/modelData.h"
|
||||||
|
#include "graphics/graphics.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void voidFn(void);
|
typedef void voidFn(void);
|
||||||
typedef void destructorFn(void*);
|
typedef void destructorFn(void*);
|
||||||
|
@ -522,5 +526,16 @@ int luax_readmesh(lua_State* L, int index, float** vertices, uint32_t* vertexCou
|
||||||
return index + 2;
|
return index + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef LOVR_DISABLE_GRAPHICS
|
||||||
|
Model* model = luax_totype(L, index, Model);
|
||||||
|
|
||||||
|
if (model) {
|
||||||
|
ModelData* modelData = lovrModelGetInfo(model)->data;
|
||||||
|
lovrModelDataGetTriangles(modelData, vertices, indices, vertexCount, indexCount);
|
||||||
|
*shouldFree = false;
|
||||||
|
return index + 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return luaL_argerror(L, index, "table or Model");
|
return luaL_argerror(L, index, "table or Model");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue