UFO: Alien Invasion
Loading...
Searching...
No Matches
r_state.cpp File Reference
#include "r_local.h"
#include "r_program.h"
#include "r_error.h"
Include dependency graph for r_state.cpp:

Go to the source code of this file.

Macros

#define FOG_START   300.0
#define FOG_END   2500.0

Functions

bool R_SelectTexture (gltexunit_t *texunit)
 Returns false 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_UseMaterial (const material_t *material)
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_EnableMultisample (bool enable)
void R_EnableBlend (bool enable)
void R_EnableAlphaTest (bool enable)
void R_EnableStencilTest (bool enable)
void R_EnableTexture (gltexunit_t *texunit, bool enable)
void R_EnableColorArray (bool enable)
bool R_EnableLighting (r_program_t *program, bool 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_SetupSpotLight (int index, const light_t *light)
void R_DisableSpotLight (int index)
void R_EnableAnimation (const mAliasMesh_t *mesh, float backlerp, bool enable)
 Enables animation using keyframe interpolation on the GPU.
void R_EnableBumpmap (const image_t *normalmap)
 Enables bumpmapping and binds the given normalmap.
void R_EnableWarp (r_program_t *program, bool enable)
void R_EnableBlur (r_program_t *program, bool enable, r_framebuffer_t *source, r_framebuffer_t *dest, int dir)
void R_EnableShell (bool enable)
void R_EnableFog (bool enable)
static void R_UpdateGlowBufferBinding (void)
void R_EnableGlowMap (const image_t *image)
void R_EnableDrawAsGlow (bool enable)
void R_EnableSpecularMap (const image_t *image, bool enable)
void R_EnableRoughnessMap (const image_t *image, bool enable)
static void MYgluPerspective (GLfloat zNear, GLfloat zFar)
void R_Setup3D (void)
void R_Setup2D (void)
void R_SetDefaultState (void)
void R_TexEnv (GLenum modemode)
void R_TexOverride (vec4_t rgba)
 Sets special texture environment mode to override texture color; don't forget to call R_TexOverride(nullptr) to reset after drawing; intended for UI only, will conflict with lightmaps.
void R_Color (const vec4_t rgba)
 Change the color to given value.
void R_ReallocateStateArrays (int sizesize)
 Reallocate arrays of GL primitives if needed.
void R_ReallocateTexunitArray (gltexunit_t *texunit, int sizesize)
 Reallocate texcoord array of the specified texunit, if needed.

Variables

const vec2_t default_texcoords [4]
static r_program_t * lastProgram = nullptr
vec2_t fogRange = {FOG_START, FOG_END}
const vec4_t color_white = {1, 1, 1, 1}

Macro Definition Documentation

◆ FOG_END

#define FOG_END   2500.0

Definition at line 582 of file r_state.cpp.

Referenced by R_SetDefaultState().

◆ FOG_START

#define FOG_START   300.0

Definition at line 581 of file r_state.cpp.

Referenced by R_SetDefaultState().

Function Documentation

◆ MYgluPerspective()

void MYgluPerspective ( GLfloat zNear,
GLfloat zFar )
static

◆ R_BindArray()

◆ R_BindBuffer()

void R_BindBuffer ( GLenum target,
GLenum type,
GLuint id )

◆ R_BindDefaultArray()

◆ R_BindDeluxemapTexture()

void R_BindDeluxemapTexture ( GLuint texnum)

◆ R_BindLightmapTexture()

◆ R_BindNormalmapTexture()

void R_BindNormalmapTexture ( GLuint texnum)

◆ R_BindTexture_()

void R_BindTexture_ ( int texnum)
static

◆ R_BindTextureDebug()

void R_BindTextureDebug ( int texnum,
const char * file,
int line,
const char * function )

Definition at line 69 of file r_state.cpp.

References Com_Printf(), R_BindTexture_(), and R_BindTextureDebug().

Referenced by R_BindTextureDebug().

◆ R_BindTextureForTexUnit()

◆ R_BlendFunc()

◆ R_Color()

◆ R_DisableSpotLight()

◆ R_EnableAlphaTest()

void R_EnableAlphaTest ( bool enable)

◆ R_EnableAnimation()

void R_EnableAnimation ( const mAliasMesh_t * mesh,
float backlerp,
bool enable )

◆ R_EnableBlend()

◆ R_EnableBlur()

◆ R_EnableBumpmap()

void R_EnableBumpmap ( const image_t * normalmap)

◆ R_EnableColorArray()

◆ R_EnableDrawAsGlow()

◆ R_EnableFog()

◆ R_EnableGlowMap()

◆ R_EnableLighting()

bool R_EnableLighting ( r_program_t * program,
bool 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 350 of file r_state.cpp.

References rstate_t::active_program, r_program_t::id, cvar_t::integer, rstate_t::lighting_enabled, R_EnableLighting(), r_programs, r_state, and R_UseProgram().

Referenced by R_DrawBlendMeshEntities(), R_DrawMaterialSurfaces(), R_DrawMeshShadow(), R_DrawOpaqueMeshEntities(), R_EnableLighting(), R_RenderAlphaTestBspRRefs(), R_RenderOpaqueBspRRefs(), R_SphereShadeGLSL(), and R_StageLighting().

◆ R_EnableMultisample()

void R_EnableMultisample ( bool enable)

◆ R_EnableRoughnessMap()

◆ R_EnableShell()

◆ R_EnableSpecularMap()

◆ R_EnableStencilTest()

void R_EnableStencilTest ( bool enable)

Definition at line 290 of file r_state.cpp.

References R_EnableStencilTest(), r_state, and rstate_t::stencil_test_enabled.

Referenced by R_DrawMeshShadow(), and R_EnableStencilTest().

◆ R_EnableTexture()

◆ R_EnableWarp()

◆ R_ReallocateStateArrays()

◆ R_ReallocateTexunitArray()

void R_ReallocateTexunitArray ( gltexunit_t * texunit,
int size )

Reallocate texcoord array of the specified texunit, if needed.

Parameters
texunitPointer to texunit (TODO: remove this comment as obvious and redundant)
sizeThe new array size
Note
Also resets active texunit
See also
R_ReallocateStateArrays

Definition at line 1059 of file r_state.cpp.

References rstate_t::active_texunit, gltexunit_t::array_size, COMPONENTS_TEXCOORD_ARRAY, Mem_SafeReAlloc, R_BindDefaultArray(), R_ReallocateTexunitArray(), r_state, and gltexunit_t::texcoord_array.

Referenced by R_DrawSurfaceStage(), R_FillArrayData(), R_ReallocateTexunitArray(), and R_SetDefaultState().

◆ R_SelectTexture()

◆ R_SetDefaultState()

◆ R_Setup2D()

◆ R_Setup3D()

◆ R_SetupSpotLight()

◆ R_TexEnv()

◆ R_TexOverride()

void R_TexOverride ( vec4_t rgba)

Sets special texture environment mode to override texture color; don't forget to call R_TexOverride(nullptr) to reset after drawing; intended for UI only, will conflict with lightmaps.

Definition at line 968 of file r_state.cpp.

References GL_SOURCE0_ALPHA, GL_SOURCE0_RGB, GL_SOURCE1_RGB, GL_SOURCE2_RGB, R_BindTexture, r_dummyTexture, R_SelectTexture(), R_TexEnv(), R_TexOverride(), image_t::texnum, texunit_diffuse, and texunit_lightmap.

Referenced by R_TexOverride(), UI_DisableFlashing(), and UI_EnableFlashing().

◆ R_UpdateGlowBufferBinding()

◆ R_UseMaterial()

Variable Documentation

◆ color_white

const vec4_t color_white = {1, 1, 1, 1}

Definition at line 1004 of file r_state.cpp.

Referenced by R_Color().

◆ default_texcoords

const vec2_t default_texcoords[4]
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.cpp.

Referenced by R_DrawFlareSurfaces(), and R_DrawTexture().

◆ fogRange

◆ lastProgram

r_program_t* lastProgram = nullptr
static

Definition at line 35 of file r_state.cpp.

Referenced by R_EnableDrawAsGlow(), and R_EnableGlowMap().