UFO: Alien Invasion
Loading...
Searching...
No Matches
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"
Include dependency graph for r_local.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rlocals_t
struct  rconfig_t
 GL config stuff. More...

Macros

#define MIN_GL_CONSTANT_ATTENUATION   0.01

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.
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.
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.
void R_DrawModelParticle (modelInfo_t *mi)
 Renders a particle model for the battlescape.
void R_DrawBspNormals (int tile)
 Developer tool for viewing BSP vertex normals. Only Phong interpolated surfaces show their normals when r_shownormals > 1.
bool R_CullBspModel (const entity_t *e)
 Returns true if the specified entity is completely culled by the view frustum, false otherwise.
bool R_CullSphere (const vec3_t centre, const float radius, const unsigned int clipflags)
 Performs a spherical frustum check.
void R_GetLevelSurfaceLists (void)
 Fills the surface chains for the current worldlevel and hide other levels.
void R_GetEntityLists (void)
 Primary entry point for drawing all entities.
void R_DrawInitLocal (void)
 Loads some textures and init the 3d globe.
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.
void R_RenderOpaqueBspRRefs (void)
 Draw all simple opaque bsp surfaces with multitexture enabled and light enabled.
void R_RenderOpaqueWarpBspRRefs (void)
 Draw all warped opaque bsp surfaces via warp shader.
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.
void R_RenderBlendWarpBspRRefs (void)
 Draw all warped translucent bsp surfaces via warp shader and with blend enabled.
bool Rimp_Init (void)
void Rimp_Shutdown (void)
bool R_InitGraphics (const viddefContext_t *context)
 Init the SDL window.

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

◆ MIN_GL_CONSTANT_ATTENUATION

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

Enumeration Type Documentation

◆ hardwareType_t

Enumerator
GLHW_GENERIC 
GLHW_MESA 
GLHW_INTEL 
GLHW_ATI 
GLHW_NVIDIA 

Definition at line 146 of file r_local.h.

Function Documentation

◆ R_AddBspRRef()

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_t::angles, bspRenderRef_t::bsp, bspRRefs, Com_Printf(), mBspModel_t::firstmodelsurface, mBspSurface_t::frame, i, MAX_BSPS_TO_RENDER, numBspRRefs, mBspModel_t::nummodelsurfaces, bspRenderRef_t::origin, r_locals, mBspModel_t::surfaces, and VectorCopy.

Referenced by R_GetEntityLists(), and R_RenderFrame().

◆ R_ClearBspRRefs()

void R_ClearBspRRefs ( void )

Definition at line 311 of file r_bsp.cpp.

References numBspRRefs.

Referenced by R_ClearScene().

◆ R_CullBspModel()

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::isOriginBrushModel, entity_t::model, entity_t::origin, PSIDE_BACK, R_CullBox(), and AABB::shift().

Referenced by R_CullEntity().

◆ R_CullMeshModel()

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 entity_t::angles, AngleVectors(), cBspPlane_t::dist, DotProduct, f, i, lengthof, entity_t::model, cBspPlane_t::normal, entity_t::origin, r_locals, entity_t::scale, entity_t::tagent, VectorAdd, VectorCopy, and YAW.

Referenced by R_CullEntity().

◆ R_CullSphere()

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_t::dist, DotProduct, i, lengthof, cBspPlane_t::normal, r_locals, and r_nocull.

◆ R_DrawBspNormals()

void R_DrawBspNormals ( int tile)

◆ R_DrawInitLocal()

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(), draw_chars, ERR_FATAL, it_chars, it_effect, R_FindImage(), r_noTexture, and shadow.

Referenced by R_Init().

◆ R_DrawMaterialSurfaces()

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 mBspSurfaces_t::count, mBspSurface_t::frame, i, mBspTexInfo_t::image, m, image_t::material, 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, mBspSurfaces_t::surfaces, mBspSurface_t::texinfo, and texunit_lightmap.

Referenced by R_RenderMaterialBspRRefs().

◆ R_DrawModelParticle()

◆ R_DrawParticles()

