mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Quick hack at EF_ADDITIVE, for reliable overlapping transparencies (especially light sources/rayvolues).
This commit is contained in:
parent
528824e507
commit
32b433a09d
4 changed files with 25 additions and 3 deletions
|
@ -9069,6 +9069,7 @@ void PR_DumpPlatform_f(void)
|
|||
fprintf(f, "const float EF_MUZZLEFLASH = %i;\n", EF_MUZZLEFLASH);
|
||||
fprintf(f, "const float EF_BRIGHTLIGHT = %i;\n", EF_BRIGHTLIGHT);
|
||||
fprintf(f, "const float EF_DIMLIGHT = %i;\n", EF_DIMLIGHT);
|
||||
fprintf(f, "const float EF_ADDITIVE = %i;\n", EF_ADDITIVE);
|
||||
fprintf(f, "const float EF_BLUE = %i;\n", EF_BLUE);
|
||||
fprintf(f, "const float EF_RED = %i;\n", EF_RED);
|
||||
fprintf(f, "const float EF_FULLBRIGHT = %i;\n", EF_FULLBRIGHT);
|
||||
|
|
|
@ -440,7 +440,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define EF_BRIGHTLIGHT 4
|
||||
#define EF_DIMLIGHT 8
|
||||
//#define EF_NODRAW 16
|
||||
//#define EF_ADDITIVE 32
|
||||
#define EF_ADDITIVE 32
|
||||
#define EF_BLUE 64
|
||||
#define EF_RED 128
|
||||
//#define EFDP_NOGUNBOB (1u<<8)
|
||||
|
|
|
@ -1185,6 +1185,11 @@ void R_DrawAliasModel (entity_t *e)
|
|||
}
|
||||
else if (alphatest)
|
||||
glEnable (GL_ALPHA_TEST);
|
||||
if (e->effects & EF_ADDITIVE)
|
||||
{
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE);
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
|
||||
//
|
||||
// set up lighting
|
||||
|
@ -1432,6 +1437,8 @@ cleanup:
|
|||
glColor3f(1,1,1);
|
||||
if (e->eflags & EFLAGS_VIEWMODEL)
|
||||
glDepthRange (0, 1);
|
||||
if (e->effects & EF_ADDITIVE)
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPopMatrix ();
|
||||
}
|
||||
|
||||
|
|
|
@ -985,11 +985,19 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
|||
int lastlightmap;
|
||||
gltexture_t *fullbright = NULL;
|
||||
float entalpha;
|
||||
unsigned int enteffects;
|
||||
|
||||
entalpha = (ent != NULL) ? ENTALPHA_DECODE(ent->alpha) : 1.0f;
|
||||
enteffects = (ent != NULL) ? ent->effects : 0;
|
||||
|
||||
// enable blending / disable depth writes
|
||||
if (entalpha < 1)
|
||||
if (enteffects & EF_ADDITIVE)
|
||||
{
|
||||
glDepthMask (GL_FALSE);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE);
|
||||
glEnable (GL_BLEND);
|
||||
}
|
||||
else if (entalpha < 1)
|
||||
{
|
||||
glDepthMask (GL_FALSE);
|
||||
glEnable (GL_BLEND);
|
||||
|
@ -1078,7 +1086,13 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
|||
GL_UseProgramFunc (0);
|
||||
GL_SelectTexture (GL_TEXTURE0);
|
||||
|
||||
if (entalpha < 1)
|
||||
if (enteffects & EF_ADDITIVE)
|
||||
{
|
||||
glDepthMask (GL_TRUE);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //our normal alpha setting.
|
||||
glDisable (GL_BLEND);
|
||||
}
|
||||
else if (entalpha < 1)
|
||||
{
|
||||
glDepthMask (GL_TRUE);
|
||||
glDisable (GL_BLEND);
|
||||
|
|
Loading…
Reference in a new issue