UFO: Alien Invasion
|
#include "r_local.h"
#include "r_error.h"
#include "r_geoscape.h"
#include "../../shared/images.h"
#include "../cl_screen.h"
Go to the source code of this file.
Data Structures | |
struct | imageArray_s |
struct | glTextureMode_t |
struct | gltmode_t |
Macros | |
#define | MAX_IMAGEHASH 256 |
#define | IMAGE_ARRAY_SIZE 128 |
#define | FOR_EACH_IMAGE(i, image, imageArray) |
#define | MAX_TEXTURE_SIZE 8192 |
Typedefs | |
typedef struct imageArray_s | imageArray_t |
Functions | |
void | R_ImageClearMaterials (void) |
Free previously loaded materials and their stages. More... | |
void | R_ImageList_f (void) |
Shows all loaded images. More... | |
void | R_LoadImage (const char *name, byte **pic, int *width, int *height) |
Generic image-data loading fucntion. More... | |
void | R_ScaleTexture (const unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight) |
void | R_GetScaledTextureSize (int width, int height, int *scaledWidth, int *scaledHeight) |
Calculates the texture size that should be used to upload the texture data. More... | |
static bool | R_IsClampedImageType (imagetype_t type) |
void | R_UploadTexture (const unsigned *data, int width, int height, image_t *image) |
Uploads the opengl texture to the server. More... | |
void | R_SoftenTexture (byte *in, int width, int height, int bpp) |
Applies blurring to a texture. More... | |
void | R_UploadAlpha (const image_t *image, const byte *alphaData) |
static void | R_DeleteImage (image_t *image) |
image_t * | R_GetImage (const char *name) |
image_t * | R_LoadImageData (const char *name, const 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. More... | |
image_t * | R_RenderToTexture (const char *name, int x, int y, int w, int h) |
static void | R_ChangeImageType (image_t *img, imagetype_t type) |
Set up new image type and change texturemapping paramenters accordingly. More... | |
image_t * | R_FindImage (const char *pname, imagetype_t type) |
Finds or loads the given image. More... | |
const image_t * | R_FindPics (const char *name) |
Searches for an image in the image array. More... | |
bool | R_ImageExists (const char *pname,...) |
int | R_GetImageIndex (image_t *imagePtr) |
Returns an index of the image pointer in the r_images linked list, as if r_images would be a plain contiguous array. More... | |
image_t * | R_GetImageAtIndex (int i) |
Returns an image pointer from the r_images linked list, as if r_images would be a plain contiguous array. More... | |
void | R_FreeImage (image_t *image) |
Free the image and its assigned maps (roughness, normal, specular, glow - if there are any) More... | |
void | R_FreeWorldImages (void) |
Any image that is a mesh or world texture will be removed here. More... | |
void | R_InitImages (void) |
void | R_ShutdownImages (void) |
static void | R_ReloadImageData (image_t *image) |
void | R_ReloadImages (void) |
void | R_TextureMode (const char *string) |
void | R_TextureAlphaMode (const char *string) |
void | R_TextureSolidMode (const char *string) |
Variables | |
static image_t * | imageHash [MAX_IMAGEHASH] |
imageArray_t | r_images |
int | r_numImages |
image_t * | r_envmaptextures [MAX_ENVMAPTEXTURES] |
image_t * | r_flaretextures [NUM_FLARETEXTURES] |
static const glTextureMode_t | gl_texture_modes [] |
static const gltmode_t | gl_alpha_modes [] |
static const gltmode_t | gl_solid_modes [] |
#define FOR_EACH_IMAGE | ( | i, | |
image, | |||
imageArray | |||
) |
Definition at line 44 of file r_image.cpp.
Referenced by R_FreeWorldImages(), R_ImageClearMaterials(), R_ImageList_f(), R_LoadImageData(), R_ReloadImages(), R_ShutdownImages(), and R_TextureMode().
#define IMAGE_ARRAY_SIZE 128 |
Definition at line 34 of file r_image.cpp.
Referenced by R_GetImageAtIndex(), R_GetImageIndex(), and R_LoadImageData().
#define MAX_IMAGEHASH 256 |
Definition at line 31 of file r_image.cpp.
Referenced by R_DeleteImage(), R_GetImage(), and R_LoadImageData().
#define MAX_TEXTURE_SIZE 8192 |
Definition at line 55 of file r_image.cpp.
Referenced by R_GetScaledTextureSize(), and R_ScaleTexture().
typedef struct imageArray_s imageArray_t |
|
static |
Set up new image type and change texturemapping paramenters accordingly.
Definition at line 575 of file r_image.cpp.
References glTexParameterf(), R_BindTexture, R_IsClampedImageType(), image_s::texnum, image_s::type, and type.
Referenced by R_FindImage().
Definition at line 435 of file r_image.cpp.
References Com_HashKey(), hash, HASH_Delete, image_s::hash_next, MAX_IMAGEHASH, image_s::name, OBJZERO, Q_streq, R_CheckError, and image_s::texnum.
Referenced by R_FreeImage(), R_RenderToTexture(), and R_ShutdownImages().
image_t* R_FindImage | ( | const char * | pname, |
imagetype_t | type | ||
) |
Finds or loads the given image.
[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 |
Definition at line 603 of file r_image.cpp.
Referenced by CL_AddActor(), Con_DrawConsole(), HUD_UpdateCursor(), R_AliasModelGetSkin(), R_Draw3DGlobe(), R_DrawEntityEffects(), R_DrawFlatGeoscape(), R_DrawFloor(), R_DrawGrass(), R_DrawImageCentered(), R_DrawInitLocal(), R_FindImage(), R_FindPics(), R_InitImages(), R_LoadAnimImages(), R_LoadMaterials(), R_ModLoadTexinfo(), R_ParseStage(), R_UploadData(), SCR_DrawCursor(), SCR_DrawLoadingScreen(), SCR_TouchPics(), SEQ_Render2D(), UI_InitRadar(), UI_LoadImage(), and UI_LoadWrappedImage().
const image_t* R_FindPics | ( | const char * | name | ) |
Searches for an image in the image array.
[in] | name | The name of the image relative to pics/ |
Definition at line 673 of file r_image.cpp.
References it_pic, R_FindImage(), r_noTexture, and va().
Referenced by CL_ParticleLoadArt(), LE_BrushModelAction(), and SEQ_ExecutePrecache().
Free the image and its assigned maps (roughness, normal, specular, glow - if there are any)
image | The image that should be freed |
Definition at line 735 of file r_image.cpp.
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().
Any image that is a mesh or world texture will be removed here.
Definition at line 757 of file r_image.cpp.
References FOR_EACH_IMAGE, i, imageArray_s::images, it_world, R_CheckError, R_FreeImage(), and image_s::type.
Referenced by CL_Disconnect().
image_t* R_GetImage | ( | const char * | name | ) |
Definition at line 452 of file r_image.cpp.
References Com_HashKey(), hash, image_s::hash_next, MAX_IMAGEHASH, image_s::name, and Q_streq.
Referenced by R_FindImage(), R_LoadImageData(), R_LoadMaterials(), R_RenderToTexture(), and R_UploadAlpha_().
Returns an image pointer from the r_images linked list, as if r_images would be a plain contiguous array.
i | The image index inside r_images |
Definition at line 718 of file r_image.cpp.
References IMAGE_ARRAY_SIZE, imageArray_s::images, imageArray_s::next, and r_numImages.
Referenced by uiMaterialEditorNode::draw(), uiMaterialEditorNode::onMouseDown(), UI_MaterialEditorChangeValue_f(), UI_MaterialEditorNewStage_f(), UI_MaterialEditorNodeGetImageAtPosition(), UI_MaterialEditorNodeGetImageCount(), UI_MaterialEditorRemoveStage_f(), and UI_MaterialEditorSelectStage_f().
Returns an index of the image pointer in the r_images linked list, as if r_images would be a plain contiguous array.
imagePtr | The image pointer |
Definition at line 702 of file r_image.cpp.
References IMAGE_ARRAY_SIZE, imageArray_s::images, and imageArray_s::next.
Referenced by R_SortSurfacesArrays(), and R_SortSurfacesArrays_().
Calculates the texture size that should be used to upload the texture data.
[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 220 of file r_image.cpp.
References MAX_TEXTURE_SIZE, rconfig_t::maxTextureSize, and r_config.
Referenced by R_UploadData(), and R_UploadTexture().
Free previously loaded materials and their stages.
Definition at line 61 of file r_image.cpp.
References defaultMaterial, FOR_EACH_IMAGE, i, imageArray_s::images, m, image_s::material, Mem_Free, materialStage_s::next, and material_s::stages.
Referenced by R_LoadMaterials().
bool R_ImageExists | ( | const char * | pname, |
... | |||
) |
Definition at line 681 of file r_image.cpp.
References FS_CheckFile(), i, Img_GetImageTypes(), MAX_QPATH, and Q_vsnprintf().
Referenced by GAME_GetImportData(), R_InitExtensions(), UI_MapInfo(), and UI_RequestMapList_f().
Shows all loaded images.
Definition at line 85 of file r_image.cpp.
References Com_Printf(), FOR_EACH_IMAGE, i, imageArray_s::images, it_chars, it_effect, it_lightmap, it_material, it_normalmap, it_pic, it_skin, it_static, it_world, it_wrappic, MAX_GL_TEXTURES, image_s::name, r_numImages, image_s::texnum, image_s::type, type, image_s::upload_height, and image_s::upload_width.
Definition at line 774 of file r_image.cpp.
References Com_Error(), ERR_FATAL, i, it_effect, MAX_ENVMAPTEXTURES, NUM_FLARETEXTURES, R_FindImage(), r_noTexture, r_numImages, and va().
Referenced by R_Init().
|
inlinestatic |
Definition at line 241 of file r_image.cpp.
References it_pic, and it_worldrelated.
Referenced by R_ChangeImageType(), R_FindImage(), and R_UploadTexture().
Generic image-data loading fucntion.
[in] | name | (Full) pathname to the image to load. Extension (if given) will be ignored. |
[out] | pic | Image data. |
[out] | width | Width of the loaded image. |
[out] | height | Height of the loaded image. |
Definition at line 152 of file r_image.cpp.
References Com_Error(), Com_StripExtension(), ERR_FATAL, Img_LoadImage(), MAX_QPATH, Mem_PoolAllocTypeN, Q_strnull(), and vid_imagePool.
Referenced by GAME_GetImportData().
image_t* R_LoadImageData | ( | const char * | name, |
const 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.
[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 |
Definition at line 475 of file r_image.cpp.
Referenced by uiGeoscapeNode::onLoading(), R_FindImage(), R_InitMiscTexture(), and R_RenderToTexture().
Definition at line 814 of file r_image.cpp.
References Com_Printf(), glGenTextures(), image_s::height, Img_LoadImage(), image_s::name, R_BindTexture, r_noTexture, R_UploadTexture(), image_s::texnum, and image_s::width.
Referenced by R_ReloadImages().
Definition at line 835 of file r_image.cpp.
References FOR_EACH_IMAGE, image_s::glowmap, i, imageArray_s::images, image_s::normalmap, R_CheckError, r_numImages, R_ReloadImageData(), image_s::roughnessmap, SCR_DrawLoadingScreen(), and image_s::specularmap.
Referenced by R_ReinitOpenglContext().
Definition at line 547 of file r_image.cpp.
References image_s::height, it_effect, Mem_Free, Mem_PoolAllocTypeN, R_BindTexture, R_DeleteImage(), R_GetImage(), R_LoadImageData(), R_SelectTexture(), image_s::texnum, texunit_diffuse, vid_imagePool, and image_s::width.
void R_ScaleTexture | ( | const unsigned * | in, |
int | inwidth, | ||
int | inheight, | ||
unsigned * | out, | ||
int | outwidth, | ||
int | outheight | ||
) |
Definition at line 172 of file r_image.cpp.
References i, index, int(), and MAX_TEXTURE_SIZE.
Referenced by R_UploadData(), and R_UploadTexture().
Definition at line 796 of file r_image.cpp.
References FOR_EACH_IMAGE, i, imageArray_s::images, OBJZERO, R_CheckError, R_DeleteImage(), r_numImages, and image_s::texnum.
Referenced by R_Shutdown(), and TEST_Shutdown().
Applies blurring to a texture.
Definition at line 391 of file r_image.cpp.
References Com_Error(), dest, ERR_FATAL, i, Mem_Free, Mem_PoolAllocTypeN, and vid_imagePool.
Referenced by GAME_GetImportData().
void R_TextureAlphaMode | ( | const char * | string | ) |
Definition at line 931 of file r_image.cpp.
References Com_Printf(), rconfig_t::gl_alpha_format, i, lengthof, gltmode_t::mode, gltmode_t::name, Q_strcasecmp, and r_config.
Referenced by R_BeginFrame().
void R_TextureMode | ( | const char * | string | ) |
Definition at line 869 of file r_image.cpp.
References Com_Printf(), FOR_EACH_IMAGE, rconfig_t::gl_filter_max, rconfig_t::gl_filter_min, glTexParameterf(), i, it_chars, it_pic, it_worldrelated, lengthof, rconfig_t::maxAnisotropic, glTextureMode_t::maximize, glTextureMode_t::minimize, glTextureMode_t::name, Q_strcasecmp, R_BindTexture, R_CheckError, r_config, image_s::texnum, and image_s::type.
Referenced by R_BeginFrame().
void R_TextureSolidMode | ( | const char * | string | ) |
Definition at line 966 of file r_image.cpp.
References Com_Printf(), rconfig_t::gl_solid_format, i, lengthof, gltmode_t::mode, gltmode_t::name, Q_strcasecmp, and r_config.
Referenced by R_BeginFrame().
Definition at line 423 of file r_image.cpp.
References rconfig_t::gl_filter_max, glTexImage2D(), glTexParameterf(), image_s::height, it_wrappic, R_BindTexture, r_config, image_s::texnum, image_s::type, and image_s::width.
Referenced by uiGeoscapeNode::calcAndUploadDayAndNightTexture(), and R_UploadAlpha_().
Uploads the opengl texture to the server.
[in] | data | Must be in RGBA format |
width | Width of the image | |
height | Height of the image | |
[in,out] | image | Pointer to the image structure to initialize |
Definition at line 262 of file r_image.cpp.
References rconfig_t::anisotropic, rconfig_t::gl_alpha_format, rconfig_t::gl_compressed_alpha_format, rconfig_t::gl_compressed_solid_format, rconfig_t::gl_filter_max, rconfig_t::gl_filter_min, rconfig_t::gl_solid_format, glTexImage2D(), glTexParameterf(), image_s::has_alpha, i, cvar_s::integer, it_chars, it_pic, it_worldrelated, rconfig_t::lod_bias, rconfig_t::maxAnisotropic, Mem_Free, Mem_PoolAllocTypeN, R_CheckError, r_config, R_GetScaledTextureSize(), R_IsClampedImageType(), R_ScaleTexture(), r_texture_lod, image_s::type, image_s::upload_height, image_s::upload_width, cvar_s::value, and vid_imagePool.
Referenced by R_LoadImageData(), and R_ReloadImageData().
|
static |
Definition at line 916 of file r_image.cpp.
|
static |
Definition at line 946 of file r_image.cpp.
|
static |
Definition at line 860 of file r_image.cpp.
|
static |
Definition at line 32 of file r_image.cpp.
image_t* r_envmaptextures[MAX_ENVMAPTEXTURES] |
Definition at line 50 of file r_image.cpp.
Referenced by R_DrawMeshModelShell(), and R_ParseStage().
image_t* r_flaretextures[NUM_FLARETEXTURES] |
Definition at line 53 of file r_image.cpp.
Referenced by R_DrawFlareSurfaces(), and R_ParseStage().
imageArray_t r_images |
Definition at line 40 of file r_image.cpp.
int r_numImages |
Definition at line 41 of file r_image.cpp.
Referenced by uiMaterialEditorNode::draw(), R_GetImageAtIndex(), R_ImageList_f(), R_InitImages(), R_LoadImageData(), R_ReloadImages(), R_ShutdownImages(), R_SortSurfacesArrays(), R_SortSurfacesArrays_(), UI_MaterialEditorChangeValue_f(), UI_MaterialEditorNewStage_f(), UI_MaterialEditorNodeGetImageAtPosition(), UI_MaterialEditorNodeGetImageCount(), UI_MaterialEditorRemoveStage_f(), and UI_MaterialEditorSelectStage_f().