mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Fixed Geometry:getVertexMap to return 1-based vertex indices and made it return the default vertex map instead of nil if no map is set.
This commit is contained in:
@@ -539,8 +539,6 @@ bool Image::refresh()
|
|||||||
if (texture == 0)
|
if (texture == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (gl.getMaxTextureSize())
|
|
||||||
|
|
||||||
while (glGetError() != GL_NO_ERROR); // clear errors
|
while (glGetError() != GL_NO_ERROR); // clear errors
|
||||||
|
|
||||||
// We want this lock to potentially cover mipmap creation as well.
|
// We want this lock to potentially cover mipmap creation as well.
|
||||||
@@ -593,7 +591,7 @@ void Image::uploadDefaultTexture()
|
|||||||
|
|
||||||
// A nice friendly checkerboard to signify invalid textures...
|
// A nice friendly checkerboard to signify invalid textures...
|
||||||
GLubyte px[] = {0xFF,0xFF,0xFF,0xFF, 0xC0,0xC0,0xC0,0xFF,
|
GLubyte px[] = {0xFF,0xFF,0xFF,0xFF, 0xC0,0xC0,0xC0,0xFF,
|
||||||
0xC0,0xC0,0xC0,0xFF, 0xFF,0xFF,0xFF,0xFF};
|
0xC0,0xC0,0xC0,0xFF, 0xFF,0xFF,0xFF,0xFF};
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, px);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, px);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,13 +151,17 @@ int w_Geometry_getVertexMap(lua_State *L)
|
|||||||
size_t elemcount = g->getElementCount();
|
size_t elemcount = g->getElementCount();
|
||||||
const uint16 *elements = g->getElementArray();
|
const uint16 *elements = g->getElementArray();
|
||||||
|
|
||||||
if (elemcount == 0 || elements == 0)
|
if (elemcount == 0)
|
||||||
return 0;
|
elemcount = g->getVertexCount();
|
||||||
|
|
||||||
lua_createtable(L, elemcount, 0);
|
lua_createtable(L, elemcount, 0);
|
||||||
for (size_t i = 0; i < elemcount; i++)
|
for (size_t i = 0; i < elemcount; i++)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, elements[i]);
|
if (elements)
|
||||||
|
lua_pushinteger(L, elements[i] + 1);
|
||||||
|
else
|
||||||
|
lua_pushinteger(L, i + 1);
|
||||||
|
|
||||||
lua_rawseti(L, -2, i + 1);
|
lua_rawseti(L, -2, i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user