r_image.h File Reference

#include "r_material.h"
Include dependency graph for r_image.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  image_s

Defines

#define MAX_GL_TEXTURES   1024
#define MAX_GL_LIGHTMAPS   256
#define MAX_GL_DELUXEMAPS   256
#define MAX_GL_FRAMEBUFFERS   256
#define TEXNUM_LIGHTMAPS   MAX_GL_TEXTURES
#define TEXNUM_DELUXEMAPS   (TEXNUM_LIGHTMAPS + MAX_GL_LIGHTMAPS)
#define TEXNUM_FRAMEBUFFER_TEXTURES   (TEXNUM_DELUXEMAPS + MAX_GL_DELUXEMAPS)
#define MAX_ENVMAPTEXTURES   2
#define NUM_FLARETEXTURES   10

Typedefs

typedef struct image_s image_t

Enumerations

enum  imagetype_t {
  it_chars, it_effect, it_static, it_pic,
  it_wrappic, it_skin, it_normalmap, it_glowmap,
  it_specularmap, it_roughnessmap, it_world, it_lightmap,
  it_deluxemap, it_material
}

Functions

void R_UploadTexture (unsigned *data, int width, int height, image_t *image)
 Uploads the opengl texture to the server.
void R_SoftenTexture (byte *in, int width, int height, int bpp)
 Applies blurring to a texture.
void R_GetScaledTextureSize (int width, int height, int *scaledWidth, int *scaledHeight)
 Calculates the texture size that should be used to upload the texture data.
void R_ScaleTexture (unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight)
void R_ImageList_f (void)
 Shows all loaded images.
void R_InitImages (void)
void R_ShutdownImages (void)
void R_FreeWorldImages (void)
 Any image that is a mesh or world texture will be removed here.
void R_ImageClearMaterials (void)
 Free previously loaded materials and their stages.
void R_UploadAlpha (const image_t *image, const byte *alphaData)
void R_FilterTexture (byte *in, int width, int height, imagetype_t type, int bpp)
 Applies brightness and contrast to the specified image while optionally computing the image's average color. Also handles image inversion and monochrome. This is all munged into one function to reduce loops on level load.
void R_TextureMode (const char *string)
void R_TextureAlphaMode (const char *string)
void R_TextureSolidMode (const char *string)
void R_FreeImage (image_t *image)
 Free the image and its normalmap (if there is one).
image_tR_LoadImageData (const char *name, byte *pic, int width, int height, imagetype_t type)
 Creates a new image from RGBA data. Stores it in the gltextures array and also uploads it.
image_tR_GetImage (const char *name)
image_tR_FindImage (const char *pname, imagetype_t type)
 Finds or loads the given image.
qboolean R_ImageExists (const char *pname)

Variables

image_t r_images [MAX_GL_TEXTURES]
int r_numImages
image_tr_envmaptextures [MAX_ENVMAPTEXTURES]
image_tr_flaretextures [NUM_FLARETEXTURES]
image_tshadow
image_tr_noTexture
image_tr_warpTexture

Detailed Description

Definition in file r_image.h.


Define Documentation

#define MAX_ENVMAPTEXTURES   2

Definition at line 112 of file r_image.h.

Referenced by R_InitImages(), and R_ParseStage().

#define MAX_GL_DELUXEMAPS   256

Definition at line 78 of file r_image.h.

Referenced by R_UploadLightmapBlock().

#define MAX_GL_FRAMEBUFFERS   256

Definition at line 79 of file r_image.h.

#define MAX_GL_LIGHTMAPS   256

Definition at line 77 of file r_image.h.

Referenced by R_UploadLightmapBlock().

#define MAX_GL_TEXTURES   1024

Definition at line 76 of file r_image.h.

Referenced by R_ImageList_f(), and R_LoadImageData().

#define NUM_FLARETEXTURES   10

Definition at line 115 of file r_image.h.

Referenced by R_InitImages(), and R_ParseStage().

#define TEXNUM_DELUXEMAPS   (TEXNUM_LIGHTMAPS + MAX_GL_LIGHTMAPS)

