UFO: Alien Invasion
Loading...
Searching...
No Matches
r_draw.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void R_DrawImage (float x, float y, const image_t *image)
 Draws an image or parts of it.
void R_DrawStretchImage (float x, float y, int w, int h, const image_t *image)
const image_t * R_DrawImageArray (const vec2_t texcoords[4], const vec2_t verts[4], const image_t *image)
void R_DrawChar (int x, int y, int c, uint32_t color)
 Draws one 8*8 graphics character with 0 being transparent. It can be clipped to the top of the screen to allow the console to be smoothly scrolled off.
void R_DrawChars (void)
void R_DrawFills (void)
void R_DrawFill (int x, int y, int w, int h, const vec4_t color)
 Fills a box of pixels with a single color.
void R_DrawRect (int x, int y, int w, int h, const vec4_t color, float lineWidth, int pattern)
 Draws a rect to the screen. Also has support for stippled rendering of the rect.
int R_UploadData (const char *name, unsigned *frame, int width, int height)
 Uploads image data.
void R_DrawTexture (int texnum, int x, int y, int w, int h)
 Bind and draw a texture.
void R_DrawLineStrip (int points, int *verts)
 2 dimensional line strip
void R_DrawLineLoop (int points, int *verts)
void R_DrawLine (int *verts, float thickness)
 Draws one line with only one start and one end point.
void R_DrawCircle (float radius, const vec4_t color, float thickness, const vec3_t shift)
void R_DrawPolygon (int points, int *verts)
void R_PushClipRect (int x, int y, int width, int height)
 Force to draw only on a rect.
void R_PopClipRect (void)
void R_CleanupDepthBuffer (int x, int y, int width, int height)
 "Clean up" the depth buffer into a rect
void R_DrawBoundingBox (const AABB &absBox)
 Draws the model bounding box.
void R_DrawBoundingBoxBatched (const AABB &box)
void R_DrawBoundingBoxes (void)
void R_DrawTexturedBox (const vec3_t absmins, const vec3_t absmaxs)
 Draws the textured box, the caller should bind the texture.

Function Documentation

◆ R_CleanupDepthBuffer()

void R_CleanupDepthBuffer ( int x,
int y,
int width,
int height )

"Clean up" the depth buffer into a rect

Note
we use a big value (but not too big) to set the depth buffer, then it is not really a clean up
Todo
can we fix bigZ with a value come from glGet?

Definition at line 596 of file r_draw.cpp.

References rendererData_t::batchCount, GLboolean(), GLint, R_BindArray(), R_BindDefaultArray(), R_CleanupDepthBuffer(), refdef, viddef_t::rx, viddef_t::ry, and viddef.

Referenced by uiItemNode::draw(), uiRadarNode::draw(), uiSequenceNode::draw(), R_CleanupDepthBuffer(), and UI_DrawModelNode().

◆ R_DrawBoundingBox()

void R_DrawBoundingBox ( const AABB & absBox)

Draws the model bounding box.

See also
R_EntityComputeBoundingBox

Definition at line 690 of file r_draw.cpp.

References AABB::maxs, AABB::mins, R_BindArray(), R_BindDefaultArray(), R_ComputeBoundingBox(), and R_DrawBoundingBox().

Referenced by R_DrawAliasModel(), R_DrawBoundingBox(), R_DrawBox(), R_DrawModelDirect(), R_DrawModelParticle(), and R_RenderBspRRefs().

◆ R_DrawBoundingBoxBatched()

◆ R_DrawBoundingBoxes()

◆ R_DrawChar()

void R_DrawChar ( int x,
int y,
int c,
uint32_t color )

Draws one 8*8 graphics character with 0 being transparent. It can be clipped to the top of the screen to allow the console to be smoothly scrolled off.

Definition at line 99 of file r_draw.cpp.

References char_arrays_t::color_index, char_arrays_t::colors, con_fontHeight, con_fontWidth, int(), lengthof, r_char_arrays, R_DrawChar(), char_arrays_t::texcoord_index, char_arrays_t::texcoords, char_arrays_t::vert_index, and char_arrays_t::verts.

Referenced by Con_DrawConsole(), Con_DrawText(), and R_DrawChar().

◆ R_DrawChars()

◆ R_DrawCircle()

void R_DrawCircle ( float radius,
const vec4_t color,
float thickness,
const vec3_t shift )

◆ R_DrawFill()

void R_DrawFill ( int x,
int y,
int w,
int h,
const vec4_t color )

Fills a box of pixels with a single color.

Todo
this shouldn't be here, but only called once at the end of the frame but this is needed here because a) we don't want them to get rendered on top of the console and b) the ui stuff relies on the order of these renderings

Definition at line 188 of file r_draw.cpp.

References batch_arrays_t::color_index, batch_arrays_t::colors, lengthof, LittleLong, R_DrawFill(), R_DrawFills(), r_fill_arrays, viddef_t::rx, viddef_t::ry, batch_arrays_t::vert_index, batch_arrays_t::verts, and viddef.

Referenced by uiLineChartNode::draw(), GAME_GetImportData(), R_DrawFill(), SCR_DrawLoadingBar(), SEQ_Render2D(), UI_DrawFill(), and cgame_import_t::void().

◆ R_DrawFills()

◆ R_DrawImage()

void R_DrawImage ( float x,
float y,
const image_t * image )

Draws an image or parts of it.

Parameters
x,yposition to draw the image to
[in]imagePointer to the imlage to display

Definition at line 341 of file r_draw.cpp.

References image_t::height, R_DrawImage(), R_DrawTexture(), viddef_t::rx, viddef_t::ry, image_t::texnum, viddef, and image_t::width.

Referenced by HUD_UpdateCursor(), R_DrawImage(), R_DrawImageCentered(), SCR_DrawCursor(), SCR_DrawLoadingScreen(), and SEQ_Render2D().

