From 9b53d7d4e288e2a4763c808754ba405c0222b477 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 19 Jan 2021 08:26:53 +0900 Subject: [PATCH] [model] Remove empty brush model functions It seems better to check for a null pointer and just not call. --- libs/models/brush/glsl_model_brush.c | 10 ---------- libs/models/brush/model_brush.c | 11 +++++++---- libs/models/brush/sw_model_brush.c | 16 ---------------- libs/models/null_model.c | 15 --------------- libs/video/renderer/vid_render_glsl.c | 4 ++-- libs/video/renderer/vid_render_sw.c | 6 +++--- libs/video/renderer/vid_render_sw32.c | 6 +++--- 7 files changed, 15 insertions(+), 53 deletions(-) diff --git a/libs/models/brush/glsl_model_brush.c b/libs/models/brush/glsl_model_brush.c index 8827844da..e840e0b29 100644 --- a/libs/models/brush/glsl_model_brush.c +++ b/libs/models/brush/glsl_model_brush.c @@ -132,11 +132,6 @@ glsl_Mod_ProcessTexture (texture_t *tx) } } -void -glsl_Mod_LoadExternalTextures (model_t *mod) -{ -} - void glsl_Mod_LoadLighting (bsp_t *bsp) { @@ -150,8 +145,3 @@ glsl_Mod_LoadLighting (bsp_t *bsp) loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize, loadname); memcpy (loadmodel->lightdata, bsp->lightdata, bsp->lightdatasize); } - -void -glsl_Mod_SubdivideSurface (msurface_t *fa) -{ -} diff --git a/libs/models/brush/model_brush.c b/libs/models/brush/model_brush.c index c81fbabe9..19d28a8c6 100644 --- a/libs/models/brush/model_brush.c +++ b/libs/models/brush/model_brush.c @@ -204,7 +204,7 @@ Mod_LoadTextures (bsp_t *bsp) if (!strncmp (mt->name, "sky", 3)) loadmodel->skytexture = tx; - if (mod_funcs) + if (mod_funcs && mod_funcs->Mod_ProcessTexture) mod_funcs->Mod_ProcessTexture (tx); } @@ -539,7 +539,7 @@ Mod_LoadFaces (bsp_t *bsp) if (!strncmp (out->texinfo->texture->name, "sky", 3)) { // sky out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED); if (gl_sky_divide && gl_sky_divide->int_val) - if (mod_funcs) + if (mod_funcs && mod_funcs->Mod_SubdivideSurface) mod_funcs->Mod_SubdivideSurface (out); continue; } @@ -552,8 +552,10 @@ Mod_LoadFaces (bsp_t *bsp) out->extents[i] = 16384; out->texturemins[i] = -8192; } - if (mod_funcs) // cut up polygon for warps + if (mod_funcs && mod_funcs->Mod_SubdivideSurface) { + // cut up polygon for warps mod_funcs->Mod_SubdivideSurface (out); + } continue; } } @@ -915,8 +917,9 @@ Mod_LoadBrushModel (model_t *mod, void *buffer) Mod_LoadEdges (bsp); Mod_LoadSurfedges (bsp); Mod_LoadTextures (bsp); - if (mod_funcs) + if (mod_funcs && mod_funcs->Mod_LoadLighting) { mod_funcs->Mod_LoadLighting (bsp); + } Mod_LoadPlanes (bsp); Mod_LoadTexinfo (bsp); Mod_LoadFaces (bsp); diff --git a/libs/models/brush/sw_model_brush.c b/libs/models/brush/sw_model_brush.c index c78cd12b4..1f179bab2 100644 --- a/libs/models/brush/sw_model_brush.c +++ b/libs/models/brush/sw_model_brush.c @@ -40,22 +40,6 @@ #include "mod_internal.h" - -void -sw_Mod_SubdivideSurface (msurface_t *fa) -{ -} - -void -sw_Mod_ProcessTexture (texture_t *tx) -{ -} - -void -sw_Mod_LoadExternalTextures (model_t *mod) -{ -} - void sw_Mod_LoadLighting (bsp_t *bsp) { diff --git a/libs/models/null_model.c b/libs/models/null_model.c index 18cb987c1..6f482cc01 100644 --- a/libs/models/null_model.c +++ b/libs/models/null_model.c @@ -48,26 +48,11 @@ Mod_LoadSpriteModel (model_t *mod, void *buf) { } -void -Mod_ProcessTexture (texture_t *tx) -{ -} - void Mod_LoadExternalSkins (model_t *mod) { } -void -Mod_LoadExternalTextures (model_t *mod) -{ -} - -void -Mod_SubdivideSurface (msurface_t *fa) -{ -} - viddef_t vid; VISIBLE void diff --git a/libs/video/renderer/vid_render_glsl.c b/libs/video/renderer/vid_render_glsl.c index 25bdb9224..6d6c87b3a 100644 --- a/libs/video/renderer/vid_render_glsl.c +++ b/libs/video/renderer/vid_render_glsl.c @@ -46,9 +46,9 @@ gl_ctx_t *glsl_ctx; static vid_model_funcs_t model_funcs = { - glsl_Mod_LoadExternalTextures, + 0,//Mod_LoadExternalTextures, glsl_Mod_LoadLighting, - glsl_Mod_SubdivideSurface, + 0,//Mod_SubdivideSurface, glsl_Mod_ProcessTexture, Mod_LoadIQM, diff --git a/libs/video/renderer/vid_render_sw.c b/libs/video/renderer/vid_render_sw.c index 02ff562e6..8c5360701 100644 --- a/libs/video/renderer/vid_render_sw.c +++ b/libs/video/renderer/vid_render_sw.c @@ -39,10 +39,10 @@ sw_ctx_t *sw_ctx; static vid_model_funcs_t model_funcs = { - sw_Mod_LoadExternalTextures, + 0,//Mod_LoadExternalTextures, sw_Mod_LoadLighting, - sw_Mod_SubdivideSurface, - sw_Mod_ProcessTexture, + 0,//Mod_SubdivideSurface, + 0,//Mod_ProcessTexture, Mod_LoadIQM, Mod_LoadAliasModel, diff --git a/libs/video/renderer/vid_render_sw32.c b/libs/video/renderer/vid_render_sw32.c index 97097e2ad..af72bc0df 100644 --- a/libs/video/renderer/vid_render_sw32.c +++ b/libs/video/renderer/vid_render_sw32.c @@ -44,10 +44,10 @@ sw_ctx_t *sw32_ctx; static vid_model_funcs_t model_funcs = { - sw_Mod_LoadExternalTextures, + 0,//Mod_LoadExternalTextures, sw_Mod_LoadLighting, - sw_Mod_SubdivideSurface, - sw_Mod_ProcessTexture, + 0,//Mod_SubdivideSurface, + 0,//Mod_ProcessTexture, Mod_LoadIQM, Mod_LoadAliasModel,