light: faceextents_t: add another conversion

This commit is contained in:
Eric Wasylishen 2017-02-21 19:03:54 -07:00
parent 8ab0ef9687
commit 64dba663e0
1 changed files with 9 additions and 0 deletions

View File

@ -143,6 +143,15 @@ public:
return lm.x + (width() * lm.y);
}
glm::ivec2 intCoordsFromIndex(int index) const {
Q_assert(index >= 0);
Q_assert(index < numsamples());
glm::ivec2 res(index % width(), index / width());
Q_assert(indexOf(res) == index);
return res;
}
glm::vec2 LMCoordToTexCoord(const glm::vec2 &LMCoord) const {
const glm::vec2 res(m_lightmapscale * (m_texmins[0] + LMCoord.x),
m_lightmapscale * (m_texmins[1] + LMCoord.y));