UFO: Alien Invasion
r_array.cpp File Reference

Arrays are "lazily" managed to reduce glArrayPointer calls. Drawing routines should call R_SetArrayState or R_ResetArrayState somewhat early-on. More...

#include "r_local.h"
Include dependency graph for r_array.cpp:

Go to the source code of this file.

Data Structures

struct  r_array_state_t
 

Macros

#define R_ARRAY_VERTEX   0x1
 
#define R_ARRAY_COLOR   0x2
 
#define R_ARRAY_NORMAL   0x4
 
#define R_ARRAY_TANGENT   0x8
 
#define R_ARRAY_TEX_DIFFUSE   0x10
 
#define R_ARRAY_TEX_LIGHTMAP   0x20
 
#define R_ARRAY_ELEMENT   0x1000
 

Functions

static int R_ArraysMask (void)
 This function is consulted to determine whether or not array bindings are up to date. More...
 
static void R_SetVertexArrayState (const mBspModel_t *bsp, int mask)
 
static void R_SetVertexBufferState (const mBspModel_t *bsp, int mask)
 
void R_SetArrayState (const mBspModel_t *bsp)
 
void R_ResetArrayState (void)
 

Variables

static r_array_state_t r_array_state
 

Detailed Description

Arrays are "lazily" managed to reduce glArrayPointer calls. Drawing routines should call R_SetArrayState or R_ResetArrayState somewhat early-on.

Definition in file r_array.cpp.

Macro Definition Documentation

◆ R_ARRAY_COLOR

#define R_ARRAY_COLOR   0x2

Definition at line 31 of file r_array.cpp.

◆ R_ARRAY_ELEMENT

#define R_ARRAY_ELEMENT   0x1000

Definition at line 36 of file r_array.cpp.

◆ R_ARRAY_NORMAL

#define R_ARRAY_NORMAL   0x4

Definition at line 32 of file r_array.cpp.

◆ R_ARRAY_TANGENT

#define R_ARRAY_TANGENT   0x8

Definition at line 33 of file r_array.cpp.

◆ R_ARRAY_TEX_DIFFUSE

#define R_ARRAY_TEX_DIFFUSE   0x10

Definition at line 34 of file r_array.cpp.

◆ R_ARRAY_TEX_LIGHTMAP

#define R_ARRAY_TEX_LIGHTMAP   0x20

Definition at line 35 of file r_array.cpp.

◆ R_ARRAY_VERTEX

#define R_ARRAY_VERTEX   0x1

Definition at line 30 of file r_array.cpp.

Function Documentation

◆ R_ArraysMask()

static int R_ArraysMask ( void  )
static

This function is consulted to determine whether or not array bindings are up to date.

Returns
Returns a bitmask representing the arrays which should be enabled according to r_state.

Definition at line 52 of file r_array.cpp.

References rstate_t::color_array_enabled, rstate_t::lighting_enabled, R_ARRAY_COLOR, R_ARRAY_ELEMENT, R_ARRAY_NORMAL, R_ARRAY_TANGENT, R_ARRAY_TEX_DIFFUSE, R_ARRAY_TEX_LIGHTMAP, R_ARRAY_VERTEX, r_bumpmap, r_state, texunit_diffuse, texunit_lightmap, and cvar_t::value.

Referenced by R_SetArrayState().

◆ R_ResetArrayState()

◆ R_SetArrayState()

◆ R_SetVertexArrayState()

static void R_SetVertexArrayState ( const mBspModel_t bsp,
int  mask 
)
inlinestatic
See also
R_SetVertexBufferState
Parameters
[in]bspThe BSP model to use arrays from
[in]maskThe bitmask representing the arrays which should be enabled according to r_state.

Definition at line 82 of file r_array.cpp.

References GL_TANGENT_ARRAY, rstate_t::lighting_enabled, mBspModel_t::lmtexcoords, mBspModel_t::normals, R_ARRAY_NORMAL, R_ARRAY_TANGENT, R_ARRAY_TEX_DIFFUSE, R_ARRAY_TEX_LIGHTMAP, R_ARRAY_VERTEX, R_BindArray(), R_SelectTexture(), r_state, mBspModel_t::tangents, mBspModel_t::texcoords, texunit_diffuse, texunit_lightmap, and mBspModel_t::verts.

Referenced by R_SetArrayState().

◆ R_SetVertexBufferState()

static void R_SetVertexBufferState ( const mBspModel_t bsp,
int  mask 
)
inlinestatic
See also
R_SetVertexArrayState
Parameters
[in]bspThe BSP model to use arrays from
[in]maskThe bitmask representing the arrays which should be enabled according to r_state.
Note
r_vertexbuffers must be set to 1 to use this

Definition at line 118 of file r_array.cpp.

References GL_TANGENT_ARRAY, mBspModel_t::index_buffer, rstate_t::lighting_enabled, mBspModel_t::lmtexcoord_buffer, mBspModel_t::normal_buffer, R_ARRAY_ELEMENT, R_ARRAY_NORMAL, R_ARRAY_TANGENT, R_ARRAY_TEX_DIFFUSE, R_ARRAY_TEX_LIGHTMAP, R_ARRAY_VERTEX, R_BindBuffer(), R_SelectTexture(), r_state, mBspModel_t::tangent_buffer, mBspModel_t::texcoord_buffer, texunit_diffuse, texunit_lightmap, and mBspModel_t::vertex_buffer.

Referenced by R_SetArrayState().

Variable Documentation

◆ r_array_state

r_array_state_t r_array_state
static

Definition at line 43 of file r_array.cpp.

Referenced by R_ResetArrayState(), and R_SetArrayState().