Changed love.graphics.newImage's optional second argument to be a table of flags. Current flags are 'mipmaps' and 'srgb'.

If mipmaps are enabled on image creation, the image will use the default mipmap filter (now 'nearest' by default.) Image:setMipmapFilter will error if the image was not created with mipmaps enabled.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2014-06-05 17:19:31 -03:00
parent bfa3ec9369
commit 8483ea31a1
10 changed files with 200 additions and 213 deletions
+18
View File
@@ -89,6 +89,23 @@ const Texture::Filter &Texture::getDefaultFilter()
return defaultFilter;
}
bool Texture::validateFilter(const Filter &f, bool mipmapsAllowed)
{
if (!mipmapsAllowed && f.mipmap != FILTER_NONE)
return false;
if (f.mag != FILTER_LINEAR && f.mag != FILTER_NEAREST)
return false;
if (f.min != FILTER_LINEAR && f.min != FILTER_NEAREST)
return false;
if (f.mipmap != FILTER_LINEAR && f.mipmap != FILTER_NEAREST && f.mipmap != FILTER_NONE)
return false;
return true;
}
bool Texture::getConstant(const char *in, FilterMode &out)
{
return filterModes.find(in, out);
@@ -113,6 +130,7 @@ StringMap<Texture::FilterMode, Texture::FILTER_MAX_ENUM>::Entry Texture::filterM
{
{ "linear", Texture::FILTER_LINEAR },
{ "nearest", Texture::FILTER_NEAREST },
{ "none", Texture::FILTER_NONE },
};
StringMap<Texture::FilterMode, Texture::FILTER_MAX_ENUM> Texture::filterModes(Texture::filterModeEntries, sizeof(Texture::filterModeEntries));