Definition at line 82 of file r_image.h.

Referenced by R_BeginBuildingLightmaps().

#define TEXNUM_FRAMEBUFFER_TEXTURES   (TEXNUM_DELUXEMAPS + MAX_GL_DELUXEMAPS)

Definition at line 83 of file r_image.h.

Referenced by R_FreeFBOTexture(), and R_GetFreeFBOTexture().

#define TEXNUM_LIGHTMAPS   MAX_GL_TEXTURES

Definition at line 81 of file r_image.h.

Referenced by R_BeginBuildingLightmaps().


Typedef Documentation

typedef struct image_s image_t

Enumeration Type Documentation

Enumerator:
it_chars 
it_effect 
it_static 
it_pic 
it_wrappic 
it_skin 
it_normalmap 
it_glowmap 
it_specularmap 
it_roughnessmap 
it_world 

the following are freed with every mapchange

it_lightmap 
it_deluxemap 
it_material 

Definition at line 41 of file r_image.h.


Function Documentation

void R_FilterTexture ( byte in,
int  width,
int  height,
imagetype_t  type,
int  bpp 
)

Applies brightness and contrast to the specified image while optionally computing the image's average color. Also handles image inversion and monochrome. This is all munged into one function to reduce loops on level load.

Definition at line 208 of file r_image.c.

References byte, DotProduct, it_lightmap, luminosity, r_brightness, r_contrast, r_modulate, r_saturation, scale, cvar_s::value, VectorCopy, VectorMix(), VectorScale, and VectorSet.

Referenced by R_BuildLightmap(), and R_UploadTexture().

image_t* R_FindImage ( const char *  pname,
imagetype_t  type 
)

Finds or loads the given image.

See also:
R_RegisterImage
Parameters:
[in] pname Image name Path relative to the game dir (e.g. textures/tex_common/nodraw)
[in] type The type of the image. This has influence on image filters and texture parameters when uploading the image data
Note:
the image name has to be at least 5 chars long
See also:
R_LoadTGA
R_LoadJPG
R_LoadPNG

Definition at line 555 of file r_image.c.

References Com_Error(), Com_Printf(), Com_StripExtension(), ERR_FATAL, image_s::glowmap, Img_LoadImage(), it_glowmap, it_normalmap, it_roughnessmap, it_specularmap, it_world, MAX_QPATH, image_s::name, image_s::normalmap, R_FindImage(), R_GetImage(), R_LoadImageData(), r_noTexture, image_s::roughnessmap, image_s::specularmap, image_s::type, and va().

Referenced by CL_AddActor(), Con_DrawConsole(), HUD_UpdateCursor(), MAP_DrawMapOneInstallation(), MAP_InitStartup(), R_AliasModelGetSkin(), R_Draw3DGlobe(), R_DrawFlatGeoscape(), R_DrawInitLocal(), R_FindImage(), R_InitImages(), R_LoadAnimImages(), R_LoadMaterials(), R_ModLoadTexinfo(), R_ParseStage(), R_RegisterImage(), R_UploadData(), SCR_DrawCursor(), SCR_DrawPrecacheScreen(), SCR_SetLoadingBackground(), SCR_TouchPics(), SEQ_Render2D(), UI_InitRadar(), and UI_LoadImage().

void R_FreeImage ( image_t image  ) 

Free the image and its normalmap (if there is one).

Parameters:
image The image that should be freed

Definition at line 624 of file r_image.c.

References image_s::glowmap, image_s::normalmap, R_DeleteImage(), image_s::roughnessmap, image_s::specularmap, and image_s::texnum.

Referenced by R_Draw3DGlobe(), and R_FreeWorldImages().

void R_FreeWorldImages ( void   ) 

Any image that is a mesh or world texture will be removed here.

See also:
R_ShutdownImages

Definition at line 646 of file r_image.c.

References i, it_world, R_CheckError, R_FreeImage(), r_numImages, and image_s::type.

Referenced by R_ModBeginLoading().

image_t* R_GetImage ( const char *  name  ) 
void R_GetScaledTextureSize ( int  width,
int  height,
int *  scaledWidth,
int *  scaledHeight 
)

