some whitespace changes
[divverent/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 #define TOP_RANGE               16                      // soldier uniform colors
24 #define BOTTOM_RANGE    96
25
26 //=============================================================================
27
28 typedef struct entity_s
29 {
30         entity_state_t                  state_baseline; // baseline for entity
31         entity_state_t                  state_previous; // previous state (interpolating from this)
32         entity_state_t                  state_current;  // current state (interpolating to this)
33
34         struct
35         {
36                 vec3_t                                  origin;
37                 vec3_t                                  angles; 
38
39                 // LordHavoc: added support for alpha transprency and other effects
40                 float                                   alpha;                  // opacity (alpha) of the model
41                 float                                   colormod[3];    // color tint for model
42                 float                                   scale;                  // size the model is shown
43                 float                                   glowsize;               // how big the glow is
44                 byte                                    glowcolor;              // color of glow and particle trail (paletted)
45                 byte                                    flags;                  // render flags
46
47                 struct model_s                  *model;                 // NULL = no model
48                 int                                             frame;                  // current desired frame (usually identical to frame2, but frame2 is not always used)
49                 int                                             colormap;
50                 int                                             effects;                // light, particles, etc
51                 int                                             skinnum;                // for Alias models
52
53                 int                                             visframe;               // last frame this entity was found in an active leaf
54
55                 struct model_s                  *lerp_model;    // lerp resets when model changes
56                 double                                  lerp_starttime; // start of this transition
57                 int                                             frame1;                 // frame that the model is interpolating from
58                 int                                             frame2;                 // frame that the model is interpolating to
59                 double                                  framelerp;              // interpolation factor, usually computed from lerp_starttime
60                 double                                  frame1start;    // time frame1 began playing (for framegroup animations)
61                 double                                  frame2start;    // time frame2 began playing (for framegroup animations)
62
63                 int                                             dlightframe;    // dynamic lighting
64                 int                                             dlightbits[8];
65                 
66                 float                                   trail_time;
67         }
68         render;
69 } entity_t;
70
71 typedef struct
72 {
73         vrect_t         vrect;                          // subwindow in video for refresh
74                                                                         // FIXME: not need vrect next field here?
75         /*
76         vrect_t         aliasvrect;                     // scaled Alias version
77         int                     vrectright, vrectbottom;        // right & bottom screen coords
78         int                     aliasvrectright, aliasvrectbottom;      // scaled Alias versions
79         float           vrectrightedge;                 // rightmost right edge we care about,
80                                                                                 //  for use in edge list
81         float           fvrectx, fvrecty;               // for floating-point compares
82         float           fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
83         int                     vrect_x_adj_shift20;    // (vrect.x + 0.5 - epsilon) << 20
84         int                     vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
85         float           fvrectright_adj, fvrectbottom_adj;
86                                                                                 // right and bottom edges, for clamping
87         float           fvrectright;                    // rightmost edge, for Alias clamping
88         float           fvrectbottom;                   // bottommost edge, for Alias clamping
89         float           horizontalFieldOfView;  // at Z = 1.0, this many X is visible 
90                                                                                 // 2.0 = 90 degrees
91         float           xOrigin;                        // should probably always be 0.5
92         float           yOrigin;                        // between be around 0.3 to 0.5
93         */
94
95         vec3_t          vieworg;
96         vec3_t          viewangles;
97         
98         float           fov_x, fov_y;
99
100 //      int                     ambientlight;
101 } refdef_t;
102
103
104 //
105 // refresh
106 //
107
108
109 extern  refdef_t        r_refdef;
110 extern vec3_t   r_origin, vpn, vright, vup;
111 extern qboolean hlbsp;
112
113 void R_Init (void);
114 void R_RenderView (void); // must set r_refdef first
115 void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect); // called whenever r_refdef or vid change
116
117 // LordHavoc: changed this for sake of GLQuake
118 void R_InitSky (byte *src, int bytesperpixel); // called at level load
119
120 int R_VisibleCullBox (vec3_t mins, vec3_t maxs);
121
122 void R_NewMap (void);
123
124 #include "r_decals.h"
125
126 void R_ParseParticleEffect (void);
127 void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
128 void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent);
129 void R_RocketTrail2 (vec3_t start, vec3_t end, int type, entity_t *ent);
130 void R_SparkShower (vec3_t org, vec3_t dir, int count);
131 void R_BloodPuff (vec3_t org, vec3_t vel, int count);
132 void R_FlameCube (vec3_t mins, vec3_t maxs, int count);
133 void R_Flames (vec3_t org, vec3_t vel, int count);
134
135 void R_EntityParticles (entity_t *ent);
136 void R_BlobExplosion (vec3_t org);
137 void R_ParticleExplosion (vec3_t org, int smoke);
138 void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
139 void R_LavaSplash (vec3_t org);
140 void R_TeleportSplash (vec3_t org);
141
142 void R_NewExplosion(vec3_t org);
143
144 void R_PushDlights (void);
145 void R_DrawWorld (void);
146 //void R_RenderDlights (void);
147 void R_DrawParticles (void);
148 void R_MoveParticles (void);
149 void R_DrawExplosions (void);
150 void R_MoveExplosions (void);