luax_readmesh supports Model again;
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#ifndef LOVR_DISABLE_GRAPHICS
+#include "data/modelData.h"
+#include "graphics/graphics.h"
+#endif
typedef void voidFn(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;
}
+#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");
}
