UFO: Alien Invasion
Loading...
Searching...
No Matches
r_light.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  light_t
 a light source More...
struct  sustain_t
 sustains are light flashes which slowly decay More...

Macros

#define MAX_STATIC_LIGHTS   1024

Functions

void R_AddLight (const vec3_t origin, float radius, const vec3_t color)
 Create light to be rendered in the current frame (will be removed before the next).
void R_AddSustainedLight (const vec3_t org, float radius, const vec3_t color, float sustain)
void R_UpdateSustainedLights (void)
 Updates state of sustained lights; should be called once per frame right before world rendering.
void R_EnableWorldLights (void)
 Set up lighting data for the GLSL world shader.
void R_EnableModelLights (const light_t **lights, int numLights, bool inShadow, bool enable)
 Enable or disable realtime dynamic lighting for models.
void R_DisableLights (void)
void R_AddStaticLight (const vec3_t origin, float radius, const vec3_t color)
 Add static light for model lighting (world already got them baked into lightmap).
void R_ClearStaticLights (void)
 Remove all static light data.
void R_UpdateLightList (struct entity_s *ent)

Macro Definition Documentation

◆ MAX_STATIC_LIGHTS

#define MAX_STATIC_LIGHTS   1024

Definition at line 47 of file r_light.h.

Referenced by R_AddStaticLight().

Function Documentation

◆ R_AddLight()

void R_AddLight ( const vec3_t origin,
float radius,
const vec3_t color )

Create light to be rendered in the current frame (will be removed before the next).

Todo
  • integrate the particle-based lights into the new dynamic light system
Note
Call before actual 3D rendering begins to avoid missing or partially rendered lights

Definition at line 36 of file r_light.cpp.

References Com_DPrintf(), DEBUG_RENDERER, i, MAX_GL_LIGHTS, refdef, and VectorCopy.

Referenced by CL_ParticleRun2(), and R_UpdateSustainedLights().

◆ R_AddStaticLight()

void R_AddStaticLight ( const vec3_t origin,
float radius,
const vec3_t color )

Add static light for model lighting (world already got them baked into lightmap).

Note
To be called from map loader only
See also
SP_light

Definition at line 261 of file r_light.cpp.

References light_t::color, Com_DPrintf(), Com_Printf(), DEBUG_RENDERER, MAX_STATIC_LIGHTS, light_t::origin, light_t::radius, refdef, and VectorCopy.

Referenced by SP_light().

◆ R_AddSustainedLight()

void R_AddSustainedLight ( const vec3_t org,
float radius,
const vec3_t color,
float sustain )
See also
R_AddSustainedLights

Definition at line 58 of file r_light.cpp.

References light_t::color, i, sustain_t::light, MAX_GL_LIGHTS, light_t::origin, r_sustainArray, light_t::radius, refdef, sustain_t::sustain, sustain_t::time, and VectorCopy.

Referenced by CL_ParticleRun2().

◆ R_ClearStaticLights()

void R_ClearStaticLights ( void )

Remove all static light data.

Note
To be called before loading a new map

Definition at line 300 of file r_light.cpp.

References refdef.

Referenced by R_ModBeginLoading(), and R_SetDefaultState().

◆ R_DisableLights()

void R_DisableLights ( void )

Definition at line 282 of file r_light.cpp.

References i, MAX_GL_LIGHTS, and MIN_GL_CONSTANT_ATTENUATION.

◆ R_EnableModelLights()

void R_EnableModelLights ( const light_t ** lights,
int numLights,
bool inShadow,
bool enable )

Enable or disable realtime dynamic lighting for models.

Parameters
lightsThe lights to enable
numLightsThe amount of lights in the given lights list
inShadowWhether model is shadowed from the sun
enableWhether to turn realtime lighting on or off
Todo
is it a good idea?
Todo
assert?

Definition at line 149 of file r_light.cpp.

References light_t::color, defaultMaterial, GLPositionTransform(), i, lights, MAX_GL_LIGHTS, light_t::origin, R_DisableAttribute(), r_dynamic_lights, R_EnableAttribute(), r_locals, R_ProgramParameter3fv(), R_ProgramParameter3fvs(), R_ProgramParameter4fvs(), r_programs, r_state, R_UseMaterial(), light_t::radius, refdef, Vector4Set, and VectorCopy.

Referenced by R_DrawAliasModel(), and R_DrawMaterialSurfaces().

◆ R_EnableWorldLights()

◆ R_UpdateLightList()

void R_UpdateLightList ( struct entity_s * ent)

◆ R_UpdateSustainedLights()

void R_UpdateSustainedLights ( void )

Updates state of sustained lights; should be called once per frame right before world rendering.

See also
R_RenderFrame
R_AddSustainedLight

Definition at line 83 of file r_light.cpp.

References light_t::color, i, sustain_t::light, MAX_GL_LIGHTS, light_t::origin, R_AddLight(), r_sustainArray, light_t::radius, refdef, sustain_t::sustain, sustain_t::time, and VectorScale.

Referenced by R_RenderFrame().