Calculates the texture size that should be used to upload the texture data.

Parameters:
[in] width The width of the source texture data
[in] height The heigt of the source texture data
[out] scaledWidth The resulting width - can be the same as the given width
[out] scaledHeight The resulting height - can be the same as the given height

Definition at line 279 of file r_image.c.

References MAX_TEXTURE_SIZE, rconfig_t::maxTextureSize, and r_config.

Referenced by R_UploadData(), and R_UploadTexture().

void R_ImageClearMaterials ( void   ) 
qboolean R_ImageExists ( const char *  pname  ) 

Definition at line 608 of file r_image.c.

References FS_CheckFile(), i, Img_GetImageTypes(), qfalse, and qtrue.

Referenced by R_InitExtensions().

void R_ImageList_f ( void   ) 
void R_InitImages ( void   ) 
image_t* R_LoadImageData ( const char *  name,
byte pic,
int  width,
int  height,
imagetype_t  type 
)

Creates a new image from RGBA data. Stores it in the gltextures array and also uploads it.

Note:
This is also used as an entry point for the generated r_noTexture
Parameters:
[in] name The name of the newly created image
[in] pic The RGBA data of the image
[in] width The width of the image (power of two, please)
[in] height The height of the image (power of two, please)
[in] type The image type
See also:
imagetype_t

Definition at line 486 of file r_image.c.

References Com_Error(), Com_HashKey(), Com_Printf(), ERR_DROP, image_s::has_alpha, hash(), image_s::hashNext, image_s::hashPrev, image_s::height, i, len, MAX_GL_TEXTURES, MAX_IMAGEHASH, Mem_PoolAlloc, image_s::name, Q_strncpyz(), qfalse, R_BindTexture, R_GetImage(), r_numImages, R_UploadTexture(), image_s::texnum, image_s::type, and image_s::width.

Referenced by CP_InitOverlay(), R_FindImage(), and R_InitMiscTexture().

void R_ScaleTexture ( unsigned *  in,
int  inwidth,
int  inheight,
unsigned *  out,
int  outwidth,
int  outheight 
)

Definition at line 161 of file r_image.c.

References byte, i, int(), and MAX_TEXTURE_SIZE.

Referenced by R_UploadData(), and R_UploadTexture().

void R_ShutdownImages ( void   ) 
See also:
R_FreeWorldImages

Definition at line 692 of file r_image.c.

References i, R_CheckError, R_DeleteImage(), r_numImages, and image_s::texnum.

Referenced by R_Shutdown().

void R_SoftenTexture ( byte in,
int  width,
int  height,
int  bpp 
)

Applies blurring to a texture.

See also:
R_BuildLightMap

Definition at line 391 of file r_image.c.

References byte, Com_Error(), dest, ERR_FATAL, i, Mem_Free, Mem_PoolAllocExt, qfalse, and vid_imagePool.

Referenced by CP_UploadRadarCoverage(), and R_BuildLightmap().

void R_TextureAlphaMode ( const char *  string  ) 
void R_TextureMode ( const char *  string  ) 
void R_TextureSolidMode ( const char *  string  ) 
void R_UploadAlpha ( const image_t image,
const byte alphaData 
)
void R_UploadTexture ( unsigned *  data,
int  width,
int  height,
image_t image 
)

Variable Documentation

image_t* r_envmaptextures[MAX_ENVMAPTEXTURES]

Definition at line 37 of file r_image.c.

Referenced by R_DrawMeshModelShell(), and R_ParseStage().

image_t* r_flaretextures[NUM_FLARETEXTURES]

Definition at line 40 of file r_image.c.

Referenced by R_DrawFlareSurfaces(), and R_ParseStage().

image_t r_images[MAX_GL_TEXTURES]

Definition at line 47 of file r_main.c.

Referenced by R_EnableWarp(), and R_InitMiscTexture().

draw this when actor is alive

Definition at line 34 of file r_draw.c.

Referenced by R_DrawEntityEffects().


Generated by  doxygen 1.6.2