add inner outline in order to avoid texture bleeding
This commit is contained in:
parent
88e6ce0a33
commit
67ebcebd21
@ -306,7 +306,7 @@ Atlas::~Atlas()
|
||||
delete[] m_textureBuffer;
|
||||
}
|
||||
|
||||
uint16_t Atlas::addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bitmapBuffer, AtlasRegion::Type _type)
|
||||
uint16_t Atlas::addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bitmapBuffer, AtlasRegion::Type _type, uint16_t outline)
|
||||
{
|
||||
if (m_regionCount >= m_maxRegionCount)
|
||||
{
|
||||
@ -350,13 +350,19 @@ uint16_t Atlas::addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bit
|
||||
}
|
||||
|
||||
AtlasRegion& region = m_regions[m_regionCount];
|
||||
region.m_x = x;
|
||||
region.m_y = y;
|
||||
region.m_x = x ;
|
||||
region.m_y = y ;
|
||||
region.m_width = _width;
|
||||
region.m_height = _height;
|
||||
region.m_mask = m_layers[idx].faceRegion.m_mask;
|
||||
|
||||
updateRegion(region, _bitmapBuffer);
|
||||
|
||||
region.m_x += outline;
|
||||
region.m_y += outline;
|
||||
region.m_width -= (outline*2);
|
||||
region.m_height -= (outline*2);
|
||||
|
||||
return m_regionCount++;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
~Atlas();
|
||||
|
||||
/// add a region to the atlas, and copy the content of mem to the underlying texture
|
||||
uint16_t addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bitmapBuffer, AtlasRegion::Type _type = AtlasRegion::TYPE_BGRA8);
|
||||
uint16_t addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bitmapBuffer, AtlasRegion::Type _type = AtlasRegion::TYPE_BGRA8, uint16_t outline = 0);
|
||||
|
||||
/// update a preallocated region
|
||||
void updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffer);
|
||||
|
Loading…
Reference in New Issue
Block a user