home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / quakeworld_src / client / render.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-17  |  4.8 KB  |  154 lines

  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 efrag_s
  29. {
  30.   struct mleaf_s    *leaf;
  31.   struct efrag_s    *leafnext;
  32.   struct entity_s   *entity;
  33.   struct efrag_s    *entnext;
  34. } efrag_t;
  35.  
  36.  
  37. typedef struct entity_s
  38. {
  39.   int           keynum;     // for matching entities in different frames
  40.   vec3_t          origin;
  41.   vec3_t          angles; 
  42.   struct model_s      *model;     // NULL = no model
  43.   int           frame;
  44.   byte          *colormap;
  45.   int           skinnum;    // for Alias models
  46.  
  47.   struct player_info_s  *scoreboard;  // identify player
  48.  
  49.   float         syncbase;
  50.  
  51.   struct efrag_s      *efrag;     // linked list of efrags (FIXME)
  52.   int           visframe;   // last frame this entity was
  53.                       // found in an active leaf
  54.                       // only used for static objects
  55.                       
  56.   int           dlightframe;  // dynamic lighting
  57.   int           dlightbits;
  58.   
  59. // FIXME: could turn these into a union
  60.   int           trivial_accept;
  61.   struct mnode_s      *topnode;   // for bmodels, first world node
  62.                       //  that splits bmodel, or NULL if
  63.                       //  not split
  64. } entity_t;
  65.  
  66. // !!! if this is changed, it must be changed in asm_draw.h too !!!
  67. typedef struct
  68. {
  69.   vrect_t   vrect;        // subwindow in video for refresh
  70.                   // FIXME: not need vrect next field here?
  71.   vrect_t   aliasvrect;     // scaled Alias version
  72.   int     vrectright, vrectbottom;  // right & bottom screen coords
  73.   int     aliasvrectright, aliasvrectbottom;  // scaled Alias versions
  74.   float   vrectrightedge;     // rightmost right edge we care about,
  75.                     //  for use in edge list
  76.   float   fvrectx, fvrecty;   // for floating-point compares
  77.   float   fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
  78.   int     vrect_x_adj_shift20;  // (vrect.x + 0.5 - epsilon) << 20
  79.   int     vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
  80.   float   fvrectright_adj, fvrectbottom_adj;
  81.                     // right and bottom edges, for clamping
  82.   float   fvrectright;      // rightmost edge, for Alias clamping
  83.   float   fvrectbottom;     // bottommost edge, for Alias clamping
  84.   float   horizontalFieldOfView;  // at Z = 1.0, this many X is visible 
  85.                     // 2.0 = 90 degrees
  86.   float   xOrigin;      // should probably allways be 0.5
  87.   float   yOrigin;      // between be around 0.3 to 0.5
  88.  
  89.   vec3_t    vieworg;
  90.   vec3_t    viewangles;
  91.  
  92.   float   fov_x, fov_y;
  93.   
  94.   int     ambientlight;
  95. } refdef_t;
  96.  
  97.  
  98. //
  99. // refresh
  100. //
  101. extern  int   reinit_surfcache;
  102.  
  103.  
  104. extern  refdef_t  r_refdef;
  105. extern vec3_t r_origin, vpn, vright, vup;
  106.  
  107. extern  struct texture_s  *r_notexture_mip;
  108.  
  109. extern  entity_t  r_worldentity;
  110.  
  111. void R_Init (void);
  112. void R_InitTextures (void);
  113. void R_InitEfrags (void);
  114. void R_RenderView (void);   // must set r_refdef first
  115. void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
  116.                 // called whenever r_refdef or vid change
  117. void R_InitSky (struct texture_s *mt);  // called at level load
  118.  
  119. void R_AddEfrags (entity_t *ent);
  120. void R_RemoveEfrags (entity_t *ent);
  121.  
  122. void R_NewMap (void);
  123.  
  124.  
  125. void R_ParseParticleEffect (void);
  126. void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
  127. void R_RocketTrail (vec3_t start, vec3_t end, int type);
  128.  
  129. void R_EntityParticles (entity_t *ent);
  130. void R_BlobExplosion (vec3_t org);
  131. void R_ParticleExplosion (vec3_t org);
  132. void R_LavaSplash (vec3_t org);
  133. void R_TeleportSplash (vec3_t org);
  134.  
  135. void R_PushDlights (void);
  136. void R_InitParticles (void);
  137. void R_ClearParticles (void);
  138. void R_DrawParticles (void);
  139. void R_DrawWaterSurfaces (void);
  140.  
  141.  
  142. //
  143. // surface cache related
  144. //
  145. extern  int   reinit_surfcache; // if 1, surface cache is currently empty and
  146. extern qboolean r_cache_thrash; // set if thrashing the surface cache
  147.  
  148. int D_SurfaceCacheForRes (int width, int height);
  149. void D_FlushCaches (void);
  150. void D_DeleteSurfaceCache (void);
  151. void D_InitCaches (void *buffer, int size);
  152. void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
  153.  
  154.