This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
|
|
Definition at line 23 of file aas_create.h. |
|
|
Definition at line 79 of file aas_create.h. |
|
|
|
|
|
|
Referenced by AAS_CreateAreaSettings(), and AAS_StoreAreaSettings(). |
|
|
|
|
Referenced by AAS_AllocTmpNode(), and AAS_FreeTmpAAS(). |
|
||||||||||||||||
|
Definition at line 246 of file aas_create.c. References tmp_face_s::backarea, Error(), tmp_face_s::frontarea, tmp_face_s::next, tmp_face_s::prev, tmp_area_t, tmp_face_t, and tmp_area_s::tmpfaces. Referenced by AAS_CreateArea(), AAS_FlipFace(), AAS_SplitArea(), and AAS_TryMergeFaceAreas(). 00247 {
00248 int tmpfaceside;
00249
00250 if (side)
00251 {
00252 if (tmpface->backarea) Error("AAS_AddFaceSideToArea: already a back area\n");
00253 } //end if
00254 else
00255 {
00256 if (tmpface->frontarea) Error("AAS_AddFaceSideToArea: already a front area\n");
00257 } //end else
00258
00259 if (side) tmpface->backarea = tmparea;
00260 else tmpface->frontarea = tmparea;
00261
00262 if (tmparea->tmpfaces)
00263 {
00264 tmpfaceside = tmparea->tmpfaces->frontarea != tmparea;
00265 tmparea->tmpfaces->prev[tmpfaceside] = tmpface;
00266 } //end if
00267 tmpface->next[side] = tmparea->tmpfaces;
00268 tmpface->prev[side] = NULL;
00269 tmparea->tmpfaces = tmpface;
00270 } //end of the function AAS_AddFaceSideToArea
|
Here is the call graph for this function:

|
|
Definition at line 139 of file aas_create.c. References tmp_aas_s::areanum, tmp_area_s::areanum, tmp_aas_s::areas, GetClearedMemory(), tmp_area_s::l_next, tmp_area_s::l_prev, tmp_aas_s::numareas, tmp_area_t, and tmpaasworld. Referenced by AAS_CreateArea(), AAS_SplitArea(), and AAS_TryMergeFaceAreas(). 00140 {
00141 tmp_area_t *tmparea;
00142
00143 tmparea = (tmp_area_t *) GetClearedMemory(sizeof(tmp_area_t));
00144 tmparea->areanum = tmpaasworld.areanum++;
00145 tmparea->l_prev = NULL;
00146 tmparea->l_next = tmpaasworld.areas;
00147 if (tmpaasworld.areas) tmpaasworld.areas->l_prev = tmparea;
00148 tmpaasworld.areas = tmparea;
00149 tmpaasworld.numareas++;
00150 return tmparea;
00151 } //end of the function AAS_AllocTmpArea
|
Here is the call graph for this function:

|
|
Definition at line 103 of file aas_create.c. References tmp_aas_s::facenum, tmp_aas_s::faces, GetClearedMemory(), tmp_face_s::l_next, tmp_face_s::l_prev, tmp_face_s::num, tmp_aas_s::numfaces, tmp_face_t, and tmpaasworld. Referenced by AAS_CreateArea(), AAS_SplitArea(), and AAS_SplitFace(). 00104 {
00105 tmp_face_t *tmpface;
00106
00107 tmpface = (tmp_face_t *) GetClearedMemory(sizeof(tmp_face_t));
00108 tmpface->num = tmpaasworld.facenum++;
00109 tmpface->l_prev = NULL;
00110 tmpface->l_next = tmpaasworld.faces;
00111 if (tmpaasworld.faces) tmpaasworld.faces->l_prev = tmpface;
00112 tmpaasworld.faces = tmpface;
00113 tmpaasworld.numfaces++;
00114 return tmpface;
00115 } //end of the function AAS_AllocTmpFace
|
Here is the call graph for this function:

