Commit fa3c1826 authored by Janis Born's avatar Janis Born
Browse files

Add anisotropic filter settings to TextureControl, TextureControlFileJPG

parent 8435787d
......@@ -32,6 +32,7 @@ public:
mType(GL_UNSIGNED_BYTE),
mMinFilter(0),
mMagFilter(0),
mAnisotropicFilter(0.0),
mWrapS(0),
mWrapT(0),
mWrapR(0)
......@@ -58,12 +59,13 @@ public:
return *this;
}
inline TextureControl& internalFormat (GLenum _internalFormat) { mInternalFormat = _internalFormat; return *this; }
inline TextureControl& target (GLenum _target) { mTarget = _target; return *this; }
inline TextureControl& format (GLenum _format) { mFormat = _format; return *this; }
inline TextureControl& type (GLenum type) { mType = type; return *this; }
inline TextureControl& minFilter (GLint _minFilter) { mMinFilter = _minFilter; return *this; }
inline TextureControl& magFilter (GLint _magFilter) { mMagFilter = _magFilter; return *this; }
inline TextureControl& internalFormat (GLenum _internalFormat) { mInternalFormat = _internalFormat; return *this; }
inline TextureControl& target (GLenum _target) { mTarget = _target; return *this; }
inline TextureControl& format (GLenum _format) { mFormat = _format; return *this; }
inline TextureControl& type (GLenum type) { mType = type; return *this; }
inline TextureControl& minFilter (GLint _minFilter) { mMinFilter = _minFilter; return *this; }
inline TextureControl& magFilter (GLint _magFilter) { mMagFilter = _magFilter; return *this; }
inline TextureControl& anisotropicFilter (GLint _anisotropicFilter) { mAnisotropicFilter = _anisotropicFilter; return *this; }
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
......@@ -73,9 +75,10 @@ public:
{
SharedTexture texture(new Texture(mTarget));
texture->bind();
if(mMinFilter > 0) texture->setMinFilter(mMinFilter);
if(mMagFilter > 0) texture->setMagFilter(mMagFilter);
if(mWrapS > 0) texture->setWrap(mWrapS, mWrapT, mWrapR);
if(mMinFilter > 0) texture->setMinFilter(mMinFilter);
if(mMagFilter > 0) texture->setMagFilter(mMagFilter);
if(mWrapS > 0) texture->setWrap(mWrapS, mWrapT, mWrapR);
if(mAnisotropicFilter > 0.0) texture->setAnisotropicFilter(mAnisotropicFilter);
texture->setImageData(
NULL,
mWidth,
......@@ -100,6 +103,7 @@ protected:
GLenum mType;
GLint mMinFilter;
GLint mMagFilter;
GLfloat mAnisotropicFilter;
GLenum mWrapS;
GLenum mWrapT;
GLenum mWrapR;
......
......@@ -25,7 +25,8 @@ public:
TextureControlFileJPG(const std::string& _filename)
: Resource::FileController<Texture>(_filename, Base::Settings::the()->getFullTexturePath()),
mMinFilter(0),
mMagFilter(0)
mMagFilter(0),
mAnisotropicFilter(0.0)
{}
virtual ~TextureControlFileJPG(void) {}
......@@ -35,6 +36,7 @@ public:
public:
inline TextureControlFileJPG& minFilter (GLint _minFilter) { mMinFilter = _minFilter; return *this; }
inline TextureControlFileJPG& magFilter (GLint _magFilter) { mMagFilter = _magFilter; return *this; }
inline TextureControlFileJPG& anisotropicFilter (GLfloat _anisotropicFilter) { mAnisotropicFilter = _anisotropicFilter; return *this; }
private:
bool loadJPG(SharedTexture& texture);
......@@ -52,6 +54,7 @@ public:
protected:
GLint mMinFilter;
GLint mMagFilter;
GLfloat mAnisotropicFilter;
};
} // OpenGL
......
......@@ -17,6 +17,9 @@ SharedTexture TextureControlFileJPG::create(void)
texture->setMinFilter(mMinFilter == 0 ? GL_LINEAR_MIPMAP_LINEAR : mMinFilter);
texture->setMagFilter(mMagFilter == 0 ? GL_LINEAR : mMagFilter);
if(mAnisotropicFilter > 0.0)
texture->setAnisotropicFilter(mAnisotropicFilter);
if(loadJPG(texture))
return texture;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment