UFO: Alien Invasion
Loading...
Searching...
No Matches
lighting.cpp
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 1997-2001 Id Software, Inc.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#include "lighting.h"
27#include "map.h"
28#include "bsp.h"
29
34void LightWorld (void)
35{
36 if (curTile->numnodes == 0 || curTile->numfaces == 0)
37 Sys_Error("Empty map");
38
39 /* initialize light data */
40 curTile->lightdata[config.compile_for_day][0] = config.lightquant;
41 curTile->lightdatasize[config.compile_for_day] = 1;
42
44
45 /* turn each face into a single patch */
47
48 /* subdivide patches to a maximum dimension */
50
51 /* create lights out of patches and lights */
53
54 /* patches are no longer needed */
56
57 /* build per-vertex normals for phong shading */
59
60 /* build initial facelights */
61 RunThreadsOn(BuildFacelights, curTile->numfaces, config.verbosity >= VERB_NORMAL, "FACELIGHTS");
62
63 /* finalize it and write it out */
64 RunThreadsOn(FinalLightFace, curTile->numfaces, config.verbosity >= VERB_NORMAL, "FINALLIGHT");
66}
void CloseTracingNodes(void)
Definition trace.cpp:65
void MakeTracingNodes(int levels)
Use the bsp node structure to reconstruct efficient tracing structures that are used for fast visibil...
Definition trace.cpp:38
#define LEVEL_LASTLIGHTBLOCKING
Definition defines.h:350
void Sys_Error(const char *error,...)
Definition g_main.cpp:421
void LightWorld(void)
Build the lightmap out of light entities and surface lights (patches).
Definition lighting.cpp:34
void BuildVertexNormals(void)
Calculate per-vertex (instead of per-plane) normal vectors. This is done by finding all of the faces ...
Definition lightmap.cpp:673
void BuildLights(void)
Create lights out of patches and entity lights.
Definition lightmap.cpp:293
void SubdividePatches(void)
Iterate all of the head face patches, subdividing them as necessary.
Definition patches.cpp:312
void FinalLightFace(unsigned int facenum)
Add the indirect lighting on top of the direct lighting and save into final map format.
Definition lightmap.cpp:987
void BuildFacelights(unsigned int facenum)
Definition lightmap.cpp:753
void FreePatches(void)
After light sources have been created, patches may be freed.
Definition patches.cpp:325
void BuildPatches(void)
Create surface fragments for light-emitting surfaces so that light sources may be computed along them...
Definition patches.cpp:198
static config_t config
Definition test_all.cpp:43
dMapTile_t * curTile
Definition bsp.cpp:32
void RunThreadsOn(void(*func)(unsigned int), unsigned int workcount, bool progress, const char *id)
@ VERB_NORMAL
Definition shared.h:45