|
|
Definition at line 173 of file aas_create.c. References GetClearedMemory(), tmp_nodebuf_s::next, tmp_aas_s::nodebuffer, tmp_nodebuf_s::nodes, tmp_aas_s::numnodes, tmp_nodebuf_s::numnodes, tmp_node_t, tmp_nodebuf_t, and tmpaasworld. Referenced by AAS_CreateArea(), AAS_CreateAreas_r(), AAS_LadderSubdivideArea_r(), and AAS_SubdivideArea_r(). 00174 {
00175 tmp_nodebuf_t *nodebuf;
00176
00177 if (!tmpaasworld.nodebuffer ||
00178 tmpaasworld.nodebuffer->numnodes >= NODEBUF_SIZE)
00179 {
00180 nodebuf = (tmp_nodebuf_t *) GetClearedMemory(sizeof(tmp_nodebuf_t));
00181 nodebuf->next = tmpaasworld.nodebuffer;
00182 nodebuf->numnodes = 0;
00183 tmpaasworld.nodebuffer = nodebuf;
00184 } //end if
00185 tmpaasworld.numnodes++;
00186 return &tmpaasworld.nodebuffer->nodes[tmpaasworld.nodebuffer->numnodes++];
00187 } //end of the function AAS_AllocTmpNode
|
Here is the call graph for this function:

|
|
Definition at line 314 of file aas_create.c. References tmp_area_s::areanum, plane_t::dist, DotProduct, fabs(), tmp_face_s::frontarea, tmp_area_s::invalid, Log_Print(), Log_Write(), mapplanes, n, tmp_face_s::next, plane_t::normal, tmp_face_s::num, tmp_face_s::planenum, tmp_area_t, tmp_face_t, tmp_area_s::tmpfaces, vec3_t, VectorAdd, VectorScale, tmp_face_s::winding, WindingCenter(), WindingError(), WindingErrorString(), and WindingPlane(). Referenced by AAS_CreateArea(), AAS_MergeAreaFaces(), AAS_SplitArea(), and AAS_TryMergeFaceAreas(). 00315 {
00316 int side;
00317 tmp_face_t *face;
00318 plane_t *plane;
00319 vec3_t wcenter, acenter = {0, 0, 0};
00320 vec3_t normal;
00321 float n, dist;
00322
00323 if (tmparea->invalid) Log_Print("AAS_CheckArea: invalid area\n");
00324 for (n = 0, face = tmparea->tmpfaces; face; face = face->next[side])
00325 {
00326 //side of the face the area is on
00327 side = face->frontarea != tmparea;
00328 WindingCenter(face->winding, wcenter);
00329 VectorAdd(acenter, wcenter, acenter);
00330 n++;
00331 } //end for
00332 n = 1 / n;
00333 VectorScale(acenter, n, acenter);
00334 for (face = tmparea->tmpfaces; face; face = face->next[side])
00335 {
00336 //side of the face the area is on
00337 side = face->frontarea != tmparea;
00338
00339 #ifdef L_DEBUG
00340 if (WindingError(face->winding))
00341 {
00342 Log_Write("AAS_CheckArea: area %d face %d: %s\r\n", tmparea->areanum,
00343 face->num, WindingErrorString());
00344 } //end if
00345 #endif L_DEBUG
00346
00347 plane = &mapplanes[face->planenum ^ side];
00348
00349 if (DotProduct(plane->normal, acenter) - plane->dist < 0)
00350 {
00351 Log_Print("AAS_CheckArea: area %d face %d is flipped\n", tmparea->areanum, face->num);
00352 Log_Print("AAS_CheckArea: area %d center is %f %f %f\n", tmparea->areanum, acenter[0], acenter[1], acenter[2]);
00353 } //end if
00354 //check if the winding plane is the same as the face plane
00355 WindingPlane(face->winding, normal, &dist);
00356 plane = &mapplanes[face->planenum];
00357 #ifdef L_DEBUG
00358 if (fabs(dist - plane->dist) > 0.4 ||
00359 fabs(normal[0] - plane->normal[0]) > 0.0001 ||
00360 fabs(normal[1] - plane->normal[1]) > 0.0001 ||
00361 fabs(normal[2] - plane->normal[2]) > 0.0001)
00362 {
00363 Log_Write("AAS_CheckArea: area %d face %d winding plane unequal to face plane\r\n",
00364 tmparea->areanum, face->num);
00365 } //end if
00366 #endif L_DEBUG
00367 } //end for
00368 } //end of the function AAS_CheckArea
|
Here is the call graph for this function:

|
|
Definition at line 1035 of file aas_create.c. References AAS_CreateAreas(), AAS_CreateAreaSettings(), AAS_FlipSharedFaces(), AAS_FreeTmpAAS(), AAS_GravitationalSubdivision(), AAS_InitTmpAAS(), AAS_LadderSubdivision(), AAS_MeltAreaFaceWindings(), AAS_MergeAreaFaces(), AAS_MergeAreaPlaneFaces(), AAS_MergeAreas(), AAS_PruneNodes(), AAS_RemoveAreaFaceColinearPoints(), AAS_RemoveTinyFaces(), AAS_StoreFile(), e, entities, entity_num, Error(), FillOutside(), entity_t::firstbrush, FloodEntities(), I_FloatTime(), LeakFile(), Log_Print(), MakeTreePortals(), entity_t::numbrushes, ProcessWorldBrushes(), strcpy(), StripExtension(), ThreadSetDefault(), tree(), Tree_Free(), and Tree_PruneNodes(). Referenced by main(). 01036 {
01037 entity_t *e;
01038 tree_t *tree;
01039 double start_time;
01040
01041 //for a possible leak file
01042 strcpy(source, aasfile);
01043 StripExtension(source);
01044 //the time started
01045 start_time = I_FloatTime();
01046 //set the default number of threads (depends on number of processors)
01047 ThreadSetDefault();
01048 //set the global entity number to the world model
01049 entity_num = 0;
01050 //the world entity
01051 e = &entities[entity_num];
01052 //process the whole world
01053 tree = ProcessWorldBrushes(e->firstbrush, e->firstbrush + e->numbrushes);
01054 //if the conversion is cancelled
01055 if (cancelconversion)
01056 {
01057 Tree_Free(tree);
01058 return;
01059 } //end if
01060 //display BSP tree creation time
01061 Log_Print("BSP tree created in %5.0f seconds\n", I_FloatTime() - start_time);
01062 //prune the bsp tree
01063 Tree_PruneNodes(tree->headnode);
01064 //if the conversion is cancelled
01065 if (cancelconversion)
01066 {
01067 Tree_Free(tree);
01068 return;
01069 } //end if
01070 //create the tree portals
01071 MakeTreePortals(tree);
01072 //if the conversion is cancelled
01073 if (cancelconversion)
01074 {
01075 Tree_Free(tree);
01076 return;
01077 } //end if
01078 //Marks all nodes that can be reached by entites
01079 if (FloodEntities(tree))
01080 {
01081 //fill out nodes that can't be reached
01082 FillOutside(tree->headnode);
01083 } //end if
01084 else
01085 {
01086 LeakFile(tree);
01087 Error("**** leaked ****\n");
01088 return;
01089 } //end else
01090 //create AAS from the BSP tree
01091 //==========================================
01092 //initialize tmp aas
01093 AAS_InitTmpAAS();
01094 //create the convex areas from the leaves
01095 AAS_CreateAreas(tree->headnode);
01096 //free the BSP tree because it isn't used anymore
01097 if (freetree) Tree_Free(tree);
01098 //try to merge area faces
01099 AAS_MergeAreaFaces();
01100 //do gravitational subdivision
01101 AAS_GravitationalSubdivision();
01102 //merge faces if possible
01103 AAS_MergeAreaFaces();
01104 AAS_RemoveAreaFaceColinearPoints();
01105 //merge areas if possible
01106 AAS_MergeAreas();
01107 //NOTE: prune nodes directly after area merging
01108 AAS_PruneNodes();
01109 //flip shared faces so they are all facing to the same area
01110 AAS_FlipSharedFaces();
01111 AAS_RemoveAreaFaceColinearPoints();
01112 //merge faces if possible
01113 AAS_MergeAreaFaces();
01114 //merge area faces in the same plane
01115 AAS_MergeAreaPlaneFaces();
01116 //do ladder subdivision
01117 AAS_LadderSubdivision();
01118 //FIXME: melting is buggy
01119 AAS_MeltAreaFaceWindings();
01120 //remove tiny faces
01121 AAS_RemoveTinyFaces();
01122 //create area settings
01123 AAS_CreateAreaSettings();
01124 //check if the winding plane is equal to the face plane
01125 //AAS_CheckAreaWindingPlanes();
01126 //
01127 //AAS_CheckSharedFaces();
01128 //==========================================
01129 //if the conversion is cancelled
01130 if (cancelconversion)
01131 {
01132 Tree_Free(tree);
01133 AAS_FreeTmpAAS();
01134 return;
01135 } //end if
01136 //store the created AAS stuff in the AAS file format and write the file
01137 AAS_StoreFile(aasfile);
01138 //free the temporary AAS memory
01139 AAS_FreeTmpAAS();
01140 //display creation time
01141 Log_Print("\nAAS created in %5.0f seconds\n", I_FloatTime() - start_time);
01142 } //end of the function AAS_Create
|
Here is the call graph for this function:

