Fix skin functions for plugins.

This commit is contained in:
Bill Currie 2012-02-23 12:09:19 +09:00
parent f5d6959f4b
commit 52e518bb1b
14 changed files with 57 additions and 50 deletions

View file

@ -96,8 +96,6 @@ typedef struct vid_model_funcs_s {
void (*Skin_SetTranslation) (int cmap, int top, int bottom);
void (*Skin_ProcessTranslation) (int cmap, const byte *translation);
void (*Skin_InitTranslations) (void);
int (*Skin_Init_Textures) (int base);
void (*Skin_SetPlayerSkin) (int width, int height, const byte *data);
} vid_model_funcs_t;
typedef struct vid_render_funcs_s {

View file

@ -3,6 +3,9 @@
#include "QF/model.h"
#include "QF/skin.h"
#include "QF/plugin/vid_render.h"
extern vid_model_funcs_t *m_funcs;
void Mod_LoadExternalTextures (model_t *mod);
void Mod_LoadLighting (bsp_t *bsp);
@ -15,10 +18,19 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer);
void Skin_Init (void);
skin_t *Skin_SetColormap (skin_t *skin, int cmap);
skin_t *Skin_SetSkin (skin_t *skin, int cmap, const char *skinname);
void Skin_SetupSkin (skin_t *skin, int cmap);
void Skin_SetTranslation (int cmap, int top, int bottom);
void Skin_ProcessTranslation (int cmap, const byte *translation);
void Skin_InitTranslations (void);
int Skin_Init_Textures (int base);
void Skin_SetPlayerSkin (int width, int height, const byte *data);
void sw_Skin_SetupSkin (skin_t *skin, int cmap);
void sw_Skin_ProcessTranslation (int cmap, const byte *translation);
void sw_Skin_InitTranslations (void);
void glsl_Skin_SetupSkin (skin_t *skin, int cmap);
void glsl_Skin_ProcessTranslation (int cmap, const byte *translation);
void glsl_Skin_InitTranslations (void);
void gl_Skin_SetupSkin (skin_t *skin, int cmap);
void gl_Skin_ProcessTranslation (int cmap, const byte *translation);
void gl_Skin_InitTranslations (void);
int gl_Skin_Init_Textures (int base);
void gl_Skin_SetPlayerSkin (int width, int height, const byte *data);
#endif// __mod_internal_h

View file

@ -14,7 +14,6 @@ lib_ldflags=-version-info $(QUAKE_LIBRARY_VERSION_INFO) \
models_sources = clip_hull.c model.c portal.c trace.c winding.c
common_libs = \
$(top_builddir)/libs/image/libQFimage.la \
$(top_builddir)/libs/util/libQFutil.la
models_libs=brush/libbrush.la $(common_libs)
@ -28,7 +27,8 @@ gl_sources=gl_model_fullbright.c gl_skin.c skin.c
gl_libs= \
alias/libalias_gl.la \
brush/libbrush_gl.la \
sprite/libsprite_gl.la
sprite/libsprite_gl.la \
$(top_builddir)/libs/image/libQFimage.la
libmodels_gl_la_LDFLAGS=
libmodels_gl_la_LIBADD= $(gl_libs)
libmodels_gl_la_DEPENDENCIES= $(gl_libs)
@ -37,7 +37,8 @@ libmodels_gl_la_SOURCES= $(gl_sources)
glsl_libs= \
alias/libalias_glsl.la \
brush/libbrush_glsl.la \
sprite/libsprite_glsl.la
sprite/libsprite_glsl.la \
$(top_builddir)/libs/image/libQFimage.la
libmodels_glsl_la_LDFLAGS=
libmodels_glsl_la_LIBADD= $(glsl_libs)
libmodels_glsl_la_DEPENDENCIES= $(glsl_libs)
@ -46,7 +47,8 @@ libmodels_glsl_la_SOURCES= glsl_skin.c skin.c
sw_libs= \
alias/libalias_sw.la \
brush/libbrush_sw.la \
sprite/libsprite_sw.la
sprite/libsprite_sw.la \
$(top_builddir)/libs/image/libQFimage.la
libmodels_sw_la_LDFLAGS=
libmodels_sw_la_LIBADD= $(sw_libs)
libmodels_sw_la_DEPENDENCIES= $(sw_libs)

View file

