History

Support for scaling splat textures in S and T, use mipmaps for them.

Andrzej Kapolka committed 12 years ago

Commit 2dfabdf1 parent 4f3f0989 files · +71 −11Browse files

Showing the changes to interface/src/renderer/TextureCache.cpp (1 of 9 files). Show all

Unified · Split

interface/src/renderer/TextureCache.cpp+8−1
@@ -320,6 +320,7 @@ Texture::~Texture() { · 319 unmodified lines
320 320
321NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArray& content) :321NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArray& content) :
322 Resource(url, !content.isEmpty()),322 Resource(url, !content.isEmpty()),
323 _type(type),
323 _translucent(false) {324 _translucent(false) {
324 325
325 if (!url.isValid()) {326 if (!url.isValid()) {
@@ -474,7 +475,13 @@ void NetworkTexture::setImage(const QImage& image, bool translucent, const QColo · 148 unmodified lines
474 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0,475 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0,
475 GL_RGB, GL_UNSIGNED_BYTE, image.constBits());476 GL_RGB, GL_UNSIGNED_BYTE, image.constBits());
476 }477 }
477 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);478 if (_type == SPLAT_TEXTURE) {
479 // generate mipmaps for splat textures
480 glGenerateMipmap(GL_TEXTURE_2D);
481 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
482 } else {
483 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
484 }
478 glBindTexture(GL_TEXTURE_2D, 0);485 glBindTexture(GL_TEXTURE_2D, 0);
479}486}
480 487