29 #include "../../../idlib/precompiled.h"
34 #define VERTEX_HASH_BOXSIZE (1<<6) // must be power of 2
35 #define VERTEX_HASH_SIZE (VERTEX_HASH_BOXSIZE*VERTEX_HASH_BOXSIZE)
36 #define EDGE_HASH_SIZE (1<<14)
38 #define INTEGRAL_EPSILON 0.01f
39 #define VERTEX_EPSILON 0.1f
41 #define AAS_PLANE_NORMAL_EPSILON 0.00001f
42 #define AAS_PLANE_DIST_EPSILON 0.01f
79 aas_vertexHash->
Clear();
80 aas_edgeHash->
Clear();
81 aas_vertexBounds = bounds;
83 max = bounds[1].x - bounds[0].x;
84 f = bounds[1].y - bounds[0].y;
107 x = (((
int) (vec[0] - aas_vertexBounds[0].x + 0.5)) + 2) >> 2;
108 y = (((
int) (vec[1] - aas_vertexBounds[0].y + 0.5)) + 2) >> 2;
121 for (i = 0; i < 3; i++) {
132 for ( vn = aas_vertexHash->
First( hashKey ); vn >= 0; vn = aas_vertexHash->
Next( vn ) ) {
157 int v2num, hashKey, e;
170 if ( v1num == v2num ) {
174 hashKey = aas_edgeHash->
GenerateKey( v1num, v2num );
177 for ( e = aas_edgeHash->
First( hashKey ); e >= 0; e = aas_edgeHash->
Next( e ) ) {
180 if ( vertexNum[0] == v2num ) {
181 if ( vertexNum[1] == v1num ) {
187 else if ( vertexNum[0] == v1num ) {
188 if ( vertexNum[1] == v2num ) {
238 GetEdge( (*w)[i].ToVec3(), (*w)[(i+1)%w->
GetNumPoints()].ToVec3(), &faceEdges[numFaceEdges], v1num );
240 if ( faceEdges[numFaceEdges] ) {
250 if ( numFaceEdges < 3 ) {
255 for ( i = 0; i < numFaceEdges; i++ ) {
256 for ( j = i+1; j < numFaceEdges; j++ ) {
257 if ( faceEdges[i] == faceEdges[j] || faceEdges[i] == -faceEdges[j] ) {
270 for ( i = 0; i < numFaceEdges; i++ ) {
345 int areaNum, nodeNum, child0, child1;
370 file->
nodes[nodeNum].children[0] = child0;
372 file->
nodes[nodeNum].children[1] = child1;
374 if ( !child0 && !child1 ) {
473 memset( &edge, 0,
sizeof( edge ) );
474 file->edges.Append( edge );
477 memset( &face, 0,
sizeof( face ) );
478 file->faces.Append( face );
481 memset( &area, 0,
sizeof( area ) );
482 file->areas.Append( area );
485 memset( &node, 0,
sizeof( node ) );
486 file->nodes.Append( node );
void SetSizeEstimate(const idBrushBSP &bsp, idAASFileLocal *file)
struct sizeEstimate_s sizeEstimate_t
bool StoreFile(const idBrushBSP &bsp)
int Next(const int index) const
int GetContents(void) const
void GetSizeEstimate_r(idBrushBSPNode *parent, idBrushBSPNode *node, struct sizeEstimate_s &size)
GLdouble GLdouble GLint vn
#define AAS_PLANE_NORMAL_EPSILON
idList< aasNode_t > nodes
bool GetEdge(const idVec3 &v1, const idVec3 &v2, int *edgeNum, int v1num)
const idPlane & GetPlane(void) const
idHashIndex * aas_edgeHash
const idPlane & GetPlane(void) const
#define AREACONTENTS_SOLID
idBounds aas_vertexBounds
static float Rint(float f)
idList< aasIndex_t > faceIndex
idBrushBSPNode * GetRootNode(void) const
int FindPlane(const idPlane &plane, const float normalEps, const float distEps)
int First(const int key) const
bool GetFaceForPortal(idBrushBSPPortal *portal, int side, int *faceNum)
int GetAreaNum(void) const
idList< aasIndex_t > edgeIndex
GLfloat GLfloat GLfloat v2
int GetFaceNum(void) const
int GetNumPoints(void) const
#define MAX_POINTS_ON_WINDING
GLubyte GLubyte GLubyte GLubyte w
idBrushBSPNode * GetNode(int side) const
bool GetAreaForLeafNode(idBrushBSPNode *node, int *areaNum)
idList< aasFace_t > faces
static float Fabs(float f)
#define INTSIGNBITNOTSET(i)
int StoreTree_r(idBrushBSPNode *node)
virtual void Printf(const char *fmt,...) id_attribute((format(printf
int HashVec(const idVec3 &vec)
int GenerateKey(const char *string, bool caseSensitive=true) const
int Append(const type &obj)
idList< aasEdge_t > edges
idList< aasVertex_t > vertices
idReachability * rev_reach
idBrushBSPNode * GetChild(int index) const
bool GetVertex(const idVec3 &v, int *vertexNum)
idList< aasArea_t > areas
const idBounds & GetTreeBounds(void) const
idBrushBSPPortal * GetPortals(void) const
#define VERTEX_HASH_BOXSIZE
idWinding * GetWinding(void) const
idBrushBSPPortal * Next(int side) const
void DisplayRealTimeString(char *string,...)
void Add(const int key, const int index)
idBrushBSPNode * GetParent(void) const
#define AAS_PLANE_DIST_EPSILON
void ClearHash(const idBounds &bounds)
idHashIndex * aas_vertexHash