mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
with issue with uv packing of face
This commit is contained in:
parent
9c0b5be6d7
commit
d7a53cd25f
1 changed files with 8 additions and 4 deletions
|
@ -375,6 +375,10 @@ uint16_t Atlas::addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bit
|
||||||
//create new layers
|
//create new layers
|
||||||
for (int ii = 0; ii < _type; ++ii)
|
for (int ii = 0; ii < _type; ++ii)
|
||||||
{
|
{
|
||||||
|
m_layers[idx + ii].faceRegion.m_x = 0;
|
||||||
|
m_layers[idx + ii].faceRegion.m_y = 0;
|
||||||
|
m_layers[idx + ii].faceRegion.m_width = m_textureSize;
|
||||||
|
m_layers[idx + ii].faceRegion.m_height = m_textureSize;
|
||||||
m_layers[idx + ii].faceRegion.setMask(_type, m_usedFaces, ii);
|
m_layers[idx + ii].faceRegion.setMask(_type, m_usedFaces, ii);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,10 +472,10 @@ void Atlas::packUV(const AtlasRegion& _region, uint8_t* _vertexBuffer, uint32_t
|
||||||
static const int16_t minVal = -32768;
|
static const int16_t minVal = -32768;
|
||||||
static const int16_t maxVal = 32767;
|
static const int16_t maxVal = 32767;
|
||||||
|
|
||||||
int16_t x0 = (int16_t)(_region.m_x * texMult) - 32768;
|
int16_t x0 = (int16_t)(_region.m_x * texMult) - 32767;
|
||||||
int16_t y0 = (int16_t)(_region.m_y * texMult) - 32768;
|
int16_t y0 = (int16_t)(_region.m_y * texMult) - 32767;
|
||||||
int16_t x1 = (int16_t)( (_region.m_x + _region.m_width) * texMult) - 32768;
|
int16_t x1 = (int16_t)( (_region.m_x + _region.m_width) * texMult) - 32767;
|
||||||
int16_t y1 = (int16_t)( (_region.m_y + _region.m_height) * texMult) - 32768;
|
int16_t y1 = (int16_t)( (_region.m_y + _region.m_height) * texMult) - 32767;
|
||||||
int16_t w = (int16_t) ( (32767.0f / 4.0f) * _region.getComponentIndex() );
|
int16_t w = (int16_t) ( (32767.0f / 4.0f) * _region.getComponentIndex() );
|
||||||
|
|
||||||
_vertexBuffer += _offset;
|
_vertexBuffer += _offset;
|
||||||
|
|
Loading…
Reference in a new issue