r_state.h File Reference

#include "r_program.h"
#include "r_material.h"
#include "r_framebuffer.h"
#include "r_light.h"
Include dependency graph for r_state.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gltexunit_s
 texunits maintain multitexture state More...
struct  rstate_t

Defines

#define MAX_GL_ARRAY_LENGTH   0x40000
#define MAX_GL_TEXUNITS   5
#define texunit_0   r_state.texunits[0]
#define texunit_1   r_state.texunits[1]
#define texunit_2   r_state.texunits[2]
#define texunit_3   r_state.texunits[3]
#define texunit_4   r_state.texunits[4]
#define texunit_diffuse   texunit_0
#define texunit_lightmap   texunit_1
#define texunit_deluxemap   texunit_2
#define texunit_normalmap   texunit_3
#define texunit_glowmap   texunit_4
#define texunit_specularmap   texunit_1
#define texunit_roughnessmap   texunit_2
#define DOWNSAMPLE_PASSES   5
#define DOWNSAMPLE_SCALE   2
#define fbo_screen   NULL
#define fbo_render   r_state.renderBuffer
#define fbo_bloom0   r_state.bloomBuffer0
#define fbo_bloom1   r_state.bloomBuffer1
#define default_program   NULL
#define R_BindTexture(tn)   R_BindTextureDebug(tn, __FILE__, __LINE__, __PRETTY_FUNCTION__)

Typedefs

typedef struct gltexunit_s gltexunit_t
 texunits maintain multitexture state

Functions

void R_SetDefaultState (void)
void R_Setup2D (void)
void R_Setup3D (void)
void R_TexEnv (GLenum value)
void R_BlendFunc (GLenum src, GLenum dest)
qboolean R_SelectTexture (gltexunit_t *texunit)
 Returns qfalse if the texunit is not supported.
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_BindBuffer (GLenum target, GLenum type, GLuint id)
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_EnableTexture (gltexunit_t *texunit, qboolean enable)
void R_EnableBlend (qboolean enable)
void R_EnableAlphaTest (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_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_EnableDrawAsGlow (qboolean enable)
void R_EnableGlowMap (const image_t *image, qboolean enable)
void R_EnableDynamicLights (const entity_t *ent, qboolean enable)
 Enable or disable realtime dynamic lighting.
void R_EnableSpecularMap (const image_t *image, qboolean enable)
void R_EnableRoughnessMap (const image_t *image, qboolean enable)
void R_EnableAnimation (const mAliasMesh_t *mesh, float backlerp, qboolean enable)
 Enables animation using keyframe interpolation on the GPU.

Variables

const vec2_t default_texcoords [4]
rstate_t r_state

Detailed Description

Definition in file r_state.h.


Define Documentation

#define default_program   NULL

Definition at line 73 of file r_state.h.

Referenced by R_BlurStack(), and R_DrawBloom().

#define DOWNSAMPLE_PASSES   5

Definition at line 65 of file r_state.h.

Referenced by R_DrawBloom(), and R_InitFBObjects().

#define DOWNSAMPLE_SCALE   2

Definition at line 66 of file r_state.h.

Referenced by R_InitFBObjects().

#define fbo_bloom0   r_state.bloomBuffer0

Definition at line 70 of file r_state.h.

Referenced by R_DrawBloom(), and R_InitFBObjects().

#define fbo_bloom1   r_state.bloomBuffer1

Definition at line 71 of file r_state.h.

Referenced by R_DrawBloom(), and R_InitFBObjects().

#define fbo_render   r_state.renderBuffer

Definition at line 69 of file r_state.h.

Referenced by R_DrawBloom(), R_DrawQuad(), and R_EnableRenderbuffer().

#define fbo_screen   NULL

Definition at line 68 of file r_state.h.

Referenced by R_DrawBloom(), R_EnableBlur(), and R_EnableRenderbuffer().

#define MAX_GL_ARRAY_LENGTH   0x40000

Definition at line 35 of file r_state.h.

Referenced by R_DrawBspNormals(), R_DrawSurfaceStage(), and R_LoadBspVertexArrays().

#define MAX_GL_TEXUNITS   5

Definition at line 47 of file r_state.h.

Referenced by R_SetDefaultState().

#define R_BindTexture ( tn   )     R_BindTextureDebug(tn, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#define texunit_0   r_state.texunits[0]

Definition at line 50 of file r_state.h.

Referenced by R_Blur(), R_BlurStack(), and R_DrawBloom().

#define texunit_1   r_state.texunits[1]

Definition at line 51 of file r_state.h.

Referenced by R_BlurStack(), R_DrawBloom(), and R_SphereShadeGLSL().

#define texunit_2   r_state.texunits[2]

Definition at line 52 of file r_state.h.

Referenced by R_SphereShadeGLSL().

#define texunit_3   r_state.texunits[3]

Definition at line 53 of file r_state.h.

#define texunit_4   r_state.texunits[4]

Definition at line 54 of file r_state.h.

#define texunit_deluxemap   texunit_2

Definition at line 58 of file r_state.h.

Referenced by R_BindDeluxemapTexture().

#define texunit_diffuse   texunit_0
#define texunit_glowmap   texunit_4

Definition at line 60 of file r_state.h.

Referenced by R_EnableGlowMap().

#define texunit_lightmap   texunit_1
#define texunit_normalmap   texunit_3

Definition at line 59 of file r_state.h.

Referenced by R_BindNormalmapTexture().

#define texunit_roughnessmap   texunit_2

Definition at line 62 of file r_state.h.

Referenced by R_EnableRoughnessMap().

#define texunit_specularmap   texunit_1

Definition at line 61 of file r_state.h.

Referenced by R_EnableSpecularMap().


Typedef Documentation

typedef struct gltexunit_s gltexunit_t

texunits maintain multitexture state


Function Documentation

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

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_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  value  ) 

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

