texturec: Added normalmap BC5 encoding.

This commit is contained in:
Branimir Karadžić
2016-01-07 17:31:57 -08:00
parent aca9a0cdb9
commit 895c3e43d3
2 changed files with 107 additions and 33 deletions

View File

@@ -2293,10 +2293,10 @@ namespace bgfx
{
for (uint32_t xx = 0; xx < width; ++xx)
{
decodeBlockDxt45A(temp+1, src);
src += 8;
decodeBlockDxt45A(temp+2, src);
src += 8;
decodeBlockDxt45A(temp+1, src);
src += 8;
for (uint32_t ii = 0; ii < 16; ++ii)
{
@@ -2512,10 +2512,10 @@ namespace bgfx
{
uint8_t temp[16*4];
decodeBlockDxt45A(temp+1, src);
src += 8;
decodeBlockDxt45A(temp+2, src);
src += 8;
decodeBlockDxt45A(temp+1, src);
src += 8;
for (uint32_t ii = 0; ii < 16; ++ii)
{
@@ -2523,7 +2523,7 @@ namespace bgfx
float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f;
float nz = sqrtf(1.0f - nx*nx - ny*ny);
const uint32_t offset = (yy + ii/4)*_pitch + (xx*4 + ii%4)*16;
const uint32_t offset = (yy*4 + ii/4)*_width*16 + (xx*4 + ii%4)*16;
float* block = (float*)&dst[offset];
block[0] = nx;
block[1] = ny;