/
rend_dyn.h
122 lines (105 loc) · 4.39 KB
/
rend_dyn.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
/**\file
*\section Copyright and License Summary
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2006 Jaakko Keränen <skyjake@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
*/
/*
* rend_dyn.h: Dynamic Lights
*/
#ifndef __DOOMSDAY_DYNLIGHTS_H__
#define __DOOMSDAY_DYNLIGHTS_H__
#include "p_object.h"
#include "rend_list.h"
#define DYN_ASPECT 1.1f // 1.2f is just too round for Doom.
#define MAX_GLOWHEIGHT 1024.0f // Absolute max glow height
// Lumobj Flags.
#define LUMF_USED 0x1
#define LUMF_RENDERED 0x2
#define LUMF_CLIPPED 0x4 // Hidden by world geometry.
#define LUMF_NOHALO 0x100
#define LUMF_DONTTURNHALO 0x200
typedef struct lumobj_s // For dynamic lighting.
{
struct lumobj_s *next; // Next in the same DL block, or NULL.
struct lumobj_s *ssNext; // Next in the same subsector, or NULL.
int flags;
mobj_t *thing;
float center; // Offset to center from mobj Z.
int radius, patch, distance; // Radius: lights are spheres.
int flareSize; // Radius for this light source.
byte rgb[3]; // The color.
float xOff;
float xyScale; // 1.0 if there's no modeldef.
DGLuint tex; // Lightmap texture.
DGLuint floorTex, ceilTex; // Lightmaps for floor/ceil.
DGLuint decorMap; // Decoration lightmap.
DGLuint flareTex; // Flaremap if flareCustom ELSE (flaretexName id.
// Zero = automatical)
boolean flareCustom; // True id flareTex is a custom flare graphic
float flareMul; // Flare brightness factor.
} lumobj_t;
/*
* The data of a projected dynamic light is stored in this structure.
* A list of these is associated with all the lit segs/planes in a frame.
*/
typedef struct dynlight_s {
struct dynlight_s *next, *nextUsed;
int flags;
float s[2], t[2];
byte color[3];
DGLuint texture;
} dynlight_t;
// Flags for projected dynamic lights.
#define DYNF_PREGEN_DECOR 0x1 // Pregen RGB lightmap for a light decoration.
extern boolean dlInited;
extern lumobj_t *luminousList;
extern int numLuminous;
extern int useDynLights;
extern int maxDynLights, dlBlend, dlMaxRad;
extern float dlRadFactor, dlFactor;
extern int useWallGlow, glowHeightMax;
extern float glowHeightFactor;
extern float glowFogBright;
extern byte rendInfoLums;
extern int dlMinRadForBias;
// Initialization
void DL_Register(void);
// Setup.
void DL_InitLinks();
void DL_Clear(); // 'Physically' destroy the tables.
// Action.
void DL_ClearForFrame();
void DL_InitForNewFrame();
int DL_NewLuminous(void);
lumobj_t *DL_GetLuminous(int index);
void DL_ProcessSubsector(subsector_t *ssec);
dynlight_t *DL_GetSegLightLinks(int seg, int whichpart);
dynlight_t *DL_GetSubSecLightLinks(int ssec, int plane);
// Helpers.
boolean DL_RadiusIterator(subsector_t *subsector, fixed_t x, fixed_t y,
fixed_t radius, void *data,
boolean (*func) (lumobj_t *, fixed_t, void *data));
boolean DL_BoxIterator(fixed_t box[4], void *ptr,
boolean (*func) (lumobj_t *, void *));
int Rend_SubsectorClipper(fvertex_t * out, subsector_t *sub,
float x, float y, float radius);
void DL_ClipInSubsector(int ssecidx);
void DL_ClipBySight(int ssecidx);
#endif