◆ R_DrawSurfaces()

void R_DrawSurfaces ( const mBspSurfaces_t * surfs,
glElementIndex_t * indexPtr )

◆ R_GetEntityLists()

◆ R_GetLevelSurfaceLists()

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 mBspHeader_t::headnode, i, LEVEL_LASTVISIBLE, mBspModel_t::nodes, mBspHeader_t::numfaces, r_drawworld, r_mapTiles, r_numMapTiles, R_RecurseWorld(), refdef, and mBspModel_t::submodels.

Referenced by R_RenderFrame(), and R_RunThread().

◆ R_InitGraphics()

◆ R_RenderAlphaTestBspRRefs()

void R_RenderAlphaTestBspRRefs ( void )

◆ R_RenderBlendBspRRefs()

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 R_DrawSurfaces(), R_EnableTexture(), R_RenderBspRRefs(), r_state, S_BLEND, and texunit_lightmap.

Referenced by R_RenderFrame().

◆ R_RenderBlendWarpBspRRefs()

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 R_DrawSurfaces(), R_EnableGlowMap(), R_EnableWarp(), R_RenderBspRRefs(), r_state, and S_BLEND_WARP.

Referenced by R_RenderFrame().

◆ R_RenderFlareBspRRefs()

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

◆ R_RenderMaterialBspRRefs()

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

◆ R_RenderOpaqueBspRRefs()

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

Referenced by R_RenderFrame().

◆ R_RenderOpaqueWarpBspRRefs()

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

Referenced by R_RenderFrame().

◆ R_SetSurfaceBumpMappingParameters()

◆ R_SetupFrustum()

◆ Rimp_Init()

bool Rimp_Init ( void )

◆ Rimp_Shutdown()

void Rimp_Shutdown ( void )

Definition at line 230 of file r_sdl.cpp.

References cls.

Referenced by R_Shutdown().

Variable Documentation

◆ r_anisotropic

cvar_t* r_anisotropic
extern

Definition at line 64 of file r_main.cpp.

Referenced by R_BeginFrame(), R_InitExtensions(), and R_RegisterSystemVars().

◆ r_bumpmap

◆ r_checkerror

cvar_t* r_checkerror
extern

Definition at line 84 of file r_main.cpp.

Referenced by R_CheckErrorDebug(), and R_RegisterSystemVars().

◆ r_config

◆ r_coronas

cvar_t* r_coronas
extern

Definition at line 109 of file r_main.cpp.

Referenced by R_AddCorona(), R_DrawCoronas(), and R_RegisterSystemVars().

◆ r_debug_lights

cvar_t* r_debug_lights
extern

Definition at line 71 of file r_main.cpp.

Referenced by R_DrawAliasModel(), R_RegisterSystemVars(), and R_RenderFrame().

◆ r_debug_normals

cvar_t* r_debug_normals
extern

Definition at line 69 of file r_main.cpp.

Referenced by R_RegisterSystemVars().

◆ r_debug_tangents

cvar_t* r_debug_tangents
extern

Definition at line 70 of file r_main.cpp.

Referenced by R_RegisterSystemVars().

◆ r_default_hardness

cvar_t* r_default_hardness
extern

Definition at line 83 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and R_UpdateDefaultMaterial().

◆ r_default_specular

cvar_t* r_default_specular
extern

Definition at line 82 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and R_UpdateDefaultMaterial().

◆ r_drawbuffer

cvar_t* r_drawbuffer
extern

Definition at line 85 of file r_main.cpp.

Referenced by R_BeginFrame(), and R_RegisterSystemVars().

◆ r_drawentities

cvar_t* r_drawentities
extern

Definition at line 60 of file r_main.cpp.

Referenced by R_GetEntityLists(), and R_RegisterSystemVars().

◆ r_drawtags

cvar_t* r_drawtags
extern

Definition at line 110 of file r_main.cpp.

Referenced by R_DrawAliasModelBuffer(), and R_RegisterSystemVars().

◆ r_drawworld

cvar_t* r_drawworld
extern

Definition at line 61 of file r_main.cpp.

