-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
r_world.h
180 lines (151 loc) · 6.42 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
/**\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"
// Used for vertex sector owners, side line owners and reverb subsectors.
typedef struct ownernode_s {
void* data;
struct ownernode_s* next;
} ownernode_t;
typedef struct {
ownernode_t* head;
uint count;
} ownerlist_t;
typedef struct skyfix_s {
float height;
} skyfix_t;
extern float rendSkyLight; // cvar
extern byte rendSkyLightAuto; // cvar
extern float rendLightWallAngle;
extern byte rendLightWallAngleSmooth;
extern boolean ddMapSetup;
extern skyfix_t skyFix[2]; // [floor, ceiling]
// 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);
/**
* Polygonizes all subsectors in the map.
*/
void R_PolygonizeMap(GameMap* map);
void R_SetupFog(float start, float end, float density, float* rgb);
void R_SetupFogDefaults(void);
/**
* Sector light color may be affected by the sky light color.
*/
const float* R_GetSectorLightColor(const sector_t* 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);
/**
* Will the specified surface be added to the sky mask?
*
* @param suf Ptr to the surface to test.
* @return boolean @c true, iff the surface will be masked.
*/
boolean R_IsSkySurface(const surface_t* suf);
boolean R_SectorContainsSkySurfaces(const sector_t* sec);
void R_UpdatePlanes(void);
void R_ClearSectorFlags(void);
void R_InitSkyFix(void);
void R_MapInitSurfaceLists(void);
void R_UpdateSkyFixForSec(const sector_t* sec);
void R_OrderVertices(const linedef_t* line, const sector_t* sector,
vertex_t* verts[2]);
boolean R_FindBottomTop(linedef_t* lineDef, int side, sidedefsection_t section,
float matOffsetX, float matOffsetY,
const plane_t* ffloor, const plane_t* fceil,
const plane_t* bfloor, const plane_t* bceil,
boolean unpegBottom, boolean unpegTop,
boolean stretchMiddle, boolean isSelfRef,
float* bottom, float* top, float texOffset[2]);
plane_t* R_NewPlaneForSector(sector_t* sec);
void R_DestroyPlaneOfSector(uint id, sector_t* sec);
surfacedecor_t* R_CreateSurfaceDecoration(surface_t* suf);
void R_ClearSurfaceDecorations(surface_t* suf);
void R_UpdateWatchedPlanes(watchedplanelist_t* wpl);
void R_InterpolateWatchedPlanes(watchedplanelist_t* wpl,
boolean resetNextViewer);
void R_AddWatchedPlane(watchedplanelist_t* wpl, plane_t* pln);
boolean R_RemoveWatchedPlane(watchedplanelist_t* wpl,
const plane_t* 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_t* suf);
boolean R_SurfaceListRemove(surfacelist_t* sl, const surface_t* 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_t* suf, void*), void* context);
void R_MarkDependantSurfacesForDecorationUpdate(plane_t* 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_t* plane);
float R_GlowStrength(const plane_t* pln);
lineowner_t* R_GetVtxLineOwner(const vertex_t* vtx, const linedef_t* line);
linedef_t* R_FindLineNeighbor(const sector_t* sector,
const linedef_t* line,
const lineowner_t* own,
boolean antiClockwise, binangle_t* diff);
linedef_t* R_FindSolidLineNeighbor(const sector_t* sector,
const linedef_t* line,
const lineowner_t* own,
boolean antiClockwise,
binangle_t* diff);
linedef_t* R_FindLineBackNeighbor(const sector_t* sector,
const linedef_t* line,
const lineowner_t* own,
boolean antiClockwise,
binangle_t* diff);
#endif /* LIBDENG_REFRESH_WORLD_H */