UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
r_local.h File Reference

local graphics definitions More...

#include "../../common/common.h"
#include "../../common/qfiles.h"
#include "../cl_renderer.h"
#include "../cl_video.h"
#include "r_gl.h"
#include "r_state.h"
#include "r_array.h"
#include "r_material.h"
#include "r_image.h"
#include "r_model.h"
#include "r_thread.h"
#include "r_framebuffer.h"
#include "r_lightmap.h"
#include "r_corona.h"
#include "r_flare.h"

Go to the source code of this file.

Data Structures

struct  rlocals_s
 
struct  rconfig_t
 GL config stuff. More...
 

Macros

#define MIN_GL_CONSTANT_ATTENUATION   0.01
 

Typedefs

typedef struct rlocals_s rlocals_t
 

Enumerations

enum  hardwareType_t {
  GLHW_GENERIC, GLHW_MESA, GLHW_INTEL, GLHW_ATI,
  GLHW_NVIDIA
}
 

Functions

void R_DrawSurfaces (const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr)
 General surface drawing function, that draw the surface chains. More...
 
void R_DrawMaterialSurfaces (const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr)
 Iterates the specified surfaces list, updating materials as they are encountered, and rendering all visible stages. State is lazily managed throughout the iteration, so there is a concerted effort to restore the state after all surface stages have been rendered. More...
 
void R_SetSurfaceBumpMappingParameters (const mBspSurface_t *surf, const image_t *normalMap, const image_t *specularMap)
 
bool R_CullMeshModel (const entity_t *e)
 Checks whether a model is visible in the current scene. More...
 
void R_DrawModelParticle (modelInfo_t *mi)
 Renders a particle model for the battlescape. More...
 
void R_DrawBspNormals (int tile)
 Developer tool for viewing BSP vertex normals. Only Phong interpolated surfaces show their normals when r_shownormals > 1. More...
 
bool R_CullBspModel (const entity_t *e)
 Returns true if the specified entity is completely culled by the view frustum, false otherwise. More...
 
bool R_CullSphere (const vec3_t centre, const float radius, const unsigned int clipflags)
 Performs a spherical frustum check. More...
 
void R_GetLevelSurfaceLists (void)
 Fills the surface chains for the current worldlevel and hide other levels. More...
 
void R_GetEntityLists (void)
 Primary entry point for drawing all entities. More...
 
void R_DrawInitLocal (void)
 Loads some textures and init the 3d globe. More...
 
void R_DrawParticles (void)
 
void R_SetupFrustum (void)
 
void R_ClearBspRRefs (void)
 
void R_AddBspRRef (const mBspModel_t *model, const vec3_t origin, const vec3_t angles, const bool forceVisibility)
 Adds bsp render references. More...
 
void R_RenderOpaqueBspRRefs (void)
 Draw all simple opaque bsp surfaces with multitexture enabled and light enabled. More...
 
void R_RenderOpaqueWarpBspRRefs (void)
 Draw all warped opaque bsp surfaces via warp shader. More...
 
void R_RenderAlphaTestBspRRefs (void)
 
void R_RenderMaterialBspRRefs (void)
 
void R_RenderFlareBspRRefs (void)
 
void R_RenderBlendBspRRefs (void)
 Draw all translucent bsp surfaces with multitexture enabled and blend enabled. More...
 
void R_RenderBlendWarpBspRRefs (void)
 Draw all warped translucent bsp surfaces via warp shader and with blend enabled. More...
 
bool Rimp_Init (void)
 
void Rimp_Shutdown (void)
 
bool R_InitGraphics (const viddefContext_t *context)
 Init the SDL window. More...
 

Variables

cvar_tr_drawworld
 
cvar_tr_drawentities
 
cvar_tr_nocull
 
cvar_tr_isometric
 
cvar_tr_anisotropic
 
cvar_tr_texture_lod
 
cvar_tr_materials
 
cvar_tr_overridematerial
 
cvar_tr_default_specular
 
cvar_tr_default_hardness
 
cvar_tr_screenshot_format
 
cvar_tr_screenshot_jpeg_quality
 
cvar_tr_lightmap
 
cvar_tr_debug_normals
 
cvar_tr_debug_tangents
 
cvar_tr_debug_lights
 
cvar_tr_ext_texture_compression
 
cvar_tr_checkerror
 
cvar_tr_particles
 
cvar_tr_showbox
 
cvar_tr_shadows
 
cvar_tr_stencilshadows
 
cvar_tr_drawbuffer
 
cvar_tr_driver
 
cvar_tr_swapinterval
 
