git-svn-id: http://bladebattles.com/kurok/SVN@11 20cd92bb-ff49-0410-b73e-96a06e42c3b9
[kurok.git] / render.h
blob7607282440e1a42758ac44cef87338afbf1b7d19
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
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.
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.
13 See the GNU General Public License for more details.
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.
21 // refresh.h -- public interface to refresh functions
23 #define MAXCLIPPLANES 11
25 #define TOP_RANGE 16 // soldier uniform colors
26 #define BOTTOM_RANGE 96
28 //=============================================================================
30 typedef struct efrag_s
32 struct mleaf_s *leaf;
33 struct efrag_s *leafnext;
34 struct entity_s *entity;
35 struct efrag_s *entnext;
36 } efrag_t;
39 typedef struct entity_s
41 qboolean forcelink; // model changed
43 int update_type;
45 entity_state_t baseline; // to fill in defaults in updates
47 double msgtime; // time of last update
48 vec3_t msg_origins[2]; // last two updates (0 is newest)
49 vec3_t origin;
50 vec3_t msg_angles[2]; // last two updates (0 is newest)
51 vec3_t angles;
52 struct model_s *model; // NULL = no model
53 struct efrag_s *efrag; // linked list of efrags
54 int frame;
55 float syncbase; // for client-side animations
56 byte *colormap;
57 int effects; // light, particals, etc
58 int skinnum; // for Alias models
59 int visframe; // last frame this entity was
60 // found in an active leaf
62 int dlightframe; // dynamic lighting
63 int dlightbits;
65 // FIXME: could turn these into a union
66 int trivial_accept;
67 struct mnode_s *topnode; // for bmodels, first world node
68 // that splits bmodel, or NULL if
69 // not split
71 float frame_start_time;
72 float frame_interval;
73 int pose1;
74 int pose2;
76 // fenix@io.com: model transform interpolation
77 float translate_start_time;
78 vec3_t origin1;
79 vec3_t origin2;
81 float rotate_start_time;
82 vec3_t angles1;
83 vec3_t angles2;
85 // light lerping - pox@planetquake.com
87 float last_shadelight;
89 // Tomaz - QC Alpha Scale Glow Begin
91 float alpha;
92 float scale;
93 float glow_size;
94 float glow_red;
95 float glow_green;
96 float glow_blue;
98 // Tomaz - QC Alpha Scale Glow End
100 } entity_t;
102 // !!! if this is changed, it must be changed in asm_draw.h too !!!
103 typedef struct
105 vrect_t vrect; // subwindow in video for refresh
106 // FIXME: not need vrect next field here?
107 vrect_t aliasvrect; // scaled Alias version
108 int vrectright, vrectbottom; // right & bottom screen coords
109 int aliasvrectright, aliasvrectbottom; // scaled Alias versions
110 float vrectrightedge; // rightmost right edge we care about,
111 // for use in edge list
112 float fvrectx, fvrecty; // for floating-point compares
113 float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
114 int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
115 int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
116 float fvrectright_adj, fvrectbottom_adj;
117 // right and bottom edges, for clamping
118 float fvrectright; // rightmost edge, for Alias clamping
119 float fvrectbottom; // bottommost edge, for Alias clamping
120 float horizontalFieldOfView; // at Z = 1.0, this many X is visible
121 // 2.0 = 90 degrees
122 float xOrigin; // should probably allways be 0.5
123 float yOrigin; // between be around 0.3 to 0.5
125 vec3_t vieworg;
126 vec3_t viewangles;
128 float fov_x, fov_y;
130 int ambientlight;
132 float fog_start;
133 float fog_end;
134 float fog_red;
135 float fog_green;
136 float fog_blue;
138 } refdef_t;
142 // refresh
144 extern int reinit_surfcache;
147 extern refdef_t r_refdef;
148 extern vec3_t r_origin, vpn, vright, vup;
150 extern struct texture_s *r_notexture_mip;
153 void R_Init (void);
154 void R_InitTextures (void);
155 void R_InitEfrags (void);
156 void R_RenderView (void); // must set r_refdef first
157 void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
158 #ifdef PSP_HARDWARE_VIDEO // called whenever r_refdef or vid change
159 void R_InitSky (byte *mt); // called at level load
160 #else
161 void R_InitSky (struct texture_s *mt); // called at level load
162 #endif
164 void R_AddEfrags (entity_t *ent);
165 void R_RemoveEfrags (entity_t *ent);
167 void R_NewMap (void);
170 void R_ParseParticleEffect (void);
171 void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
172 void R_RocketTrail (vec3_t start, vec3_t end, int type);
174 #ifdef QUAKE2
175 void R_DarkFieldParticles (entity_t *ent);
176 #endif
177 void R_EntityParticles (entity_t *ent);
178 void R_BlobExplosion (vec3_t org);
179 void R_ParticleExplosion (vec3_t org);
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);
184 void R_PushDlights (void);
188 // surface cache related
190 extern int reinit_surfcache; // if 1, surface cache is currently empty and
191 extern qboolean r_cache_thrash; // set if thrashing the surface cache
193 int D_SurfaceCacheForRes (int width, int height);
194 void D_FlushCaches (void);
195 void D_DeleteSurfaceCache (void);
196 void D_InitCaches (void *buffer, int size);
197 void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);