◆ R_DrawImageArray()

const image_t * R_DrawImageArray ( const vec2_t texcoords[4],
const vec2_t verts[4],
const image_t * image )

◆ R_DrawLine()

void R_DrawLine ( int * verts,
float thickness )

Draws one line with only one start and one end point.

See also
R_DrawLineStrip

Definition at line 494 of file r_draw.cpp.

References R_Draw2DArray(), and R_DrawLine().

Referenced by GAME_GetImportData(), and R_DrawLine().

◆ R_DrawLineLoop()

void R_DrawLineLoop ( int points,
int * verts )
See also
R_DrawLineStrip

Definition at line 485 of file r_draw.cpp.

References R_Draw2DArray(), and R_DrawLineLoop().

Referenced by R_DrawLineLoop().

◆ R_DrawLineStrip()

void R_DrawLineStrip ( int points,
int * verts )

2 dimensional line strip

See also
R_DrawLineLoop

Definition at line 477 of file r_draw.cpp.

References R_Draw2DArray(), and R_DrawLineStrip().

Referenced by uiLineChartNode::draw(), GAME_GetImportData(), and R_DrawLineStrip().

◆ R_DrawPolygon()

void R_DrawPolygon ( int points,
int * verts )
See also
R_DrawLineStrip
R_DrawLineLoop

Definition at line 509 of file r_draw.cpp.

References R_Draw2DArray(), and R_DrawPolygon().

Referenced by R_DrawPolygon().

◆ R_DrawRect()

void R_DrawRect ( int x,
int y,
int w,
int h,
const vec4_t color,
float lineWidth,
int pattern )

Draws a rect to the screen. Also has support for stippled rendering of the rect.

Parameters
[in]x,yX/Y-position of the rect
[in]wWidth of the rect
[in]hHeight of the rect
[in]colorRGBA color of the rect
[in]lineWidthLine strength in pixel of the rect
[in]patternSpecifies a 16-bit integer whose bit pattern determines which fragments of a line will be drawn when the line is rasterized. Bit zero is used first; the default pattern is all 1's
Note
The stipple factor is 2 for this function

Definition at line 390 of file r_draw.cpp.

References rendererData_t::batchCount, R_BindDefaultArray(), R_Color(), R_DrawRect(), refdef, viddef_t::rx, viddef_t::ry, and viddef.

Referenced by GAME_GetImportData(), R_DrawRect(), SEQ_Render2D(), UI_DrawRect(), and cgame_import_t::void().

◆ R_DrawStretchImage()

void R_DrawStretchImage ( float x,
float y,
int w,
int h,
const image_t * image )

◆ R_DrawTexture()

void R_DrawTexture ( int texnum,
int x,
int y,
int w,
int h )

Bind and draw a texture.

Parameters
[in]texnumThe texture id (already uploaded of course)
[in]x,ynormalized position on the screen
[in]w,hnormalized width and height values

Definition at line 328 of file r_draw.cpp.

References default_texcoords, R_BindTexture, R_DrawImageArray(), R_DrawTexture(), and Vector2FromInt.

Referenced by CIN_OGM_DrawCinematic(), CIN_ROQ_DrawCinematic(), R_Draw3DGlobe(), R_DrawImage(), R_DrawStretchImage(), and R_DrawTexture().

◆ R_DrawTexturedBox()

void R_DrawTexturedBox ( const vec3_t a0,
const vec3_t a1 )

Draws the textured box, the caller should bind the texture.

See also
R_DrawBox

Definition at line 714 of file r_draw.cpp.

References R_BindArray(), R_BindDefaultArray(), and R_DrawTexturedBox().

Referenced by R_DrawBox(), and R_DrawTexturedBox().

◆ R_PopClipRect()

void R_PopClipRect ( void )
See also
R_PushClipRect

Definition at line 579 of file r_draw.cpp.

References clipRect, currentClipRect, and R_PopClipRect().

Referenced by R_PopClipRect(), and UI_PopClipRect().

◆ R_PushClipRect()

void R_PushClipRect ( int x,
int y,
int width,
int height )

Force to draw only on a rect.

Note
Don't forget to call R_EndClipRect
See also
R_PopClipRect

Definition at line 550 of file r_draw.cpp.

References clipRect, currentClipRect, rect_t::height, MAX_CLIPRECT, R_PushClipRect(), R_RectIntersection(), viddef_t::rx, viddef_t::ry, viddef, viddef_t::virtualHeight, rect_t::width, rect_t::x, and rect_t::y.

Referenced by R_PushClipRect(), and UI_PushClipRect().

◆ R_UploadData()

int R_UploadData ( const char * name,
unsigned * frame,
int width,
int height )

Uploads image data.

Parameters
[in]nameThe name of the texture to use for this data
[in]frameThe frame data that is uploaded
[in]widthThe width of the texture
[in]heightThe height of the texture
Returns
the texture number of the uploaded images

Definition at line 270 of file r_draw.cpp.

References Com_Error(), ERR_FATAL, rconfig_t::gl_alpha_format, rconfig_t::gl_compressed_alpha_format, rconfig_t::gl_compressed_solid_format, rconfig_t::gl_solid_format, glTexImage2D(), glTexParameterf(), image_t::height, i, it_pic, Mem_Free, Mem_PoolAllocTypeN, name, R_BindTexture, R_CheckError, r_config, R_FindImage(), R_GetScaledTextureSize(), r_noTexture, R_ScaleTexture(), R_UploadData(), image_t::texnum, image_t::upload_height, image_t::upload_width, vid_imagePool, and image_t::width.

Referenced by CIN_OGM_DrawCinematic(), CIN_ROQ_DrawCinematic(), and R_UploadData().