/
r_world.h
191 lines (153 loc) · 5.91 KB
/
r_world.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/**\file r_world.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2012 Daniel Swanson <danij@dengine.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/**
* World Setup and Refresh.
*/
#ifndef LIBDENG_REFRESH_WORLD_H
#define LIBDENG_REFRESH_WORLD_H
#include "r_data.h"
#ifdef __cplusplus
extern "C" {
#endif
// Used for vertex sector owners, side line owners and reverb BSP leafs.
typedef struct ownernode_s {
void* data;
struct ownernode_s* next;
} ownernode_t;
typedef struct {
ownernode_t* head;
uint count;
} ownerlist_t;
extern float rendSkyLight; // cvar
extern byte rendSkyLightAuto; // cvar
extern float rendLightWallAngle;
extern byte rendLightWallAngleSmooth;
extern boolean ddMapSetup;
// Sky flags.
#define SIF_DRAW_SPHERE 0x1 // Always draw the sky sphere.
/**
* Called by the game at various points in the map setup process.
*/
void R_SetupMap(int mode, int flags);
void R_SetupFogDefaults(void);
void R_SetupFog(float start, float end, float density, float* rgb);
/**
* Sector light color may be affected by the sky light color.
*/
const float* R_GetSectorLightColor(const Sector* sector);
float R_DistAttenuateLightLevel(float distToViewer, float lightLevel);
/**
* The DOOM lighting model applies a light level delta to everything when
* e.g. the player shoots.
*
* @return Calculated delta.
*/
float R_ExtraLightDelta(void);
/**
* @return @c > 0 if @a lightlevel passes the min max limit condition.
*/
float R_CheckSectorLight(float lightlevel, float min, float max);
boolean R_SectorContainsSkySurfaces(const Sector* sec);
void R_UpdatePlanes(void);
void R_ClearSectorFlags(void);
void R_MapInitSurfaceLists(void);
void R_OrderVertices(const LineDef* line, const Sector* sector,
Vertex* verts[2]);
/**
* @param matOffset Can be @c NULL.
*/
boolean R_FindBottomTop(LineDef* line, int side, SideDefSection section,
Sector* frontSec, Sector* backSec, SideDef* frontSideDef,
coord_t* low, coord_t* hi, float matOffset[2]);
Plane* R_NewPlaneForSector(Sector* sec);
void R_DestroyPlaneOfSector(uint id, Sector* sec);
surfacedecor_t* R_CreateSurfaceDecoration(Surface* suf);
void R_ClearSurfaceDecorations(Surface* suf);
void R_UpdateTrackedPlanes(void);
void R_InterpolateTrackedPlanes(boolean resetNextViewer);
void R_AddTrackedPlane(planelist_t* plist, Plane* pln);
boolean R_RemoveTrackedPlane(planelist_t* plist, const Plane* pln);
void R_UpdateSurfaceScroll(void);
void R_InterpolateSurfaceScroll(boolean resetNextViewer);
/**
* Adds the surface to the given surface list.
*
* @param sl The surface list to add the surface to.
* @param suf The surface to add to the list.
*/
void R_SurfaceListAdd(surfacelist_t* sl, Surface* suf);
boolean R_SurfaceListRemove(surfacelist_t* sl, const Surface* suf);
void R_SurfaceListClear(surfacelist_t* sl);
/**
* Iterate the list of surfaces making a callback for each.
*
* @param callback The callback to make. Iteration will continue until
* a callback returns a zero value.
* @param context Is passed to the callback function.
*/
boolean R_SurfaceListIterate(surfacelist_t* sl, boolean (*callback) (Surface* suf, void*), void* context);
void R_MarkDependantSurfacesForDecorationUpdate(Plane* pln);
/**
* To be called in response to a Material property changing which may
* require updating any map surfaces which are presently using it.
*/
void R_UpdateMapSurfacesOnMaterialChange(material_t* material);
/// @return @c true= @a plane is non-glowing (i.e. not glowing or a sky).
boolean R_IsGlowingPlane(const Plane* plane);
float R_GlowStrength(const Plane* pln);
lineowner_t* R_GetVtxLineOwner(const Vertex* vtx, const LineDef* line);
/**
* A neighbour is a line that shares a vertex with 'line', and faces the
* specified sector.
*/
LineDef* R_FindLineNeighbor(const Sector* sector, const LineDef* line,
const lineowner_t* own, boolean antiClockwise, binangle_t* diff);
LineDef* R_FindSolidLineNeighbor(const Sector* sector, const LineDef* line,
const lineowner_t* own, boolean antiClockwise, binangle_t* diff);
/**
* A line's align neighbor is a line that shares a vertex with 'line' and
* whos orientation is aligned with it (thus, making it unnecessary to have
* a shadow between them. In practice, they would be considered a single,
* long sidedef by the shadow generator).
*/
LineDef* R_FindLineAlignNeighbor(const Sector* sec, const LineDef* line,
const lineowner_t* own, boolean antiClockwise, int alignment);
/**
* Find a backneighbour for the given line. They are the neighbouring line
* in the backsector of the imediate line neighbor.
*/
LineDef* R_FindLineBackNeighbor(const Sector* sector, const LineDef* line,
const lineowner_t* own, boolean antiClockwise, binangle_t* diff);
/**
* @defgroup skyCapFlags Sky Cap Flags
*/
///@{
#define SKYCAP_LOWER 0x1
#define SKYCAP_UPPER 0x2
///@}
coord_t R_SkyCapZ(BspLeaf* bspLeaf, int skyCap);
#ifdef __cplusplus
}
#endif
#endif /* LIBDENG_REFRESH_WORLD_H */