Definition at line 30 of file r_state.c.

Referenced by R_DrawFlareSurfaces(), and R_DrawTexture().

Definition at line 43 of file r_main.c.

Referenced by R_AddLightsource(), R_ArraysMask(), R_BindColorAttachments(), R_BindDefaultArray(), R_BindTexture_(), R_BlendFunc(), R_Blur(), R_BlurStack(), R_ClearActiveLights(), R_CreateFramebuffer(), R_Draw2DArray(), R_Draw3DGlobe(), R_DrawAliasStatic(), R_DrawAlphaTestSurfaces(), R_DrawBlendMeshEntities(), R_DrawBlendSurfaces(), R_DrawBlendWarpSurfaces(), R_DrawBloom(), R_DrawBspNormals(), R_DrawCoronas(), R_DrawFlareSurfaces(), R_DrawMaterialSurfaces(), R_DrawOpaqueMeshEntities(), R_DrawOpaqueSurfaces(), R_DrawOpaqueWarpSurfaces(), R_DrawSurfaces(), R_DrawSurfaceStage(), R_EnableAlphaTest(), R_EnableAnimation(), R_EnableBlend(), R_EnableBlur(), R_EnableBumpmap(), R_EnableColorArray(), R_EnableDrawAsGlow(), R_EnableDynamicLights(), R_EnableFog(), R_EnableGlowMap(), R_EnableLighting(), R_EnableRenderbuffer(), R_EnableRoughnessMap(), R_EnableShell(), R_EnableSpecularMap(), R_EnableWarp(), R_FillArrayData(), R_FontDrawTexture(), R_InitFBObjects(), R_InitPrograms(), R_LoadProgram(), R_LoadShader(), R_ProgramVariable(), R_RenderbufferEnabled(), R_ResetArrayState(), R_SelectTexture(), R_SetDefaultState(), R_SetSurfaceBumpMappingParameters(), R_SetSurfaceStageState(), R_SetSurfaceState(), R_SetVertexArrayState(), R_SetVertexBufferState(), R_ShutdownFBObjects(), R_ShutdownPrograms(), R_SortLightList_qsort(), R_StageGlow(), R_StageLighting(), R_TexEnv(), R_UpdateLightList(), R_UseFramebuffer(), R_UseMaterial(), R_UseProgram(), and R_UseViewport().


Generated by  doxygen 1.6.2