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

@@ -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);