#include "lighting.h"
#include "bsp.h"
#include "../../shared/images.h"
Go to the source code of this file.
Defines | |
#define | PATCH_SUBDIVIDE 64 |
Functions | |
void | CalcTextureReflectivity (void) |
static winding_t * | WindingFromFace (const dBspSurface_t *f) |
static qboolean | HasLight (const dBspSurface_t *f) |
static void | EmissiveLight (patch_t *patch) |
Check for light emited by texture. | |
static void | BuildPatch (int fn, winding_t *w) |
static entity_t * | EntityForModel (int modnum) |
void | BuildPatches (void) |
Create surface fragments for light-emitting surfaces so that light sources may be computed along them. This function is responsible for one. | |
static void | FinishSubdividePatch (patch_t *patch, patch_t *newp) |
static void | SubdividePatch (patch_t *patch) |
Chops the patch by a global grid. | |
void | SubdividePatches (void) |
Iterate all of the head face patches, subdividing them as necessary. | |
void | FreePatches (void) |
After light sources have been created, patches may be freed. | |
Variables | |
static vec3_t | texture_reflectivity [MAX_MAP_TEXINFO] |
patch_t * | face_patches [MAX_MAP_FACES] |
Definition in file patches.c.
#define PATCH_SUBDIVIDE 64 |
Definition at line 235 of file patches.c.
Referenced by SubdividePatch().
static void BuildPatch | ( | int | fn, | |
winding_t * | w | |||
) | [static] |
Definition at line 140 of file patches.c.
References patch_s::area, curTile, EmissiveLight(), patch_s::face, dMapTile_t::faces, Mem_Alloc, patch_s::normal, dBspPlane_t::normal, patch_s::origin, dBspSurface_t::planenum, dMapTile_t::planes, dBspSurface_t::side, VectorCopy, VectorMA(), VectorNegate, patch_s::winding, WindingArea(), and WindingCenter().
Referenced by BuildPatches().
void BuildPatches | ( | void | ) |
Create surface fragments for light-emitting surfaces so that light sources may be computed along them. This function is responsible for one.
Definition at line 194 of file patches.c.
References BuildPatch(), curTile, EntityForModel(), f, face_offset, dMapTile_t::faces, dBspModel_t::firstface, GetVectorForKey(), HasLight(), i, dMapTile_t::models, dBspModel_t::numfaces, dMapTile_t::nummodels, winding_s::numpoints, winding_s::p, VectorAdd, VectorCopy, and WindingFromFace().
Referenced by LightWorld().
void CalcTextureReflectivity | ( | void | ) |
Definition at line 38 of file patches.c.
References byte, light_s::color, Com_sprintf(), curTile, i, Img_LoadImage(), MAX_QPATH, dMapTile_t::numtexinfo, pos, dMapTile_t::texinfo, texinfo_s::texture, texture_reflectivity, VectorCopy, VectorSet, VERB_EXTRA, VERB_NORMAL, and Verb_Printf().
Referenced by main().
static void EmissiveLight | ( | patch_t * | patch | ) | [inline, static] |
Check for light emited by texture.
Definition at line 130 of file patches.c.
References curTile, patch_s::face, HasLight(), patch_s::light, dBspSurface_t::texinfo, dMapTile_t::texinfo, texture_reflectivity, texinfo_s::value, and VectorScale.
Referenced by BuildPatch().
static entity_t* EntityForModel | ( | int | modnum | ) | [static] |
Definition at line 173 of file patches.c.
References Com_sprintf(), entities, i, name, num_entities, and ValueForKey().
Referenced by BuildPatches().
Definition at line 237 of file patches.c.
References patch_s::area, patch_s::light, patch_s::normal, patch_s::origin, VectorCopy, VectorMA(), patch_s::winding, WindingArea(), and WindingCenter().
Referenced by SubdividePatch().
void FreePatches | ( | void | ) |
After light sources have been created, patches may be freed.
Definition at line 326 of file patches.c.
References i, MAX_MAP_FACES, Mem_Free, and patch_s::next.
Referenced by LightWorld().
static qboolean HasLight | ( | const dBspSurface_t * | f | ) | [inline, static] |
Definition at line 117 of file patches.c.
References curTile, SURF_LIGHT, texinfo_s::surfaceFlags, dBspSurface_t::texinfo, dMapTile_t::texinfo, and texinfo_s::value.
Referenced by BuildPatches(), and EmissiveLight().
static void SubdividePatch | ( | patch_t * | patch | ) | [static] |
Chops the patch by a global grid.
Definition at line 265 of file patches.c.
References ClipWindingEpsilon(), FinishSubdividePatch(), i, Mem_Alloc, patch_s::next, ON_EPSILON, PATCH_SUBDIVIDE, VectorClear, patch_s::winding, and WindingBounds().
Referenced by SubdividePatches().
void SubdividePatches | ( | void | ) |
Iterate all of the head face patches, subdividing them as necessary.
Definition at line 311 of file patches.c.
References i, MAX_MAP_FACES, and SubdividePatch().
Referenced by LightWorld().
static winding_t* WindingFromFace | ( | const dBspSurface_t * | f | ) | [static] |
Definition at line 92 of file patches.c.
References AllocWinding(), curTile, dMapTile_t::edges, dBspSurface_t::firstedge, i, dBspSurface_t::numedges, winding_s::numpoints, winding_s::p, dBspVertex_t::point, RemoveColinearPoints(), dMapTile_t::surfedges, dBspEdge_t::v, VectorCopy, and dMapTile_t::vertexes.
Referenced by BuildPatches().
patch_t* face_patches[MAX_MAP_FACES] |
Definition at line 30 of file patches.c.
Referenced by BuildLights().
vec3_t texture_reflectivity[MAX_MAP_TEXINFO] [static] |
Definition at line 29 of file patches.c.
Referenced by CalcTextureReflectivity(), and EmissiveLight().