-
Notifications
You must be signed in to change notification settings - Fork 0
/
render.h
195 lines (154 loc) · 6.17 KB
/
render.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
/*
Copyright (C) 1996-1997 Id Software, Inc.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// refresh.h -- public interface to refresh functions
#define MAXCLIPPLANES 11
#define TOP_RANGE 16 // soldier uniform colors
#define BOTTOM_RANGE 96
//=============================================================================
typedef struct efrag_s
{
struct mleaf_s *leaf;
struct efrag_s *leafnext;
struct entity_s *entity;
struct efrag_s *entnext;
} efrag_t;
//johnfitz -- for lerping
#define LERP_MOVESTEP (1<<0) //this is a MOVETYPE_STEP entity, enable movement lerp
#define LERP_RESETANIM (1<<1) //disable anim lerping until next anim frame
#define LERP_RESETANIM2 (1<<2) //set this and previous flag to disable anim lerping for two anim frames (UNUSED)
#define LERP_RESETMOVE (1<<3) //disable movement lerping until next origin/angles change
#define LERP_FINISH (1<<4) //use lerpfinish time from server update instead of assuming interval of 0.1
//johnfitz
//johnfitz -- struct for passing lerp information to drawing functions
typedef struct {
short pose1;
short pose2;
float blend;
vec3_t origin;
vec3_t angles;
} lerpdata_t;
//johnfitz
// Baker change (RMQ Engine)
typedef struct glmatrix_s
{
union
{
// put first because gcc barfs a little
float m16[16];
float m4x4[4][4];
struct
{
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
};
};
} glmatrix_t;
typedef struct entity_s
{
qboolean forcelink; // model changed
int update_type;
entity_state3_t baseline; // to fill in defaults in updates
double msgtime; // time of last update
vec3_t msg_origins[2]; // last two updates (0 is newest)
vec3_t origin;
vec3_t msg_angles[2]; // last two updates (0 is newest)
vec3_t angles;
struct model_s *model; // NULL = no model
struct efrag_s *efrag; // linked list of efrags
int frame;
float syncbase; // for client-side animations
byte *colormap, *sourcecolormap;
byte colorshade;
int effects; // light, particals, etc
int skinnum; // for Alias models
int scale; // for Alias models
int drawflags; // for Alias models
int abslight; // for Alias models
int visframe; // last frame this entity was
// found in an active leaf
int dlightframe; // dynamic lighting
int dlightbits;
// FIXME: could turn these into a union
int trivial_accept;
struct mnode_s *topnode; // for bmodels, first world node
// that splits bmodel, or NULL if
// not split
byte alpha; // alpha
float fullbright; // fullbright
// fitzquake protocol+lerping
byte lerpflags; //johnfitz -- lerping
float lerpstart; //johnfitz -- animation lerping
float lerptime; //johnfitz -- animation lerping
float lerpfinish; //johnfitz -- lerping -- server sent us a more accurate interval, use it instead of 0.1
short previouspose; //johnfitz -- animation lerping
short currentpose; //johnfitz -- animation lerping
// short futurepose; //johnfitz -- animation lerping
float movelerpstart; //johnfitz -- transform lerping
vec3_t previousorigin; //johnfitz -- transform lerping
vec3_t currentorigin; //johnfitz -- transform lerping
vec3_t previousangles; //johnfitz -- transform lerping
vec3_t currentangles; //johnfitz -- transform lerping
} entity_t;
typedef struct
{
vrect_t vrect; // subwindow in video for refresh
/* // FIXME: not need vrect next field here?
*/
vec3_t vieworg;
vec3_t viewangles;
float fov_x, fov_y;
int ambientlight;
} refdef_t;
//
// refresh
//
extern refdef_t r_refdef;
extern vec3_t r_origin, vpn, vright, vup;
extern struct texture_s *notexture_mip;
extern struct texture_s *notexture_mip2;
extern entity_t r_worldentity;
void R_Init (void);
void R_InitTextures (void);
void R_LoadPalette (void);
void R_InitEfrags (void);
void R_SndExtraUpdate (void);
void R_RenderView (void); // must set r_refdef first
void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect); // called whenever r_refdef or vid change
void R_MarkSurfaces (void);
void R_InitSky (struct texture_s *mt); // called at level load
void R_AddEfrags (entity_t *ent);
void R_RemoveEfrags (entity_t *ent);
void R_NewMap (void);
void R_ParseParticleEffect (void);
void R_ParseParticleEffect2 (void);
void R_ParseParticleEffect3 (void);
void R_ParseParticleEffect4 (void);
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
void R_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count);
void R_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count);
void R_RunParticleEffect4 (vec3_t org, float radius, int color, int effect, int count);
void R_RocketTrail (vec3_t start, vec3_t end, int type);
void R_SunStaffTrail(vec3_t source, vec3_t dest);
void R_RainEffect (vec3_t org,vec3_t e_size,int x_dir, int y_dir,int color,int count);
void R_SnowEffect (vec3_t org1,vec3_t org2,int flags,vec3_t alldir,int count);
void R_ColoredParticleExplosion (vec3_t org,int color,int radius,int counter);
void R_BlobExplosion (vec3_t org);
void R_ParticleExplosion (vec3_t org);
void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
void R_LavaSplash (vec3_t org);
void R_TeleportSplash (vec3_t org);
void R_PushDlights (void);