#include "r_local.h"
#include "r_program.h"
#include "r_error.h"
Go to the source code of this file.
Defines | |
#define | FOG_START 300.0 |
#define | FOG_END 2500.0 |
Functions | |
qboolean | R_SelectTexture (gltexunit_t *texunit) |
Returns qfalse if the texunit is not supported. | |
static void | R_BindTexture_ (int texnum) |
void | R_BindTextureDebug (int texnum, const char *file, int line, const char *function) |
void | R_BindTextureForTexUnit (GLuint texnum, gltexunit_t *texunit) |
void | R_BindLightmapTexture (GLuint texnum) |
void | R_BindDeluxemapTexture (GLuint texnum) |
void | R_BindNormalmapTexture (GLuint texnum) |
void | R_BindArray (GLenum target, GLenum type, const void *array) |
void | R_BindDefaultArray (GLenum target) |
Binds the appropriate shared vertex array to the specified target. | |
void | R_BindBuffer (GLenum target, GLenum type, GLuint id) |
void | R_BlendFunc (GLenum src, GLenum dest) |
void | R_EnableBlend (qboolean enable) |
void | R_EnableAlphaTest (qboolean enable) |
void | R_EnableTexture (gltexunit_t *texunit, qboolean enable) |
void | R_EnableColorArray (qboolean enable) |
qboolean | R_EnableLighting (r_program_t *program, qboolean enable) |
Enables hardware-accelerated lighting with the specified program. This should be called after any texture units which will be active for lighting have been enabled. | |
void | R_EnableDynamicLights (const entity_t *ent, qboolean enable) |
Enable or disable realtime dynamic lighting. | |
void | R_EnableAnimation (const mAliasMesh_t *mesh, float backlerp, qboolean enable) |
Enables animation using keyframe interpolation on the GPU. | |
void | R_EnableBumpmap (const image_t *normalmap, qboolean enable) |
Enables bumpmapping and binds the given normalmap. | |
void | R_EnableWarp (r_program_t *program, qboolean enable) |
void | R_EnableBlur (r_program_t *program, qboolean enable, r_framebuffer_t *source, r_framebuffer_t *dest, int dir) |
void | R_EnableShell (qboolean enable) |
void | R_EnableFog (qboolean enable) |
void | R_EnableGlowMap (const image_t *image, qboolean enable) |
void | R_EnableDrawAsGlow (qboolean enable) |
void | R_EnableSpecularMap (const image_t *image, qboolean enable) |
void | R_EnableRoughnessMap (const image_t *image, qboolean enable) |
static void | MYgluPerspective (GLdouble zNear, GLdouble zFar) |
void | R_Setup3D (void) |
void | R_Setup2D (void) |
void | R_SetDefaultState (void) |
void | R_TexEnv (GLenum mode) |
void | R_Color (const vec4_t rgba) |
Change the color to given value. | |
Variables | |
const vec2_t | default_texcoords [4] |
const float | SKYBOX_DEPTH |
Center position of skybox along z-axis. This is used to make sure we see only the inside of Skybox. | |
static const vec4_t | ambient |
static const vec4_t | material |
const vec4_t | color_white = {1, 1, 1, 1} |
#define FOG_END 2500.0 |
Definition at line 516 of file r_state.c.
Referenced by R_SetDefaultState().
#define FOG_START 300.0 |
Definition at line 515 of file r_state.c.
Referenced by R_SetDefaultState().
static void MYgluPerspective | ( | GLdouble | zNear, | |
GLdouble | zFar | |||
) | [static] |
Definition at line 630 of file r_state.c.
References rendererData_t::fieldOfViewX, cvar_s::integer, r_isometric, refdef, viddef, viddef_t::viewHeight, and viddef_t::viewWidth.
Referenced by R_Setup3D().
void R_BindArray | ( | GLenum | target, | |
GLenum | type, | |||
const void * | array | |||
) |
Definition at line 102 of file r_state.c.
References GL_NEXT_NORMAL_ARRAY, GL_NEXT_TANGENT_ARRAY, GL_NEXT_VERTEX_ARRAY, GL_TANGENT_ARRAY, and R_AttributePointer().
Referenced by R_BindBuffer(), R_BindDefaultArray(), R_DrawAliasStatic(), R_DrawFlatGeoscape(), R_DrawImageArray(), R_EnableAnimation(), R_SetVertexArrayState(), R_SphereActivateTextureUnit(), R_SphereShade(), and R_SphereShadeGLSL().
void R_BindBuffer | ( | GLenum | target, | |
GLenum | type, | |||
GLuint | id | |||
) |
Definition at line 165 of file r_state.c.
References cvar_s::integer, R_BindArray(), and r_vertexbuffers.
Referenced by R_ResetArrayState(), and R_SetVertexBufferState().
void R_BindDefaultArray | ( | GLenum | target | ) |
Binds the appropriate shared vertex array to the specified target.
Definition at line 135 of file r_state.c.
References rstate_t::active_texunit, rstate_t::color_array, GL_NEXT_NORMAL_ARRAY, GL_NEXT_TANGENT_ARRAY, GL_NEXT_VERTEX_ARRAY, GL_TANGENT_ARRAY, rstate_t::next_normal_array, rstate_t::next_tangent_array, rstate_t::next_vertex_array_3d, rstate_t::normal_array, R_BindArray(), r_state, rstate_t::tangent_array, gltexunit_s::texcoord_array, and rstate_t::vertex_array_3d.
Referenced by R_DrawAliasStatic(), R_DrawChars(), R_DrawFlatGeoscape(), R_DrawImageArray(), R_ResetArrayState(), R_SetDefaultState(), R_Setup2D(), R_Setup3D(), R_SphereDeactivateTextureUnit(), and R_SphereRender().
void R_BindDeluxemapTexture | ( | GLuint | texnum | ) |
Definition at line 92 of file r_state.c.
References R_BindTextureForTexUnit(), and texunit_deluxemap.
Referenced by R_SetSurfaceBumpMappingParameters().
void R_BindLightmapTexture | ( | GLuint | texnum | ) |
Definition at line 87 of file r_state.c.
References R_BindTextureForTexUnit(), and texunit_lightmap.
Referenced by R_DrawFlatGeoscape(), R_SetSurfaceState(), R_SphereShade(), and R_StageLighting().
void R_BindNormalmapTexture | ( | GLuint | texnum | ) |
Definition at line 97 of file r_state.c.
References R_BindTextureForTexUnit(), and texunit_normalmap.
Referenced by R_EnableBumpmap().
static void R_BindTexture_ | ( | int | texnum | ) | [static] |
Definition at line 53 of file r_state.c.
References rstate_t::active_texunit, R_CheckError, r_state, and gltexunit_s::texnum.
Referenced by R_BindTextureDebug().
void R_BindTextureDebug | ( | int | texnum, | |
const char * | file, | |||
int | line, | |||
const char * | function | |||
) |
Definition at line 66 of file r_state.c.
References Com_Printf(), and R_BindTexture_().
void R_BindTextureForTexUnit | ( | GLuint | texnum, | |
gltexunit_t * | texunit | |||
) |
Definition at line 74 of file r_state.c.
References R_BindTexture, R_SelectTexture(), gltexunit_s::texnum, and texunit_diffuse.
Referenced by R_BindDeluxemapTexture(), R_BindLightmapTexture(), R_BindNormalmapTexture(), R_Blur(), R_BlurStack(), R_DrawBloom(), R_EnableGlowMap(), R_EnableRoughnessMap(), R_EnableSpecularMap(), and R_SphereShadeGLSL().
void R_BlendFunc | ( | GLenum | src, | |
GLenum | dest | |||
) |
Definition at line 179 of file r_state.c.
References rstate_t::blend_dest, rstate_t::blend_src, and r_state.
Referenced by R_DrawCoronas(), R_DrawMaterialSurfaces(), R_DrawParticles(), R_EnableShell(), R_SetBlendMode(), R_SetDefaultState(), and R_SetSurfaceStageState().
void R_Color | ( | const vec4_t | rgba | ) |
Change the color to given value.
[in] | rgba | A pointer to a vec4_t with rgba color value |
Definition at line 818 of file r_state.c.
References color_white, and R_CheckError.
Referenced by MAP_3DMapDrawLine(), MAP_DrawBeam(), MAP_DrawMapMarkers(), MAP_MapDrawEquidistantPoints(), MAP_MapDrawLine(), R_DrawArrow(), R_DrawBox(), R_DrawBspNormals(), R_DrawCircle(), R_DrawCircle2D(), R_DrawCoronas(), R_DrawEntities(), R_DrawEntityEffects(), R_DrawFill(), R_DrawFlareSurfaces(), R_DrawFloor(), R_DrawMaterialSurfaces(), R_DrawMeshModelShell(), R_DrawModelDirect(), R_DrawModelParticle(), R_DrawParticles(), R_DrawPtlCircle(), R_DrawPtlLine(), R_DrawRect(), R_DrawSprite(), R_DrawSurfaces(), R_SetSurfaceStageState(), R_SetSurfaceState(), R_Setup2D(), RADAR_DrawInMap(), SCR_DrawLoading(), SEQ_Render2D(), UI_ButtonNodeDraw(), UI_CustomButtonNodeDraw(), UI_DrawIconInBox(), UI_DrawItem(), UI_DrawNotice(), UI_DrawTooltip(), UI_ImageNodeDraw(), UI_KeyBindingNodeDraw(), UI_LineChartNodeDraw(), UI_OptionListNodeDraw(), UI_OptionTreeNodeDraw(), UI_RadarNodeDrawArrays(), UI_SelectBoxNodeDraw(), UI_StringNodeDraw(), UI_TextEntryNodeDraw(), UI_TextLineNodeDrawText(), and UI_TextNodeDrawText().
void R_EnableAlphaTest | ( | qboolean | enable | ) |
Definition at line 206 of file r_state.c.
References rstate_t::alpha_test_enabled, and r_state.
Referenced by R_DrawAlphaTestSurfaces().
void R_EnableAnimation | ( | const mAliasMesh_t * | mesh, | |
float | backlerp, | |||
qboolean | enable | |||
) |
Enables animation using keyframe interpolation on the GPU.
mesh | The mesh to animate | |
backlerp | The temporal proximity to the previous keyframe (in the range 0.0 to 1.0) | |
enable | Whether to turn animation on or off |
Definition at line 364 of file r_state.c.
References rstate_t::animation_enabled, GL_NEXT_NORMAL_ARRAY, GL_NEXT_TANGENT_ARRAY, GL_NEXT_VERTEX_ARRAY, GL_TANGENT_ARRAY, cvar_s::integer, rstate_t::lighting_enabled, mAliasMesh_s::next_normals, mAliasMesh_s::next_tangents, mAliasMesh_s::next_verts, mAliasMesh_s::normals, R_BindArray(), R_DisableAttribute(), R_EnableAttribute(), R_ProgramParameter1f(), R_ProgramParameter1i(), r_programs, r_state, mAliasMesh_s::tangents, mAliasMesh_s::texcoords, and mAliasMesh_s::verts.
Referenced by R_DrawAliasFrameLerp().
void R_EnableBlend | ( | qboolean | enable | ) |
Definition at line 190 of file r_state.c.
References rstate_t::blend_enabled, and r_state.
Referenced by R_DrawBlendMeshEntities(), R_DrawBspModelSurfaces(), R_DrawEntityEffects(), R_DrawSpecialEntities(), R_EnableShell(), and R_RenderFrame().
void R_EnableBlur | ( | r_program_t * | program, | |
qboolean | enable, | |||
r_framebuffer_t * | source, | |||
r_framebuffer_t * | dest, | |||
int | dir | |||
) |
Definition at line 457 of file r_state.c.
References rstate_t::blur_enabled, fbo_screen, r_program_s::id, cvar_s::integer, r_postprocess, r_programs, R_SelectTexture(), r_state, R_UseFramebuffer(), R_UseProgram(), texunit_diffuse, texunit_lightmap, r_program_s::userdata, and r_framebuffer_t::width.
Referenced by R_Blur().
Enables bumpmapping and binds the given normalmap.
Definition at line 399 of file r_state.c.
References rstate_t::bumpmap_enabled, rstate_t::lighting_enabled, R_BindNormalmapTexture(), r_bumpmap, R_DisableAttribute(), R_EnableAttribute(), R_ProgramParameter1f(), R_ProgramParameter1i(), r_state, image_s::texnum, and cvar_s::value.
Referenced by R_DrawMaterialSurfaces(), R_DrawSurfaces(), and R_SetSurfaceBumpMappingParameters().
void R_EnableColorArray | ( | qboolean | enable | ) |
Definition at line 248 of file r_state.c.
References rstate_t::color_array_enabled, and r_state.
Referenced by R_DrawCoronas(), R_DrawFlareSurfaces(), R_DrawMaterialSurfaces(), R_SetDefaultState(), and R_SetSurfaceStageState().
void R_EnableDrawAsGlow | ( | qboolean | enable | ) |
Definition at line 577 of file r_state.c.
References rstate_t::draw_glow_enabled, GLenum, rstate_t::glowmap_enabled, cvar_s::integer, R_BindColorAttachments(), R_DrawBuffers(), r_postprocess, and r_state.
Referenced by R_EnableShell().
Enable or disable realtime dynamic lighting.
ent | The entity to enable/disable lighting for | |
enable | Whether to turn realtime lighting on or off |
Definition at line 297 of file r_state.c.
References r_light_s::ambientColor, rstate_t::bumpmap_enabled, r_light_s::constantAttenuation, r_light_s::diffuseColor, rstate_t::dynamic_lighting_enabled, r_light_s::enabled, rstate_t::glowmap_enabled, i, cvar_s::integer, rstate_t::lighting_enabled, r_light_s::linearAttenuation, r_light_s::loc, rstate_t::numActiveLights, qfalse, qtrue, r_light_s::quadraticAttenuation, R_DisableAttribute(), r_dynamic_lights, R_EnableAttribute(), R_ProgramParameter1f(), R_ProgramParameter1i(), r_state, and r_light_s::specularColor.
Referenced by R_DrawMaterialSurfaces().
void R_EnableFog | ( | qboolean | enable | ) |
Definition at line 518 of file r_state.c.
References rstate_t::fog_enabled, rendererData_t::fogColor, cvar_s::integer, qfalse, qtrue, r_fog, r_state, refdef, rendererData_t::weather, and WEATHER_FOG.
Referenced by R_DrawBspModelSurfaces(), R_DrawMaterialSurfaces(), R_RenderFrame(), and R_SetSurfaceStageState().
Definition at line 539 of file r_state.c.
References rstate_t::active_program, rstate_t::draw_glow_enabled, GLenum, rstate_t::glowmap_enabled, cvar_s::integer, R_BindColorAttachments(), R_BindTextureForTexUnit(), R_DrawBuffers(), r_postprocess, R_ProgramParameter1f(), r_state, R_UseProgram(), rstate_t::simple_glow_program, image_s::texnum, and texunit_glowmap.
Referenced by R_DrawMaterialSurfaces(), R_DrawSurfaces(), R_SetSurfaceState(), and R_StageGlow().
qboolean R_EnableLighting | ( | r_program_t * | program, | |
qboolean | enable | |||
) |
Enables hardware-accelerated lighting with the specified program. This should be called after any texture units which will be active for lighting have been enabled.
Definition at line 266 of file r_state.c.
References rstate_t::active_program, r_program_s::id, cvar_s::integer, rstate_t::lighting_enabled, r_lights, r_programs, r_state, and R_UseProgram().
Referenced by R_DrawAlphaTestSurfaces(), R_DrawBlendMeshEntities(), R_DrawMaterialSurfaces(), R_DrawOpaqueMeshEntities(), R_DrawOpaqueSurfaces(), R_SphereShadeGLSL(), and R_StageLighting().
Definition at line 612 of file r_state.c.
References rstate_t::dynamic_lighting_enabled, qfalse, R_BindTextureForTexUnit(), R_ProgramParameter1i(), r_state, rstate_t::roughnessmap_enabled, image_s::texnum, and texunit_roughnessmap.
void R_EnableShell | ( | qboolean | enable | ) |
Definition at line 485 of file r_state.c.
References rstate_t::lighting_enabled, qfalse, qtrue, R_BlendFunc(), R_EnableBlend(), R_EnableDrawAsGlow(), R_ProgramParameter1f(), r_state, refdef, rstate_t::shell_enabled, and rendererData_t::time.
Referenced by R_DrawMeshModelShell().
Definition at line 597 of file r_state.c.
References rstate_t::dynamic_lighting_enabled, qfalse, R_BindTextureForTexUnit(), R_ProgramParameter1i(), r_state, rstate_t::specularmap_enabled, image_s::texnum, and texunit_specularmap.
void R_EnableTexture | ( | gltexunit_t * | texunit, | |
qboolean | enable | |||
) |
Definition at line 219 of file r_state.c.
References gltexunit_s::enabled, cvar_s::integer, r_lightmap, R_SelectTexture(), R_TexEnv(), texunit_diffuse, and texunit_lightmap.
Referenced by R_DrawBlendSurfaces(), R_DrawBspNormals(), R_DrawCoronas(), R_DrawFlatGeoscape(), R_DrawMaterialSurfaces(), R_DrawNullModel(), R_DrawOpaqueSurfaces(), R_DrawPtlCircle(), R_DrawPtlLine(), R_SetDefaultState(), R_SphereShade(), and R_StageLighting().
void R_EnableWarp | ( | r_program_t * | program, | |
qboolean | enable | |||
) |
Definition at line 430 of file r_state.c.
References r_program_s::id, cvar_s::integer, R_BindTexture, r_programs, R_SelectTexture(), r_state, R_UseProgram(), r_warp, r_warpTexture, image_s::texnum, texunit_diffuse, texunit_lightmap, and rstate_t::warp_enabled.
Referenced by R_DrawBlendWarpSurfaces(), and R_DrawOpaqueWarpSurfaces().
qboolean R_SelectTexture | ( | gltexunit_t * | texunit | ) |
Returns qfalse if the texunit is not supported.
Definition at line 37 of file r_state.c.
References rstate_t::active_texunit, rconfig_t::maxTextureCoords, qfalse, qtrue, r_config, r_state, and gltexunit_s::texture.
Referenced by R_BindTextureForTexUnit(), R_DrawFlatGeoscape(), R_EnableBlur(), R_EnableTexture(), R_EnableWarp(), R_ResetArrayState(), R_SetDefaultState(), R_SetVertexArrayState(), R_SetVertexBufferState(), R_SphereActivateTextureUnit(), R_SphereDeactivateTextureUnit(), R_SphereShade(), and R_SphereShadeGLSL().
void R_SetDefaultState | ( | void | ) |
Definition at line 742 of file r_state.c.
References f, FOG_END, FOG_START, i, MAX_GL_TEXUNITS, rconfig_t::maxTextureCoords, qfalse, qtrue, R_BindDefaultArray(), R_BlendFunc(), R_CheckError, R_ClearActiveLights(), r_config, R_EnableColorArray(), R_EnableTexture(), R_SelectTexture(), r_state, gltexunit_s::texture, texunit_diffuse, and rstate_t::texunits.
Referenced by R_Init().
void R_Setup2D | ( | void | ) |
Definition at line 702 of file r_state.c.
References viddef_t::height, qfalse, R_BindDefaultArray(), R_CheckError, R_Color(), R_EnableRenderbuffer(), SKYBOX_DEPTH, viddef, and viddef_t::width.
Referenced by R_BeginFrame(), and R_RenderFrame().
void R_Setup3D | ( | void | ) |
Definition at line 650 of file r_state.c.
References viddef_t::height, MAX_WORLD_WIDTH, MYgluPerspective(), qtrue, R_BindDefaultArray(), R_CheckError, R_EnableRenderbuffer(), r_locals, refdef, viddef, rendererData_t::viewAngles, viddef_t::viewHeight, rendererData_t::viewOrigin, viddef_t::viewWidth, viddef_t::width, rlocals_s::world_matrix, viddef_t::x, and viddef_t::y.
Referenced by R_RenderFrame().
void R_TexEnv | ( | GLenum | mode | ) |
Definition at line 802 of file r_state.c.
References rstate_t::active_texunit, r_state, and gltexunit_s::texenv.
Referenced by R_DrawParticles(), R_EnableTexture(), and R_SetBlendMode().
{ 0.0, 0.0, 0.0, 1.0 }
Definition at line 733 of file r_state.c.
Referenced by BuildLights().
const vec4_t color_white = {1, 1, 1, 1} |
const vec2_t default_texcoords[4] |
{ {0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0} }
Definition at line 30 of file r_state.c.
Referenced by R_DrawFlareSurfaces(), and R_DrawTexture().
{ 1.0, 1.0, 1.0, 1.0 }
Definition at line 738 of file r_state.c.
Referenced by R_LoadSurfacesArrays_().
const float SKYBOX_DEPTH |
Center position of skybox along z-axis. This is used to make sure we see only the inside of Skybox.
Definition at line 294 of file r_geoscape.c.
Referenced by R_DrawBloom(), R_DrawStarfield(), and R_Setup2D().