rm drawInstanced (last argument of draw instead);

Willing to revert this, but I think this is the cleaner API to use.
This commit is contained in:
bjorn 2018-12-11 22:16:40 -08:00
parent 259dbd5758
commit 2435108d4d
2 changed files with 6 additions and 20 deletions

View File

@ -71,11 +71,11 @@ int l_lovrMeshDetachAttributes(lua_State* L) {
return 0;
}
int l_lovrMeshDrawInstanced(lua_State* L) {
int l_lovrMeshDraw(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
int instances = luaL_checkinteger(L, 2);
float transform[16];
luax_readmat4(L, 3, transform, 1, NULL);
int index = luax_readmat4(L, 3, transform, 1, NULL);
int instances = luaL_optinteger(L, index, 1);
lovrGraphicsDraw(&(DrawCommand) {
.transform = transform,
.mesh = mesh,
@ -85,12 +85,6 @@ int l_lovrMeshDrawInstanced(lua_State* L) {
return 0;
}
int l_lovrMeshDraw(lua_State* L) {
lua_pushinteger(L, 1);
lua_insert(L, 2);
return l_lovrMeshDrawInstanced(L);
}
int l_lovrMeshGetDrawMode(lua_State* L) {
Mesh* mesh = luax_checktype(L, 1, Mesh);
lua_pushstring(L, MeshDrawModes[lovrMeshGetDrawMode(mesh)]);
@ -346,7 +340,6 @@ int l_lovrMeshSetMaterial(lua_State* L) {
const luaL_Reg lovrMesh[] = {
{ "attachAttributes", l_lovrMeshAttachAttributes },
{ "detachAttributes", l_lovrMeshDetachAttributes },
{ "drawInstanced", l_lovrMeshDrawInstanced },
{ "draw", l_lovrMeshDraw },
{ "getVertexFormat", l_lovrMeshGetVertexFormat },
{ "getVertexCount", l_lovrMeshGetVertexCount },

View File

@ -2,21 +2,15 @@
#include "api/math.h"
#include "graphics/model.h"
int l_lovrModelDrawInstanced(lua_State* L) {
int l_lovrModelDraw(lua_State* L) {
Model* model = luax_checktype(L, 1, Model);
int instances = luaL_checkinteger(L, 2);
float transform[16];
luax_readmat4(L, 3, transform, 1, NULL);
int index = luax_readmat4(L, 3, transform, 1, NULL);
int instances = luaL_optinteger(L, index, 1);
lovrModelDraw(model, transform, instances);
return 0;
}
int l_lovrModelDraw(lua_State* L) {
lua_pushinteger(L, 1);
lua_insert(L, 2);
return l_lovrModelDrawInstanced(L);
}
int l_lovrModelGetAABB(lua_State* L) {
Model* model = luax_checktype(L, 1, Model);
const float* aabb = lovrModelGetAABB(model);
@ -80,7 +74,6 @@ int l_lovrModelGetMesh(lua_State* L) {
}
const luaL_Reg lovrModel[] = {
{ "drawInstanced", l_lovrModelDrawInstanced },
{ "draw", l_lovrModelDraw },
{ "getAABB", l_lovrModelGetAABB },
{ "getAnimator", l_lovrModelGetAnimator },