engine: draft new RefAPI 14: remove reserved functions from render api, remove CL_AddCustomBeam

This commit is contained in:
Alibek Omarov
2026-04-12 15:18:54 +05:00
parent 5f6577df2e
commit 6719443d99
11 changed files with 32 additions and 82 deletions

View File

@@ -981,15 +981,8 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
if( !draw_player )
return false;
if( entityType == ET_BEAM )
{
ref.dllFuncs.CL_AddCustomBeam( ent );
return true;
}
else if( !ref.dllFuncs.R_AddEntity( ent, entityType ))
{
if( !ref.dllFuncs.R_AddEntity( ent, entityType ))
return false;
}
// because pTemp->entity.curstate.effects
// is already occupied by FTENT_FLICKER

View File

@@ -62,7 +62,9 @@ GNU General Public License for more details.
// 11. Added size argument to Mod_ProcessRenderData
// 12. Added Image_CalcImageSize
// 13. Removed ignore_flags argument from GetCvarPointer
#define REF_API_VERSION 13
// 14. Removed reserved functions, they are leftover from RenderAPI
// Removed CL_AddCustomBeam, it's now handled through R_AddEntity
#define REF_API_VERSION 14
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP|TF_ALLOW_NEAREST)
#define TF_FONT (TF_NOMIPMAP|TF_CLAMP|TF_ALLOW_NEAREST)
@@ -533,7 +535,6 @@ typedef struct ref_interface_s
void (*GL_SetRenderMode)( int renderMode );
qboolean (*R_AddEntity)( struct cl_entity_s *clent, int type );
void (*CL_AddCustomBeam)( cl_entity_t *pEnvBeam );
void (*R_ProcessEntData)( qboolean allocate, cl_entity_t *entities, unsigned int max_entities );
void (*R_Flush)( unsigned int flush_flags );
@@ -632,8 +633,6 @@ typedef struct ref_interface_s
void (*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture
void (*GL_TexCoordArrayMode)( unsigned int texmode );
void (*GL_UpdateTexSize)( int texnum, int width, int height, int depth ); // recalc statistics
void (*GL_Reserved0)( void ); // for potential interface expansion without broken compatibility
void (*GL_Reserved1)( void );
// Misc renderer functions
void (*GL_DrawParticles)( const struct ref_viewpass_s *rvp, qboolean trans_pass, float frametime );

View File

@@ -151,28 +151,6 @@ qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly )
return true;
}
/*
================
CL_AddCustomBeam
Add the beam that encoded as custom entity
================
*/
void CL_AddCustomBeam( cl_entity_t *pEnvBeam )
{
if( tr.draw_list->num_beam_entities >= MAX_VISIBLE_PACKET )
{
gEngfuncs.Con_Printf( S_ERROR "Too many beams %d!\n", tr.draw_list->num_beam_entities );
return;
}
if( pEnvBeam )
{
tr.draw_list->beam_entities[tr.draw_list->num_beam_entities] = pEnvBeam;
tr.draw_list->num_beam_entities++;
}
}
/*
==============================================================

View File

@@ -452,7 +452,6 @@ static const ref_interface_t gReffuncs =
GL_SetRenderMode,
R_AddEntity,
CL_AddCustomBeam,
R_ProcessEntData,
R_Flush,
@@ -531,8 +530,6 @@ static const ref_interface_t gReffuncs =
GL_TextureTarget,
GL_SetTexCoordArrayMode,
GL_UpdateTexSize,
NULL,
NULL,
CL_DrawParticlesExternal,
R_LightVec,

View File

@@ -538,7 +538,6 @@ int R_CreateDecalList( decallist_t *pList );
void R_ClearAllDecals( void );
byte *Mod_GetCurrentVis( void );
void Mod_SetOrthoBounds( const float *mins, const float *maxs );
void CL_AddCustomBeam( cl_entity_t *pEnvBeam );
//
// gl_opengl.c

View File

@@ -243,9 +243,6 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int type )
if( !r_drawentities->value )
return false; // not allow to drawing
if( !clent || !clent->model )
return false; // if set to invisible, skip
if( FBitSet( clent->curstate.effects, EF_NODRAW ))
return false; // done
@@ -260,10 +257,22 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int type )
case ET_TEMPENTITY:
r_stats.c_active_tents_count++;
break;
default: break;
}
if( R_OpaqueEntity( clent ))
if( type == ET_BEAM )
{
if( tr.draw_list->num_beam_entities >= MAX_VISIBLE_PACKET )
{
gEngfuncs.Con_Printf( S_ERROR "Too many beams %d!\n", tr.draw_list->num_beam_entities );
return false;
}
tr.draw_list->beam_entities[tr.draw_list->num_beam_entities] = clent;
tr.draw_list->num_beam_entities++;
return true;
}
else if( R_OpaqueEntity( clent ))
{
// opaque
if( tr.draw_list->num_solid_entities >= MAX_VISIBLE_PACKET )

View File

@@ -75,11 +75,6 @@ static qboolean R_AddEntity( struct cl_entity_s *clent, int type )
return true;
}
static void CL_AddCustomBeam( cl_entity_t *pEnvBeam )
{
;
}
static void R_ProcessEntData( qboolean allocate, cl_entity_t *entities, unsigned int max_entities )
{
;
@@ -460,7 +455,6 @@ static const ref_interface_t gReffuncs =
.GL_SetRenderMode = R_SimpleStubInt,
.R_AddEntity = R_AddEntity,
.CL_AddCustomBeam = CL_AddCustomBeam,
.R_ProcessEntData = R_ProcessEntData,
.R_Flush = R_SimpleStubUInt,
@@ -539,8 +533,6 @@ static const ref_interface_t gReffuncs =
.GL_TextureTarget = R_SimpleStubUInt,
.GL_TexCoordArrayMode = R_SimpleStubUInt,
.GL_UpdateTexSize = GL_UpdateTexSize,
.GL_Reserved0 = NULL,
.GL_Reserved1 = NULL,
.GL_DrawParticles = GL_DrawParticles,
.LightVec = LightVec,

View File

@@ -122,29 +122,6 @@ qboolean GAME_EXPORT R_BeamCull( const vec3_t start, const vec3_t end, qboolean
return false;
}
/*
================
CL_AddCustomBeam
Add the beam that encoded as custom entity
================
*/
void GAME_EXPORT CL_AddCustomBeam( cl_entity_t *pEnvBeam )
{
if( tr.draw_list->num_beam_entities >= MAX_VISIBLE_PACKET )
{
gEngfuncs.Con_Printf( S_ERROR "Too many beams %d!\n", tr.draw_list->num_beam_entities );
return;
}
if( pEnvBeam )
{
tr.draw_list->beam_entities[tr.draw_list->num_beam_entities] = pEnvBeam;
tr.draw_list->num_beam_entities++;
}
}
/*
==============================================================

View File

@@ -438,7 +438,6 @@ static const ref_interface_t gReffuncs =
GL_SetRenderMode,
R_AddEntity,
CL_AddCustomBeam,
R_ProcessEntData,
R_Flush,
@@ -517,8 +516,6 @@ static const ref_interface_t gReffuncs =
GL_TextureTarget,
GL_SetTexCoordArrayMode,
GL_UpdateTexSize,
NULL,
NULL,
CL_DrawParticlesExternal,
R_LightVec,

View File

@@ -529,7 +529,6 @@ void R_ClearAllDecals( void );
byte *Mod_GetCurrentVis( void );
void Mod_SetOrthoBounds( const float *mins, const float *maxs );
void R_NewMap( void );
void CL_AddCustomBeam( cl_entity_t *pEnvBeam );
//
// gl_triapi.c

View File

@@ -319,9 +319,6 @@ qboolean GAME_EXPORT R_AddEntity( struct cl_entity_s *clent, int type )
if( !r_drawentities->value )
return false; // not allow to drawing
if( !clent || !clent->model )
return false; // if set to invisible, skip
if( FBitSet( clent->curstate.effects, EF_NODRAW ))
return false; // done
@@ -331,7 +328,20 @@ qboolean GAME_EXPORT R_AddEntity( struct cl_entity_s *clent, int type )
if( type == ET_FRAGMENTED )
r_stats.c_client_ents++;
if( R_OpaqueEntity( clent ))
if( type == ET_BEAM )
{
if( tr.draw_list->num_beam_entities >= MAX_VISIBLE_PACKET )
{
gEngfuncs.Con_Printf( S_ERROR "Too many beams %d!\n", tr.draw_list->num_beam_entities );
return false;
}
tr.draw_list->beam_entities[tr.draw_list->num_beam_entities] = clent;
tr.draw_list->num_beam_entities++;
return true;
}
else if( R_OpaqueEntity( clent ))
{
if( clent->model->type == mod_brush )
{