summaryrefslogtreecommitdiffstats
path: root/src/render/texture/qtexture.cpp
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2017-01-24 16:41:53 +0100
committerKevin Ottens <kevin.ottens@kdab.com>2017-01-27 14:58:35 +0000
commit946e78eada359f651d337309b25d51d4204289b0 (patch)
tree44b84df80da796390ad0e9aaef396575a3a7a08c /src/render/texture/qtexture.cpp
parent5578d5b89d06b502e05ef6b3e3c6ffa0c29a7aa7 (diff)
Change QTextureLoader defaults
We realized that for rich formats the defaults are ignored by QTextureLoader. At the same time for simpler formats the defaults coming from QAbstractTexture are a bit subpar for quality. So change QTextureLoader defaults to be better in that regard to make QTextureLoader a nice way to load a texture from file in one line. Change-Id: Iefe1b07d14f362ef619e4a86d6599370534041ff Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/texture/qtexture.cpp')
-rw-r--r--src/render/texture/qtexture.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp
index 7dc071833..b5e9a147b 100644
--- a/src/render/texture/qtexture.cpp
+++ b/src/render/texture/qtexture.cpp
@@ -900,10 +900,25 @@ QTextureBuffer::~QTextureBuffer()
/*!
* Constructs a new Qt3DRender::QTextureLoader instance with \a parent as parent.
+ *
+ * Note that by default, if not contradicted by the file metadata, the loaded texture
+ * will have the following properties set:
+ * - wrapMode set to Repeat
+ * - minificationFilter set to LinearMipMapLinear
+ * - magnificationFilter set to Linear
+ * - generateMipMaps set to true
+ * - maximumAnisotropy set to 16.0f
+ * - target set to TargetAutomatic
*/
QTextureLoader::QTextureLoader(QNode *parent)
: QAbstractTexture(*new QTextureLoaderPrivate, parent)
{
+ d_func()->m_wrapMode.setX(QTextureWrapMode::Repeat);
+ d_func()->m_wrapMode.setY(QTextureWrapMode::Repeat);
+ d_func()->m_minFilter = LinearMipMapLinear;
+ d_func()->m_magFilter = Linear;
+ d_func()->m_autoMipMap = true;
+ d_func()->m_maximumAnisotropy = 16.0f;
d_func()->m_target = TargetAutomatic;
}