]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - render.h
cleaned up nearly all of the externs in .c files (moved to appropriate .h files)
[xonotic/darkplaces.git] / render.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21 // refresh.h -- public interface to refresh functions
22
23 // sky stuff
24 extern char skyname[];
25 extern void R_SetSkyBox(char* sky);
26 extern void LoadSky_f(void);
27 extern rtexture_t *solidskytexture;
28 extern rtexture_t *alphaskytexture;
29 extern float speedscale; // for top sky and bottom sky
30
31 // far clip distance for scene
32 extern cvar_t r_farclip;
33
34 // fog stuff
35 extern void FOG_clear(void);
36 extern float fog_density, fog_red, fog_green, fog_blue;
37
38 // SHOWLMP stuff (Nehahra)
39 extern void SHOWLMP_decodehide(void);
40 extern void SHOWLMP_decodeshow(void);
41 extern void SHOWLMP_drawall(void);
42 extern void SHOWLMP_clear(void);
43
44 // render profiling stuff
45 extern qboolean intimerefresh;
46 extern cvar_t r_speeds2;
47 extern char r_speeds2_string1[81], r_speeds2_string2[81], r_speeds2_string3[81], r_speeds2_string4[81], r_speeds2_string5[81], r_speeds2_string6[81], r_speeds2_string7[81];
48
49 // lighting stuff
50 extern vec3_t lightspot;
51 extern cvar_t r_ambient;
52
53 // model rendering stuff
54 extern float *aliasvert;
55 extern float *aliasvertnorm;
56 extern byte *aliasvertcolor;
57 extern float modelalpha;
58
59 // vis stuff
60 extern cvar_t r_novis;
61
62 // model transform stuff
63 extern cvar_t gl_transform;
64
65 #define TOP_RANGE               16                      // soldier uniform colors
66 #define BOTTOM_RANGE    96
67
68 //=============================================================================
69
70 typedef struct entity_s
71 {
72         entity_state_t                  state_baseline; // baseline for entity
73         entity_state_t                  state_previous; // previous state (interpolating from this)
74         entity_state_t                  state_current;  // current state (interpolating to this)
75
76         struct
77         {
78                 vec3_t                                  origin;
79                 vec3_t                                  angles; 
80
81                 // LordHavoc: added support for alpha transprency and other effects
82                 float                                   alpha;                  // opacity (alpha) of the model
83                 float                                   colormod[3];    // color tint for model
84                 float                                   scale;                  // size the model is shown
85                 float                                   glowsize;               // how big the glow is
86                 byte                                    glowcolor;              // color of glow and particle trail (paletted)
87                 byte                                    flags;                  // render flags
88
89                 struct model_s                  *model;                 // NULL = no model
90                 int                                             frame;                  // current desired frame (usually identical to frame2, but frame2 is not always used)
91                 int                                             colormap;
92                 int                                             effects;                // light, particles, etc
93                 int                                             skinnum;                // for Alias models
94
95                 int                                             visframe;               // last frame this entity was found in an active leaf
96
97                 struct model_s                  *lerp_model;    // lerp resets when model changes
98                 double                                  lerp_starttime; // start of this transition
99                 int                                             frame1;                 // frame that the model is interpolating from
100                 int                                             frame2;                 // frame that the model is interpolating to
101                 double                                  framelerp;              // interpolation factor, usually computed from lerp_starttime
102                 double                                  frame1start;    // time frame1 began playing (for framegroup animations)
103                 double                                  frame2start;    // time frame2 began playing (for framegroup animations)
104
105                 int                                             dlightframe;    // dynamic lighting
106                 int                                             dlightbits[8];
107                 
108                 float                                   trail_time;
109         }
110         render;
111 } entity_t;
112
113 typedef struct
114 {
115         vrect_t         vrect;                          // subwindow in video for refresh
116                                                                         // FIXME: not need vrect next field here?
117         /*
118         vrect_t         aliasvrect;                     // scaled Alias version
119         int                     vrectright, vrectbottom;        // right & bottom screen coords
120         int                     aliasvrectright, aliasvrectbottom;      // scaled Alias versions
121         float           vrectrightedge;                 // rightmost right edge we care about,
122                                                                                 //  for use in edge list
123         float           fvrectx, fvrecty;               // for floating-point compares
124         float           fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
125         int                     vrect_x_adj_shift20;    // (vrect.x + 0.5 - epsilon) << 20
126         int                     vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
127         float           fvrectright_adj, fvrectbottom_adj;
128                                                                                 // right and bottom edges, for clamping
129         float           fvrectright;                    // rightmost edge, for Alias clamping
130         float           fvrectbottom;                   // bottommost edge, for Alias clamping
131         float           horizontalFieldOfView;  // at Z = 1.0, this many X is visible 
132                                                                                 // 2.0 = 90 degrees
133         float           xOrigin;                        // should probably always be 0.5
134         float           yOrigin;                        // between be around 0.3 to 0.5
135         */
136
137         vec3_t          vieworg;
138         vec3_t          viewangles;
139         
140         float           fov_x, fov_y;
141
142 //      int                     ambientlight;
143 } refdef_t;
144
145
146 //
147 // refresh
148 //
149
150
151 extern  refdef_t        r_refdef;
152 extern vec3_t   r_origin, vpn, vright, vup;
153 extern qboolean hlbsp;
154
155 void R_Init (void);
156 void R_RenderView (void); // must set r_refdef first
157 void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect); // called whenever r_refdef or vid change
158
159 // LordHavoc: changed this for sake of GLQuake
160 void R_InitSky (byte *src, int bytesperpixel); // called at level load
161
162 int R_VisibleCullBox (vec3_t mins, vec3_t maxs);
163
164 void R_NewMap (void);
165
166 #include "r_decals.h"
167
168 void R_ParseParticleEffect (void);
169 void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
170 void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent);
171 void R_RocketTrail2 (vec3_t start, vec3_t end, int type, entity_t *ent);
172 void R_SparkShower (vec3_t org, vec3_t dir, int count);
173 void R_BloodPuff (vec3_t org, vec3_t vel, int count);
174 void R_FlameCube (vec3_t mins, vec3_t maxs, int count);
175 void R_Flames (vec3_t org, vec3_t vel, int count);
176
177 void R_EntityParticles (entity_t *ent);
178 void R_BlobExplosion (vec3_t org);
179 void R_ParticleExplosion (vec3_t org, int smoke);
180 void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
181 void R_LavaSplash (vec3_t org);
182 void R_TeleportSplash (vec3_t org);
183
184 void R_NewExplosion(vec3_t org);
185
186 void R_PushDlights (void);
187 void R_DrawWorld (void);
188 //void R_RenderDlights (void);
189 void R_DrawParticles (void);
190 void R_MoveParticles (void);
191 void R_DrawExplosions (void);
192 void R_MoveExplosions (void);