This commit is contained in:
Branimir Karadžić 2015-07-28 22:02:48 -07:00
parent eecb4be9e9
commit 72a4bf0847

View file

@ -405,7 +405,10 @@ uint16_t Atlas::addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bit
void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffer)
{
const bgfx::Memory* mem = bgfx::alloc(_region.width * _region.height * 4);
uint32_t size = _region.width * _region.height * 4;
if (0 < size)
{
const bgfx::Memory* mem = bgfx::alloc(size);
memset(mem->data, 0, mem->size);
if (_region.getType() == AtlasRegion::TYPE_BGRA8)
{
@ -441,6 +444,7 @@ void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffe
}
bgfx::updateTextureCube(m_textureHandle, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
}
}
void Atlas::packFaceLayerUV(uint32_t _idx, uint8_t* _vertexBuffer, uint32_t _offset, uint32_t _stride) const