From bb491bc024ab5379d3dec6d89853e6e91e548bc1 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Nov 2024 02:07:50 +0000 Subject: [PATCH] library: vertex off-by-1 errors --- src/library/plugin/plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/library/plugin/plugin.c b/src/library/plugin/plugin.c index b21d7b2..866a898 100644 --- a/src/library/plugin/plugin.c +++ b/src/library/plugin/plugin.c @@ -2562,7 +2562,7 @@ static int api_render3d_vertexuv(lua_State* state) { const struct Render3D* render = require_self_userdata(state, "vertexuv"); const lua_Integer index = luaL_checkinteger(state, 2); double uv[4]; - render->vertex_functions.uv(index, render->vertex_functions.userdata, uv); + render->vertex_functions.uv(index - 1, render->vertex_functions.userdata, uv); lua_pushnumber(state, uv[0]); lua_pushnumber(state, uv[1]); return 2; @@ -2572,7 +2572,7 @@ static int api_render3d_vertexcolour(lua_State* state) { const struct Render3D* render = require_self_userdata(state, "vertexcolour"); const lua_Integer index = luaL_checkinteger(state, 2); double col[4]; - render->vertex_functions.colour(index, render->vertex_functions.userdata, col); + render->vertex_functions.colour(index - 1, render->vertex_functions.userdata, col); lua_pushnumber(state, col[0]); lua_pushnumber(state, col[1]); lua_pushnumber(state, col[2]);