UFO: Alien Invasion
Loading...
Searching...
No Matches
patches.cpp File Reference
#include "lighting.h"
#include "bsp.h"
#include "../../shared/images.h"
Include dependency graph for patches.cpp:

Go to the source code of this file.

Macros

#define PATCH_SUBDIVIDE   64

Functions

void CalcTextureReflectivity (void)
 Calculates the texture color that is used for light emitting surfaces.
static winding_tWindingFromFace (const dBspSurface_t *f)
static bool HasLight (const dBspSurface_t *f)
static void EmissiveLight (patch_t *patch)
 Check for light emitted by texture.
static void BuildPatch (int fn, winding_t *w)
 Build a patch for a surface that emits light.
static entity_tEntityForModel (int modnum)
void BuildPatches (void)
 Create surface fragments for light-emitting surfaces so that light sources may be computed along them.
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_tface_patches [MAX_MAP_FACES]

Macro Definition Documentation

◆ PATCH_SUBDIVIDE

#define PATCH_SUBDIVIDE   64

Definition at line 236 of file patches.cpp.

Referenced by SubdividePatch().

Function Documentation

◆ BuildPatch()

void BuildPatch ( int fn,
winding_t * w )
static

Build a patch for a surface that emits light.

Note
This is called in the lighting stage
Parameters
fnThe face number of the surface that emits the light
wThe winding
See also
BuildLights

Definition at line 145 of file patches.cpp.

References patch_t::area, curTile, EmissiveLight(), patch_t::face, face_patches, Mem_AllocType, dBspPlane_t::normal, patch_t::normal, patch_t::origin, dBspSurface_t::planenum, dBspSurface_t::side, VectorCopy, VectorMA(), VectorNegate, patch_t::winding, WindingArea(), and WindingCenter().

Referenced by BuildPatches().

◆ BuildPatches()

void BuildPatches ( void )

Create surface fragments for light-emitting surfaces so that light sources may be computed along them.

Definition at line 198 of file patches.cpp.

References BuildPatch(), curTile, EntityForModel(), f, face_offset, face_patches, dBspModel_t::firstface, GetVectorForKey(), HasLight(), i, dBspModel_t::numfaces, winding_t::numpoints, OBJZERO, winding_t::p, VectorAdd, VectorCopy, and WindingFromFace().

Referenced by LightWorld().

◆ CalcTextureReflectivity()

void CalcTextureReflectivity ( void )

Calculates the texture color that is used for light emitting surfaces.

Definition at line 41 of file patches.cpp.

References Com_sprintf(), curTile, i, Img_LoadImage(), MAX_QPATH, Q_streq, texture_reflectivity, VectorCopy, VectorSet, VERB_EXTRA, VERB_NORMAL, and Verb_Printf().

Referenced by main().

◆ EmissiveLight()

void EmissiveLight ( patch_t * patch)
inlinestatic

Check for light emitted by texture.

Note
Surface lights
See also
TexinfoForBrushTexture

Definition at line 130 of file patches.cpp.

References curTile, patch_t::face, patch_t::light, dBspSurface_t::texinfo, texture_reflectivity, dBspTexinfo_t::value, and VectorScale.

Referenced by BuildPatch().

◆ EntityForModel()

entity_t * EntityForModel ( int modnum)
static

Definition at line 178 of file patches.cpp.

References Com_sprintf(), entities, i, name, num_entities, Q_streq, and ValueForKey().

Referenced by BuildPatches().

◆ FinishSubdividePatch()

void FinishSubdividePatch ( patch_t * patch,
patch_t * newp )
static

◆ FreePatches()

void FreePatches ( void )

After light sources have been created, patches may be freed.

Definition at line 325 of file patches.cpp.

References face_patches, i, MAX_MAP_FACES, Mem_Free, and patch_t::next.

Referenced by LightWorld().

◆ HasLight()

bool HasLight ( const dBspSurface_t * f)
inlinestatic

Definition at line 117 of file patches.cpp.

References curTile, f, SURF_LIGHT, dBspTexinfo_t::surfaceFlags, and dBspTexinfo_t::value.

Referenced by BuildPatches().

◆ SubdividePatch()

void SubdividePatch ( patch_t * patch)
static

◆ SubdividePatches()

void SubdividePatches ( void )

Iterate all of the head face patches, subdividing them as necessary.

Definition at line 312 of file patches.cpp.

References face_patches, i, MAX_MAP_FACES, and SubdividePatch().

Referenced by LightWorld().

◆ WindingFromFace()

winding_t * WindingFromFace ( const dBspSurface_t * f)
static

Variable Documentation

◆ face_patches

patch_t* face_patches[MAX_MAP_FACES]

Definition at line 30 of file patches.cpp.

Referenced by BuildLights(), BuildPatch(), BuildPatches(), FreePatches(), and SubdividePatches().

◆ texture_reflectivity

vec3_t texture_reflectivity[MAX_MAP_TEXINFO]
static

Definition at line 29 of file patches.cpp.

Referenced by CalcTextureReflectivity(), and EmissiveLight().