r_state.c File Reference

#include "r_local.h"
#include "r_program.h"
#include "r_error.h"
Include dependency graph for r_state.c:

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 Documentation

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


Function Documentation

static void MYgluPerspective ( GLdouble  zNear,
GLdouble  zFar 
) [static]
void R_BindArray ( GLenum  target,
GLenum  type,
const void *  array 
)
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  ) 
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  ) 
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 
)
void R_BlendFunc ( GLenum  src,
GLenum  dest 
)
void R_Color ( const vec4_t  rgba  ) 
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.

Parameters:
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  ) 
void R_EnableBlur ( r_program_t program,
qboolean  enable,
r_framebuffer_t source,
r_framebuffer_t dest,
int  dir 
)
void R_EnableBumpmap ( const image_t normalmap,
qboolean  enable 
)
void R_EnableColorArray ( qboolean  enable  ) 
void R_EnableDrawAsGlow ( qboolean  enable  ) 
void R_EnableDynamicLights ( const entity_t ent,
qboolean  enable 
)
void R_EnableFog ( qboolean  enable  ) 
void R_EnableGlowMap ( const image_t image,
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.

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

void R_EnableRoughnessMap ( const image_t image,
qboolean  enable 
)
void R_EnableShell ( qboolean  enable  ) 
void R_EnableSpecularMap ( const image_t image,
qboolean  enable 
)
void R_EnableTexture ( gltexunit_t texunit,
qboolean  enable 
)
void R_EnableWarp ( r_program_t program,
qboolean  enable 
)
qboolean R_SelectTexture ( gltexunit_t texunit  ) 
void R_SetDefaultState ( void   ) 
void R_Setup2D ( void   ) 
void R_Setup3D ( void   ) 
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().


Variable Documentation

const vec4_t ambient [static]
Initial value:
 {
    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}

Definition at line 811 of file r_state.c.

Referenced by R_Color().

Initial value:
 {
    {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().

const vec4_t material [static]
Initial value:
 {
    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.

See also:
R_DrawStarfield
R_Setup2D

Definition at line 294 of file r_geoscape.c.

Referenced by R_DrawBloom(), R_DrawStarfield(), and R_Setup2D().


Generated by  doxygen 1.6.2