[model] Make Mod_LoadExternalTextures private

It never really needed to be externally accessible as it has always been
gl-specific and can be called by Mod_ProcessTexture anyway.
This commit is contained in:
Bill Currie 2021-01-19 10:30:37 +09:00
parent e50430e00c
commit 40fc9f0000
9 changed files with 45 additions and 64 deletions

View file

@ -80,7 +80,6 @@ typedef struct vid_particle_funcs_s {
} vid_particle_funcs_t;
typedef struct vid_model_funcs_s {
void (*Mod_LoadExternalTextures) (model_t *mod);
void (*Mod_LoadLighting) (bsp_t *bsp);
void (*Mod_SubdivideSurface) (msurface_t *fa);
void (*Mod_ProcessTexture) (texture_t *tx);

View file

@ -32,17 +32,14 @@ void sw_Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
void sw_Mod_LoadExternalSkins (model_t *mod);
void sw_Mod_IQMFinish (model_t *mod);
void gl_Mod_LoadExternalTextures (model_t *mod);
void gl_Mod_LoadLighting (bsp_t *bsp);
void gl_Mod_SubdivideSurface (msurface_t *fa);
void gl_Mod_ProcessTexture(texture_t *tx);
void glsl_Mod_LoadExternalTextures (model_t *mod);
void glsl_Mod_LoadLighting (bsp_t *bsp);
void glsl_Mod_SubdivideSurface (msurface_t *fa);
void glsl_Mod_ProcessTexture(texture_t *tx);
void sw_Mod_LoadExternalTextures (model_t *mod);
void sw_Mod_LoadLighting (bsp_t *bsp);
void sw_Mod_SubdivideSurface (msurface_t *fa);
void sw_Mod_ProcessTexture(texture_t *tx);

View file

@ -51,22 +51,6 @@
#include "mod_internal.h"
#include "r_internal.h"
void
gl_Mod_ProcessTexture (texture_t *tx)
{
const char *name;
if (!strncmp (tx->name, "sky", 3))
return;
name = va ("fb_%s", tx->name);
tx->gl_fb_texturenum =
Mod_Fullbright ((byte *) (tx + 1), tx->width, tx->height, name);
tx->gl_texturenum =
GL_LoadTexture (tx->name, tx->width, tx->height, (byte *) (tx + 1),
true, false, 1);
}
static tex_t *
Mod_LoadAnExternalTexture (char *tname, char *mname)
{
@ -92,44 +76,59 @@ Mod_LoadAnExternalTexture (char *tname, char *mname)
return image;
}
void
gl_Mod_LoadExternalTextures (model_t *mod)
static int
Mod_LoadExternalTextures (model_t *mod, texture_t *tx)
{
int i;
tex_t *base, *luma;
texture_t *tx;
int external = 0;
if ((base = Mod_LoadAnExternalTexture (tx->name, mod->name))) {
external = 1;
tx->gl_texturenum =
GL_LoadTexture (tx->name, base->width, base->height,
base->data, true, false,
base->format > 2 ? base->format : 1);
for (i = 0; i < mod->numtextures; i++) {
tx = mod->textures[i];
if (!tx)
continue;
if ((base = Mod_LoadAnExternalTexture (tx->name, mod->name))) {
tx->gl_texturenum =
GL_LoadTexture (tx->name, base->width, base->height,
base->data, true, false,
base->format > 2 ? base->format : 1);
luma = Mod_LoadAnExternalTexture (va ("%s_luma", tx->name),
luma = Mod_LoadAnExternalTexture (va ("%s_luma", tx->name),
mod->name);
if (!luma)
luma = Mod_LoadAnExternalTexture (va ("%s_glow", tx->name),
mod->name);
if (!luma)
luma = Mod_LoadAnExternalTexture (va ("%s_glow", tx->name),
mod->name);
tx->gl_fb_texturenum = 0;
tx->gl_fb_texturenum = 0;
if (luma) {
tx->gl_fb_texturenum =
GL_LoadTexture (va ("fb_%s", tx->name), luma->width,
luma->height, luma->data, true, true,
luma->format > 2 ? luma->format : 1);
} else if (base->format < 3) {
tx->gl_fb_texturenum =
Mod_Fullbright (base->data, base->width, base->height,
va ("fb_%s", tx->name));
}
if (luma) {
tx->gl_fb_texturenum =
GL_LoadTexture (va ("fb_%s", tx->name), luma->width,
luma->height, luma->data, true, true,
luma->format > 2 ? luma->format : 1);
} else if (base->format < 3) {
tx->gl_fb_texturenum =
Mod_Fullbright (base->data, base->width, base->height,
va ("fb_%s", tx->name));
}
}
return external;
}
void
gl_Mod_ProcessTexture (texture_t *tx)
{
const char *name;
if (gl_textures_external && gl_textures_external->int_val) {
if (Mod_LoadExternalTextures (loadmodel, tx)) {
return;
}
}
if (strncmp (tx->name, "sky", 3) == 0) {
return;
}
name = va ("fb_%s", tx->name);
tx->gl_fb_texturenum =
Mod_Fullbright ((byte *) (tx + 1), tx->width, tx->height, name);
tx->gl_texturenum =
GL_LoadTexture (tx->name, tx->width, tx->height, (byte *) (tx + 1),
true, false, 1);
}
void

View file

@ -231,10 +231,6 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
default: // Version 29: Quake 1 .bsp
// Version 38: Quake 2 .bsp
Mod_LoadBrushModel (mod, buf);
if (gl_textures_external && gl_textures_external->int_val
&& mod_funcs && mod_funcs->Mod_LoadExternalTextures)
mod_funcs->Mod_LoadExternalTextures (mod);
break;
}
free (buf);

View file

@ -46,7 +46,6 @@
gl_ctx_t *gl_ctx;
static vid_model_funcs_t model_funcs = {
gl_Mod_LoadExternalTextures,
gl_Mod_LoadLighting,
gl_Mod_SubdivideSurface,
gl_Mod_ProcessTexture,

View file

@ -46,7 +46,6 @@
gl_ctx_t *glsl_ctx;
static vid_model_funcs_t model_funcs = {
0,//Mod_LoadExternalTextures,
glsl_Mod_LoadLighting,
0,//Mod_SubdivideSurface,
glsl_Mod_ProcessTexture,

View file

@ -39,7 +39,6 @@
sw_ctx_t *sw_ctx;
static vid_model_funcs_t model_funcs = {
0,//Mod_LoadExternalTextures,
sw_Mod_LoadLighting,
0,//Mod_SubdivideSurface,
0,//Mod_ProcessTexture,

View file

@ -44,7 +44,6 @@
sw_ctx_t *sw32_ctx;
static vid_model_funcs_t model_funcs = {
0,//Mod_LoadExternalTextures,
sw_Mod_LoadLighting,
0,//Mod_SubdivideSurface,
0,//Mod_ProcessTexture,

View file

@ -385,11 +385,6 @@ vulkan_r_particles_style_f (struct cvar_s *var)
Vulkan_r_particles_style_f (var, vulkan_ctx);
}
static void
vulkan_Mod_LoadExternalTextures (model_t *mod)
{
}
static void
vulkan_Mod_LoadLighting (bsp_t *bsp)
{
@ -454,7 +449,6 @@ vulkan_Skin_InitTranslations (void)
}
static vid_model_funcs_t model_funcs = {
vulkan_Mod_LoadExternalTextures,
vulkan_Mod_LoadLighting,
vulkan_Mod_SubdivideSurface,
vulkan_Mod_ProcessTexture,