#include "r_local.h"
#include "r_error.h"
#include "r_entity.h"
#include "r_lightmap.h"
Go to the source code of this file.
Functions | |
static void | R_UploadLightmapBlock (void) |
static qboolean | R_AllocLightmapBlock (int w, int h, int *x, int *y) |
returns a texture number and the position inside it | |
static void | R_BuildDefaultLightmap (mBspSurface_t *surf, byte *sout, byte *dout, int stride) |
Fullbridght lightmap. | |
static void | R_BuildLightmap (mBspSurface_t *surf, byte *sout, byte *dout, int stride) |
Consume raw lightmap and deluxemap RGB/XYZ data from the surface samples, writing processed lightmap and deluxemap RGBA to the specified destinations. | |
void | R_CreateSurfaceLightmap (mBspSurface_t *surf) |
void | R_BeginBuildingLightmaps (void) |
void | R_EndBuildingLightmaps (void) |
void | R_Trace (vec3_t start, vec3_t end, float size, int contentmask) |
Moves the given mins/maxs volume through the world from start to end. | |
Variables | |
lightmaps_t | r_lightmaps |
In video memory, lightmaps are chunked into NxN RGBA blocks. In the bsp, they are just RGB, and we retrieve them using floating point for precision.
Definition in file r_lightmap.c.
static qboolean R_AllocLightmapBlock | ( | int | w, | |
int | h, | |||
int * | x, | |||
int * | y | |||
) | [static] |
returns a texture number and the position inside it
Definition at line 78 of file r_lightmap.c.
References lightmaps_s::allocated, i, qfalse, qtrue, and lightmaps_s::size.
Referenced by R_CreateSurfaceLightmap().
void R_BeginBuildingLightmaps | ( | void | ) |
Definition at line 272 of file r_lightmap.c.
References lightmaps_s::allocated, byte, lightmaps_s::deluxemap_texnum, lightmaps_s::direction_buffer, cvar_s::integer, lightmaps_s::lightmap_texnum, Mem_PoolAlloc, r_maxlightmap, lightmaps_s::sample_buffer, lightmaps_s::size, TEXNUM_DELUXEMAPS, TEXNUM_LIGHTMAPS, and vid_lightPool.
Referenced by R_ModBeginLoading().
static void R_BuildDefaultLightmap | ( | mBspSurface_t * | surf, | |
byte * | sout, | |||
byte * | dout, | |||
int | stride | |||
) | [static] |
Fullbridght lightmap.
Definition at line 114 of file r_lightmap.c.
References mBspSurface_s::color, DELUXEMAP_BLOCK_BYTES, i, LIGHTMAP_BLOCK_BYTES, mBspSurface_s::lightmap_scale, mBspSurface_s::stextents, and Vector4Set.
Referenced by R_CreateSurfaceLightmap().
static void R_BuildLightmap | ( | mBspSurface_t * | surf, | |
byte * | sout, | |||
byte * | dout, | |||
int | stride | |||
) | [static] |
Consume raw lightmap and deluxemap RGB/XYZ data from the surface samples, writing processed lightmap and deluxemap RGBA to the specified destinations.
Definition at line 148 of file r_lightmap.c.
References byte, mBspSurface_s::color, DELUXEMAP_BLOCK_BYTES, mBspTexInfo_s::flags, i, cvar_s::integer, it_lightmap, mBspSurface_s::lightmap, LIGHTMAP_BLOCK_BYTES, LIGHTMAP_BYTES, mBspSurface_s::lightmap_scale, Mem_Free, Mem_PoolAlloc, R_FilterTexture(), r_soften, R_SoftenTexture(), mBspSurface_s::samples, mBspSurface_s::stextents, SURF_ALPHATEST, SURF_BLEND33, SURF_BLEND66, mBspSurface_s::texinfo, and vid_lightPool.
Referenced by R_CreateSurfaceLightmap().
void R_CreateSurfaceLightmap | ( | mBspSurface_t * | surf | ) |
Definition at line 234 of file r_lightmap.c.
References byte, Com_Error(), DELUXEMAP_BLOCK_BYTES, lightmaps_s::deluxemap_texnum, mBspSurface_s::deluxemap_texnum, lightmaps_s::direction_buffer, ERR_DROP, mBspSurface_s::flags, mBspSurface_s::light_s, mBspSurface_s::light_t, LIGHTMAP_BLOCK_BYTES, mBspSurface_s::lightmap_scale, lightmaps_s::lightmap_texnum, mBspSurface_s::lightmap_texnum, MSURF_LIGHTMAP, R_AllocLightmapBlock(), R_BuildDefaultLightmap(), R_BuildLightmap(), R_UploadLightmapBlock(), lightmaps_s::sample_buffer, mBspSurface_s::samples, lightmaps_s::size, and mBspSurface_s::stextents.
Referenced by R_ModLoadSurfaces().
void R_EndBuildingLightmaps | ( | void | ) |
Definition at line 294 of file r_lightmap.c.
References R_UploadLightmapBlock().
Referenced by R_ModEndLoading().
Moves the given mins/maxs volume through the world from start to end.
[in] | start | Start vector to start the trace from |
[in] | end | End vector to stop the trace at |
[in] | size | Bounding box size used for tracing |
[in] | contentmask | Searched content the trace should watch for |
Definition at line 308 of file r_lightmap.c.
References model_s::bsp, CM_CompleteBoxTrace(), CM_TransformedBoxTrace, mBspModel_s::firstnode, trace_s::fraction, i, m, trace_s::mapTile, mBspModel_s::maptile, mapTiles_t::mapTiles, rendererData_t::mapTiles, mod_bsp_submodel, rendererData_t::numEntities, entity_t::origin, R_GetEntity(), r_locals, r_numMapTiles, refdef, rendererData_t::trace, rendererData_t::traceEntity, rlocals_s::tracenum, TRACING_ALL_VISIBLE_LEVELS, model_s::type, and VectorSet.
Referenced by R_DrawFlareSurfaces().
static void R_UploadLightmapBlock | ( | void | ) | [static] |
Definition at line 34 of file r_lightmap.c.
References lightmaps_s::allocated, Com_Printf(), lightmaps_s::deluxemap_texnum, lightmaps_s::direction_buffer, rconfig_t::gl_compressed_solid_format, rconfig_t::gl_solid_format, lightmaps_s::lightmap_texnum, MAX_GL_DELUXEMAPS, MAX_GL_LIGHTMAPS, R_BindTexture, R_CheckError, r_config, lightmaps_s::sample_buffer, and lightmaps_s::size.
Referenced by R_CreateSurfaceLightmap(), and R_EndBuildingLightmaps().
Definition at line 32 of file r_lightmap.c.
Referenced by R_LoadBspVertexArrays().