From e2e4728c7c3909b713f52dba488e55cb4a35bbe7 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 14 Apr 2026 12:09:18 +0500 Subject: [PATCH] engine: remove R_BeamCull from RefAPI --- engine/client/cl_efx.c | 27 ++++++++++++++++++++++++++- engine/ref_api.h | 1 - ref/gl/gl_beams.c | 2 +- ref/gl/gl_context.c | 1 - ref/gl/gl_local.h | 1 - ref/null/r_context.c | 1 - ref/soft/r_beams.c | 2 +- ref/soft/r_context.c | 1 - ref/soft/r_local.h | 1 - 9 files changed, 28 insertions(+), 9 deletions(-) diff --git a/engine/client/cl_efx.c b/engine/client/cl_efx.c index 588b441b..0a691813 100644 --- a/engine/client/cl_efx.c +++ b/engine/client/cl_efx.c @@ -849,6 +849,31 @@ BEAM * GAME_EXPORT R_BeamEnts( int startEnt, int endEnt, int modelIndex, float l return pbeam; } +static qboolean R_BeamVisible( const vec3_t start, const vec3_t end ) +{ + vec3_t mins, maxs; + + for( int i = 0; i < 3; i++ ) + { + if( start[i] < end[i] ) + { + mins[i] = start[i]; + maxs[i] = end[i]; + } + else + { + mins[i] = end[i]; + maxs[i] = start[i]; + } + + // don't let it be zero sized + if( mins[i] == maxs[i] ) + maxs[i] += 1.0f; + } + + return Mod_BoxVisible( mins, maxs, ref.dllFuncs.Mod_GetCurrentVis( )); +} + /* ============== R_BeamPoints @@ -861,7 +886,7 @@ BEAM * GAME_EXPORT R_BeamPoints( vec3_t start, vec3_t end, int modelIndex, float { BEAM *pbeam; - if( life != 0 && ref.dllFuncs.R_BeamCull( start, end, true )) + if( life != 0 && !R_BeamVisible( start, end )) return NULL; pbeam = R_BeamAlloc(); diff --git a/engine/ref_api.h b/engine/ref_api.h index 096b0bd5..ea071af9 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -593,7 +593,6 @@ typedef struct ref_interface_s void (*CL_DrawParticles)( double frametime, particle_t *particles, float partsize ); void (*CL_DrawTracers)( double frametime, particle_t *tracers ); void (*CL_DrawBeams)( int fTrans , BEAM *beams ); - qboolean (*R_BeamCull)( const vec3_t start, const vec3_t end, qboolean pvsOnly ); // Xash3D Render Interface int (*RefGetParm)( int parm, int arg ); // generic diff --git a/ref/gl/gl_beams.c b/ref/gl/gl_beams.c index f3ddd99b..8d61ba7d 100644 --- a/ref/gl/gl_beams.c +++ b/ref/gl/gl_beams.c @@ -114,7 +114,7 @@ R_BeamCull Cull the beam by bbox ============== */ -qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly ) +static qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly ) { vec3_t mins, maxs; int i; diff --git a/ref/gl/gl_context.c b/ref/gl/gl_context.c index 055c137f..03e74634 100644 --- a/ref/gl/gl_context.c +++ b/ref/gl/gl_context.c @@ -567,7 +567,6 @@ const ref_interface_t gReffuncs = CL_DrawParticles, CL_DrawTracers, CL_DrawBeams, - R_BeamCull, GL_RefGetParm, diff --git a/ref/gl/gl_local.h b/ref/gl/gl_local.h index 877d9141..a3fa866c 100644 --- a/ref/gl/gl_local.h +++ b/ref/gl/gl_local.h @@ -296,7 +296,6 @@ void SCR_TimeRefresh_f( void ); // gl_beams.c // void CL_DrawBeams( int fTrans, BEAM *active_beams ); -qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly ); // // gl_cull.c diff --git a/ref/null/r_context.c b/ref/null/r_context.c index 91b20037..b0216ccd 100644 --- a/ref/null/r_context.c +++ b/ref/null/r_context.c @@ -512,7 +512,6 @@ static const ref_interface_t gReffuncs = .CL_DrawParticles = CL_DrawParticles, .CL_DrawTracers = CL_DrawTracers, .CL_DrawBeams = CL_DrawBeams, - .R_BeamCull = R_BeamCull, .RefGetParm = RefGetParm, diff --git a/ref/soft/r_beams.c b/ref/soft/r_beams.c index 3d01050f..5979ddd6 100644 --- a/ref/soft/r_beams.c +++ b/ref/soft/r_beams.c @@ -116,7 +116,7 @@ R_BeamCull Cull the beam by bbox ============== */ -qboolean GAME_EXPORT R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly ) +static qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly ) { // culling is undone in ref_soft return false; diff --git a/ref/soft/r_context.c b/ref/soft/r_context.c index d9d37d52..a247002d 100644 --- a/ref/soft/r_context.c +++ b/ref/soft/r_context.c @@ -505,7 +505,6 @@ const ref_interface_t gReffuncs = CL_DrawParticles, CL_DrawTracers, CL_DrawBeams, - R_BeamCull, GL_RefGetParm, diff --git a/ref/soft/r_local.h b/ref/soft/r_local.h index 1aca8f38..10d539aa 100644 --- a/ref/soft/r_local.h +++ b/ref/soft/r_local.h @@ -317,7 +317,6 @@ typedef struct image_s // gl_beams.c // void CL_DrawBeams( int fTrans, BEAM *active_beams ); -qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly ); // // gl_decals.c