This commit is contained in:
Бранимир Караџић
2019-07-23 20:42:41 -07:00
parent 6a8a1cbe38
commit 50833b01ac
3 changed files with 42 additions and 33 deletions

View File

@@ -18,9 +18,9 @@ namespace bimg
Highest,
Fastest,
NormalMap_Default, // Treat the source as a normal map
NormalMap_Highest,
NormalMap_Fastest,
NormalMapDefault, // Treat the source as a normal map
NormalMapHighest,
NormalMapFastest,
Count
};

View File

@@ -153,11 +153,15 @@ namespace bimg
ASTC_COMPRESS_MODE compress_mode = s_astcQuality[_quality];
ASTC_DECODE_MODE decode_mode = ASTC_DECODE_LDR_LINEAR;
if (Quality::NormalMap_Default <= _quality)
if (Quality::NormalMapDefault <= _quality)
{
astc_compress(_width, _height, src, ASTC_ENC_NORMAL_RA, srcPitch, astcBlockInfo.blockWidth, astcBlockInfo.blockHeight, compress_mode, decode_mode, dst);
}
else
{
astc_compress(_width, _height, src, ASTC_RGBA, srcPitch, astcBlockInfo.blockWidth, astcBlockInfo.blockHeight, compress_mode, decode_mode, dst);
}
}
break;
case TextureFormat::BGRA8:

View File

@@ -3,7 +3,6 @@
* License: https://github.com/bkaradzic/bimg#license-bsd-2-clause
*/
#include <stdio.h>
#include <bx/allocator.h>
#include <bx/readerwriter.h>
#include <bx/endian.h>
@@ -450,7 +449,7 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData
, rgba
);
bimg::Quality::Enum nmapQuality = bimg::Quality::Enum(_options.quality + bimg::Quality::NormalMap_Default);
bimg::Quality::Enum nmapQuality = bimg::Quality::Enum(_options.quality + bimg::Quality::NormalMapDefault);
bimg::imageEncodeFromRgba32f(_allocator
, dstData
, rgbaDst
@@ -861,7 +860,7 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData
, uint16_t(mip.m_height)
);
printf("%f\n", result);
bx::printf("%f\n", result);
BX_FREE(_allocator, ref);
}
@@ -888,7 +887,7 @@ void help(const char* _error = NULL, bool _showHelp = true)
{
if (NULL != _error)
{
fprintf(stderr, "Error:\n%s\n\n", _error);
bx::printf("Error:\n%s\n\n", _error);
if (!_showHelp)
{
@@ -896,8 +895,8 @@ void help(const char* _error = NULL, bool _showHelp = true)
}
}
fprintf(stderr
, "texturec, bgfx texture compiler tool, version %d.%d.%d.\n"
bx::printf(
"texturec, bgfx texture compiler tool, version %d.%d.%d.\n"
"Copyright 2011-2019 Branimir Karadzic. All rights reserved.\n"
"License: https://github.com/bkaradzic/bimg#license-bsd-2-clause\n\n"
, BIMG_TEXTUREC_VERSION_MAJOR
@@ -905,8 +904,8 @@ void help(const char* _error = NULL, bool _showHelp = true)
, BIMG_API_VERSION
);
fprintf(stderr
, "Usage: texturec -f <in> -o <out> [-t <texture format>]\n"
bx::printf(
"Usage: texturec -f <in> -o <out> [-t <texture format>]\n"
"\n"
"Supported file formats:\n"
@@ -1014,18 +1013,24 @@ int main(int _argc, const char* _argv[])
if (cmdLine.hasArg("formats"))
{
printf("Uncompressed formats:\n");
bx::printf("Uncompressed formats:\n");
for (int format = bimg::TextureFormat::Unknown + 1; format < bimg::TextureFormat::UnknownDepth; format++)
printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
{
bx::printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
}
for (int format = bimg::TextureFormat::UnknownDepth + 1; format < bimg::TextureFormat::Count; format++)
printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
{
bx::printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
}
printf("Compressed formats:\n");
bx::printf("Compressed formats:\n");
for (int format = 0; format < bimg::TextureFormat::Unknown; format++)
printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
{
bx::printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format));
}
return bx::kExitSuccess;
}