This commit is contained in:
Бранимир Караџић 2022-08-22 20:45:14 -07:00
parent 5d447dd7f3
commit ae7eca02b7
1 changed files with 21 additions and 16 deletions

View File

@ -60,11 +60,12 @@ public:
| BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MIN_POINT
| BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MAG_POINT
; ;
float* rgbaf32Pixels = (float*)BX_ALLOC(entry::getAllocator(), kTextureSize * kTextureSize * 4 * sizeof(float) ); float* rgbaf32Pixels = (float*)BX_ALLOC(entry::getAllocator(), kTextureSize * kTextureSize * 4 * sizeof(float) );
int32_t x, y;
for (y = 0 ; y < kTextureSize; ++y) for (int32_t y = 0 ; y < kTextureSize; ++y)
{ {
for (x = 0; x < kTextureSize; ++x) for (int32_t x = 0; x < kTextureSize; ++x)
{ {
float relX = (x - kHalfTextureSize) / (float) kHalfTextureSize; float relX = (x - kHalfTextureSize) / (float) kHalfTextureSize;
float relY = (y - kHalfTextureSize) / (float) kHalfTextureSize; float relY = (y - kHalfTextureSize) / (float) kHalfTextureSize;
@ -77,9 +78,9 @@ public:
} }
} }
for (y = 0; y < 16; ++y) for (int32_t y = 0; y < 16; ++y)
{ {
for (x = 0; x < 16; ++x) for (int32_t x = 0; x < 16; ++x)
{ {
float* r = &rgbaf32Pixels[(x + (kTextureSize - 36 + y) * kTextureSize) * 4]; float* r = &rgbaf32Pixels[(x + (kTextureSize - 36 + y) * kTextureSize) * 4];
r[0] = 1.0f; r[0] = 1.0f;
@ -101,9 +102,9 @@ public:
} }
} }
for (y = 0; y < 16; ++y) for (int32_t y = 0; y < 16; ++y)
{ {
for (x = 0; x < 48; ++x) for (int32_t x = 0; x < 48; ++x)
{ {
float* a = &rgbaf32Pixels[(x + (kTextureSize - 20 + y) * kTextureSize) * 4]; float* a = &rgbaf32Pixels[(x + (kTextureSize - 20 + y) * kTextureSize) * 4];
a[0] = 1.0f; a[0] = 1.0f;
@ -113,7 +114,6 @@ public:
} }
} }
bimg::TextureInfo info;
for (int32_t i = 0; i < kNumFormats; ++i) for (int32_t i = 0; i < kNumFormats; ++i)
{ {
int32_t format = (int32_t)bgfx::TextureFormat::Unknown + 1 + i; int32_t format = (int32_t)bgfx::TextureFormat::Unknown + 1 + i;
@ -129,6 +129,7 @@ public:
continue; continue;
} }
bimg::TextureInfo info;
bimg::imageGetSize( bimg::imageGetSize(
&info &info
, kTextureSize , kTextureSize
@ -194,14 +195,18 @@ public:
{ {
imguiDestroy(); imguiDestroy();
for (auto texture: m_textures) for (auto texture : m_textures)
{ {
if (bgfx::isValid(texture) ) if (bgfx::isValid(texture) )
{
bgfx::destroy(texture); bgfx::destroy(texture);
} }
}
if (bgfx::isValid(m_checkerboard) ) if (bgfx::isValid(m_checkerboard) )
{
bgfx::destroy(m_checkerboard); bgfx::destroy(m_checkerboard);
}
// Shutdown bgfx. // Shutdown bgfx.
bgfx::shutdown(); bgfx::shutdown();