diff options
author | Mauro Persano <mauro.persano@kdab.com> | 2017-01-10 15:20:46 -0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-01-10 21:06:53 +0000 |
commit | a4ab9962239c692b302f0d75cfdec96359a8d33e (patch) | |
tree | f36e0dcb5eb97ec26a1ee8689a6bfa49f5803836 | |
parent | b54eb8dbb89335f24ac0cb7b7d3cdb9e3aa890f9 (diff) |
Use QTextureLoader for textures in GLTF files
This allows us to handle GLTF files with compressed texture formats
such as DDS.
Task-number: QTBUG-57998
Change-Id: If64309b6597d536b9a9772951e1becdfae011035
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfio.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/plugins/sceneparsers/gltf/gltfio.cpp b/src/plugins/sceneparsers/gltf/gltfio.cpp index ad66bb960..e376d5303 100644 --- a/src/plugins/sceneparsers/gltf/gltfio.cpp +++ b/src/plugins/sceneparsers/gltf/gltfio.cpp @@ -1190,13 +1190,8 @@ void GLTFIO::processJSONTexture(const QString &id, const QJsonObject &jsonObject return; } - QTexture2D* tex = new QTexture2D; - - // TODO: Choose suitable internal format - may vary on OpenGL context type - //int pixelFormat = jsonObj.value(KEY_FORMAT).toInt(GL_RGBA); - int internalFormat = jsonObject.value(KEY_INTERNAL_FORMAT).toInt(GL_RGBA); - - tex->setFormat(static_cast<QAbstractTexture::TextureFormat>(internalFormat)); + QTextureLoader* tex = new QTextureLoader; + tex->setMirrored(false); QString samplerId = jsonObject.value(KEY_SAMPLER).toString(); QString source = jsonObject.value(KEY_SOURCE).toString(); @@ -1207,9 +1202,7 @@ void GLTFIO::processJSONTexture(const QString &id, const QJsonObject &jsonObject return; } - QTextureImage *texImage = new QTextureImage(tex); - texImage->setSource(QUrl::fromLocalFile(imagIt.value())); - tex->addTextureImage(texImage); + tex->setSource(QUrl::fromLocalFile(imagIt.value())); const auto samplersDictValue = m_json.object().value(KEY_SAMPLERS).toObject().value(samplerId); if (Q_UNLIKELY(samplersDictValue.isUndefined())) { |