Commit 6b2a7887 authored by schurade's avatar schurade

[FIX] 3D texture alignment corrected

parent a58d2c86
......@@ -339,10 +339,17 @@ wmath::WVector3D WGridRegular3D::worldCoordToTexCoord( wmath::WPosition point )
{
wmath::WVector3D r( wmath::transformPosition3DWithMatrix4D( m_matrixInverse, point ) );
// Scale to [0,1]
r[0] = r[0] / m_nbPosX;
r[1] = r[1] / m_nbPosY;
r[2] = r[2] / m_nbPosZ;
// Correct the coordinates to have the position at the center of the texture voxel.
r[0] += 0.5 / m_nbPosX;
r[1] += 0.5 / m_nbPosY;
r[2] += 0.5 / m_nbPosZ;
return r;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment