UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_renderer.h File Reference
#include "renderer/r_image.h"
#include "renderer/r_model.h"
#include "renderer/r_program.h"
#include <SDL.h>

Go to the source code of this file.

Data Structures

struct  corona_s
 coronas are soft, alpha-blended, rounded polys More...
 
struct  modelInfo_t
 
struct  ptlCmd_s
 
struct  ptlDef_s
 
struct  ptlArt_s
 
struct  ptl_s
 
struct  rendererData_t
 
struct  renderer_threadstate_s
 

Macros

#define RDF_NOWORLDMODEL   1
 
#define RDF_IRGOGGLES   2
 
#define WEATHER_NONE   0
 
#define WEATHER_FOG   1
 
#define VID_NORM_WIDTH   1024
 
#define VID_NORM_HEIGHT   768
 
#define MAX_PTL_ART   1024
 
#define MAX_PTLS   2048
 
#define MAX_CORONAS   128
 
#define MAX_GL_LIGHTS   8
 

Typedefs

typedef struct corona_s corona_t
 coronas are soft, alpha-blended, rounded polys More...
 
typedef struct ptlCmd_s ptlCmd_t
 
typedef struct ptlDef_s ptlDef_t
 
typedef enum artType_s artType_t
 particle art type More...
 
typedef struct ptlArt_s ptlArt_t
 
typedef struct ptl_s ptl_t
 
typedef struct
renderer_threadstate_s 
renderer_threadstate_t
 

Enumerations

enum  artType_s { ART_PIC, ART_MODEL }
 particle art type More...
 
enum  threadstate_t {
  THREAD_DEAD, THREAD_IDLE, THREAD_CLIENT, THREAD_BSP,
  THREAD_RENDERER
}
 
enum  longlines_t { LONGLINES_WRAP, LONGLINES_CHOP, LONGLINES_PRETTYCHOP, LONGLINES_LAST }
 

Functions

void R_Color (const vec4_t rgba)
 Change the color to given value. More...
 
void R_ModBeginLoading (const char *tiles, bool day, const char *pos, const char *mapName, const char *mapZone)
 Specifies the model that will be used as the world. More...
 
void R_SwitchModelMemPoolTag (void)
 After all static models are loaded, switch the pool tag for these models to not free them everytime R_ShutdownModels is called. More...
 
void R_LoadImage (const char *name, byte **pic, int *width, int *height)
 Generic image-data loading fucntion. More...
 
void R_FontShutdown (void)
 frees the SDL_ttf fonts More...
 
void R_FontInit (void)
 
void R_FontRegister (const char *name, int size, const char *path, const char *style)
 
void R_FontSetTruncationMarker (const char *marker)
 
void R_FontTextSize (const char *fontId, const char *text, int maxWidth, longlines_t method, int *width, int *height, int *lines, bool *isTruncated)
 Supply information about the size of the text when it is linewrapped and rendered, without actually rendering it. Any of the output parameters may be nullptr. More...
 
int R_FontDrawString (const char *fontId, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char *c, int boxHeight, int scrollPos, int *curLine, longlines_t method)
 

Variables

rendererData_t refdef
 
renderer_threadstate_t r_threadstate
 

Macro Definition Documentation

#define MAX_CORONAS   128

Definition at line 53 of file cl_renderer.h.

Referenced by R_AddCorona().

#define MAX_PTL_ART   1024

Definition at line 43 of file cl_renderer.h.

Referenced by CL_ParticleGetArt().

#define MAX_PTLS   2048

Definition at line 44 of file cl_renderer.h.

Referenced by CL_ParticleSpawn(), and TEST_F().

#define RDF_IRGOGGLES   2

actor is using ir goggles and everything with RF_IRGOGGLES is visible for him

Definition at line 35 of file cl_renderer.h.

Referenced by CL_ActorDoShoot(), CL_ActorSelect(), CL_ClearState(), CL_DoEndRound(), and R_DrawAliasModel().

#define VID_NORM_HEIGHT   768
#define WEATHER_FOG   1

Definition at line 38 of file cl_renderer.h.

Referenced by R_EnableFog().

#define WEATHER_NONE   0

Definition at line 37 of file cl_renderer.h.

Referenced by SP_worldspawn().

Typedef Documentation

typedef enum artType_s artType_t

particle art type

typedef struct corona_s corona_t

coronas are soft, alpha-blended, rounded polys

typedef struct ptl_s ptl_t
typedef struct ptlArt_s ptlArt_t
typedef struct ptlCmd_s ptlCmd_t
typedef struct ptlDef_s ptlDef_t

Enumeration Type Documentation

enum artType_s

particle art type

Enumerator
ART_PIC 
ART_MODEL 

Definition at line 91 of file cl_renderer.h.

Enumerator
LONGLINES_WRAP 
LONGLINES_CHOP 
LONGLINES_PRETTYCHOP 
LONGLINES_LAST 

Definition at line 217 of file cl_renderer.h.

Enumerator
THREAD_DEAD 
THREAD_IDLE 
THREAD_CLIENT 
THREAD_BSP 
THREAD_RENDERER 

Definition at line 209 of file cl_renderer.h.

Function Documentation

int R_FontDrawString ( const char *  fontId,
align_t  align,
int  x,
int  y,
int  absX,
int  maxWidth,
int  lineHeight,
const char *  c,
int  boxHeight,
int  scrollPos,
int curLine,
longlines_t  method 
)
Parameters
[in]fontIdthe font id (defined in ufos/fonts.ufo)
alignAlignment of the text inside the text zone
[in]xCurrent x position (may differ from absX due to tabs e.g.)
[in]yCurrent y position (may differ from absY due to linebreaks)
[in]absXAbsolute x value for this string
[in]maxWidthMax width - relative from absX
[in]lineHeightThe lineheight of that node
[in]cThe string to draw
boxHeightNumber of line the box can contain. If <= 0 the value is autogenerated according to the number of line of the text input
[in]scrollPosStarting line in this node (due to scrolling)
[in]curLineCurrent line (see lineHeight)
methodExplain the way we manage line overflow
Note
the x, y, width and height values are all normalized here - don't use the viddef settings for drawstring calls - make them all relative to VID_NORM_WIDTH and VID_NORM_HEIGHT
Todo:
This could be replaced with a set of much simpler interfaces.

Definition at line 687 of file r_font.cpp.

References wrapCache_s::chunkIdx, i, chunkCache_t::linenum, wrapCache_s::numChunks, wrapCache_s::numLines, R_FontDrawTexture(), R_FontGenerateTexture(), R_FontWrapText(), R_GetFont(), chunkCache_t::texnum, chunkCache_t::texsize, and chunkCache_t::width.

Referenced by UI_BaseInventoryNodeDraw2(), and UI_DrawString().

void R_FontRegister ( const char *  name,
int  size,
const char *  path,
const char *  style 
)

Definition at line 750 of file r_font.cpp.

References i, NUM_FONT_STYLES, Q_strcasecmp, R_FontAnalyze(), and fontRenderStyle_t::renderStyle.

Referenced by UI_RegisterFont().

void R_FontSetTruncationMarker ( const char *  marker)

Definition at line 112 of file r_font.cpp.

References Q_strncpyz(), and truncmarker.

Referenced by CL_NewLanguage().

void R_FontShutdown ( void  )

frees the SDL_ttf fonts

See also
R_FontCleanCache

Definition at line 144 of file r_font.cpp.

References i, Mem_Free, numFonts, OBJZERO, and R_FontCleanCache().

Referenced by CL_NewLanguage(), R_Shutdown(), and UI_Restart_f().

void R_FontTextSize ( const char *  fontId,
const char *  text,
int  maxWidth,
longlines_t  method,
int width,
int height,
int lines,
bool *  isTruncated 
)

Supply information about the size of the text when it is linewrapped and rendered, without actually rendering it. Any of the output parameters may be nullptr.

Parameters
[in]fontIdthe font id (defined in ufos/fonts.ufo)
[in]textThe text to check
maxWidthMax width available
methodLine overflow method
[out]widthreceives width in pixels of the longest line in the text
[out]heightreceives height in pixels when rendered with standard line height
[out]linesreceives total number of lines in text, including blank ones
[out]isTruncatedreceives true, if the text must be trucated

Definition at line 524 of file r_font.cpp.

References wrapCache_s::chunkIdx, font_s::height, i, font_s::lineSkip, wrapCache_s::numChunks, wrapCache_s::numLines, R_FontWrapText(), R_GetFont(), chunkCache_t::truncated, and chunkCache_t::width.

Referenced by uiButtonNode::draw(), uiTabNode::draw(), uiText2Node::drawText(), uiTextNode::drawText(), uiStringNode::drawTooltip(), HUD_UpdateCursor(), UI_BaseInventoryNodeDrawItems(), UI_BaseInventoryNodeGetItem(), UI_DrawNotice(), UI_DrawTooltip(), UI_MessageGetLines(), and UI_TabNodeTabAtPosition().

void R_LoadImage ( const char *  name,
byte **  pic,
int width,
int height 
)

Generic image-data loading fucntion.

Parameters
[in]name(Full) pathname to the image to load. Extension (if given) will be ignored.
[out]picImage data.
[out]widthWidth of the loaded image.
[out]heightHeight of the loaded image.
See also
R_FindImage

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().

void R_ModBeginLoading ( const char *  tiles,
bool  day,
const char *  pos,
const char *  mapName,
const char *  mapZone 
)

Specifies the model that will be used as the world.

Parameters
[in]tilesThe tiles string can be only one map or a list of space seperated map tiles for random assembly. In case of random assembly we also need the pos string. Every tile needs an entry in the pos string, too.
[in]dayLoad the day lightmap
[in]posIn case of a random map assembly this is the string that holds the world grid positions of the tiles. The positions are x, y and z values. They are just written one after another for every tile in the tiles string and every of the three components must exists for every tile.
[in]mapNameThe mapname that the get from the server (used to identify the correct name for the materials in case of a random assembly).
[in]mapZoneThe terrain type for texture replacement
See also
R_ModAddMapTile
CM_LoadMap
Note
This function is called for listen servers, too. This loads the bsp struct for rendering it. The CM_LoadMap code only loads the collision and pathfinding stuff.
See also
UI_BuildRadarImageList

Definition at line 1098 of file r_model_brush.cpp.

References Com_Error(), Com_Parse(), Com_sprintf(), ERR_DROP, i, MAX_QPATH, MAX_VAR, name, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, Q_strncpyz(), R_BeginBuildingLightmaps(), R_ClearGrass(), R_ClearStaticLights(), R_ModAddMapTile(), R_ModEndLoading(), r_numMapTiles, and r_numModelsInline.

Referenced by CL_ViewLoadMedia().

void R_SwitchModelMemPoolTag ( void  )

After all static models are loaded, switch the pool tag for these models to not free them everytime R_ShutdownModels is called.

See also
CL_InitAfter
R_FreeWorldImages

Definition at line 299 of file r_model.cpp.

References model_s::alias, Com_Printf(), i, it_static, Mem_ChangeTag, MEM_TAG_STATIC_MODELS, mAliasModel_s::meshes, model_s::name, mAliasModel_s::num_meshes, mAliasMesh_s::num_skins, r_noTexture, r_numModels, r_numModelsStatic, mAliasSkin_s::skin, mAliasMesh_s::skins, image_s::type, and vid_modelPool.

Referenced by CL_ViewPrecacheModels().

Variable Documentation

renderer_threadstate_t r_threadstate

Definition at line 34 of file r_thread.cpp.

Referenced by CL_ViewRender(), R_RenderFrame(), and SCR_TimeRefresh_f().

Definition at line 45 of file r_main.cpp.

Referenced by CL_ActorDoShoot(), CL_ActorSelect(), CL_ClearState(), CL_DoEndRound(), CL_GetWorldCoordsUnderMouse(), CL_ParseConfigString(), CL_ParseServerData(), CL_ViewCalcFieldOfViewX(), CL_ViewCalcFieldOfViewY(), CL_ViewLoadMedia(), CL_ViewRender(), CL_ViewUpdateRenderData(), MYgluPerspective(), R_AddCorona(), R_AddEntity(), R_AddLight(), R_AddStaticLight(), R_AddSustainedLight(), R_CalcTransform(), R_CleanupDepthBuffer(), R_ClearStaticLights(), R_CullEntity(), R_Draw2DArray(), R_DrawAliasFrameLerp(), R_DrawAliasModel(), R_DrawAliasModelBuffer(), R_DrawAliasStatic(), R_DrawAliasTags(), R_DrawArrow(), R_DrawBlendMeshEntities(), R_DrawBox(), R_DrawBspNormals(), R_DrawChars(), R_DrawCircle(), R_DrawCoronas(), R_DrawEntityEffects(), R_DrawFills(), R_DrawFlareSurfaces(), R_DrawFlatGeoscape(), R_DrawFloor(), R_DrawGrass(), R_DrawImageArray(), R_DrawMeshModelShell(), R_DrawMeshShadow(), R_DrawModelDirect(), R_DrawModelParticle(), R_DrawNullModel(), R_DrawOpaqueMeshEntities(), R_DrawParticles(), R_DrawPtlLine(), R_DrawQuad(), R_DrawRect(), R_DrawSprite(), R_DrawStarfield(), R_DrawSurfaces(), R_DrawSurfaceStage(), R_EnableFog(), R_EnableModelLights(), R_EnableShell(), R_EnableWorldLights(), R_FontDrawTexture(), R_GetEntity(), R_GetEntityLists(), R_GetFreeEntity(), R_GetLevelOfDetailForModel(), R_GetLevelSurfaceLists(), R_InitModelProgram(), R_InitWarpProgram(), R_InitWorldProgram(), R_RunThread(), R_Setup2D(), R_Setup3D(), R_SphereRender(), R_SphereRenderTris(), R_SpriteTexcoords(), R_StageTexCoord(), R_Trace(), R_UpdateLightList(), R_UpdateMaterial(), R_UpdateShadowOrigin(), R_UpdateSustainedLights(), R_UseModelProgram(), R_UseProgram(), R_UseWarpProgram(), R_UseWorldProgram(), Weather::render(), SCR_TimeRefresh_f(), SCR_UpdateScreen(), SEQ_Render3D(), SP_worldspawn(), and VID_Restart_f().