UFO: Alien Invasion
Loading...
Searching...
No Matches
lighting.cpp
Go to the documentation of this file.
1
5
6
/*
7
Copyright (C) 1997-2001 Id Software, Inc.
8
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License
11
as published by the Free Software Foundation; either version 2
12
of the License, or (at your option) any later version.
13
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18
See the GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, 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
34
void
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
43
MakeTracingNodes
(
LEVEL_LASTLIGHTBLOCKING
+ 1);
44
45
/* turn each face into a single patch */
46
BuildPatches
();
47
48
/* subdivide patches to a maximum dimension */
49
SubdividePatches
();
50
51
/* create lights out of patches and lights */
52
BuildLights
();
53
54
/* patches are no longer needed */
55
FreePatches
();
56
57
/* build per-vertex normals for phong shading */
58
BuildVertexNormals
();
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"
);
65
CloseTracingNodes
();
66
}
bsp.h
CloseTracingNodes
void CloseTracingNodes(void)
Definition
trace.cpp:65
MakeTracingNodes
void MakeTracingNodes(int levels)
Use the bsp node structure to reconstruct efficient tracing structures that are used for fast visibil...
Definition
trace.cpp:38
LEVEL_LASTLIGHTBLOCKING
#define LEVEL_LASTLIGHTBLOCKING
Definition
defines.h:350
Sys_Error
void Sys_Error(const char *error,...)
Definition
g_main.cpp:421
LightWorld
void LightWorld(void)
Build the lightmap out of light entities and surface lights (patches).
Definition
lighting.cpp:34
lighting.h
BuildVertexNormals
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
BuildLights
void BuildLights(void)
Create lights out of patches and entity lights.
Definition
lightmap.cpp:293
SubdividePatches
void SubdividePatches(void)
Iterate all of the head face patches, subdividing them as necessary.
Definition
patches.cpp:312
FinalLightFace
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
BuildFacelights
void BuildFacelights(unsigned int facenum)
Definition
lightmap.cpp:753
FreePatches
void FreePatches(void)
After light sources have been created, patches may be freed.
Definition
patches.cpp:325
BuildPatches
void BuildPatches(void)
Create surface fragments for light-emitting surfaces so that light sources may be computed along them...
Definition
patches.cpp:198
map.h
config
static config_t config
Definition
test_all.cpp:43
curTile
dMapTile_t * curTile
Definition
bsp.cpp:32
RunThreadsOn
void RunThreadsOn(void(*func)(unsigned int), unsigned int workcount, bool progress, const char *id)
VERB_NORMAL
@ VERB_NORMAL
Definition
shared.h:45
src
tools
ufo2map
lighting.cpp
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.16.1