Initial image mipmapping implementation. Includes Image:set/getMipmapFilter and Image:set/getMipmapSharpness. setMipMapFilter requires a filter mode, or nil to disable mipmapping.

Enabling mipmapping on an image that does not have power-of-two dimensions will raise an error, due to inconsistent support in older graphics chipsets
This commit is contained in:
Alexander Szpakowski
2013-01-02 02:50:13 -04:00
parent ab98b0de45
commit 2739ea561a
4 changed files with 196 additions and 37 deletions
+18 -9
View File
@@ -101,11 +101,15 @@ public:
**/
void setFilter(const Image::Filter &f);
Image::Filter getFilter() const;
const Image::Filter &getFilter() const;
void setWrap(Image::Wrap &w);
Image::Wrap getWrap() const;
const Image::Wrap &getWrap() const;
void setMipmapSharpness(float sharpness);
float getMipmapSharpness() const;
void bind() const;
@@ -117,6 +121,7 @@ public:
void unloadVolatile();
static bool hasNpot();
static bool hasMipmapSupport();
private:
@@ -138,13 +143,17 @@ private:
// The source vertices of the image.
vertex vertices[4];
// The settings we need to save when reloading.
struct
{
Image::Filter filter;
Image::Wrap wrap;
} settings;
// Mipmap texture LOD bias value
float mipmapsharpness;
float maxmipmapsharpness;
// The image's filter mode
Image::Filter filter;
// The image's wrap mode
Image::Wrap wrap;
bool loadVolatilePOT();
bool loadVolatileNPOT();