mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Fix Issue #476: Add HDR Canvas (thanks, Alexander Szpakowski!).
* Add `love.graphics.isSupported("hdrcanvas")' to query whether the hardware
actually supports HDR canvases.
* Add optional third argument to `love.graphics.newCanvas(w,h, type)', where
`type' is one of "normal" or "hdr" and defaults to "normal". HDR canvases
use floating point that can have values > 1 to store pixels, allowing for
HDR rendering and other higher level lighting techniques when combined with
pixel effects.
* Add `canvas:getType()'.
This commit is contained in:
@@ -181,6 +181,16 @@ int w_Canvas_getHeight(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Canvas_getType(lua_State *L)
|
||||
{
|
||||
Canvas *canvas = luax_checkcanvas(L, 1);
|
||||
Canvas::TextureType type = canvas->getTextureType();
|
||||
const char *str;
|
||||
Canvas::getConstant(type, str);
|
||||
lua_pushstring(L, str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "renderTo", w_Canvas_renderTo },
|
||||
@@ -192,6 +202,7 @@ static const luaL_Reg functions[] =
|
||||
{ "clear", w_Canvas_clear },
|
||||
{ "getWidth", w_Canvas_getWidth },
|
||||
{ "getHeight", w_Canvas_getHeight },
|
||||
{ "getType", w_Canvas_getType },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user