cvar_tr_multisample
 
cvar_tr_threads
 
cvar_tr_wire
 
cvar_tr_vertexbuffers
 
cvar_tr_maxlightmap
 
cvar_tr_warp
 
cvar_tr_programs
 
cvar_tr_glsl_version
 The GLSL version being used (not necessarily a supported version by the OpenGL implementation). Stored as a c-string and integer. More...
 
cvar_tr_postprocess
 
cvar_tr_shownormals
 
cvar_tr_bumpmap
 
cvar_tr_specular
 
cvar_tr_hardness
 
cvar_tr_parallax
 
cvar_tr_fog
 
cvar_tr_flares
 
cvar_tr_coronas
 
cvar_tr_dynamic_lights
 
cvar_tr_drawtags
 
rlocals_t r_locals
 
rconfig_t r_config
 

Detailed Description

local graphics definitions

Definition in file r_local.h.

Macro Definition Documentation

#define MIN_GL_CONSTANT_ATTENUATION   0.01

Definition at line 45 of file r_local.h.

Referenced by R_DisableLights(), R_DisableSpotLight(), and R_SetupSpotLight().

Typedef Documentation

typedef struct rlocals_s rlocals_t

Enumeration Type Documentation

Enumerator
GLHW_GENERIC 
GLHW_MESA 
GLHW_INTEL 
GLHW_ATI 
GLHW_NVIDIA 

Definition at line 146 of file r_local.h.

Function Documentation

void R_AddBspRRef ( const mBspModel_t model,
const vec3_t  origin,
const vec3_t  angles,
const bool  forceVisibility 
)

Adds bsp render references.

Note
If forceVisibility is set, will mark the surfaces of the given bsp model as visible for this frame.
Parameters
[in]modelThe bsp model to add to the render chain
[in]origin
[in]angles
[in]forceVisibilityforce model to be fully visible

Definition at line 324 of file r_bsp.cpp.

References bspRenderRef_s::angles, bspRenderRef_s::bsp, Com_Printf(), mBspModel_s::firstmodelsurface, mBspSurface_s::frame, rlocals_s::frame, i, MAX_BSPS_TO_RENDER, numBspRRefs, mBspModel_s::nummodelsurfaces, bspRenderRef_s::origin, r_locals, mBspModel_s::surfaces, and VectorCopy.

Referenced by R_GetEntityLists(), and R_RenderFrame().

void R_ClearBspRRefs ( void  )

Definition at line 311 of file r_bsp.cpp.

References numBspRRefs.

Referenced by R_ClearScene().

bool R_CullBspModel ( const entity_t e)

Returns true if the specified entity is completely culled by the view frustum, false otherwise.

Parameters
[in]eThe entity to check
See also
R_CullBox

Definition at line 108 of file r_bsp.cpp.

References AABB::expand(), AABB::getMaxs(), AABB::getMins(), entity_t::origin, PSIDE_BACK, R_CullBox(), and AABB::shift().

Referenced by R_CullEntity().

bool R_CullMeshModel ( const entity_t e)

Checks whether a model is visible in the current scene.

Parameters
[in]eThe entity to check
Returns
false if visible, true if the entity is outside the current view

Definition at line 446 of file r_mesh.cpp.

References AngleVectors(), cBspPlane_s::dist, DotProduct, f, rlocals_s::frustum, i, lengthof, cBspPlane_s::normal, entity_t::origin, r_locals, VectorAdd, VectorCopy, and YAW.

Referenced by R_CullEntity().

bool R_CullSphere ( const vec3_t  centre,
const float  radius,
const unsigned int  clipflags 
)

Performs a spherical frustum check.

Parameters
[in]centreThe world coordinate that is the center of the sphere
[in]radiusThe radius of the sphere to check the frustum for
[in]clipflagsCan be used to skip sides of the frustum planes
Returns
true if the sphere is completely outside the frustum, false otherwise

Definition at line 83 of file r_bsp.cpp.

References cBspPlane_s::dist, DotProduct, rlocals_s::frustum, i, cvar_s::integer, lengthof, cBspPlane_s::normal, r_locals, and r_nocull.

void R_DrawInitLocal ( void  )

Loads some textures and init the 3d globe.

See also
R_Init

Definition at line 83 of file r_draw.cpp.

References Com_Error(), Com_Printf(), ERR_FATAL, it_chars, it_effect, R_FindImage(), and r_noTexture.

Referenced by R_Init().

void R_DrawMaterialSurfaces ( const mBspSurfaces_t surfs,
glElementIndex_t indexPtr 
)

