mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 00:24:12 +00:00
merge Mod_LoadSpriteFrame from gl and sw back into the common sprite loader
pulling the gl specific code (the loading of the texture into GL) into a separate function (Mod_SpriteLoadTexture), which is just a stub in sw
This commit is contained in:
parent
84bb78abe4
commit
bd0ac4a38a
4 changed files with 48 additions and 85 deletions
|
@ -469,6 +469,7 @@ void *Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||||
void Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
void Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||||
int _s);
|
int _s);
|
||||||
void Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
void Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
||||||
|
void Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,6 @@
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id$";
|
"$Id$";
|
||||||
|
|
||||||
// models are the only shared resource between a client and server running
|
|
||||||
// on the same machine.
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,46 +38,17 @@ static const char rcsid[] =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "QF/model.h"
|
#include "QF/model.h"
|
||||||
#include "QF/qendian.h"
|
|
||||||
#include "QF/GL/qf_textures.h"
|
#include "QF/GL/qf_textures.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
|
void
|
||||||
void *
|
Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
||||||
Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
|
||||||
{
|
{
|
||||||
dspriteframe_t *pinframe;
|
|
||||||
mspriteframe_t *pspriteframe;
|
|
||||||
int width, height, size, origin[2];
|
|
||||||
char name[64];
|
char name[64];
|
||||||
|
|
||||||
pinframe = (dspriteframe_t *) pin;
|
|
||||||
|
|
||||||
width = LittleLong (pinframe->width);
|
|
||||||
height = LittleLong (pinframe->height);
|
|
||||||
size = width * height;
|
|
||||||
|
|
||||||
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t), loadname);
|
|
||||||
|
|
||||||
memset (pspriteframe, 0, sizeof (mspriteframe_t));
|
|
||||||
|
|
||||||
*ppframe = pspriteframe;
|
|
||||||
|
|
||||||
pspriteframe->width = width;
|
|
||||||
pspriteframe->height = height;
|
|
||||||
origin[0] = LittleLong (pinframe->origin[0]);
|
|
||||||
origin[1] = LittleLong (pinframe->origin[1]);
|
|
||||||
|
|
||||||
pspriteframe->up = origin[1];
|
|
||||||
pspriteframe->down = origin[1] - height;
|
|
||||||
pspriteframe->left = origin[0];
|
|
||||||
pspriteframe->right = width + origin[0];
|
|
||||||
|
|
||||||
snprintf (name, sizeof (name), "%s_%i", loadmodel->name, framenum);
|
snprintf (name, sizeof (name), "%s_%i", loadmodel->name, framenum);
|
||||||
pspriteframe->gl_texturenum =
|
pspriteframe->gl_texturenum =
|
||||||
GL_LoadTexture (name, width, height, (byte *) (pinframe + 1), true,
|
GL_LoadTexture (name, pspriteframe->width, pspriteframe->height,
|
||||||
true, 1);
|
pspriteframe->pixels, true, true, 1);
|
||||||
|
|
||||||
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,12 @@ static const char rcsid[] =
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRINGS_H
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "QF/model.h"
|
#include "QF/model.h"
|
||||||
#include "QF/qendian.h"
|
#include "QF/qendian.h"
|
||||||
|
@ -37,9 +43,41 @@ static const char rcsid[] =
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
|
void *
|
||||||
|
Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||||
|
{
|
||||||
|
dspriteframe_t *pinframe;
|
||||||
|
mspriteframe_t *pspriteframe;
|
||||||
|
int width, height, size, origin[2];
|
||||||
|
|
||||||
void *Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe,
|
pinframe = (dspriteframe_t *) pin;
|
||||||
int framenum);
|
|
||||||
|
width = LittleLong (pinframe->width);
|
||||||
|
height = LittleLong (pinframe->height);
|
||||||
|
size = width * height;
|
||||||
|
|
||||||
|
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, loadname);
|
||||||
|
|
||||||
|
memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
|
||||||
|
|
||||||
|
*ppframe = pspriteframe;
|
||||||
|
|
||||||
|
pspriteframe->width = width;
|
||||||
|
pspriteframe->height = height;
|
||||||
|
origin[0] = LittleLong (pinframe->origin[0]);
|
||||||
|
origin[1] = LittleLong (pinframe->origin[1]);
|
||||||
|
|
||||||
|
pspriteframe->up = origin[1];
|
||||||
|
pspriteframe->down = origin[1] - height;
|
||||||
|
pspriteframe->left = origin[0];
|
||||||
|
pspriteframe->right = width + origin[0];
|
||||||
|
|
||||||
|
memcpy (pspriteframe->pixels, (byte *) (pinframe + 1), size);
|
||||||
|
|
||||||
|
Mod_SpriteLoadTexture (pspriteframe, framenum);
|
||||||
|
|
||||||
|
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
|
||||||
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||||
|
|
|
@ -27,57 +27,13 @@
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id$";
|
"$Id$";
|
||||||
|
|
||||||
// models are the only shared resource between a client and server running
|
|
||||||
// on the same machine.
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STRING_H
|
|
||||||
# include <string.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "QF/model.h"
|
#include "QF/model.h"
|
||||||
#include "QF/qendian.h"
|
|
||||||
#include "QF/sys.h"
|
|
||||||
|
|
||||||
#include "d_iface.h"
|
void
|
||||||
|
Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
||||||
|
|
||||||
|
|
||||||
void *
|
|
||||||
Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
|
||||||
{
|
{
|
||||||
dspriteframe_t *pinframe;
|
|
||||||
mspriteframe_t *pspriteframe;
|
|
||||||
int width, height, size, origin[2];
|
|
||||||
|
|
||||||
pinframe = (dspriteframe_t *) pin;
|
|
||||||
|
|
||||||
width = LittleLong (pinframe->width);
|
|
||||||
height = LittleLong (pinframe->height);
|
|
||||||
size = width * height;
|
|
||||||
|
|
||||||
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, loadname);
|
|
||||||
|
|
||||||
memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
|
|
||||||
|
|
||||||
*ppframe = pspriteframe;
|
|
||||||
|
|
||||||
pspriteframe->width = width;
|
|
||||||
pspriteframe->height = height;
|
|
||||||
origin[0] = LittleLong (pinframe->origin[0]);
|
|
||||||
origin[1] = LittleLong (pinframe->origin[1]);
|
|
||||||
|
|
||||||
pspriteframe->up = origin[1];
|
|
||||||
pspriteframe->down = origin[1] - height;
|
|
||||||
pspriteframe->left = origin[0];
|
|
||||||
pspriteframe->right = width + origin[0];
|
|
||||||
|
|
||||||
memcpy (&pspriteframe->pixels[0], (byte *) (pinframe + 1), size);
|
|
||||||
|
|
||||||
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue