Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed May 25, 2024
1 parent 854e9db commit e3417e5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
18 changes: 9 additions & 9 deletions client/render/gl_decals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void DecalGroupEntry :: PreloadTextures( void )

gl_diffuse_id = id;
if (FBitSet(gl_diffuse_id.GetFlags(), TF_HAS_ALPHA))
opaque = true;
has_alpha = true;

Q_snprintf( path, sizeof( path ), "gfx/decals/%s_norm", name );
if( IMAGE_EXISTS( path ))
Expand Down Expand Up @@ -382,7 +382,7 @@ static word R_ShaderDecalForward( brushdecal_t *decal )
if( CVAR_TO_BOOL( cv_specular ) && ( texinfo->gl_specular_id != tr.blackTexture ))
GL_AddShaderDirective( options, "HAS_GLOSSMAP" );

if( !texinfo->opaque )
if( !texinfo->has_alpha )
{
// GL_DST_COLOR, GL_SRC_COLOR
GL_AddShaderDirective( options, "APPLY_COLORBLEND" );
Expand Down Expand Up @@ -1497,10 +1497,10 @@ static void R_DrawSurfaceDecalsDebug( msurface_t *surf, drawlist_t drawlist_type
if( !p->surface || !p->texinfo )
continue; // bad decal?

if( drawlist_type == DRAWLIST_SOLID && !p->texinfo->opaque )
if( drawlist_type == DRAWLIST_SOLID && !p->texinfo->has_alpha )
continue;

if( drawlist_type == DRAWLIST_TRANS && p->texinfo->opaque )
if( drawlist_type == DRAWLIST_TRANS && p->texinfo->has_alpha )
continue;

DrawWireDecal( p );
Expand All @@ -1517,10 +1517,10 @@ static void R_RenderSurfaceDecals( msurface_t *surf, drawlist_t drawlist_type )
if( !p->surface || !p->texinfo )
continue; // bad decal?

if( drawlist_type == DRAWLIST_SOLID && !p->texinfo->opaque )
if( drawlist_type == DRAWLIST_SOLID && !p->texinfo->has_alpha )
continue;

if( drawlist_type == DRAWLIST_TRANS && p->texinfo->opaque )
if( drawlist_type == DRAWLIST_TRANS && p->texinfo->has_alpha )
continue;

// initialize decal shader
Expand All @@ -1529,7 +1529,7 @@ static void R_RenderSurfaceDecals( msurface_t *surf, drawlist_t drawlist_type )

R_SetDecalUniforms( p );

if( p->texinfo->opaque )
if( p->texinfo->has_alpha )
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
else pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );

Expand Down Expand Up @@ -1823,9 +1823,9 @@ void DecalsInit( void )
if( token[0] == '$' )
{
Q_strncpy( token, token + 1, sizeof( token ));
tempentries[numtemp].opaque = true;// force solid
tempentries[numtemp].has_alpha = true;// force solid
}
else tempentries[numtemp].opaque = false;
else tempentries[numtemp].has_alpha = false;
Q_strncpy( tempentries[numtemp].m_DecalName, token, sizeof( tempentries[numtemp].m_DecalName ));
tempentries[numtemp].xsize = Q_atof( sz_xsize ) / 2.0f;
tempentries[numtemp].ysize = Q_atof( sz_ysize ) / 2.0f;
Expand Down
2 changes: 1 addition & 1 deletion client/render/gl_decals.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DecalGroupEntry
int xsize, ysize;
matdesc_t *matdesc; // pointer to settings
float overlay;
bool opaque; // solid decal doesn't use blend
bool has_alpha; // solid decal doesn't use blend
const DecalGroup *group; // get group name
bool m_init;

Expand Down
8 changes: 4 additions & 4 deletions client/render/gl_studiodecal_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ word CStudioModelRenderer :: ShaderDecalForward( studiodecal_t *pDecal, bool ver
if (tr.fogEnabled && !RP_CUBEPASS())
GL_AddShaderDirective( options, "APPLY_FOG_EXP" );

if( !texinfo->opaque )
if( !texinfo->has_alpha )
{
// GL_DST_COLOR, GL_SRC_COLOR
GL_AddShaderDirective( options, "APPLY_COLORBLEND" );
Expand All @@ -858,7 +858,7 @@ word CStudioModelRenderer :: ShaderDecalForward( studiodecal_t *pDecal, bool ver
GL_AddShaderDirective( options, "PARALLAX_OCCLUSION" );
}

if (!texinfo->opaque || FBitSet(mat->flags, STUDIO_NF_FULLBRIGHT) || R_FullBright())
if (!texinfo->has_alpha || FBitSet(mat->flags, STUDIO_NF_FULLBRIGHT) || R_FullBright())
{
GL_AddShaderDirective( options, "LIGHTING_FULLBRIGHT" );
}
Expand Down Expand Up @@ -1751,7 +1751,7 @@ void CStudioModelRenderer :: DrawDecal( CSolidEntry *entry, GLenum cull_mode )
continue;

SetDecalUniforms( pDecal );
if( pDecal->texinfo->opaque )
if( pDecal->texinfo->has_alpha )
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
else pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
DrawMeshFromBuffer( &pDecal->mesh );
Expand All @@ -1768,7 +1768,7 @@ void CStudioModelRenderer :: DrawDecal( CSolidEntry *entry, GLenum cull_mode )
continue;

SetDecalUniforms( pDecal );
if( pDecal->texinfo->opaque )
if( pDecal->texinfo->has_alpha )
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
else pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
DrawMeshFromBuffer( &pDecal->mesh );
Expand Down
7 changes: 4 additions & 3 deletions client/render/gl_world_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2913,9 +2913,10 @@ static int R_SortSolidBrushFaces( const CSolidEntry *a, const CSolidEntry *b )
================
R_RenderDynLightList
fills solid/transparent/light lists for grass and world/models surfaces
================
*/
void R_BuildFaceListForLight( CDynLight *pl, bool solid )
void R_BuildFaceListsForLight( CDynLight *pl, bool solid )
{
RI->currententity = GET_ENTITY( 0 );
RI->currentmodel = RI->currententity->model;
Expand Down Expand Up @@ -3076,7 +3077,7 @@ void R_DrawLightForSurfList( CDynLight *pl )
================
R_RenderDynLightList
draw dynamic lights for world and bmodels
draw dynamic lights for world, bmodels and grass
================
*/
void R_RenderDynLightList( bool solid )
Expand Down Expand Up @@ -3121,7 +3122,7 @@ void R_RenderDynLightList( bool solid )
RI->currentlight = pl;

// draw world from light position
R_BuildFaceListForLight( pl, solid );
R_BuildFaceListsForLight( pl, solid );

if( !RI->frame.light_faces.Count() && !RI->frame.light_grass.Count() )
continue; // no interaction with this light?
Expand Down

0 comments on commit e3417e5

Please sign in to comment.