Iterates the specified surfaces list, updating materials as they are encountered, and rendering all visible stages. State is lazily managed throughout the iteration, so there is a concerted effort to restore the state after all surface stages have been rendered.

Todo:
  • integrate BSP lighting with model lighting

Definition at line 399 of file r_material.cpp.

References rstate_s::blend_enabled, mBspSurfaces_s::count, f, mBspSurface_s::frame, rlocals_s::frame, i, mBspTexInfo_s::image, cvar_s::integer, m, image_s::material, materialStage_s::next, R_BlendFunc(), R_Color(), R_DrawSurfaceStage(), R_EnableBumpmap(), R_EnableColorArray(), R_EnableFog(), R_EnableGlowMap(), R_EnableLighting(), R_EnableModelLights(), R_EnableTexture(), r_locals, r_materials, R_ResetArrayState(), R_SetSurfaceStageState(), r_state, R_UpdateMaterial(), r_wire, STAGE_RENDER, material_s::stages, mBspSurfaces_s::surfaces, mBspSurface_s::texinfo, and texunit_lightmap.

Referenced by R_RenderMaterialBspRRefs().

void R_GetLevelSurfaceLists ( void  )

Fills the surface chains for the current worldlevel and hide other levels.

See also
cvar cl_worldlevel

Definition at line 281 of file r_bsp.cpp.

References model_s::bsp, mBspHeader_s::headnode, i, cvar_s::integer, LEVEL_LASTVISIBLE, mBspModel_s::nodes, mBspHeader_s::numfaces, r_drawworld, r_mapTiles, r_numMapTiles, R_RecurseWorld(), refdef, mBspModel_s::submodels, and rendererData_t::worldlevel.

Referenced by R_RenderFrame(), and R_RunThread().

bool R_InitGraphics ( const viddefContext_t context)
void R_RenderBlendBspRRefs ( void  )

Draw all translucent bsp surfaces with multitexture enabled and blend enabled.

Definition at line 462 of file r_bsp.cpp.

References rstate_s::blend_enabled, R_DrawSurfaces(), R_EnableTexture(), R_RenderBspRRefs(), r_state, S_BLEND, and texunit_lightmap.

Referenced by R_RenderFrame().

void R_RenderBlendWarpBspRRefs ( void  )

Draw all warped translucent bsp surfaces via warp shader and with blend enabled.

Definition at line 475 of file r_bsp.cpp.

References rstate_s::blend_enabled, R_DrawSurfaces(), R_EnableGlowMap(), R_EnableWarp(), R_RenderBspRRefs(), r_state, S_BLEND_WARP, and rstate_s::warp_program.

Referenced by R_RenderFrame().

void R_RenderFlareBspRRefs ( void  )

Definition at line 454 of file r_bsp.cpp.

References R_DrawFlareSurfaces(), R_RenderBspRRefs(), and S_FLARE.

Referenced by R_RenderFrame().

void R_RenderMaterialBspRRefs ( void  )

Definition at line 449 of file r_bsp.cpp.

References R_DrawMaterialSurfaces(), R_RenderBspRRefs(), and S_MATERIAL.

Referenced by R_RenderFrame().

void R_RenderOpaqueBspRRefs ( void  )

Draw all simple opaque bsp surfaces with multitexture enabled and light enabled.

Definition at line 410 of file r_bsp.cpp.

References R_DrawSurfaces(), R_EnableGlowMap(), R_EnableLighting(), R_EnableTexture(), R_EnableWorldLights(), R_RenderBspRRefs(), r_state, S_OPAQUE, texunit_lightmap, and rstate_s::world_program.

Referenced by R_RenderFrame().

void R_RenderOpaqueWarpBspRRefs ( void  )

Draw all warped opaque bsp surfaces via warp shader.

Definition at line 426 of file r_bsp.cpp.

References R_DrawSurfaces(), R_EnableGlowMap(), R_EnableWarp(), R_RenderBspRRefs(), r_state, S_OPAQUE_WARP, and rstate_s::warp_program.

Referenced by R_RenderFrame().

void Rimp_Shutdown ( void  )

Definition at line 282 of file r_sdl.cpp.

References cls.

Referenced by R_Shutdown().

Variable Documentation

cvar_t* r_anisotropic

Definition at line 64 of file r_main.cpp.

cvar_t* r_bumpmap
cvar_t* r_checkerror

Definition at line 84 of file r_main.cpp.

Referenced by R_CheckErrorDebug().

cvar_t* r_coronas

Definition at line 109 of file r_main.cpp.

Referenced by R_AddCorona(), and R_DrawCoronas().