|
|
Definition at line 453 of file aas_create.c. References tmp_area_s::areanum, tmp_face_s::backarea, plane_t::dist, DotProduct, Error(), fabs(), tmp_face_s::frontarea, Log_Print(), Log_Write(), mapplanes, n, tmp_face_s::next, plane_t::normal, tmp_face_s::num, tmp_face_s::planenum, tmp_area_t, tmp_face_t, tmp_area_s::tmpfaces, vec3_t, VectorAdd, VectorScale, tmp_face_s::winding, WindingCenter(), and WindingPlane(). Referenced by AAS_CreateArea(), AAS_SplitArea(), and AAS_TryMergeFaceAreas(). 00454 {
00455 int side;
00456 tmp_face_t *face;
00457 plane_t *plane;
00458 vec3_t wcenter, acenter = {0, 0, 0};
00459 //winding_t *w;
00460 float n;
00461
00462 for (n = 0, face = tmparea->tmpfaces; face; face = face->next[side])
00463 {
00464 if (!face->frontarea) Error("face %d has no front area\n", face->num);
00465 //side of the face the area is on
00466 side = face->frontarea != tmparea;
00467 WindingCenter(face->winding, wcenter);
00468 VectorAdd(acenter, wcenter, acenter);
00469 n++;
00470 } //end for
00471 n = 1 / n;
00472 VectorScale(acenter, n, acenter);
00473 for (face = tmparea->tmpfaces; face; face = face->next[side])
00474 {
00475 //side of the face the area is on
00476 side = face->frontarea != tmparea;
00477
00478 plane = &mapplanes[face->planenum ^ side];
00479
00480 if (DotProduct(plane->normal, acenter) - plane->dist < 0)
00481 {
00482 Log_Print("area %d face %d flipped: front area %d, back area %d\n", tmparea->areanum, face->num,
00483 face->frontarea ? face->frontarea->areanum : 0,
00484 face->backarea ? face->backarea->areanum : 0);
00485 /*
00486 face->planenum = face->planenum ^ 1;
00487 w = face->winding;
00488 face->winding = ReverseWinding(w);
00489 FreeWinding(w);
00490 */
00491 } //end if
00492 #ifdef L_DEBUG
00493 {
00494 float dist;
00495 vec3_t normal;
00496
00497 //check if the winding plane is the same as the face plane
00498 WindingPlane(face->winding, normal, &dist);
00499 plane = &mapplanes[face->planenum];
00500 if (fabs(dist - plane->dist) > 0.4 ||
00501 fabs(normal[0] - plane->normal[0]) > 0.0001 ||
00502 fabs(normal[1] - plane->normal[1]) > 0.0001 ||
00503 fabs(normal[2] - plane->normal[2]) > 0.0001)
00504 {
00505 Log_Write("area %d face %d winding plane unequal to face plane\r\n",
00506 tmparea->areanum, face->num);
00507 } //end if
00508 }
00509 #endif
00510 } //end for
00511 } //end of the function AAS_FlipAreaFaces
|
Here is the call graph for this function:

|
|
Definition at line 158 of file aas_create.c. References tmp_aas_s::areas, FreeMemory(), tmp_area_s::l_next, tmp_area_s::l_prev, tmp_aas_s::numareas, tmp_area_s::settings, tmp_area_t, and tmpaasworld. 00159 {
00160 if (tmparea->l_next) tmparea->l_next->l_prev = tmparea->l_prev;
00161 if (tmparea->l_prev) tmparea->l_prev->l_next = tmparea->l_next;
00162 else tmpaasworld.areas = tmparea->l_next;
00163 if (tmparea->settings) FreeMemory(tmparea->settings);
00164 FreeMemory(tmparea);
00165 tmpaasworld.numareas--;
00166 } //end of the function AAS_FreeTmpArea
|
Here is the call graph for this function:

