r_image.h

Go to the documentation of this file.
00001 
00006 /*
00007 All original material Copyright (C) 2002-2010 UFO: Alien Invasion.
00008 
00009 This program is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2
00012 of the License, or (at your option) any later version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017 
00018 See the GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 
00024 */
00025 
00026 #ifndef R_IMAGE_H
00027 #define R_IMAGE_H
00028 
00029 #include "r_material.h"
00030 /*
00031 skins will be outline flood filled and mip mapped
00032 pics and sprites with alpha will be outline flood filled
00033 pic won't be mip mapped
00034 
00035 model skin
00036 sprite frame
00037 wall texture
00038 pic
00039 */
00040 
00041 typedef enum {
00042     it_chars,
00043     it_effect,
00044     it_static,
00045     it_pic,
00046     it_wrappic,
00047     it_skin,
00048     it_normalmap,
00049     it_glowmap,
00050     it_specularmap,
00051     it_roughnessmap,
00052 
00054     it_world,
00055     it_lightmap,
00056     it_deluxemap,
00057     it_material
00058 } imagetype_t;
00059 
00060 typedef struct image_s {
00061     char name[MAX_QPATH];               
00062     imagetype_t type;
00063     int width, height;                  
00064     int upload_width, upload_height;    
00065     unsigned int texnum;                
00066     qboolean has_alpha;
00067     material_t material;
00068     struct image_s *normalmap;          
00069     struct image_s *glowmap;            
00070     struct image_s *specularmap;        
00071     struct image_s *roughnessmap;       
00072     struct image_s *hashNext;           
00073     struct image_s *hashPrev;           
00074 } image_t;
00075 
00076 #define MAX_GL_TEXTURES     1024
00077 #define MAX_GL_LIGHTMAPS    256
00078 #define MAX_GL_DELUXEMAPS   256
00079 #define MAX_GL_FRAMEBUFFERS 256
00080 
00081 #define TEXNUM_LIGHTMAPS    MAX_GL_TEXTURES
00082 #define TEXNUM_DELUXEMAPS   (TEXNUM_LIGHTMAPS + MAX_GL_LIGHTMAPS)
00083 #define TEXNUM_FRAMEBUFFER_TEXTURES (TEXNUM_DELUXEMAPS + MAX_GL_DELUXEMAPS)
00084 
00085 extern image_t r_images[MAX_GL_TEXTURES];
00086 extern int r_numImages;
00087 
00088 void R_UploadTexture(unsigned *data, int width, int height, image_t* image);
00089 void R_SoftenTexture(byte *in, int width, int height, int bpp);
00090 void R_GetScaledTextureSize(int width, int height, int *scaledWidth, int *scaledHeight);
00091 void R_ScaleTexture(unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight);
00092 
00093 void R_ImageList_f(void);
00094 void R_InitImages(void);
00095 void R_ShutdownImages(void);
00096 void R_FreeWorldImages(void);
00097 void R_ImageClearMaterials(void);
00098 void R_UploadAlpha(const image_t *image, const byte *alphaData);
00099 void R_FilterTexture(byte *in, int width, int height, imagetype_t type, int bpp);
00100 void R_TextureMode(const char *string);
00101 void R_TextureAlphaMode(const char *string);
00102 void R_TextureSolidMode(const char *string);
00103 
00104 void R_FreeImage(image_t *image);
00105 
00106 image_t *R_LoadImageData(const char *name, byte * pic, int width, int height, imagetype_t type);
00107 image_t *R_GetImage(const char *name);
00108 image_t *R_FindImage(const char *pname, imagetype_t type);
00109 
00110 qboolean R_ImageExists(const char *pname);
00111 
00112 #define MAX_ENVMAPTEXTURES 2
00113 extern image_t *r_envmaptextures[MAX_ENVMAPTEXTURES];
00114 
00115 #define NUM_FLARETEXTURES 10
00116 extern image_t *r_flaretextures[NUM_FLARETEXTURES];
00117 
00118 extern image_t *shadow; 
00119 extern image_t *r_noTexture;
00120 extern image_t *r_warpTexture;
00121 
00122 #endif

Generated by  doxygen 1.6.2