2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
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 TOP_RANGE 16 // soldier uniform colors
|
|
|
|
#define BOTTOM_RANGE 96
|
|
|
|
|
|
|
|
struct msurface_s;
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
typedef struct efrag_s
|
|
|
|
{
|
|
|
|
struct mleaf_s *leaf;
|
|
|
|
struct efrag_s *leafnext;
|
|
|
|
struct entity_s *entity;
|
|
|
|
struct efrag_s *entnext;
|
|
|
|
} efrag_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct entity_s
|
|
|
|
{
|
|
|
|
int keynum; // for matching entities in different frames
|
|
|
|
vec3_t origin;
|
2005-06-04 04:20:20 +00:00
|
|
|
vec3_t angles;
|
2004-12-24 08:45:56 +00:00
|
|
|
vec3_t axis[3];
|
|
|
|
|
|
|
|
byte_vec4_t shaderRGBA;
|
2005-02-09 19:32:09 +00:00
|
|
|
float shaderTime;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
vec3_t oldorigin;
|
|
|
|
vec3_t oldangles;
|
|
|
|
|
|
|
|
struct model_s *model; // NULL = no model
|
|
|
|
int frame;
|
|
|
|
qbyte *colormap;
|
|
|
|
int skinnum; // for Alias models
|
|
|
|
|
|
|
|
struct player_info_s *scoreboard; // identify player
|
|
|
|
|
|
|
|
float syncbase;
|
|
|
|
|
|
|
|
struct efrag_s *efrag; // linked list of efrags (FIXME)
|
|
|
|
int visframe; // last frame this entity was
|
|
|
|
// found in an active leaf
|
|
|
|
// only used for static objects
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
float bonecontrols[4];
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
int flags;
|
|
|
|
|
2005-02-09 19:32:09 +00:00
|
|
|
#ifdef Q3SHADERS
|
|
|
|
struct shader_s *forcedshader;
|
|
|
|
#endif
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef PEXT_SCALE
|
|
|
|
float scale;
|
|
|
|
#endif
|
|
|
|
#ifdef PEXT_TRANS
|
|
|
|
float alpha;
|
|
|
|
#endif
|
|
|
|
#ifdef PEXT_FATNESS
|
|
|
|
float fatness;
|
|
|
|
#endif
|
|
|
|
#ifdef PEXT_HEXEN2
|
|
|
|
int drawflags;
|
|
|
|
int abslight;
|
|
|
|
#endif
|
|
|
|
float lerpfrac;
|
|
|
|
int oldframe;
|
|
|
|
} entity_t;
|
|
|
|
|
|
|
|
// !!! if this is changed, it must be changed in asm_draw.h too !!!
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
vrect_t vrect; // subwindow in video for refresh
|
|
|
|
// FIXME: not need vrect next field here?
|
|
|
|
vrect_t aliasvrect; // scaled Alias version
|
|
|
|
int vrectright, vrectbottom; // right & bottom screen coords
|
|
|
|
int aliasvrectright, aliasvrectbottom; // scaled Alias versions
|
|
|
|
float vrectrightedge; // rightmost right edge we care about,
|
|
|
|
// for use in edge list
|
|
|
|
float fvrectx, fvrecty; // for floating-point compares
|
|
|
|
float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
|
|
|
|
int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
|
|
|
|
int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
|
|
|
|
float fvrectright_adj, fvrectbottom_adj;
|
|
|
|
// right and bottom edges, for clamping
|
|
|
|
float fvrectright; // rightmost edge, for Alias clamping
|
|
|
|
float fvrectbottom; // bottommost edge, for Alias clamping
|
|
|
|
float horizontalFieldOfView; // at Z = 1.0, this many X is visible
|
|
|
|
// 2.0 = 90 degrees
|
|
|
|
float xOrigin; // should probably allways be 0.5
|
|
|
|
float yOrigin; // between be around 0.3 to 0.5
|
|
|
|
|
|
|
|
vec3_t vieworg;
|
|
|
|
vec3_t viewangles;
|
|
|
|
|
|
|
|
float fov_x, fov_y;
|
|
|
|
|
|
|
|
int ambientlight;
|
|
|
|
|
|
|
|
int flags;
|
|
|
|
|
|
|
|
int currentplayernum;
|
2005-02-09 19:32:09 +00:00
|
|
|
|
|
|
|
float time;
|
2004-08-23 00:15:46 +00:00
|
|
|
} refdef_t;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// refresh
|
|
|
|
//
|
|
|
|
extern int reinit_surfcache;
|
|
|
|
|
|
|
|
|
|
|
|
extern refdef_t r_refdef;
|
|
|
|
extern vec3_t r_origin, vpn, vright, vup;
|
|
|
|
|
|
|
|
extern struct texture_s *r_notexture_mip;
|
|
|
|
|
|
|
|
extern entity_t r_worldentity;
|
|
|
|
|
|
|
|
#if defined(RGLQUAKE)
|
|
|
|
void GLR_Init (void);
|
|
|
|
void GLR_ReInit (void);
|
|
|
|
void GLR_InitTextures (void);
|
|
|
|
void GLR_InitEfrags (void);
|
|
|
|
void GLR_RenderView (void); // must set r_refdef first
|
|
|
|
// called whenever r_refdef or vid change
|
|
|
|
void GLR_InitSky (struct texture_s *mt); // called at level load
|
|
|
|
void GLR_SetSky (char *name, float rotate, vec3_t axis);
|
|
|
|
qboolean GLR_CheckSky(void);
|
|
|
|
|
|
|
|
void GLR_AddEfrags (entity_t *ent);
|
|
|
|
void GLR_RemoveEfrags (entity_t *ent);
|
|
|
|
|
|
|
|
void GLR_NewMap (void);
|
|
|
|
|
|
|
|
void GLR_PushDlights (void);
|
|
|
|
void GLR_DrawWaterSurfaces (void);
|
|
|
|
|
|
|
|
void GLR_AddStain(vec3_t org, float red, float green, float blue, float radius);
|
|
|
|
void GLR_LessenStains(void);
|
|
|
|
|
2004-09-20 23:25:38 +00:00
|
|
|
void MediaGL_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette);
|
|
|
|
void MediaGL_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight); //top down
|
|
|
|
void MediaGL_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight); //input is bottom up...
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SWQUAKE)
|
|
|
|
void SWR_Init (void);
|
|
|
|
void SWR_InitTextures (void);
|
|
|
|
void SWR_InitEfrags (void);
|
|
|
|
void SWR_RenderView (void); // must set r_refdef first
|
|
|
|
void SWR_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
|
|
|
|
// called whenever r_refdef or vid change
|
|
|
|
void SWR_InitSky (struct texture_s *mt); // called at level load
|
|
|
|
void SWR_SetSky (char *name, float rotate, vec3_t axis);
|
|
|
|
qboolean SWR_CheckSky(void);
|
|
|
|
|
|
|
|
void SWR_AddEfrags (entity_t *ent);
|
|
|
|
void SWR_RemoveEfrags (entity_t *ent);
|
|
|
|
|
|
|
|
void SWR_NewMap (void);
|
|
|
|
|
|
|
|
void SWR_PushDlights (void);
|
|
|
|
|
|
|
|
void SWR_AddStain(vec3_t org, float red, float green, float blue, float radius);
|
|
|
|
void SWR_LessenStains(void);
|
2004-09-20 23:25:38 +00:00
|
|
|
|
|
|
|
void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette);
|
|
|
|
void MediaSW_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight); //top down
|
|
|
|
void MediaSW_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight); //input is bottom up...
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void R_AddEfrags (entity_t *ent);
|
|
|
|
void R_RemoveEfrags (entity_t *ent);
|
|
|
|
|
|
|
|
//
|
|
|
|
// surface cache related
|
|
|
|
//
|
|
|
|
extern int reinit_surfcache; // if 1, surface cache is currently empty and
|
|
|
|
extern qboolean r_cache_thrash; // set if thrashing the surface cache
|
|
|
|
|
|
|
|
int D_SurfaceCacheForRes (int width, int height, int bpp);
|
|
|
|
void D_FlushCaches (void);
|
|
|
|
void D_DeleteSurfaceCache (void);
|
|
|
|
void D_InitCaches (void *buffer, int size);
|
|
|
|
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(RGLQUAKE)
|
|
|
|
|
|
|
|
void GLMod_Init (void);
|
2005-06-14 04:52:10 +00:00
|
|
|
qboolean GLMod_GetTag(struct model_s *model, int tagnum, int frame, int frame2, float f2ness, float f1time, float f2time, float *result);
|
2004-12-21 04:31:00 +00:00
|
|
|
int GLMod_TagNumForName(struct model_s *model, char *name);
|
2004-08-23 00:15:46 +00:00
|
|
|
void GLMod_ClearAll (void);
|
|
|
|
struct model_s *GLMod_ForName (char *name, qboolean crash);
|
|
|
|
struct model_s *GLMod_FindName (char *name);
|
|
|
|
void *GLMod_Extradata (struct model_s *mod); // handles caching
|
|
|
|
void GLMod_TouchModel (char *name);
|
|
|
|
|
|
|
|
struct mleaf_s *GLMod_PointInLeaf (float *p, struct model_s *model);
|
|
|
|
qbyte *GLMod_LeafPVS (struct mleaf_s *leaf, struct model_s *model, qbyte *buffer);
|
|
|
|
qbyte *GLMod_LeafnumPVS (int leafnum, struct model_s *model, qbyte *buffer);
|
|
|
|
|
|
|
|
void GLMod_Think (void);
|
|
|
|
void GLMod_NowLoadExternal(void);
|
|
|
|
void GLR_WipeStains(void);
|
|
|
|
void R_LoadSkys (void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SWQUAKE)
|
|
|
|
|
|
|
|
void SWMod_Init (void);
|
|
|
|
void SWMod_ClearAll (void);
|
|
|
|
struct model_s *SWMod_ForName (char *name, qboolean crash);
|
|
|
|
struct model_s *SWMod_FindName (char *name);
|
|
|
|
void *SWMod_Extradata (struct model_s *mod); // handles caching
|
|
|
|
void SWMod_TouchModel (char *name);
|
|
|
|
|
|
|
|
struct mleaf_s *SWMod_PointInLeaf (float *p, struct model_s *model);
|
|
|
|
qbyte *SWMod_LeafPVS (struct mleaf_s *leaf, struct model_s *model, qbyte *buffer);
|
|
|
|
|
|
|
|
void SWMod_Think (void);
|
|
|
|
void SWMod_NowLoadExternal(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
qboolean Media_ShowFilm(void);
|
|
|
|
void Media_CaptureDemoEnd(void);
|
|
|
|
void Media_RecordAudioFrame (short *sample_buffer, int samples);
|
|
|
|
void Media_RecordFrame (void);
|
|
|
|
|
2004-11-29 05:52:57 +00:00
|
|
|
void R_SetRenderer(int wanted);
|
2004-08-23 00:15:46 +00:00
|
|
|
void RQ_Init(void);
|
2005-03-10 03:55:18 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
void CLQ2_RailTrail (vec3_t start, vec3_t end);
|
|
|
|
void CLQ2_BubbleTrail (vec3_t start, vec3_t end);
|
|
|
|
void CLQ2_EntityEvent(entity_state_t *es);
|
|
|
|
void CLQ2_TeleporterParticles(entity_state_t *es);
|
|
|
|
void CLQ2_IonripperTrail(vec3_t oldorg, vec3_t neworg);
|
|
|
|
void CLQ2_TrackerTrail(vec3_t oldorg, vec3_t neworg, int flags);
|
|
|
|
void CLQ2_Tracker_Shell(vec3_t org);
|
|
|
|
void CLQ2_TagTrail(vec3_t oldorg, vec3_t neworg, int flags);
|
|
|
|
void CLQ2_FlagTrail(vec3_t oldorg, vec3_t neworg, int flags);
|
|
|
|
void CLQ2_TrapParticles(entity_t *ent);
|
|
|
|
void CLQ2_BfgParticles(entity_t *ent);
|
|
|
|
struct q2centity_s;
|
|
|
|
void CLQ2_FlyEffect(struct q2centity_s *ent, vec3_t org);
|
|
|
|
void CLQ2_DiminishingTrail(vec3_t oldorg, vec3_t neworg, struct q2centity_s *ent, unsigned int effects);
|
|
|
|
void CLQ2_BlasterTrail2(vec3_t oldorg, vec3_t neworg);
|
|
|
|
|
|
|
|
void WritePCXfile (char *filename, qbyte *data, int width, int height, int rowbytes, qbyte *palette, qboolean upload); //data is 8bit.
|
|
|
|
qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height);
|
|
|
|
qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey);
|
|
|
|
qbyte *ReadJPEGFile(qbyte *infile, int length, int *width, int *height);
|
|
|
|
qbyte *ReadPNGFile(qbyte *buf, int length, int *width, int *height);
|
|
|
|
qbyte *ReadPCXPalette(qbyte *buf, int len, qbyte *out);
|
|
|
|
|
|
|
|
void BoostGamma(qbyte *rgba, int width, int height);
|
2005-05-18 01:40:01 +00:00
|
|
|
void SaturateR8G8B8(qbyte *data, int size, float sat);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
void CL_NewDlightRGB (int key, float x, float y, float z, float radius, float time,
|
|
|
|
float r, float g, float b);
|
|
|
|
|
|
|
|
void Renderer_Init(void);
|
2004-09-20 23:25:38 +00:00
|
|
|
void R_RestartRenderer_f (void);//this goes here so we can save some stack when first initing the sw renderer.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
//used to live in glquake.h
|
|
|
|
qbyte GetPalette(int red, int green, int blue);
|
|
|
|
extern cvar_t r_norefresh;
|
|
|
|
extern cvar_t r_drawentities;
|
|
|
|
extern cvar_t r_drawworld;
|
|
|
|
extern cvar_t r_drawviewmodel;
|
|
|
|
extern cvar_t r_speeds;
|
|
|
|
extern cvar_t r_waterwarp;
|
|
|
|
extern cvar_t r_fullbright;
|
|
|
|
extern cvar_t r_lightmap;
|
|
|
|
extern cvar_t r_shadows;
|
|
|
|
extern cvar_t r_mirroralpha;
|
|
|
|
extern cvar_t r_wateralpha;
|
|
|
|
extern cvar_t r_dynamic;
|
|
|
|
extern cvar_t r_novis;
|
|
|
|
extern cvar_t r_netgraph;
|
|
|
|
|
|
|
|
#ifdef R_XFLIP
|
|
|
|
extern cvar_t r_xflip;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern cvar_t gl_clear;
|
|
|
|
extern cvar_t gl_cull;
|
|
|
|
extern cvar_t gl_poly;
|
|
|
|
extern cvar_t gl_smoothmodels;
|
|
|
|
extern cvar_t gl_affinemodels;
|
|
|
|
extern cvar_t gl_polyblend;
|
|
|
|
extern cvar_t gl_keeptjunctions;
|
|
|
|
extern cvar_t gl_reporttjunctions;
|
|
|
|
extern cvar_t r_flashblend;
|
|
|
|
extern cvar_t gl_nocolors;
|
|
|
|
extern cvar_t gl_load24bit;
|
|
|
|
extern cvar_t gl_finish;
|
|
|
|
|
|
|
|
extern cvar_t gl_max_size;
|
|
|
|
extern cvar_t gl_playermip;
|
2004-09-07 23:15:55 +00:00
|
|
|
|
|
|
|
extern cvar_t r_palconvbits;
|
2004-09-09 19:39:26 +00:00
|
|
|
extern cvar_t r_palconvwrite;
|
2004-12-15 17:44:42 +00:00
|
|
|
|
2005-05-18 01:40:01 +00:00
|
|
|
extern cvar_t r_lightmap_saturation;
|
2004-12-15 17:44:42 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
RSPEED_TOTALREFRESH,
|
2005-04-16 16:21:27 +00:00
|
|
|
RSPEED_LINKENTITIES,
|
|
|
|
RSPEED_PROTOCOL,
|
2004-12-15 17:44:42 +00:00
|
|
|
RSPEED_WORLDNODE,
|
|
|
|
RSPEED_WORLD,
|
2005-04-16 16:21:27 +00:00
|
|
|
RSPEED_DRAWENTITIES,
|
2004-12-15 17:44:42 +00:00
|
|
|
RSPEED_STENCILSHADOWS,
|
|
|
|
RSPEED_FULLBRIGHTS,
|
|
|
|
RSPEED_DYNAMIC,
|
|
|
|
RSPEED_PARTICLES,
|
|
|
|
RSPEED_PARTICLESDRAW,
|
|
|
|
RSPEED_PALETTEFLASHES,
|
|
|
|
RSPEED_2D,
|
|
|
|
RSPEED_SERVER,
|
|
|
|
RSPEED_FINISH,
|
|
|
|
|
|
|
|
RSPEED_MAX
|
|
|
|
};
|
|
|
|
int rspeeds[RSPEED_MAX];
|
|
|
|
|
|
|
|
enum {
|
|
|
|
RQUANT_MSECS, //old r_speeds
|
|
|
|
RQUANT_EPOLYS,
|
|
|
|
RQUANT_WPOLYS,
|
|
|
|
RQUANT_SHADOWFACES,
|
|
|
|
RQUANT_SHADOWEDGES,
|
|
|
|
RQUANT_LITFACES,
|
|
|
|
|
|
|
|
RQUANT_MAX
|
|
|
|
};
|
|
|
|
int rquant[RQUANT_MAX];
|
|
|
|
|
|
|
|
#define RQuantAdd(type,quant) rquant[type] += quant;
|
|
|
|
|
|
|
|
#define RSpeedLocals() int rsp
|
|
|
|
#define RSpeedMark() int rsp = r_speeds.value?Sys_DoubleTime()*1000000:0
|
|
|
|
#define RSpeedRemark() rsp = r_speeds.value?Sys_DoubleTime()*1000000:0
|
2005-05-13 10:42:48 +00:00
|
|
|
|
|
|
|
//extern void (_stdcall *qglFinish) (void);
|
|
|
|
//#define RSpeedEnd(spt) do {qglFinish(); rspeeds[spt] += r_speeds.value?Sys_DoubleTime()*1000000 - rsp:0;}while (0)
|
2004-12-15 17:44:42 +00:00
|
|
|
#define RSpeedEnd(spt) rspeeds[spt] += r_speeds.value?Sys_DoubleTime()*1000000 - rsp:0
|