/
r_main.h
184 lines (142 loc) · 4.41 KB
/
r_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
/** @file r_main.h
*
* @author Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @author 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, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/
#ifndef LIBDENG_RENDER_R_MAIN_H
#define LIBDENG_RENDER_R_MAIN_H
#include <de/rect.h>
#include "dd_share.h"
typedef struct viewport_s {
int console;
RectRaw geometry;
} viewport_t;
typedef struct viewer_s {
coord_t origin[3];
angle_t angle;
float pitch;
} viewer_t;
typedef struct viewdata_s {
viewer_t current;
viewer_t lastSharp[2]; ///< For smoothing.
viewer_t latest; ///< "Sharp" values taken from here.
/**
* These vectors are in the DGL coordinate system, which is a left-handed
* one (same as in the game, but Y and Z have been swapped). Anyone who uses
* these must note that it might be necessary to fix the aspect ratio of the
* Y axis by dividing the Y coordinate by 1.2.
*/
float frontVec[3], upVec[3], sideVec[3];
float viewCos, viewSin;
RectRaw window, windowTarget, windowOld;
float windowInter;
} viewdata_t;
typedef enum fontstyle_e {
FS_NORMAL,
FS_BOLD,
FS_LIGHT,
FONTSTYLE_COUNT
} fontstyle_t;
DENG_EXTERN_C float frameTimePos; // 0...1: fractional part for sharp game tics
DENG_EXTERN_C int loadInStartupMode;
DENG_EXTERN_C int validCount;
DENG_EXTERN_C int frameCount;
DENG_EXTERN_C int rendInfoTris;
DENG_EXTERN_C boolean firstFrameAfterLoad;
DENG_EXTERN_C byte precacheMapMaterials, precacheSprites, precacheSkins;
DENG_EXTERN_C fontid_t fontFixed, fontVariable[FONTSTYLE_COUNT];
DENG_EXTERN_C fixed_t fineTangent[FINEANGLES / 2];
DENG_EXTERN_C byte texGammaLut[256];
#ifdef __cplusplus
extern "C" {
#endif
/**
* Register console variables.
*/
void R_Register(void);
void R_BuildTexGammaLut(void);
/**
* One-time initialization of the refresh daemon. Called by DD_Main.
*/
void R_Init(void);
/**
* Re-initialize almost everything.
*/
void R_Update(void);
/**
* Shutdown the refresh daemon.
*/
void R_Shutdown(void);
void R_Ticker(timespan_t time);
/**
* Prepare for rendering view(s) of the world.
*/
void R_BeginWorldFrame(void);
/**
* Wrap up after drawing view(s) of the world.
*/
void R_EndWorldFrame(void);
/**
* Render all view ports in the viewport grid.
*/
void R_RenderViewPorts(void);
/**
* Render a blank view for the specified player.
*/
void R_RenderBlankView(void);
/**
* Draw the border around the view window.
*/
void R_RenderPlayerViewBorder(void);
/// @return Current viewport; otherwise @c NULL.
viewport_t const *R_CurrentViewPort(void);
/**
* Set the current GL viewport.
*/
void R_UseViewPort(viewport_t *vp);
viewdata_t const *R_ViewData(int consoleNum);
void R_UpdateViewer(int consoleNum);
void R_ResetViewer(void);
/**
* Update the sharp world data by rotating the stored values of plane
* heights and sharp camera positions.
*/
void R_NewSharpWorld(void);
/**
* Attempt to set up a view grid and calculate the viewports. Set 'numCols' and
* 'numRows' to zero to just update the viewport coordinates.
*/
boolean R_SetViewGrid(int numCols, int numRows);
void R_SetupDefaultViewWindow(int consoleNum);
/**
* Animates the view window towards the target values.
*/
void R_ViewWindowTicker(int consoleNum, timespan_t ticLength);
void R_SetViewPortPlayer(int consoleNum, int viewPlayer);
void R_LoadSystemFonts(void);
#ifdef __CLIENT__
char const *R_ChooseFixedFont(void);
char const *R_ChooseVariableFont(fontstyle_t style, int resX, int resY);
#endif
/**
* Prepare resources for the current Map.
*/
void Rend_CacheForMap(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* LIBDENG_REFRESH_MAIN_H */