Skip to content

Commit

Permalink
Fixed: "Transparent texture clamp on upper/lower wall sections". (see…
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed May 9, 2010
1 parent d6f401e commit e40e7ca
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions doomsday/engine/portable/src/rend_sprite.c
Expand Up @@ -540,14 +540,12 @@ void Rend_RenderMaskedWall(rendmaskedwallparams_t *params)
params->texCoord[1][VX] < 0 || params->texCoord[1][VX] > 1)
{
// The texcoords are out of the normal [0,1] range.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
}
else
{
// Visible portion is within the actual [0,1] range.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
}

// Clamp on the vertical axis if the coords are in the normal [0, 1] range.
Expand All @@ -573,35 +571,35 @@ void Rend_RenderMaskedWall(rendmaskedwallparams_t *params)
glMultiTexCoord2fARB(dynTarget, params->modTexCoord[0][0], params->modTexCoord[1][1]);

glVertex3f(params->vertices[0].pos[VX],
params->vertices[0].pos[VZ],
params->vertices[0].pos[VY]);
params->vertices[0].pos[VZ],
params->vertices[0].pos[VY]);

glColor4fv(params->vertices[1].color);
glMultiTexCoord2fARB(normalTarget, params->texCoord[0][0], params->texCoord[0][1]);

glMultiTexCoord2fARB(dynTarget, params->modTexCoord[0][0], params->modTexCoord[1][0]);

glVertex3f(params->vertices[1].pos[VX],
params->vertices[1].pos[VZ],
params->vertices[1].pos[VY]);
params->vertices[1].pos[VZ],
params->vertices[1].pos[VY]);

glColor4fv(params->vertices[3].color);
glMultiTexCoord2fARB(normalTarget, params->texCoord[1][0], params->texCoord[0][1]);

glMultiTexCoord2fARB(dynTarget, params->modTexCoord[0][1], params->modTexCoord[1][0]);

glVertex3f(params->vertices[3].pos[VX],
params->vertices[3].pos[VZ],
params->vertices[3].pos[VY]);
params->vertices[3].pos[VZ],
params->vertices[3].pos[VY]);

glColor4fv(params->vertices[2].color);
glMultiTexCoord2fARB(normalTarget, params->texCoord[1][0], params->texCoord[1][1]);

glMultiTexCoord2fARB(dynTarget, params->modTexCoord[0][1], params->modTexCoord[1][1]);

glVertex3f(params->vertices[2].pos[VX],
params->vertices[2].pos[VZ],
params->vertices[2].pos[VY]);
params->vertices[2].pos[VZ],
params->vertices[2].pos[VY]);
glEnd();

// Restore normal GL state.
Expand All @@ -616,32 +614,40 @@ void Rend_RenderMaskedWall(rendmaskedwallparams_t *params)
glTexCoord2f(params->texCoord[0][0], params->texCoord[1][1]);

glVertex3f(params->vertices[0].pos[VX],
params->vertices[0].pos[VZ],
params->vertices[0].pos[VY]);
params->vertices[0].pos[VZ],
params->vertices[0].pos[VY]);

glColor4fv(params->vertices[1].color);
glTexCoord2f(params->texCoord[0][0], params->texCoord[0][1]);

glVertex3f(params->vertices[1].pos[VX],
params->vertices[1].pos[VZ],
params->vertices[1].pos[VY]);
params->vertices[1].pos[VZ],
params->vertices[1].pos[VY]);

glColor4fv(params->vertices[3].color);
glTexCoord2f(params->texCoord[1][0], params->texCoord[0][1]);

glVertex3f(params->vertices[3].pos[VX],
params->vertices[3].pos[VZ],
params->vertices[3].pos[VY]);
params->vertices[3].pos[VZ],
params->vertices[3].pos[VY]);

glColor4fv(params->vertices[2].color);
glTexCoord2f(params->texCoord[1][0], params->texCoord[1][1]);

glVertex3f(params->vertices[2].pos[VX],
params->vertices[2].pos[VZ],
params->vertices[2].pos[VY]);
params->vertices[2].pos[VZ],
params->vertices[2].pos[VY]);
glEnd();
}

if(params->masked)
{ // Restore the original texture state.
if(withDyn)
GL_ActiveTexture(IS_MUL ? GL_TEXTURE1 : GL_TEXTURE0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}

GL_BlendMode(BM_NORMAL);
}

Expand Down

0 comments on commit e40e7ca

Please sign in to comment.