Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

vis.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 // vis.h
00023 
00024 #include "cmdlib.h"
00025 #include "mathlib.h"
00026 #include "bspfile.h"
00027 
00028 #define MAX_PORTALS 32768
00029 
00030 #define PORTALFILE  "PRT1"
00031 
00032 #define ON_EPSILON  0.1
00033 
00034 //#define MREDEBUG
00035 
00036 // seperator caching helps a bit
00037 #define SEPERATORCACHE
00038 
00039 // can't have more seperators than the max number of points on a winding
00040 #define MAX_SEPERATORS      64
00041 
00042 typedef struct
00043 {
00044     vec3_t      normal;
00045     float       dist;
00046 } plane_t;
00047 
00048 #define MAX_POINTS_ON_WINDING   64
00049 #define MAX_POINTS_ON_FIXED_WINDING 12
00050 
00051 typedef struct
00052 {
00053     int     numpoints;
00054     vec3_t  points[MAX_POINTS_ON_FIXED_WINDING];            // variable sized
00055 } winding_t;
00056 
00057 winding_t   *NewWinding (int points);
00058 void        FreeWinding (winding_t *w);
00059 winding_t   *CopyWinding (winding_t *w);
00060 
00061 
00062 typedef struct passage_s
00063 {
00064     struct passage_s    *next;
00065     byte                cansee[1];  //all portals that can be seen through this passage
00066 } passage_t;
00067 
00068 typedef enum {stat_none, stat_working, stat_done} vstatus_t;
00069 typedef struct
00070 {
00071     int         num;
00072     qboolean    hint;   // true if this portal was created from a hint splitter
00073     qboolean    removed;
00074     plane_t     plane;  // normal pointing into neighbor
00075     int         leaf;   // neighbor
00076     
00077     vec3_t      origin; // for fast clip testing
00078     float       radius;
00079 
00080     winding_t   *winding;
00081     vstatus_t   status;
00082     byte        *portalfront;   // [portals], preliminary
00083     byte        *portalflood;   // [portals], intermediate
00084     byte        *portalvis;     // [portals], final
00085 
00086     int         nummightsee;    // bit count on portalflood for sort
00087     passage_t   *passages;      // there are just as many passages as there
00088                                 // are portals in the leaf this portal leads to
00089 } vportal_t;
00090 
00091 #define MAX_PORTALS_ON_LEAF     128
00092 typedef struct leaf_s
00093 {
00094     int         numportals;
00095     int         merged;
00096     vportal_t   *portals[MAX_PORTALS_ON_LEAF];
00097 } leaf_t;
00098 
00099     
00100 typedef struct pstack_s
00101 {
00102     byte        mightsee[MAX_PORTALS/8];        // bit string
00103     struct pstack_s *next;
00104     leaf_t      *leaf;
00105     vportal_t   *portal;    // portal exiting
00106     winding_t   *source;
00107     winding_t   *pass;
00108 
00109     winding_t   windings[3];    // source, pass, temp in any order
00110     int         freewindings[3];
00111 
00112     plane_t     portalplane;
00113     int depth;
00114 #ifdef SEPERATORCACHE
00115     plane_t seperators[2][MAX_SEPERATORS];
00116     int numseperators[2];
00117 #endif
00118 } pstack_t;
00119 
00120 typedef struct
00121 {
00122     vportal_t   *base;
00123     int         c_chains;
00124     pstack_t    pstack_head;
00125 } threaddata_t;
00126 
00127 
00128 
00129 extern  int         numportals;
00130 extern  int         portalclusters;
00131 
00132 extern  vportal_t   *portals;
00133 extern  leaf_t      *leafs;
00134 
00135 extern  int         c_portaltest, c_portalpass, c_portalcheck;
00136 extern  int         c_portalskip, c_leafskip;
00137 extern  int         c_vistest, c_mighttest;
00138 extern  int         c_chains;
00139 
00140 extern  byte    *vismap, *vismap_p, *vismap_end;    // past visfile
00141 
00142 extern  int         testlevel;
00143 
00144 extern  byte        *uncompressed;
00145 
00146 extern  int     leafbytes, leaflongs;
00147 extern  int     portalbytes, portallongs;
00148 
00149 
00150 void LeafFlow (int leafnum);
00151 
00152 
00153 void BasePortalVis(int portalnum);
00154 void BetterPortalVis(int portalnum);
00155 void PortalFlow(int portalnum);
00156 void PassagePortalFlow(int portalnum);
00157 void CreatePassages(int portalnum);
00158 void PassageFlow(int portalnum);
00159 
00160 extern  vportal_t   *sorted_portals[MAX_MAP_PORTALS*2];
00161 
00162 int CountBits (byte *bits, int numbits);

Generated on Thu Aug 25 12:38:25 2005 for Quake III Arena by  doxygen 1.3.9.1