From d7a53cd25f5655d4fc64e3b0bbf742cc49a3a745 Mon Sep 17 00:00:00 2001 From: Jeremie Roy Date: Fri, 17 May 2013 23:42:38 +0200 Subject: [PATCH] with issue with uv packing of face --- examples/common/cube_atlas.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/common/cube_atlas.cpp b/examples/common/cube_atlas.cpp index 8b50cfd5..39f0d9ad 100644 --- a/examples/common/cube_atlas.cpp +++ b/examples/common/cube_atlas.cpp @@ -375,6 +375,10 @@ uint16_t Atlas::addRegion(uint16_t _width, uint16_t _height, const uint8_t* _bit //create new layers 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); } @@ -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 maxVal = 32767; - int16_t x0 = (int16_t)(_region.m_x * texMult) - 32768; - int16_t y0 = (int16_t)(_region.m_y * texMult) - 32768; - int16_t x1 = (int16_t)( (_region.m_x + _region.m_width) * texMult) - 32768; - int16_t y1 = (int16_t)( (_region.m_y + _region.m_height) * texMult) - 32768; + int16_t x0 = (int16_t)(_region.m_x * texMult) - 32767; + int16_t y0 = (int16_t)(_region.m_y * texMult) - 32767; + 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) - 32767; int16_t w = (int16_t) ( (32767.0f / 4.0f) * _region.getComponentIndex() ); _vertexBuffer += _offset;