mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Add framebuffer filter modes (issue #112)
This commit is contained in:
@@ -41,9 +41,43 @@ namespace opengl
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Framebuffer_setFilter(lua_State * L)
|
||||
{
|
||||
Framebuffer * fbo = luax_checkfbo(L, 1);
|
||||
const char * minstr = luaL_checkstring(L, 2);
|
||||
const char * magstr = luaL_checkstring(L, 3);
|
||||
|
||||
Image::Filter f;
|
||||
if (!Image::getConstant(minstr, f.min))
|
||||
return luaL_error(L, "Invalid min filter mode: %s", minstr);
|
||||
if (!Image::getConstant(magstr, f.mag))
|
||||
return luaL_error(L, "Invalid max filter mode: %s", minstr);
|
||||
|
||||
fbo->setFilter(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_Framebuffer_getFilter(lua_State * L)
|
||||
{
|
||||
Framebuffer * fbo = luax_checkfbo(L, 1);
|
||||
Image::Filter f = fbo->getFilter();
|
||||
|
||||
const char * minstr;
|
||||
const char * magstr;
|
||||
Image::getConstant(f.min, minstr);
|
||||
Image::getConstant(f.mag, magstr);
|
||||
|
||||
lua_pushstring(L, minstr);
|
||||
lua_pushstring(L, magstr);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "renderTo", w_Framebuffer_renderTo },
|
||||
{ "getImageData", w_Framebuffer_getImageData },
|
||||
{ "setFilter", w_Framebuffer_setFilter },
|
||||
{ "getFilter", w_Framebuffer_getFilter },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user