Referenced by R_GetLevelSurfaceLists(), and R_RegisterSystemVars().

◆ r_driver

cvar_t* r_driver
extern

Definition at line 86 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and Rimp_Init().

◆ r_dynamic_lights

◆ r_ext_texture_compression

cvar_t* r_ext_texture_compression
extern

Definition at line 73 of file r_main.cpp.

Referenced by R_InitExtensions(), R_RegisterSystemVars(), and R_SetMode().

◆ r_flares

cvar_t* r_flares
extern

Definition at line 108 of file r_main.cpp.

Referenced by R_DrawFlareSurfaces(), and R_RegisterSystemVars().

◆ r_fog

◆ r_glsl_version

cvar_t* r_glsl_version
extern

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

◆ r_hardness

cvar_t* r_hardness
extern

Definition at line 105 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and R_UseMaterial().

◆ r_isometric

cvar_t* r_isometric
extern

Definition at line 63 of file r_main.cpp.

Referenced by MYgluPerspective(), R_RegisterSystemVars(), and R_SetupFrustum().

◆ r_lightmap

cvar_t* r_lightmap
extern

Definition at line 68 of file r_main.cpp.

Referenced by R_EnableTexture(), and R_RegisterSystemVars().

◆ r_locals

◆ r_materials

cvar_t* r_materials
extern

◆ r_maxlightmap

cvar_t* r_maxlightmap
extern

Definition at line 101 of file r_main.cpp.

Referenced by R_BeginBuildingLightmaps(), and R_RegisterSystemVars().

◆ r_multisample

cvar_t* r_multisample
extern

◆ r_nocull

cvar_t* r_nocull
extern

Definition at line 62 of file r_main.cpp.

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

◆ r_overridematerial

cvar_t* r_overridematerial
extern

Definition at line 81 of file r_main.cpp.

Referenced by R_LoadMaterials(), and R_RegisterSystemVars().

◆ r_parallax

cvar_t* r_parallax
extern

Definition at line 106 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and R_UseMaterial().

◆ r_particles

cvar_t* r_particles
extern

Definition at line 32 of file r_particle.cpp.

Referenced by R_DrawParticles(), and R_RegisterSystemVars().

◆ r_postprocess

◆ r_programs

◆ r_screenshot_format

cvar_t* r_screenshot_format
extern

Definition at line 66 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and R_ScreenShot().

◆ r_screenshot_jpeg_quality

cvar_t* r_screenshot_jpeg_quality
extern

Definition at line 67 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and R_ScreenShot().

◆ r_shadows

cvar_t* r_shadows
extern

Definition at line 87 of file r_main.cpp.

Referenced by R_DrawMeshShadow(), and R_RegisterSystemVars().

◆ r_showbox

cvar_t* r_showbox
extern

◆ r_shownormals

cvar_t* r_shownormals
extern

Definition at line 102 of file r_main.cpp.

Referenced by R_DrawBspNormals(), and R_RegisterSystemVars().

◆ r_specular

cvar_t* r_specular
extern

Definition at line 104 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and R_UseMaterial().

◆ r_stencilshadows

cvar_t* r_stencilshadows
extern

Definition at line 88 of file r_main.cpp.

Referenced by R_Clear(), R_DrawEntityEffects(), R_DrawMeshShadow(), and R_RegisterSystemVars().

◆ r_swapinterval

cvar_t* r_swapinterval
extern

Definition at line 89 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), R_SetMode(), and R_UpdateVidDef().

◆ r_texture_lod

cvar_t* r_texture_lod
extern

Definition at line 65 of file r_main.cpp.

Referenced by R_RegisterSystemVars(), and R_UploadTexture().

◆ r_threads

cvar_t* r_threads
extern

◆ r_vertexbuffers

cvar_t* r_vertexbuffers
extern

◆ r_warp

cvar_t* r_warp
extern

Definition at line 95 of file r_main.cpp.

Referenced by R_EnableWarp(), and R_RegisterSystemVars().

◆ r_wire

cvar_t* r_wire
extern