2010-02-15 23:26:55 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-2001 Id Software, Inc.
|
|
|
|
Copyright (C) 2002-2009 John Fitzgibbons and others
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
|
|
|
#ifndef _GL_TEXMAN_H
|
|
|
|
#define _GL_TEXMAN_H
|
|
|
|
|
2010-02-15 23:26:55 +00:00
|
|
|
//gl_texmgr.h -- fitzquake's texture manager. manages opengl texture images
|
|
|
|
|
|
|
|
#define TEXPREF_NONE 0x0000
|
|
|
|
#define TEXPREF_MIPMAP 0x0001 // generate mipmaps
|
|
|
|
#define TEXPREF_LINEAR 0x0002 // force linear
|
|
|
|
#define TEXPREF_NEAREST 0x0004 // force nearest
|
|
|
|
#define TEXPREF_ALPHA 0x0008 // allow alpha
|
|
|
|
#define TEXPREF_PAD 0x0010 // allow padding
|
|
|
|
#define TEXPREF_PERSIST 0x0020 // never free
|
|
|
|
#define TEXPREF_OVERWRITE 0x0040 // overwrite existing same-name texture
|
|
|
|
#define TEXPREF_NOPICMIP 0x0080 // always load full-sized
|
|
|
|
#define TEXPREF_FULLBRIGHT 0x0100 // use fullbright mask palette
|
|
|
|
#define TEXPREF_NOBRIGHT 0x0200 // use nobright mask palette
|
|
|
|
#define TEXPREF_CONCHARS 0x0400 // use conchars palette
|
|
|
|
#define TEXPREF_WARPIMAGE 0x0800 // resize this texture when warpimagesize changes
|
|
|
|
|
|
|
|
enum srcformat {SRC_INDEXED, SRC_LIGHTMAP, SRC_RGBA};
|
|
|
|
|
2011-04-01 14:55:45 +00:00
|
|
|
typedef uintptr_t src_offset_t;
|
64 bit compatibility effort, 2/nn: type correctness work in common.h,
gl_draw.c, gl_model.c, gl_sky.c, gl_texmgr.c, gl_texmgr.h, r_alias.c,
r_brush.c, r_part.c, r_world.c, snd_mem.c. next step will be server
side (progs) work which is actually the heart of the problems.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@34 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 21:26:11 +00:00
|
|
|
|
2010-02-15 23:26:55 +00:00
|
|
|
typedef struct gltexture_s {
|
|
|
|
//managed by texture manager
|
2011-12-29 19:06:08 +00:00
|
|
|
GLuint texnum;
|
2010-02-15 23:26:55 +00:00
|
|
|
struct gltexture_s *next;
|
2011-12-29 19:06:08 +00:00
|
|
|
model_t *owner;
|
2010-02-15 23:26:55 +00:00
|
|
|
//managed by image loading
|
2011-12-29 19:06:08 +00:00
|
|
|
char name[64];
|
2010-02-15 23:26:55 +00:00
|
|
|
unsigned int width; //size of image as it exists in opengl
|
|
|
|
unsigned int height; //size of image as it exists in opengl
|
|
|
|
unsigned int flags;
|
2011-12-29 19:06:08 +00:00
|
|
|
char source_file[MAX_QPATH]; //relative filepath to data source, or "" if source is in memory
|
64 bit compatibility effort, 2/nn: type correctness work in common.h,
gl_draw.c, gl_model.c, gl_sky.c, gl_texmgr.c, gl_texmgr.h, r_alias.c,
r_brush.c, r_part.c, r_world.c, snd_mem.c. next step will be server
side (progs) work which is actually the heart of the problems.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@34 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 21:26:11 +00:00
|
|
|
src_offset_t source_offset; //byte offset into file, or memory address
|
2010-02-15 23:26:55 +00:00
|
|
|
enum srcformat source_format; //format of pixel data (indexed, lightmap, or rgba)
|
|
|
|
unsigned int source_width; //size of image in source data
|
|
|
|
unsigned int source_height; //size of image in source data
|
|
|
|
unsigned short source_crc; //generated by source data before modifications
|
|
|
|
char shirt; //0-13 shirt color, or -1 if never colormapped
|
|
|
|
char pants; //0-13 pants color, or -1 if never colormapped
|
|
|
|
//used for rendering
|
2011-12-29 19:06:08 +00:00
|
|
|
int visframe; //matches r_framecount if texture was bound this frame
|
2010-02-15 23:26:55 +00:00
|
|
|
} gltexture_t;
|
|
|
|
|
2010-04-22 19:02:29 +00:00
|
|
|
extern gltexture_t *notexture;
|
|
|
|
extern gltexture_t *nulltexture;
|
2010-02-15 23:26:55 +00:00
|
|
|
|
2010-04-22 19:02:29 +00:00
|
|
|
extern unsigned int d_8to24table[256];
|
|
|
|
extern unsigned int d_8to24table_fbright[256];
|
|
|
|
extern unsigned int d_8to24table_nobright[256];
|
|
|
|
extern unsigned int d_8to24table_conchars[256];
|
|
|
|
extern unsigned int d_8to24table_shirt[256];
|
|
|
|
extern unsigned int d_8to24table_pants[256];
|
2010-02-15 23:26:55 +00:00
|
|
|
|
|
|
|
// TEXTURE MANAGER
|
|
|
|
|
|
|
|
float TexMgr_FrameUsage (void);
|
2010-08-29 02:22:55 +00:00
|
|
|
gltexture_t *TexMgr_FindTexture (model_t *owner, const char *name);
|
2010-02-15 23:26:55 +00:00
|
|
|
gltexture_t *TexMgr_NewTexture (void);
|
|
|
|
void TexMgr_FreeTexture (gltexture_t *kill);
|
|
|
|
void TexMgr_FreeTextures (int flags, int mask);
|
|
|
|
void TexMgr_FreeTexturesForOwner (model_t *owner);
|
|
|
|
void TexMgr_NewGame (void);
|
|
|
|
void TexMgr_Init (void);
|
|
|
|
|
|
|
|
// IMAGE LOADING
|
2010-08-29 02:22:55 +00:00
|
|
|
gltexture_t *TexMgr_LoadImage (model_t *owner, const char *name, int width, int height, enum srcformat format,
|
|
|
|
byte *data, const char *source_file, src_offset_t source_offset, unsigned flags);
|
2010-02-15 23:26:55 +00:00
|
|
|
void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants);
|
|
|
|
void TexMgr_ReloadImages (void);
|
|
|
|
void TexMgr_ReloadNobrightImages (void);
|
|
|
|
|
|
|
|
int TexMgr_Pad(int s);
|
|
|
|
int TexMgr_SafeTextureSize (int s);
|
|
|
|
int TexMgr_PadConditional (int s);
|
|
|
|
|
|
|
|
// TEXTURE BINDING & TEXTURE UNIT SWITCHING
|
|
|
|
|
|
|
|
void GL_DisableMultitexture (void); //selects texture unit 0
|
|
|
|
void GL_EnableMultitexture (void); //selects texture unit 1
|
|
|
|
void GL_Bind (gltexture_t *texture);
|
bspfile.h, cdaudio.h, client.h, cmd.h, common.h, console.h, crc.h, cvar.h,
d_ifacea.h, draw.h, gl_texmgr.h, glquake.h, image.h, input.h, keys.h, mathlib.h,
menu.h, modelgen.h, net.h, net_dgrm.h, net_loop.h, net_sdlnet.h, net_udp.h,
net_wins.h, platform.h, pr_comp.h, progdefs.h, progs.h, protocol.h, quakedef.h,
render.h, resource.h, sbar.h, screen.h, server.h, sound.h, spritegn.h, sys.h,
vid.h, view.h, wad.h, world.h, zone.h: added include guards to the headers.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@84 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-21 00:01:08 +00:00
|
|
|
|
|
|
|
#endif /* _GL_TEXMAN_H */
|
|
|
|
|