|
|
Definition at line 122 of file aas_create.c. References tmp_aas_s::faces, FreeMemory(), FreeWinding(), tmp_face_s::l_next, tmp_face_s::l_prev, tmp_aas_s::numfaces, tmp_face_t, tmpaasworld, and tmp_face_s::winding. Referenced by AAS_MergePlaneFaces(), AAS_RemoveTinyFaces(), AAS_SplitArea(), AAS_TryMergeFaceAreas(), and AAS_TryMergeFaces(). 00123 {
00124 if (tmpface->l_next) tmpface->l_next->l_prev = tmpface->l_prev;
00125 if (tmpface->l_prev) tmpface->l_prev->l_next = tmpface->l_next;
00126 else tmpaasworld.faces = tmpface->l_next;
00127 //free the winding
00128 if (tmpface->winding) FreeWinding(tmpface->winding);
00129 //free the face
00130 FreeMemory(tmpface);
00131 tmpaasworld.numfaces--;
00132 } //end of the function AAS_FreeTmpFace
|
Here is the call graph for this function:

|
|
Definition at line 194 of file aas_create.c. References tmp_aas_s::numnodes, tmp_node_t, and tmpaasworld. Referenced by AAS_PruneNodes_r(). 00195 {
00196 tmpaasworld.numnodes--;
00197 } //end of the function AAS_FreeTmpNode
|
|
||||||||||||
|
Definition at line 205 of file aas_create.c. References cfg, DotProduct, FACE_GROUND, tmp_face_s::faceflags, mapplanes, cfg_s::phys_gravitydirection, cfg_s::phys_maxsteepness, tmp_face_s::planenum, tmp_face_t, vec3_t, VectorCopy, and VectorInverse(). Referenced by AAS_FindBestAreaSplitPlane(), and AAS_TryMergeFaceAreas(). 00206 {
00207 vec3_t invgravity;
00208
00209 //if the face is a solid or ground face it can't be a gap
00210 if (tmpface->faceflags & (FACE_GROUND | FACE_SOLID)) return 0;
00211
00212 VectorCopy(cfg.phys_gravitydirection, invgravity);
00213 VectorInverse(invgravity);
00214
00215 return (DotProduct(invgravity, mapplanes[tmpface->planenum ^ side].normal) > cfg.phys_maxsteepness);
00216 } //end of the function AAS_GapFace
|
Here is the call graph for this function:

|
|
Definition at line 224 of file aas_create.c. References cfg, DotProduct, tmp_face_s::faceflags, mapplanes, cfg_s::phys_gravitydirection, cfg_s::phys_maxsteepness, tmp_face_s::planenum, tmp_face_t, vec3_t, VectorCopy, and VectorInverse(). Referenced by AAS_CreateArea(). 00225 {
00226 vec3_t invgravity;
00227
00228 //must be a solid face
00229 if (!(tmpface->faceflags & FACE_SOLID)) return 0;
00230
00231 VectorCopy(cfg.phys_gravitydirection, invgravity);
00232 VectorInverse(invgravity);
00233
00234 return (DotProduct(invgravity, mapplanes[tmpface->planenum].normal) > cfg.phys_maxsteepness);
00235 } //end of the function AAS_GroundFace
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 278 of file aas_create.c. References tmp_face_s::backarea, Error(), tmp_face_s::frontarea, tmp_face_s::next, tmp_face_s::prev, tmp_area_t, tmp_face_t, and tmp_area_s::tmpfaces. Referenced by AAS_FlipFace(), AAS_MergePlaneFaces(), AAS_RemoveTinyFaces(), AAS_SplitArea(), AAS_TryMergeFaceAreas(), and AAS_TryMergeFaces(). 00279 {
00280 int side, prevside, nextside;
00281
00282 if (tmpface->frontarea != tmparea &&
00283 tmpface->backarea != tmparea)
00284 {
00285 Error("AAS_RemoveFaceFromArea: face not part of the area");
00286 } //end if
00287 side = tmpface->frontarea != tmparea;
00288 if (tmpface->prev[side])
00289 {
00290 prevside = tmpface->prev[side]->frontarea != tmparea;
00291 tmpface->prev[side]->next[prevside] = tmpface->next[side];
00292 } //end if
00293 else
00294 {
00295 tmparea->tmpfaces = tmpface->next[side];
00296 } //end else
00297 if (tmpface->next[side])
00298 {
00299 nextside = tmpface->next[side]->frontarea != tmparea;
00300 tmpface->next[side]->prev[nextside] = tmpface->prev[side];
00301 } //end if
00302 //remove the area number from the face depending on the side
00303 if (side) tmpface->backarea = NULL;
00304 else tmpface->frontarea = NULL;
00305 tmpface->prev[side] = NULL;
00306 tmpface->next[side] = NULL;
00307 } //end of the function AAS_RemoveFaceFromArea
|
Here is the call graph for this function:

|
1.3.9.1