diff --git a/src/modules/graphics/Mesh.cpp b/src/modules/graphics/Mesh.cpp index 77261e7bb..c85662a08 100644 --- a/src/modules/graphics/Mesh.cpp +++ b/src/modules/graphics/Mesh.cpp @@ -307,6 +307,7 @@ void Mesh::attachAttribute(const std::string &name, Buffer *buffer, const std::s else if (attachedAttributes.size() + 1 > VertexAttributes::MAX) throw love::Exception("A maximum of %d attributes can be attached at once.", VertexAttributes::MAX); + newattrib.name = name; newattrib.buffer = buffer; newattrib.enabled = oldattrib.buffer.get() ? oldattrib.enabled : true; newattrib.indexInBuffer = buffer->getDataMemberIndex(attachname); diff --git a/src/modules/graphics/wrap_Graphics.cpp b/src/modules/graphics/wrap_Graphics.cpp index 5c2bc44c3..90a1d6595 100644 --- a/src/modules/graphics/wrap_Graphics.cpp +++ b/src/modules/graphics/wrap_Graphics.cpp @@ -1690,7 +1690,7 @@ static Mesh *newCustomMesh(lua_State *L) const char *name = luaL_checkstring(L, -3); - DataFormat format = DATAFORMAT_FLOAT; + DataFormat format = DATAFORMAT_MAX_ENUM; const char *tname = luaL_checkstring(L, -2); if (!lua_isnoneornil(L, -1)) @@ -1728,10 +1728,11 @@ static Mesh *newCustomMesh(lua_State *L) else luaL_error(L, "Invalid component count (%d) for vertex data type %s", components, tname); } - else if (!getConstant(tname, format)) - luax_enumerror(L, "vertex data format", getConstants(format), tname); } + if (format == DATAFORMAT_MAX_ENUM && !getConstant(tname, format)) + luax_enumerror(L, "vertex data format", getConstants(format), tname); + lua_pop(L, 4); vertexformat.emplace_back(name, format); } diff --git a/src/modules/graphics/wrap_Mesh.cpp b/src/modules/graphics/wrap_Mesh.cpp index d499106c1..aa00d4bb2 100644 --- a/src/modules/graphics/wrap_Mesh.cpp +++ b/src/modules/graphics/wrap_Mesh.cpp @@ -300,6 +300,7 @@ int w_Mesh_attachAttribute(lua_State *L) buffer = mesh->getVertexBuffer(); if (buffer == nullptr) return luaL_error(L, "Mesh does not have its own vertex buffer."); + luax_markdeprecated(L, "Mesh:attachAttribute(name, mesh, ...)", API_METHOD, DEPRECATED_REPLACED, "Mesh:attachAttribute(name, buffer, ...)"); } AttributeStep step = STEP_PER_VERTEX;