Skip to content

Commit

Permalink
Flip sky sphere material on the x axis if primary texture is missing
Browse files Browse the repository at this point in the history
Although we normally draw from right to left we do not want to display
the "missing" material back to front.
  • Loading branch information
danij-deng committed Dec 29, 2011
1 parent 1fcaf2a commit 9b6a280
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doomsday/engine/portable/src/rend_sky.c
Expand Up @@ -48,7 +48,7 @@ typedef struct {
} skyvertex_t;

typedef struct {
boolean fadeout;
boolean fadeout, texXFlip;
Size2Raw texSize;
float texOffset;
ColorRawf capColor;
Expand Down Expand Up @@ -247,6 +247,7 @@ static void configureRenderHemisphereStateForLayer(int layer, hemispherecap_t se
rs.texSize.width = rs.texSize.height = 0;
if(setupCap != HC_NONE)
rs.fadeout = false;
rs.texXFlip = true;

if(renderTextures != 0)
{
Expand All @@ -262,7 +263,10 @@ static void configureRenderHemisphereStateForLayer(int layer, hemispherecap_t se
{
mat = R_SkyLayerMaterial(layer);
if(!mat)
{
mat = Materials_ToMaterial(Materials_ResolveUriCString(MN_SYSTEM_NAME":missing"));
rs.texXFlip = false;
}
}
assert(mat);

Expand Down Expand Up @@ -348,7 +352,7 @@ static void renderSkyHemisphere(int flags)
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glLoadIdentity();
glScalef(1024.f / rs.texSize.width, yflip? -1.0f : 1.0f, 1.0f);
glScalef(1024.f / rs.texSize.width * (rs.texXFlip? 1.0f : -1.0f), yflip? -1.0f : 1.0f, 1.0f);
glTranslatef(rs.texOffset / rs.texSize.width, yflip? -1.0f : 0.0f, 0.0f);
}

Expand Down

0 comments on commit 9b6a280

Please sign in to comment.