mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 18:51:35 +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_TEXTURE_BCN_SUFFIX = "_bcn.ktx";
|
||||||
const QString BAKED_META_TEXTURE_SUFFIX = ".texmeta.json";
|
const QString BAKED_META_TEXTURE_SUFFIX = ".texmeta.json";
|
||||||
|
|
||||||
|
bool TextureBaker::_compressionEnabled = true;
|
||||||
|
|
||||||
TextureBaker::TextureBaker(const QUrl& textureURL, image::TextureUsage::Type textureType,
|
TextureBaker::TextureBaker(const QUrl& textureURL, image::TextureUsage::Type textureType,
|
||||||
const QDir& outputDirectory, const QString& metaTexturePathPrefix,
|
const QDir& outputDirectory, const QString& metaTexturePathPrefix,
|
||||||
const QString& baseFilename, const QByteArray& textureContent) :
|
const QString& baseFilename, const QByteArray& textureContent) :
|
||||||
|
@ -146,7 +148,7 @@ void TextureBaker::processTexture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compressed KTX
|
// Compressed KTX
|
||||||
{
|
if (_compressionEnabled) {
|
||||||
auto processedTexture = image::processImage(buffer, _textureURL.toString().toStdString(),
|
auto processedTexture = image::processImage(buffer, _textureURL.toString().toStdString(),
|
||||||
ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, true, _abortProcessing);
|
ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, true, _abortProcessing);
|
||||||
if (!processedTexture) {
|
if (!processedTexture) {
|
||||||
|
@ -186,7 +188,7 @@ void TextureBaker::processTexture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncompressed KTX
|
// Uncompressed KTX
|
||||||
{
|
if (_textureType == image::TextureUsage::Type::CUBE_TEXTURE) {
|
||||||
buffer->reset();
|
buffer->reset();
|
||||||
auto processedTexture = image::processImage(std::move(buffer), _textureURL.toString().toStdString(),
|
auto processedTexture = image::processImage(std::move(buffer), _textureURL.toString().toStdString(),
|
||||||
ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, false, _abortProcessing);
|
ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, false, _abortProcessing);
|
||||||
|
@ -218,6 +220,8 @@ void TextureBaker::processTexture() {
|
||||||
}
|
}
|
||||||
_outputFiles.push_back(filePath);
|
_outputFiles.push_back(filePath);
|
||||||
meta.uncompressed = _metaTexturePathPrefix + fileName;
|
meta.uncompressed = _metaTexturePathPrefix + fileName;
|
||||||
|
} else {
|
||||||
|
buffer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,8 @@ public:
|
||||||
|
|
||||||
virtual void setWasAborted(bool wasAborted) override;
|
virtual void setWasAborted(bool wasAborted) override;
|
||||||
|
|
||||||
|
static void setCompressionEnabled(bool enabled) { _compressionEnabled = enabled; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void bake() override;
|
virtual void bake() override;
|
||||||
virtual void abort() override;
|
virtual void abort() override;
|
||||||
|
@ -65,6 +67,8 @@ private:
|
||||||
QString _metaTexturePathPrefix;
|
QString _metaTexturePathPrefix;
|
||||||
|
|
||||||
std::atomic<bool> _abortProcessing { false };
|
std::atomic<bool> _abortProcessing { false };
|
||||||
|
|
||||||
|
static bool _compressionEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_TextureBaker_h
|
#endif // hifi_TextureBaker_h
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
|
|
||||||
#include <image/Image.h>
|
#include <image/Image.h>
|
||||||
|
#include <TextureBaker.h>
|
||||||
|
|
||||||
#include "BakerCLI.h"
|
#include "BakerCLI.h"
|
||||||
|
|
||||||
|
@ -47,10 +48,7 @@ OvenCLIApplication::OvenCLIApplication(int argc, char* argv[]) :
|
||||||
|
|
||||||
if (parser.isSet(CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER)) {
|
if (parser.isSet(CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER)) {
|
||||||
qDebug() << "Disabling texture compression";
|
qDebug() << "Disabling texture compression";
|
||||||
image::setColorTexturesCompressionEnabled(false);
|
TextureBaker::setCompressionEnabled(false);
|
||||||
image::setGrayscaleTexturesCompressionEnabled(false);
|
|
||||||
image::setNormalTexturesCompressionEnabled(false);
|
|
||||||
image::setCubeTexturesCompressionEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMetaObject::invokeMethod(cli, "bakeFile", Qt::QueuedConnection, Q_ARG(QUrl, inputUrl),
|
QMetaObject::invokeMethod(cli, "bakeFile", Qt::QueuedConnection, Q_ARG(QUrl, inputUrl),
|
||||||
|
|
Loading…
Reference in a new issue