Ejemplo n.º 1
0
static void quadTexCoords(Vector2f *tc, WallEdge const &leftEdge, WallEdge const &rightEdge,
    Vector2f const &texOrigin, Vector2f const &texDimensions, bool horizontal)
{
    DENG2_ASSERT(tc);
    if(horizontal)
    {
        tc[0] = (texOrigin / texDimensions).yx();
        tc[2] = tc[0] + Vector2f(0                              , wallWidth(leftEdge, rightEdge)) / texDimensions.yx();
        tc[3] = tc[0] + Vector2f(wallHeight(leftEdge, rightEdge), wallWidth(leftEdge, rightEdge)) / texDimensions.yx();
        tc[1] = Vector2f(tc[3].x, tc[0].y);
    }
    else  // Vertical.
    {
        tc[1] = texOrigin / texDimensions;
        tc[0] = tc[1] + Vector2f(0                             , wallHeight(leftEdge, rightEdge)) / texDimensions;
        tc[2] = tc[1] + Vector2f(wallWidth(leftEdge, rightEdge), wallHeight(leftEdge, rightEdge)) / texDimensions;
        tc[3] = Vector2f(tc[2].x, tc[1].y);
    }
}