/
rend_main.h
210 lines (162 loc) · 6.24 KB
/
rend_main.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/** @file render/rend_main.h Core of the rendering subsystem.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>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, see:
* http://www.gnu.org/licenses</small>
*/
#ifndef CLIENT_RENDER_MAIN_H
#define CLIENT_RENDER_MAIN_H
#ifndef __CLIENT__
# error "render/rend_main.h only exists in the Client"
#endif
#include <de/Vector>
#include "dd_types.h"
#include "Sector"
#include "MaterialVariantSpec"
#include "WallEdge"
namespace de {
class Map;
}
#define GLOW_HEIGHT_MAX (1024.f) /// Absolute maximum
#define OMNILIGHT_SURFACE_LUMINOSITY_ATTRIBUTION_MIN (.05f)
#define SHADOW_SURFACE_LUMINOSITY_ATTRIBUTION_MIN (.05f)
DENG_EXTERN_C coord_t vOrigin[3];
DENG_EXTERN_C float vang, vpitch, yfov;
DENG_EXTERN_C float viewsidex, viewsidey;
DENG_EXTERN_C float fogColor[4];
DENG_EXTERN_C byte smoothTexAnim, devMobjVLights;
DENG_EXTERN_C boolean usingFog;
DENG_EXTERN_C int rAmbient;
DENG_EXTERN_C float rendLightDistanceAttenuation;
DENG_EXTERN_C int rendLightAttenuateFixedColormap;
DENG_EXTERN_C float rendLightWallAngle;
DENG_EXTERN_C byte rendLightWallAngleSmooth;
DENG_EXTERN_C float rendSkyLight; // cvar
DENG_EXTERN_C byte rendSkyLightAuto; // cvar
DENG_EXTERN_C float lightModRange[255];
DENG_EXTERN_C int extraLight;
DENG_EXTERN_C float extraLightDelta;
DENG_EXTERN_C int devRendSkyMode;
DENG_EXTERN_C int gameDrawHUD;
DENG_EXTERN_C int useBias;
DENG_EXTERN_C int useDynLights;
DENG_EXTERN_C float dynlightFactor, dynlightFogBright;
DENG_EXTERN_C int rendMaxLumobjs;
DENG_EXTERN_C int useGlowOnWalls;
DENG_EXTERN_C float glowFactor, glowHeightFactor;
DENG_EXTERN_C int glowHeightMax;
DENG_EXTERN_C int useShadows;
DENG_EXTERN_C float shadowFactor;
DENG_EXTERN_C int shadowMaxRadius;
DENG_EXTERN_C int shadowMaxDistance;
DENG_EXTERN_C byte useLightDecorations;
DENG_EXTERN_C int useShinySurfaces;
DENG_EXTERN_C float detailFactor, detailScale;
DENG_EXTERN_C byte devRendSkyAlways;
DENG_EXTERN_C byte rendInfoLums;
DENG_EXTERN_C byte devDrawLums;
DENG_EXTERN_C byte freezeRLs;
void Rend_Register();
void Rend_Init();
void Rend_Shutdown();
void Rend_Reset();
void Rend_RenderMap(de::Map &map);
float Rend_FieldOfView();
/**
* @param useAngles @c true= Apply viewer angle rotation.
*/
void Rend_ModelViewMatrix(bool useAngles = true);
#define Rend_PointDist2D(c) (fabs((vOrigin[VZ]-(c)[VY])*viewsidex - (vOrigin[VX]-(c)[VX])*viewsidey))
/**
* The DOOM lighting model applies a light level delta to everything when
* e.g. the player shoots.
*
* @return Calculated delta.
*/
float Rend_ExtraLightDelta();
void Rend_ApplyTorchLight(float *color3, float distance);
void Rend_ApplyTorchLight(de::Vector4f &color, float distance);
/**
* Apply range compression delta to @a lightValue.
* @param lightValue The light level value to apply adaptation to.
*/
void Rend_ApplyLightAdaptation(float &lightValue);
/// Same as Rend_ApplyLightAdaptation except the delta is returned.
float Rend_LightAdaptationDelta(float lightvalue);
/**
* The DOOM lighting model applies distance attenuation to sector light
* levels.
*
* @param distToViewer Distance from the viewer to this object.
* @param lightLevel Sector lightLevel at this object's origin.
* @return The specified lightLevel plus any attentuation.
*/
float Rend_AttenuateLightLevel(float distToViewer, float lightLevel);
float Rend_ShadowAttenuationFactor(coord_t distance);
/**
* Updates the lightModRange which is used to applify sector light to help
* compensate for the differences between the OpenGL lighting equation,
* the software Doom lighting model and the light grid (ambient lighting).
*
* The offsets in the lightRangeModTables are added to the sector->lightLevel
* during rendering (both positive and negative).
*/
void Rend_UpdateLightModMatrix();
/**
* Draws the lightModRange (for debug)
*/
void Rend_DrawLightModMatrix();
/**
* Sector light color may be affected by the sky light color.
*/
de::Vector3f const &Rend_SectorLightColor(SectorCluster const &cluster);
/**
* @copydoc Rend_SectorLightColor()
* @deprecated Caller should work at cluster level.
*/
de::Vector3f const &Rend_SectorLightColor(Sector const §or);
/**
* Blend the given light value with the luminous object's color, applying any
* applicable global modifiers and returns the result.
*
* @param color Source light color.
* @param light Strength of the light on the illumination point.
*
* @return Calculated result.
*/
de::Vector3f Rend_LuminousColor(de::Vector3f const &color, float light);
/**
* Given an @a intensity determine the height of the plane glow, applying any
* applicable global modifiers.
*
* @return Calculated result.
*/
coord_t Rend_PlaneGlowHeight(float intensity);
/**
* Selects a Material for the given map @a surface considering the current map
* renderer configuration.
*/
Material *Rend_ChooseMapSurfaceMaterial(Surface const &surface);
de::MaterialVariantSpec const &Rend_MapSurfaceMaterialSpec();
de::MaterialVariantSpec const &Rend_MapSurfaceMaterialSpec(int wrapS, int wrapT);
texturevariantspecification_t &Rend_MapSurfaceShinyTextureSpec();
texturevariantspecification_t &Rend_MapSurfaceShinyMaskTextureSpec();
void R_DivVerts(de::Vector3f *dst, de::Vector3f const *src,
de::WorldEdge const &leftEdge, de::WorldEdge const &rightEdge);
void R_DivTexCoords(de::Vector2f *dst, de::Vector2f const *src,
de::WorldEdge const &leftEdge, de::WorldEdge const &rightEdge);
void R_DivVertColors(de::Vector4f *dst, de::Vector4f const *src,
de::WorldEdge const &leftEdge, de::WorldEdge const &rightEdge);
#endif // CLIENT_RENDER_MAIN_H