#include "r_local.h"
#include "r_sphere.h"
#include "r_error.h"
#include "r_draw.h"
#include "r_mesh.h"
#include "r_framebuffer.h"
#include "r_program.h"
#include "../cl_console.h"
Go to the source code of this file.
Data Structures | |
struct | rect_t |
Defines | |
#define | MAX_CHARS 8192 |
#define | CIRCLE_LINE_COUNT 40 |
#define | MAX_LINEVERTS 256 |
#define | MAX_CLIPRECT 16 |
Functions | |
void | R_DrawInitLocal (void) |
Loads some textures and init the 3d globe. | |
void | R_DrawChar (int x, int y, int num) |
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) |
int | R_UploadData (const char *name, byte *frame, int width, int height) |
Uploads image data. | |
const image_t * | R_RegisterImage (const char *name) |
Searches for an image in the image array. | |
void | R_DrawTexture (int texnum, int x, int y, int w, int h) |
Bind and draw a texture. | |
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_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. | |
void | R_DrawCircle (vec3_t mid, float radius, const vec4_t color, int thickness) |
Draws a circle out of lines. | |
void | R_DrawCircle2D (int x, int y, float radius, qboolean fill, const vec4_t color, float thickness) |
Draws a circle out of lines. | |
static void | R_Draw2DArray (int points, int *verts, GLenum mode) |
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_DrawPolygon (int points, int *verts) |
static void | R_RectIntersection (const rect_t *a, const rect_t *b, rect_t *out) |
Compute the intersection of 2 rect. | |
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 | |
static void | R_ComputeBoundingBox (const vec3_t mins, const vec3_t maxs, vec3_t bbox[8]) |
Compute the bounding box for an entity out of the mins, maxs. | |
void | R_DrawBoundingBox (const vec3_t mins, const vec3_t maxs) |
Draws the model bounding box. | |
Variables | |
image_t * | shadow |
static image_t * | draw_chars |
static float | char_texcoords [MAX_CHARS *4 *2] |
static short | char_verts [MAX_CHARS *4 *2] |
static int | char_index = 0 |
static rect_t | clipRect [MAX_CLIPRECT] |
static int | currentClipRect = 0 |
Definition in file r_draw.c.
#define CIRCLE_LINE_COUNT 40 |
Definition at line 382 of file r_draw.c.
Referenced by R_DrawCircle2D().
#define MAX_CHARS 8192 |
Definition at line 54 of file r_draw.c.
Referenced by R_DrawChar().
#define MAX_CLIPRECT 16 |
Definition at line 510 of file r_draw.c.
Referenced by R_PushClipRect().
#define MAX_LINEVERTS 256 |
Definition at line 434 of file r_draw.c.
Referenced by R_Draw2DArray().
void R_CleanupDepthBuffer | ( | int | x, | |
int | y, | |||
int | width, | |||
int | height | |||
) |
"Clean up" the depth buffer into a rect
Definition at line 585 of file r_draw.c.
References GLboolean(), GLint, viddef_t::rx, viddef_t::ry, and viddef.
Referenced by UI_DrawModelNode(), UI_ItemNodeDraw(), and UI_RadarNodeDraw().
Compute the bounding box for an entity out of the mins, maxs.
Definition at line 618 of file r_draw.c.
References i.
Referenced by R_DrawBoundingBox().
static void R_Draw2DArray | ( | int | points, | |
int * | verts, | |||
GLenum | mode | |||
) | [inline, static] |
Definition at line 436 of file r_draw.c.
References i, MAX_LINEVERTS, r_state, viddef_t::rx, viddef_t::ry, rstate_t::vertex_array_2d, rstate_t::vertex_array_3d, and viddef.
Referenced by R_DrawLine(), R_DrawLineLoop(), R_DrawLineStrip(), and R_DrawPolygon().
Draws the model bounding box.
Definition at line 634 of file r_draw.c.
References R_ComputeBoundingBox().
Referenced by R_DrawBox(), R_DrawBrushModel(), R_DrawModelDirect(), R_DrawModelParticle(), and R_DrawSurface().
void R_DrawChar | ( | int | x, | |
int | y, | |||
int | num | |||
) |
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 66 of file r_draw.c.
References char_index, char_texcoords, char_verts, con_fontHeight, con_fontWidth, int(), and MAX_CHARS.
Referenced by Con_DisplayString(), Con_DrawConsole(), Con_DrawInput(), Con_DrawNotify(), and SCR_DrawString().
void R_DrawChars | ( | void | ) |
Definition at line 110 of file r_draw.c.
References char_index, char_texcoords, char_verts, R_BindDefaultArray(), R_BindTexture, and image_s::texnum.
Referenced by SCR_UpdateScreen().
Draws a circle out of lines.
[in] | mid | Center of the circle |
[in] | radius | Radius of the circle |
[in] | color | The color of the circle lines |
Definition at line 334 of file r_draw.c.
References R_Color(), viddef_t::rx, and viddef.
void R_DrawCircle2D | ( | int | x, | |
int | y, | |||
float | radius, | |||
qboolean | fill, | |||
const vec4_t | color, | |||
float | thickness | |||
) |
Draws a circle out of lines.
[in] | x | X screen coordinate |
[in] | y | Y screen coordinate |
[in] | radius | Radius of the circle |
[in] | color | The color of the circle lines |
[in] | fill | Fill the circle with the given color |
[in] | thickness | The thickness of the lines |
Definition at line 395 of file r_draw.c.
References CIRCLE_LINE_COUNT, i, and R_Color().
void R_DrawFill | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h, | |||
const vec4_t | color | |||
) |
Fills a box of pixels with a single color.
Definition at line 261 of file r_draw.c.
References R_Color(), viddef_t::rx, viddef_t::ry, and viddef.
Referenced by MAP_DrawAircraftHealthBar(), MAP_DrawBullets(), SCR_DrawLoadingBar(), SEQ_Render2D(), and UI_DrawFill().
void R_DrawImage | ( | float | x, | |
float | y, | |||
const image_t * | image | |||
) |
Draws an image or parts of it.
[in] | x | X position to draw the image to |
[in] | y | Y position to draw the image to |
Definition at line 224 of file r_draw.c.
References image_s::height, R_DrawTexture(), viddef_t::rx, viddef_t::ry, image_s::texnum, viddef, and image_s::width.
Referenced by HUD_UpdateCursor(), MAP_DrawMapMarkers(), MAP_DrawMapOneBase(), MAP_DrawMapOneInstallation(), MAP_DrawMapOneMission(), MAP_DrawMapOnePhalanxAircraft(), SCR_DrawCursor(), SCR_DrawLoading(), SCR_DrawPrecacheScreen(), and SEQ_Render2D().
const image_t* R_DrawImageArray | ( | const vec2_t | texcoords[4], | |
const vec2_t | verts[4], | |||
const image_t * | image | |||
) |
Definition at line 240 of file r_draw.c.
References R_BindArray(), R_BindDefaultArray(), R_BindTexture, and image_s::texnum.
Referenced by R_DrawTexture(), UI_DrawNormImage(), and UI_RadarNodeDrawArrays().
void R_DrawInitLocal | ( | void | ) |
Loads some textures and init the 3d globe.
Definition at line 43 of file r_draw.c.
References Com_Error(), Com_Printf(), ERR_FATAL, it_chars, it_effect, R_FindImage(), and r_noTexture.
Referenced by R_Init().
void R_DrawLine | ( | int * | verts, | |
float | thickness | |||
) |
Draws one line with only one start and one end point.
Definition at line 482 of file r_draw.c.
References R_Draw2DArray().
Referenced by MAP_DrawBeam().
void R_DrawLineLoop | ( | int | points, | |
int * | verts | |||
) |
Definition at line 472 of file r_draw.c.
References R_Draw2DArray().
void R_DrawLineStrip | ( | int | points, | |
int * | verts | |||
) |
2 dimensional line strip
Definition at line 463 of file r_draw.c.
References R_Draw2DArray().
Referenced by MAP_3DMapDrawLine(), MAP_MapDrawEquidistantPoints(), MAP_MapDrawLine(), RADAR_DrawInMap(), and UI_LineChartNodeDraw().
void R_DrawPolygon | ( | int | points, | |
int * | verts | |||
) |
Definition at line 498 of file r_draw.c.
References R_Draw2DArray().
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.
[in] | x | X-position of the rect |
[in] | y | Y-position of the rect |
[in] | w | Width of the rect |
[in] | h | Height of the rect |
[in] | color | RGBA color of the rect |
[in] | lineWidth | Line strength in pixel of the rect |
[in] | pattern | Specifies 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 |
2
for this function Definition at line 298 of file r_draw.c.
References f, R_Color(), viddef_t::rx, viddef_t::ry, and viddef.
Referenced by MAP_DrawAircraftHealthBar(), UI_DrawNode(), UI_EditorNodeHighlightNode(), and UI_MaterialEditorNodeDraw().
void R_DrawStretchImage | ( | float | x, | |
float | y, | |||
int | w, | |||
int | h, | |||
const image_t * | image | |||
) |
Definition at line 232 of file r_draw.c.
References R_DrawTexture(), viddef_t::rx, viddef_t::ry, image_s::texnum, and viddef.
Referenced by Con_DrawConsole().
void R_DrawTexture | ( | int | texnum, | |
int | x, | |||
int | y, | |||
int | w, | |||
int | h | |||
) |
Bind and draw a texture.
[in] | texnum | The texture id (already uploaded of course) |
[in] | x | normalized x value on the screen |
[in] | y | normalized y value on the screen |
[in] | w | normalized width value |
[in] | h | normalized height value |
Definition at line 211 of file r_draw.c.
References default_texcoords, R_BindTexture, and R_DrawImageArray().
Referenced by CIN_OGM_DrawCinematic(), CIN_ROQ_DrawCinematic(), R_Draw3DGlobe(), R_DrawImage(), and R_DrawStretchImage().
void R_PopClipRect | ( | void | ) |
Definition at line 568 of file r_draw.c.
References currentClipRect.
Referenced by UI_BaseInventoryNodeDraw2(), UI_DrawModelNode(), UI_DrawNode(), UI_MapNodeDraw(), and UI_RadarNodeDraw().
void R_PushClipRect | ( | int | x, | |
int | y, | |||
int | width, | |||
int | height | |||
) |
Force to draw only on a rect.
R_EndClipRect
Definition at line 539 of file r_draw.c.
References currentClipRect, rect_t::height, MAX_CLIPRECT, R_RectIntersection(), viddef_t::rx, viddef_t::ry, viddef, viddef_t::virtualHeight, rect_t::width, rect_t::x, and rect_t::y.
Referenced by UI_BaseInventoryNodeDraw2(), UI_DrawModelNode(), UI_DrawNode(), UI_MapNodeDraw(), and UI_RadarNodeDraw().
Compute the intersection of 2 rect.
[in] | a | A rect |
[in] | b | A rect |
[out] | out | The intersection rect |
Definition at line 522 of file r_draw.c.
References rect_t::height, rect_t::width, rect_t::x, and rect_t::y.
Referenced by R_PushClipRect().
const image_t* R_RegisterImage | ( | const char * | name | ) |
Searches for an image in the image array.
[in] | name | The name of the image relative to pics/ |
Definition at line 195 of file r_draw.c.
References it_pic, R_FindImage(), r_noTexture, and va().
Referenced by CL_ParticleLoadArt(), and SEQ_ExecutePrecache().
int R_UploadData | ( | const char * | name, | |
byte * | frame, | |||
int | width, | |||
int | height | |||
) |
Uploads image data.
[in] | name | The name of the texture to use for this data |
[in] | frame | The frame data that is uploaded |
[in] | width | The width of the texture |
[in] | height | The height of the texture |
Definition at line 135 of file r_draw.c.
References byte, 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, image_s::height, i, it_pic, Mem_Free, Mem_PoolAllocExt, qfalse, R_BindTexture, R_CheckError, r_config, R_FindImage(), R_GetScaledTextureSize(), r_noTexture, R_ScaleTexture(), image_s::texnum, image_s::upload_height, image_s::upload_width, vid_imagePool, and image_s::width.
Referenced by CIN_OGM_DrawCinematic(), and CIN_ROQ_DrawCinematic().
int char_index = 0 [static] |
Definition at line 59 of file r_draw.c.
Referenced by R_DrawChar(), and R_DrawChars().
float char_texcoords[MAX_CHARS *4 *2] [static] |
Definition at line 57 of file r_draw.c.
Referenced by R_DrawChar(), and R_DrawChars().
short char_verts[MAX_CHARS *4 *2] [static] |
Definition at line 58 of file r_draw.c.
Referenced by R_DrawChar(), and R_DrawChars().
int currentClipRect = 0 [static] |
Definition at line 514 of file r_draw.c.
Referenced by R_PopClipRect(), and R_PushClipRect().
image_t* draw_chars [static] |
draw this when actor is alive
Definition at line 34 of file r_draw.c.
Referenced by R_DrawEntityEffects().