@ -72,8 +72,8 @@ Mod_LoadSkin (byte * skin, int skinsize, int snum, int gnum, qboolean group,
// save 8 bit texels for the player model to remap
// FIXME remove model restriction
if (strequal (loadmodel->name, "progs/player.mdl"))
Skin_SetPlayerSkin (pheader->mdl.skinwidth, pheader->mdl.skinheight,
pskin);
gl_Skin_SetPlayerSkin (pheader->mdl.skinwidth, pheader->mdl.skinheight,
pskin);
QFS_StripExtension (loadmodel->name, modname);

View file

@ -83,7 +83,7 @@ do_fb_skin (glskin_t *s)
}
void
Skin_SetPlayerSkin (int width, int height, const byte *data)
gl_Skin_SetPlayerSkin (int width, int height, const byte *data)
{
int size = width * height;
glskin_t *s;
@ -211,7 +211,7 @@ build_skin (skin_t *skin, int cmap)
}
void
Skin_ProcessTranslation (int cmap, const byte *translation)
gl_Skin_ProcessTranslation (int cmap, const byte *translation)
{
int changed;
@ -227,7 +227,7 @@ Skin_ProcessTranslation (int cmap, const byte *translation)
}
void
Skin_SetupSkin (skin_t *skin, int cmap)
gl_Skin_SetupSkin (skin_t *skin, int cmap)
{
int changed;
glskin_t *s;
@ -252,12 +252,12 @@ Skin_SetupSkin (skin_t *skin, int cmap)
}
void
Skin_InitTranslations (void)
gl_Skin_InitTranslations (void)
{
}
int
Skin_Init_Textures (int base)
gl_Skin_Init_Textures (int base)
{
skin_textures = base;
base += MAX_TRANSLATIONS;

View file

@ -57,7 +57,7 @@ static GLuint cmap_tex[MAX_TRANSLATIONS];
static GLuint skin_tex[MAX_TRANSLATIONS];
void
Skin_ProcessTranslation (int cmap, const byte *translation)
glsl_Skin_ProcessTranslation (int cmap, const byte *translation)
{
byte top[4 * VID_GRADES * 16];
byte bottom[4 * VID_GRADES * 16];
@ -95,7 +95,7 @@ Skin_ProcessTranslation (int cmap, const byte *translation)
}
void
Skin_SetupSkin (skin_t *skin, int cmap)
glsl_Skin_SetupSkin (skin_t *skin, int cmap)
{
skin->texnum = 0;
if (cmap) {
@ -123,7 +123,7 @@ Skin_SetupSkin (skin_t *skin, int cmap)
}
void
Skin_InitTranslations (void)
glsl_Skin_InitTranslations (void)
{
byte map[4 * VID_GRADES * 256];
byte *src, *dst;

View file

@ -227,7 +227,8 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
// Version 38: Quake 2 .bsp
Mod_LoadBrushModel (mod, buf);
if (gl_textures_external->int_val)
if (gl_textures_external->int_val
&& mod_funcs->Mod_LoadExternalTextures)
mod_funcs->Mod_LoadExternalTextures (mod);
break;
}

View file

@ -60,6 +60,8 @@ typedef struct skinbank_s {
int users;
} skinbank_t;
vid_model_funcs_t *m_funcs;
// each translation has one extra line for palette (vs colormap) based
// translation (for 32bit rendering)
static byte translations[MAX_TRANSLATIONS][(VID_GRADES + 1) * 256];
@ -119,7 +121,7 @@ Skin_SetTranslation (int cmap, int top, int bottom)
else
dest[BOTTOM_RANGE + i] = bottom + 15 - i;
}
Skin_ProcessTranslation (cmap, translations[cmap - 1]);
m_funcs->Skin_ProcessTranslation (cmap, translations[cmap - 1]);
}
skin_t *
@ -134,7 +136,7 @@ Skin_SetColormap (skin_t *skin, int cmap)
}
if (cmap)
skin->colormap = translations[cmap - 1];
Skin_SetupSkin (skin, cmap);
m_funcs->Skin_SetupSkin (skin, cmap);
return skin;
}
@ -219,7 +221,7 @@ Skin_SetSkin (skin_t *skin, int cmap, const char *skinname)
skin = new_skin ();
skin->texels = tex;
skin->name = name;
Skin_SetupSkin (skin, cmap);
m_funcs->Skin_SetupSkin (skin, cmap);
return skin;
}
@ -243,5 +245,5 @@ void
Skin_Init (void)
{
skin_cache = Hash_NewTable (127, skin_getkey, skin_free, 0);
Skin_InitTranslations ();
m_funcs->Skin_InitTranslations ();
}

View file

@ -36,16 +36,16 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "mod_internal.h"
void
Skin_ProcessTranslation (int cmap, const byte *translation)
sw_Skin_ProcessTranslation (int cmap, const byte *translation)
{
}
void
Skin_SetupSkin (skin_t *skin, int cmap)
sw_Skin_SetupSkin (skin_t *skin, int cmap)
{
}
void
Skin_InitTranslations (void)
sw_Skin_InitTranslations (void)
{
}

View file

@ -155,7 +155,7 @@ gl_R_Init (void)
gl_texture_number = gl_R_InitGraphTextures (gl_texture_number);
gl_texture_number = Skin_Init_Textures (gl_texture_number);
gl_texture_number = gl_Skin_Init_Textures (gl_texture_number);
r_init = 1;
gl_R_InitParticles ();

View file

@ -49,12 +49,10 @@ static vid_model_funcs_t model_funcs = {
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
gl_Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
gl_Skin_ProcessTranslation,
gl_Skin_InitTranslations,
};
vid_render_funcs_t gl_vid_render_funcs = {

View file

@ -49,12 +49,10 @@ static vid_model_funcs_t model_funcs = {
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
glsl_Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
glsl_Skin_ProcessTranslation,
glsl_Skin_InitTranslations,
};
vid_render_funcs_t glsl_vid_render_funcs = {

View file

@ -44,12 +44,10 @@ static vid_model_funcs_t model_funcs = {
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
sw_Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
sw_Skin_ProcessTranslation,
sw_Skin_InitTranslations,
};
vid_render_funcs_t sw_vid_render_funcs = {

View file

@ -49,12 +49,10 @@ static vid_model_funcs_t model_funcs = {
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
sw_Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
sw_Skin_ProcessTranslation,
sw_Skin_InitTranslations,
};
vid_render_funcs_t sw32_vid_render_funcs = {