| 1 |
|
| 2 |
#ifndef R_TEXTURES_H |
| 3 |
#define R_TEXTURES_H |
| 4 |
|
| 5 |
|
| 6 |
#define TEXF_ALPHA 0x00000001 |
| 7 |
|
| 8 |
#define TEXF_MIPMAP 0x00000002 |
| 9 |
|
| 10 |
#define TEXF_RGBMULTIPLYBYALPHA 0x00000004 |
| 11 |
|
| 12 |
#define TEXF_CLAMP 0x00000020 |
| 13 |
|
| 14 |
#define TEXF_FORCENEAREST 0x00000040 |
| 15 |
|
| 16 |
#define TEXF_FORCELINEAR 0x00000080 |
| 17 |
|
| 18 |
#define TEXF_PICMIP 0x00000100 |
| 19 |
|
| 20 |
#define TEXF_COMPRESS 0x00000200 |
| 21 |
|
| 22 |
#define TEXF_PERSISTENT 0x00000400 |
| 23 |
|
| 24 |
#define TEXF_COMPARE 0x00000800 |
| 25 |
|
| 26 |
#define TEXF_LOWPRECISION 0x00001000 |
| 27 |
|
| 28 |
#define TEXF_ALLOWUPDATES 0x00002000 |
| 29 |
|
| 30 |
#define TEXF_ISWORLD 0x00004000 |
| 31 |
|
| 32 |
#define TEXF_ISSPRITE 0x00008000 |
| 33 |
|
| 34 |
#define TEXF_RENDERTARGET 0x0010000 |
| 35 |
|
| 36 |
#define TEXF_IMPORTANTBITS (TEXF_ALPHA | TEXF_MIPMAP | TEXF_RGBMULTIPLYBYALPHA | TEXF_CLAMP | TEXF_FORCENEAREST | TEXF_FORCELINEAR | TEXF_PICMIP | TEXF_COMPARE | TEXF_LOWPRECISION | TEXF_RENDERTARGET) |
| 37 |
|
| 38 |
#define TEXF_FORCE_RELOAD 0x80000000 |
| 39 |
|
| 40 |
typedef enum textype_e |
| 41 |
{ |
| 42 |
|
| 43 |
TEXTYPE_UNUSED, |
| 44 |
|
| 45 |
|
| 46 |
TEXTYPE_PALETTE, |
| 47 |
|
| 48 |
TEXTYPE_RGBA, |
| 49 |
|
| 50 |
TEXTYPE_BGRA, |
| 51 |
|
| 52 |
TEXTYPE_ALPHA, |
| 53 |
|
| 54 |
TEXTYPE_DXT1, |
| 55 |
|
| 56 |
TEXTYPE_DXT1A, |
| 57 |
|
| 58 |
TEXTYPE_DXT3, |
| 59 |
|
| 60 |
TEXTYPE_DXT5, |
| 61 |
|
| 62 |
|
| 63 |
TEXTYPE_ETC1, |
| 64 |
|
| 65 |
|
| 66 |
TEXTYPE_SRGB_PALETTE, |
| 67 |
|
| 68 |
TEXTYPE_SRGB_RGBA, |
| 69 |
|
| 70 |
TEXTYPE_SRGB_BGRA, |
| 71 |
|
| 72 |
TEXTYPE_SRGB_DXT1, |
| 73 |
|
| 74 |
TEXTYPE_SRGB_DXT1A, |
| 75 |
|
| 76 |
TEXTYPE_SRGB_DXT3, |
| 77 |
|
| 78 |
TEXTYPE_SRGB_DXT5, |
| 79 |
|
| 80 |
|
| 81 |
TEXTYPE_COLORBUFFER, |
| 82 |
|
| 83 |
TEXTYPE_COLORBUFFER16F, |
| 84 |
|
| 85 |
TEXTYPE_COLORBUFFER32F, |
| 86 |
|
| 87 |
TEXTYPE_DEPTHBUFFER16, |
| 88 |
|
| 89 |
TEXTYPE_DEPTHBUFFER24, |
| 90 |
|
| 91 |
TEXTYPE_DEPTHBUFFER24STENCIL8, |
| 92 |
|
| 93 |
TEXTYPE_SHADOWMAP16_COMP, |
| 94 |
|
| 95 |
TEXTYPE_SHADOWMAP16_RAW, |
| 96 |
|
| 97 |
TEXTYPE_SHADOWMAP24_COMP, |
| 98 |
|
| 99 |
TEXTYPE_SHADOWMAP24_RAW, |
| 100 |
} |
| 101 |
textype_t; |
| 102 |
|
| 103 |
|
| 104 |
typedef struct rtexture_s |
| 105 |
{ |
| 106 |
|
| 107 |
int texnum; |
| 108 |
int renderbuffernum; |
| 109 |
qboolean dirty; |
| 110 |
qboolean glisdepthstencil; |
| 111 |
int gltexturetypeenum; |
| 112 |
} |
| 113 |
rtexture_t; |
| 114 |
|
| 115 |
|
| 116 |
typedef struct rtexturepool_s |
| 117 |
{ |
| 118 |
int useless; |
| 119 |
} |
| 120 |
rtexturepool_t; |
| 121 |
|
| 122 |
typedef void (*updatecallback_t)(rtexture_t *rt, void *data); |
| 123 |
|
| 124 |
|
| 125 |
rtexturepool_t *R_AllocTexturePool(void); |
| 126 |
|
| 127 |
void R_FreeTexturePool(rtexturepool_t **rtexturepool); |
| 128 |
|
| 129 |
|
| 130 |
extern cvar_t gl_texturecompression; |
| 131 |
extern cvar_t gl_texturecompression_color; |
| 132 |
extern cvar_t gl_texturecompression_normal; |
| 133 |
extern cvar_t gl_texturecompression_gloss; |
| 134 |
extern cvar_t gl_texturecompression_glow; |
| 135 |
extern cvar_t gl_texturecompression_2d; |
| 136 |
extern cvar_t gl_texturecompression_q3bsplightmaps; |
| 137 |
extern cvar_t gl_texturecompression_q3bspdeluxemaps; |
| 138 |
extern cvar_t gl_texturecompression_sky; |
| 139 |
extern cvar_t gl_texturecompression_lightcubemaps; |
| 140 |
extern cvar_t gl_texturecompression_reflectmask; |
| 141 |
extern cvar_t r_texture_dds_load; |
| 142 |
extern cvar_t r_texture_dds_save; |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
rtexture_t *R_LoadTexture2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, const unsigned char *data, textype_t textype, int flags, int miplevel, const unsigned int *palette); |
| 148 |
rtexture_t *R_LoadTexture3D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, int depth, const unsigned char *data, textype_t textype, int flags, int miplevel, const unsigned int *palette); |
| 149 |
rtexture_t *R_LoadTextureCubeMap(rtexturepool_t *rtexturepool, const char *identifier, int width, const unsigned char *data, textype_t textype, int flags, int miplevel, const unsigned int *palette); |
| 150 |
rtexture_t *R_LoadTextureShadowMap2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, textype_t textype, qboolean filter); |
| 151 |
rtexture_t *R_LoadTextureRenderBuffer(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, textype_t textype); |
| 152 |
rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filename, qboolean srgb, int flags, qboolean *hasalphaflag, float *avgcolor, int miplevel, qboolean optionaltexture); |
| 153 |
|
| 154 |
|
| 155 |
int R_SaveTextureDDSFile(rtexture_t *rt, const char *filename, qboolean skipuncompressed, qboolean hasalpha); |
| 156 |
|
| 157 |
|
| 158 |
void R_FreeTexture(rtexture_t *rt); |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int z, int width, int height, int depth); |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
#define R_GetTexture(rt) ((rt) ? ((rt)->dirty ? R_RealGetTexture(rt) : (rt)->texnum) : r_texture_white->texnum) |
| 168 |
int R_RealGetTexture (rtexture_t *rt); |
| 169 |
|
| 170 |
|
| 171 |
int R_TextureWidth(rtexture_t *rt); |
| 172 |
|
| 173 |
|
| 174 |
int R_TextureHeight(rtexture_t *rt); |
| 175 |
|
| 176 |
|
| 177 |
int R_TextureFlags(rtexture_t *rt); |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
void R_PurgeTexture(rtexture_t *prt); |
| 182 |
|
| 183 |
|
| 184 |
void R_Textures_Frame(void); |
| 185 |
|
| 186 |
|
| 187 |
void R_MarkDirtyTexture(rtexture_t *rt); |
| 188 |
void R_MakeTextureDynamic(rtexture_t *rt, updatecallback_t updatecallback, void *data); |
| 189 |
|
| 190 |
|
| 191 |
void R_ClearTexture (rtexture_t *rt); |
| 192 |
|
| 193 |
|
| 194 |
int R_PicmipForFlags(int flags); |
| 195 |
|
| 196 |
void R_TextureStats_Print(qboolean printeach, qboolean printpool, qboolean printtotal); |
| 197 |
|
| 198 |
#endif |
| 199 |
|