UFO: Alien Invasion
Loading...
Searching...
No Matches
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.
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.

Referenced by R_ArraysMask().

◆ R_ARRAY_ELEMENT

#define R_ARRAY_ELEMENT   0x1000

Definition at line 36 of file r_array.cpp.

Referenced by R_ArraysMask(), and R_SetVertexBufferState().

◆ R_ARRAY_NORMAL

#define R_ARRAY_NORMAL   0x4

Definition at line 32 of file r_array.cpp.

Referenced by R_ArraysMask(), R_SetVertexArrayState(), and R_SetVertexBufferState().

◆ R_ARRAY_TANGENT

#define R_ARRAY_TANGENT   0x8

Definition at line 33 of file r_array.cpp.

Referenced by R_ArraysMask(), R_SetVertexArrayState(), and R_SetVertexBufferState().

◆ R_ARRAY_TEX_DIFFUSE

#define R_ARRAY_TEX_DIFFUSE   0x10

Definition at line 34 of file r_array.cpp.

Referenced by R_ArraysMask(), R_SetVertexArrayState(), and R_SetVertexBufferState().

◆ R_ARRAY_TEX_LIGHTMAP

#define R_ARRAY_TEX_LIGHTMAP   0x20

Definition at line 35 of file r_array.cpp.

Referenced by R_ArraysMask(), R_SetVertexArrayState(), and R_SetVertexBufferState().

◆ R_ARRAY_VERTEX

#define R_ARRAY_VERTEX   0x1

Definition at line 30 of file r_array.cpp.

Referenced by R_ArraysMask(), R_SetVertexArrayState(), and R_SetVertexBufferState().

Function Documentation

◆ R_ArraysMask()

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 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, and texunit_lightmap.

Referenced by R_SetArrayState().

◆ R_ResetArrayState()

◆ R_SetArrayState()

void R_SetArrayState ( const mBspModel_t * bsp)

◆ R_SetVertexArrayState()

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

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