cvar_t* r_debug_lights

Definition at line 71 of file r_main.cpp.

Referenced by R_DrawAliasModel().

cvar_t* r_debug_normals

Definition at line 69 of file r_main.cpp.

cvar_t* r_debug_tangents

Definition at line 70 of file r_main.cpp.

cvar_t* r_default_hardness

Definition at line 83 of file r_main.cpp.

Referenced by R_UpdateDefaultMaterial().

cvar_t* r_default_specular

Definition at line 82 of file r_main.cpp.

Referenced by R_UpdateDefaultMaterial().

cvar_t* r_drawbuffer

Definition at line 85 of file r_main.cpp.

cvar_t* r_drawentities

Definition at line 60 of file r_main.cpp.

Referenced by R_GetEntityLists().

cvar_t* r_drawtags

Definition at line 110 of file r_main.cpp.

Referenced by R_DrawAliasModelBuffer().

cvar_t* r_drawworld

Definition at line 61 of file r_main.cpp.

Referenced by R_GetLevelSurfaceLists().

cvar_t* r_driver

Definition at line 86 of file r_main.cpp.

Referenced by Rimp_Init().

cvar_t* r_ext_texture_compression

Definition at line 73 of file r_main.cpp.

cvar_t* r_flares

Definition at line 108 of file r_main.cpp.

Referenced by R_DrawFlareSurfaces().

cvar_t* r_glsl_version

The GLSL version being used (not necessarily a supported version by the OpenGL implementation). Stored as a c-string and integer.

Definition at line 99 of file r_main.cpp.

Referenced by R_InitializeShader().

cvar_t* r_hardness

Definition at line 105 of file r_main.cpp.

Referenced by R_UseMaterial().

cvar_t* r_isometric

Definition at line 63 of file r_main.cpp.

Referenced by MYgluPerspective().

cvar_t* r_lightmap

Definition at line 68 of file r_main.cpp.

Referenced by R_EnableTexture().

cvar_t* r_materials

Definition at line 80 of file r_main.cpp.

Referenced by R_DrawMaterialSurfaces(), R_LoadMaterials(), and R_StageLighting().

cvar_t* r_maxlightmap

Definition at line 101 of file r_main.cpp.

Referenced by R_BeginBuildingLightmaps().

cvar_t* r_multisample

Definition at line 90 of file r_main.cpp.

Referenced by R_CreateFramebuffer(), and R_EnableMultisample().

cvar_t* r_nocull

Definition at line 62 of file r_main.cpp.

Referenced by R_CullBox(), R_CullEntity(), and R_CullSphere().

cvar_t* r_overridematerial

Definition at line 81 of file r_main.cpp.

Referenced by R_LoadMaterials().

cvar_t* r_parallax

Definition at line 106 of file r_main.cpp.

Referenced by R_UseMaterial().

cvar_t* r_particles

Definition at line 32 of file r_particle.cpp.

Referenced by R_RegisterSystemVars().

cvar_t* r_screenshot_format

Definition at line 66 of file r_main.cpp.

Referenced by R_ScreenShot().

cvar_t* r_screenshot_jpeg_quality

Definition at line 67 of file r_main.cpp.

Referenced by R_ScreenShot().

cvar_t* r_shadows

Definition at line 87 of file r_main.cpp.

Referenced by R_DrawMeshShadow().

cvar_t* r_showbox
cvar_t* r_shownormals

Definition at line 102 of file r_main.cpp.

Referenced by R_DrawBspNormals().

cvar_t* r_specular

Definition at line 104 of file r_main.cpp.

Referenced by R_UseMaterial().

cvar_t* r_stencilshadows

Definition at line 88 of file r_main.cpp.

Referenced by R_DrawEntityEffects(), and R_DrawMeshShadow().

cvar_t* r_swapinterval

Definition at line 89 of file r_main.cpp.

cvar_t* r_texture_lod

Definition at line 65 of file r_main.cpp.

Referenced by R_UploadTexture().

cvar_t* r_threads

Definition at line 93 of file r_main.cpp.

Referenced by R_RunThread(), and R_ShutdownThreads().

cvar_t* r_vertexbuffers

Definition at line 94 of file r_main.cpp.

Referenced by R_BindBuffer(), R_RenderBspRRefs(), R_ResetArrayState(), and R_SetArrayState().

cvar_t* r_warp

Definition at line 95 of file r_main.cpp.

Referenced by R_EnableWarp().

cvar_t* r_wire

Definition at line 91 of file r_main.cpp.

Referenced by R_DrawMaterialSurfaces(), and R_DrawMeshShadow().