diff options
author | Paul Lemire <paul.lemire.ecortex.kdab.com> | 2014-10-27 12:24:37 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2014-10-30 07:15:13 +0100 |
commit | 2144f9c8204b27adfd298fd984ad314fbf28c0de (patch) | |
tree | 2d837856939f1aaa6b156ea07df5ad5723984924 /src/render/io/gltfparser.cpp | |
parent | c2ba286730162091865ea32af648579c7d662d01 (diff) |
QTexture refactoring
Target is now set in the ctor from C++. On the QML side, there's a QTexture
subclass for each target.
WrapMode on s, t, r for texture, accessible as a grouped property in QML.
Note: I left out the static fromImage as I didn't really understand their
purpose. Please let me know what I'm missing.
Change-Id: I16f75283ae459cbd8ab2d1ec53584b3022bc965b
Task-number: QTBUG-41537
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/io/gltfparser.cpp')
-rw-r--r-- | src/render/io/gltfparser.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/render/io/gltfparser.cpp b/src/render/io/gltfparser.cpp index 649482412..a035f29f0 100644 --- a/src/render/io/gltfparser.cpp +++ b/src/render/io/gltfparser.cpp @@ -792,15 +792,14 @@ void GLTFParser::processJSONImage( QString id, QJsonObject jsonObj) void GLTFParser::processJSONTexture( QString id, QJsonObject jsonObj) { - QTexture* tex = new QTexture(); - int target = jsonObj.value(KEY_TARGET).toInt(); + QTexture* tex = new QTexture(static_cast<QTexture::Target>(target)); + // TODO: Choose suitable internal format - may vary on OpenGL context type //int pixelFormat = jsonObj.value(KEY_FORMAT).toInt(); //int internalFormat = jsonObj.value(KEY_INTERNAL_FORMAT).toInt(); - tex->setTarget(static_cast<QTexture::Target>(target)); tex->setFormat(QTexture::RGBA8_UNorm /* static_cast<QOpenGLTexture::TextureFormat>(internalFormat)*/); QString samplerId = jsonObj.value(KEY_SAMPLER).toString(); @@ -820,9 +819,7 @@ void GLTFParser::processJSONTexture( QString id, QJsonObject jsonObj) QJsonObject sampler = samplersDict.value(samplerId).toObject(); - tex->setWrapMode(static_cast<QTexture::WrapMode>(sampler.value(KEY_WRAP_S).toInt())); - // tex->setWrapMode(sampler.value("wrapT").toInt()); - + tex->setWrapMode(QTextureWrapMode(static_cast<QTextureWrapMode::WrapMode>(sampler.value(KEY_WRAP_S).toInt()))); tex->setMinificationFilter(static_cast<QTexture::Filter>(sampler.value(KEY_MIN_FILTER).toInt())); tex->setMagnificationFilter(static_cast<QTexture::Filter>(sampler.value(KEY_MAG_FILTER).toInt())); |