mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 14:03:26 +02:00
some optimizations and compilation changes
* speedup render of widget images on low end devices using mipmaps * changes in CMakeLists.txt to allow usage of distcc and crosscompiling
This commit is contained in:
@@ -98,8 +98,8 @@ void Texture::generateMipmaps()
|
||||
{
|
||||
bind();
|
||||
|
||||
if(!m_useMipmaps) {
|
||||
m_useMipmaps = true;
|
||||
if(!m_hasMipmaps) {
|
||||
m_hasMipmaps = true;
|
||||
setupFilters();
|
||||
}
|
||||
|
||||
@@ -141,8 +141,8 @@ void Texture::generateBilinearMipmaps(std::vector<uint8> inPixels)
|
||||
{
|
||||
bind();
|
||||
|
||||
if(!m_useMipmaps) {
|
||||
m_useMipmaps = true;
|
||||
if(!m_hasMipmaps) {
|
||||
m_hasMipmaps = true;
|
||||
setupFilters();
|
||||
}
|
||||
|
||||
@@ -204,10 +204,10 @@ void Texture::setupFilters()
|
||||
GLint minFilter;
|
||||
GLint magFilter;
|
||||
if(m_smooth) {
|
||||
minFilter = m_useMipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
|
||||
minFilter = m_hasMipmaps ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
|
||||
magFilter = GL_LINEAR;
|
||||
} else {
|
||||
minFilter = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
|
||||
minFilter = m_hasMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
|
||||
magFilter = GL_NEAREST;
|
||||
}
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);
|
||||
|
@@ -48,7 +48,8 @@ public:
|
||||
int getHeight() { return m_size.height(); }
|
||||
const Size& getSize() { return m_size; }
|
||||
|
||||
bool isEmpty() const { return m_textureId == 0; }
|
||||
bool isEmpty() { return m_textureId == 0; }
|
||||
bool hasMipmaps() { return m_hasMipmaps; }
|
||||
|
||||
protected:
|
||||
void setupFilters();
|
||||
@@ -56,7 +57,7 @@ protected:
|
||||
|
||||
GLuint m_textureId;
|
||||
Size m_size;
|
||||
Boolean<false> m_useMipmaps;
|
||||
Boolean<false> m_hasMipmaps;
|
||||
Boolean<false> m_smooth;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user