mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 09:33:49 +02:00
Update oven to only produce uncompressed ktx for cubemaps
This commit is contained in:
parent
38df5d3db5
commit
015c092e1c
3 changed files with 12 additions and 6 deletions
|
@ -30,6 +30,8 @@ const QString BAKED_TEXTURE_KTX_EXT = ".ktx";
|
|||
const QString BAKED_TEXTURE_BCN_SUFFIX = "_bcn.ktx";
|
||||
const QString BAKED_META_TEXTURE_SUFFIX = ".texmeta.json";
|
||||
|
||||
bool TextureBaker::_compressionEnabled = true;
|
||||
|
||||
TextureBaker::TextureBaker(const QUrl& textureURL, image::TextureUsage::Type textureType,
|
||||
const QDir& outputDirectory, const QString& metaTexturePathPrefix,
|
||||
const QString& baseFilename, const QByteArray& textureContent) :
|
||||
|
@ -146,7 +148,7 @@ void TextureBaker::processTexture() {
|
|||
}
|
||||
|
||||
// Compressed KTX
|
||||
{
|
||||
if (_compressionEnabled) {
|
||||
auto processedTexture = image::processImage(buffer, _textureURL.toString().toStdString(),
|
||||
ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, true, _abortProcessing);
|
||||
if (!processedTexture) {
|
||||
|
@ -186,7 +188,7 @@ void TextureBaker::processTexture() {
|
|||
}
|
||||
|
||||
// Uncompressed KTX
|
||||
{
|
||||
if (_textureType == image::TextureUsage::Type::CUBE_TEXTURE) {
|
||||
buffer->reset();
|
||||
auto processedTexture = image::processImage(std::move(buffer), _textureURL.toString().toStdString(),
|
||||
ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, false, _abortProcessing);
|
||||
|
@ -218,6 +220,8 @@ void TextureBaker::processTexture() {
|
|||
}
|
||||
_outputFiles.push_back(filePath);
|
||||
meta.uncompressed = _metaTexturePathPrefix + fileName;
|
||||
} else {
|
||||
buffer.reset();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
|
||||
virtual void setWasAborted(bool wasAborted) override;
|
||||
|
||||
static void setCompressionEnabled(bool enabled) { _compressionEnabled = enabled; }
|
||||
|
||||
public slots:
|
||||
virtual void bake() override;
|
||||
virtual void abort() override;
|
||||
|
@ -65,6 +67,8 @@ private:
|
|||
QString _metaTexturePathPrefix;
|
||||
|
||||
std::atomic<bool> _abortProcessing { false };
|
||||
|
||||
static bool _compressionEnabled;
|
||||
};
|
||||
|
||||
#endif // hifi_TextureBaker_h
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <QtCore/QUrl>
|
||||
|
||||
#include <image/Image.h>
|
||||
#include <TextureBaker.h>
|
||||
|
||||
#include "BakerCLI.h"
|
||||
|
||||
|
@ -47,10 +48,7 @@ OvenCLIApplication::OvenCLIApplication(int argc, char* argv[]) :
|
|||
|
||||
if (parser.isSet(CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER)) {
|
||||
qDebug() << "Disabling texture compression";
|
||||
image::setColorTexturesCompressionEnabled(false);
|
||||
image::setGrayscaleTexturesCompressionEnabled(false);
|
||||
image::setNormalTexturesCompressionEnabled(false);
|
||||
image::setCubeTexturesCompressionEnabled(false);
|
||||
TextureBaker::setCompressionEnabled(false);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(cli, "bakeFile", Qt::QueuedConnection, Q_ARG(QUrl, inputUrl),
|
||||
|
|
Loading…
Reference in a new issue