mirror of
https://github.com/nzp-team/glquake.git
synced 2024-11-26 05:50:51 +00:00
Fix rendering of alpha assets (#10)
This commit is contained in:
parent
e9363ae28b
commit
4e7be6266d
4 changed files with 34 additions and 6 deletions
BIN
nzportable.3dsx
BIN
nzportable.3dsx
Binary file not shown.
BIN
nzportable.elf
BIN
nzportable.elf
Binary file not shown.
|
@ -405,7 +405,8 @@ void Mod_LoadTextures (lump_t *l)
|
|||
if (tx->gl_texturenum == 0)// did not find a matching TGA...
|
||||
{
|
||||
data = WAD3_LoadTexture(mt);
|
||||
tx->gl_texturenum = GL_LoadTexture32 (mt->name, tx->width, tx->height, (byte *)data, true, false);
|
||||
bool choosealpha = mt->name[0] == '{' ? true : false; // naievil -- need to choose alpha mode for certain textures
|
||||
tx->gl_texturenum = GL_LoadTexture32 (mt->name, tx->width, tx->height, (byte *)data, true, choosealpha);
|
||||
}
|
||||
texture_mode = GL_LINEAR;
|
||||
}
|
||||
|
|
|
@ -796,7 +796,7 @@ R_BlendLightmaps
|
|||
================
|
||||
*/
|
||||
|
||||
void R_BlendLightmaps (void)
|
||||
void R_BlendLightmaps (int specialrender)
|
||||
{
|
||||
int i, j;
|
||||
glpoly_t *p;
|
||||
|
@ -809,7 +809,14 @@ void R_BlendLightmaps (void)
|
|||
glEnable(GL_MODULATE);
|
||||
glColor4f(1,1,1,1);
|
||||
glDepthMask(GL_FALSE); // don't bother writing Z
|
||||
glBlendFunc (GL_ZERO, GL_SRC_COLOR);
|
||||
|
||||
// naievil -- stuff that starts with '{' is a special render
|
||||
if (!specialrender) {
|
||||
glBlendFunc (GL_ZERO, GL_SRC_COLOR);
|
||||
} else {
|
||||
glBlendFunc (GL_ZERO, GL_DST_ALPHA);
|
||||
}
|
||||
|
||||
glEnable (GL_BLEND);
|
||||
|
||||
for (i=0 ; i<MAX_LIGHTMAPS ; i++)
|
||||
|
@ -875,11 +882,31 @@ void R_RenderBrushPoly (msurface_t *fa)
|
|||
EmitWaterPolys (fa);
|
||||
return;
|
||||
}
|
||||
|
||||
//Diabolickal start
|
||||
if(!Q_strncmp(fa->texinfo->texture->name,"nodraw",6) || !Q_strncmp(fa->texinfo->texture->name,"NODRAW",6)) //Diabolickal nodraw support
|
||||
return;
|
||||
if (!strncmp(fa->texinfo->texture->name,"{",1)) //Diabolickal Alpha pixel support
|
||||
{
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
}
|
||||
if (strstr(fa->texinfo->texture->name,"light")) // Any texture with light in the name ignore lightmaps
|
||||
{
|
||||
DrawGLPoly (fa->polys);
|
||||
return;
|
||||
}
|
||||
//Diabolickal end
|
||||
if (fa->flags & SURF_UNDERWATER)
|
||||
DrawGLWaterPoly (fa->polys);
|
||||
else
|
||||
DrawGLPoly (fa->polys);
|
||||
|
||||
//Diabolickal start
|
||||
if (!strncmp(fa->texinfo->texture->name,"{",1)) //Diabolickal Alpha pixel support
|
||||
{
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
//glDisable(GL_BLEND);
|
||||
}
|
||||
//Diabolickal end
|
||||
|
||||
// add the poly to the proper lightmap chain
|
||||
|
||||
|
@ -1262,7 +1289,7 @@ void R_DrawBrushModel (entity_t *e)
|
|||
}
|
||||
}
|
||||
|
||||
R_BlendLightmaps ();
|
||||
R_BlendLightmaps (1);
|
||||
|
||||
glPopMatrix ();
|
||||
}
|
||||
|
@ -1429,7 +1456,7 @@ void R_DrawWorld (void)
|
|||
|
||||
DrawTextureChains ();
|
||||
|
||||
R_BlendLightmaps ();
|
||||
R_BlendLightmaps (0);
|
||||
|
||||
#ifdef QUAKE2
|
||||
R_DrawSkyBox ();
|
||||
|
|
Loading…
Reference in a new issue