diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-08-19 15:43:22 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@theqtcompany.com> | 2015-08-20 12:31:02 +0000 |
commit | 8213f9b513bccaa1153ba9a6234023af3841386c (patch) | |
tree | e489c8f877ca419b6e50b063704b85e1a7283461 /tools | |
parent | a30f089e82c726e5fd28bd3869571a615c8f5d6e (diff) |
qgltf: Generate a non-mipmapped sampler for compressed textures
This will cause the loader not to enable automatic mipmap generation
which is good because that would fail with GLES.
Change-Id: Ie3d0ea473e28bddc9144aa629019d4331b505829
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qgltf/qgltf.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/qgltf/qgltf.cpp b/tools/qgltf/qgltf.cpp index 44568ae39..2f8779e61 100644 --- a/tools/qgltf/qgltf.cpp +++ b/tools/qgltf/qgltf.cpp @@ -2362,8 +2362,9 @@ void GltfExporter::save(const QString &inputFilename) imageMap[it.key()] = newImageName(); texture["source"] = imageMap[it.key()]; texture["format"] = 0x1908; // RGBA - texture["internalFormat"] = !m_compressedTextures.contains(it.key()) ? 0x1908 : 0x8D64; // RGBA / ETC1 - texture["sampler"] = QStringLiteral("sampler_1"); + const bool compressed = m_compressedTextures.contains(it.key()); + texture["internalFormat"] = !compressed ? 0x1908 : 0x8D64; // RGBA / ETC1 + texture["sampler"] = !compressed ? QStringLiteral("sampler_mip_rep") : QStringLiteral("sampler_nonmip_rep"); texture["target"] = 3553; // TEXTURE_2D texture["type"] = 5121; // UNSIGNED_BYTE textures[it.value()] = texture; @@ -2384,7 +2385,12 @@ void GltfExporter::save(const QString &inputFilename) sampler["minFilter"] = 9987; // LINEAR_MIPMAP_LINEAR sampler["wrapS"] = 10497; // REPEAT sampler["wrapT"] = 10497; - samplers["sampler_1"] = sampler; + samplers["sampler_mip_rep"] = sampler; + // Compressed textures may not support mipmapping with GLES. + if (!m_compressedTextures.isEmpty()) { + sampler["minFilter"] = 9729; // LINEAR + samplers["sampler_nonmip_rep"] = sampler; + } m_obj["samplers"] = samplers; // Just a dummy light, never referenced. |