Fixed texture load info.

This commit is contained in:
Branimir Karadžić
2017-04-27 21:09:44 -07:00
parent f300010028
commit 01a76bbdf0
3 changed files with 56 additions and 9 deletions

View File

@@ -206,10 +206,10 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath,
*_info
, uint16_t(imageContainer->m_width)
, uint16_t(imageContainer->m_height)
, 0
, false
, false
, 1
, uint16_t(imageContainer->m_depth)
, imageContainer->m_cubeMap
, 1 < imageContainer->m_numMips
, imageContainer->m_numLayers
, bgfx::TextureFormat::Enum(imageContainer->m_format)
);
}

View File

@@ -12,7 +12,7 @@
#include <bimg/encode.h>
#if 0
# define BX_TRACE(_format, ...) fprintf(stderr, "" _format "\n", ##__VA_ARGS__)
# define DBG(_format, ...) fprintf(stderr, "" _format "\n", ##__VA_ARGS__)
#endif // DEBUG
#include <bx/bx.h>
@@ -44,6 +44,24 @@ struct Options
bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData, uint32_t _inputSize, const Options& _options)
{
DBG("Options:\n"
"\t maxSize: %d\n"
"\t edge: %f\n"
"\t format: %s\n"
"\t mips: %s\n"
"\tnormalMap: %s\n"
"\t iqa: %s\n"
"\t sdf: %s\n"
, _options.maxSize
, _options.edge
, bimg::getName(_options.format)
, _options.mips ? "true" : "false"
, _options.normalMap ? "true" : "false"
, _options.iqa ? "true" : "false"
, _options.sdf ? "true" : "false"
);
const uint8_t* inputData = (uint8_t*)_inputData;
bimg::ImageContainer* output = NULL;
@@ -105,7 +123,16 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData
if (_options.normalMap)
{
output = bimg::imageAlloc(_allocator, format, uint16_t(mip.m_width), uint16_t(mip.m_height), 0, 1, false, _options.mips);
output = bimg::imageAlloc(
_allocator
, format
, uint16_t(mip.m_width)
, uint16_t(mip.m_height)
, 0
, 1
, false
, _options.mips
);
bimg::ImageMip dstMip;
bimg::imageGetRawData(*output, 0, 0, NULL, 0, dstMip);
@@ -179,7 +206,16 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData
else if (!bimg::isCompressed(input->m_format)
&& 8 != bimg::getBlockInfo(input->m_format).rBits)
{
output = bimg::imageAlloc(_allocator, format, uint16_t(mip.m_width), uint16_t(mip.m_height), 0, 1, false, _options.mips);
output = bimg::imageAlloc(
_allocator
, format
, uint16_t(mip.m_width)
, uint16_t(mip.m_height)
, 0
, 1
, false
, _options.mips
);
bimg::ImageMip dstMip;
bimg::imageGetRawData(*output, 0, 0, NULL, 0, dstMip);
@@ -248,7 +284,16 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData
}
else
{
output = bimg::imageAlloc(_allocator, format, uint16_t(mip.m_width), uint16_t(mip.m_height), 0, 1, false, _options.mips);
output = bimg::imageAlloc(
_allocator
, format
, uint16_t(mip.m_width)
, uint16_t(mip.m_height)
, 0
, 1
, false
, _options.mips
);
bimg::ImageMip dstMip;
bimg::imageGetRawData(*output, 0, 0, NULL, 0, dstMip);

View File

@@ -858,11 +858,13 @@ int _main_(int _argc, char** _argv)
std::string title;
if (isValid(texture) )
{
bx::stringPrintf(title, "%s (%d x %d%s, %s)"
bx::stringPrintf(title, "%s (%d x %d%s, mips: %d, layers %d, %s)"
, filePath
, view.m_info.width
, view.m_info.height
, view.m_info.cubeMap ? " CubeMap" : ""
, view.m_info.numMips
, view.m_info.numLayers
, bimg::getName(bimg::TextureFormat::Enum(view.m_info.format) )
);
}