29 #include "../../../idlib/precompiled.h"
34 #define BFL_PATCH 0x1000
100 src->
Error(
"idAASBuild::ParseProcNodes: bad numProcNodes" );
155 if ( token ==
"model" ) {
160 if ( token ==
"shadowModel" ) {
165 if ( token ==
"interAreaPortals" ) {
170 if ( token ==
"nodes" ) {
175 src->
Error(
"idAASBuild::LoadProcBSP: bad token \"%s\"", token.
c_str() );
210 if ( dist > radius ) {
213 else if ( dist < -radius ) {
247 }
while ( nodeNum > 0 );
273 for ( brush = brushList.
Head(); brush; brush = brush->
Next() ) {
283 origin = (bounds[1] - bounds[0]) * 0.5
f;
285 origin = bounds[0] + origin;
294 common->
Printf(
"%6d brush sides clipped\n", clippedSides );
336 mapSide = mapBrush->
GetSide(i);
346 for ( i = 0; i < sideList.
Num(); i++ ) {
356 common->
Warning(
"brush primitive %d on entity %d is degenerate", primitiveNum, entityNum );
375 int i,
j, contents, validBrushes;
403 for ( i = 0; i < mesh.
GetWidth() - 1; i++ ) {
404 for ( j = 0; j < mesh.
GetHeight() - 1; j++ ) {
411 d1 = mesh[
v2].xyz - mesh[
v1].xyz;
412 d2 = mesh[
v3].xyz - mesh[
v1].xyz;
416 dot = plane.
Distance( mesh[v4].xyz );
463 d1 = mesh[
v3].xyz - mesh[
v1].xyz;
464 d2 = mesh[v4].xyz - mesh[
v1].xyz;
491 if ( !validBrushes ) {
492 common->
Warning(
"patch primitive %d on entity %d is completely degenerate", primitiveNum, entityNum );
513 if ( !mapEnt->
epairs.
GetMatrix(
"rotation",
"1 0 0 0 1 0 0 0 1", axis ) ) {
515 if ( angle != 0.0
f ) {
527 brushList =
AddBrushesForMapBrush( static_cast<idMapBrush*>(mapPrim), origin, axis, entityNum, i, brushList );
532 brushList =
AddBrushesForMapPatch( static_cast<idMapPatch*>(mapPrim), origin, axis, entityNum, i, brushList );
556 if (
idStr::Icmp( classname,
"func_aas_obstacle" ) == 0 ) {
589 return ( entityClassNames.
Num() != 0 );
640 int i, bit,
mask, startTime;
661 if ( !mapFile->
Parse( name ) ) {
678 if ( brushList.
Num() == 0 ) {
694 expandedBrushes.
Append( &brushList );
701 for ( i = 0; i < expandedBrushes.
Num(); i++ ) {
702 for ( b = expandedBrushes[i]->Head();
b; b = b->
Next() ) {
712 brushList.
AddToTail( *expandedBrushes[i] );
713 delete expandedBrushes[
i];
809 if ( !mapFile->
Parse( name ) ) {
852 for ( i = 1; i < args.
Argc(); i++ ) {
854 str = args.
Argv( i );
857 if ( str.
Icmp(
"usePatches" ) == 0 ) {
860 }
else if ( str.
Icmp(
"writeBrushMap" ) == 0 ) {
863 }
else if ( str.
Icmp(
"playerFlood" ) == 0 ) {
866 }
else if ( str.
Icmp(
"noOptimize" ) == 0 ) {
871 return args.
Argc() - 1;
885 if ( args.
Argc() <= 1 ) {
888 " -usePatches = use bezier patches for collision detection.\n"
889 " -writeBrushMap = write a brush map with the AAS geometry.\n"
890 " -playerFlood = use player spawn points as valid AAS positions.\n" );
901 common->
Error(
"Unable to find entityDef for 'aas_types'" );
905 while( kv !=
NULL ) {
907 if ( !settingsDict ) {
912 mapName = args.
Argv(i);
914 if ( mapName.
Icmpn(
"maps/", 4 ) != 0 ) {
915 mapName =
"maps/" + mapName;
917 aas.
Build( mapName, &settings );
922 common->
Printf(
"=======================================================\n" );
940 if ( args.
Argc() <= 1 ) {
952 common->
Error(
"Unable to find entityDef for 'aas_types'" );
961 common->
Printf(
"=======================================================\n" );
965 while( kv !=
NULL ) {
967 if ( !settingsDict ) {
976 common->
Printf(
"=======================================================\n" );
997 if ( args.
Argc() <= 1 ) {
1009 common->
Error(
"Unable to find entityDef for 'aas_types'" );
1013 while( kv !=
NULL ) {
1015 if ( !settingsDict ) {
1025 common->
Printf(
"=======================================================\n" );
int GetNumSides(void) const
int ParseOptions(const idCmdArgs &args, idAASSettings &settings)
const idPlane & GetPlane(void) const
void GetBounds(idBounds &bounds) const
void MergePortals(int skipContents)
float GetFloat(const char *key, const char *defaultString="0") const
const float DEFAULT_CURVE_MAX_ERROR_CD
bool BuildReachability(const idStr &fileName, const idAASSettings *settings)
bool StoreFile(const idBrushBSP &bsp)
idMapEntity * GetEntity(int i) const
idStr & SetFileExtension(const char *extension)
virtual idFileList * ListFiles(const char *relativePath, const char *extension, bool sort=false, bool fullRelativePath=false, const char *gamedir=NULL)=0
unsigned int GetGeometryCRC(void) const
const idVec3 & Normal(void) const
void MergeLeafNodes(idBrushBSP &bsp)
idBrushList AddBrushesForMapFile(const idMapFile *mapFile, idBrushList brushList)
idMapBrushSide * GetSide(int i) const
int GetVertSubdivisions(void) const
int GetContents(void) const
void StripLeading(const char c)
void Transform(const idVec3 &origin, const idMat3 &axis)
void MeltPortals(int skipContents)
bool RemoveOutside(const idMapFile *mapFile, int contents, const idStrList &classNames)
bool ValidEntity(const char *classname) const
float Distance(const idVec3 &v) const
idBrushList AddBrushesForMapPatch(const idMapPatch *mapPatch, const idVec3 &origin, const idMat3 &axis, int entityNum, int primitiveNum, idBrushList brushList)
const idWinding * GetWinding(void) const
int GetNumFiles(void) const
int Parse1DMatrix(int x, float *m)
const ID_TIME_T GetFileTime(void)
bool Build(const idMapFile *mapFile, idAASFileLocal *file)
bool LoadProcBSP(const char *name, ID_TIME_T minFileTime)
int Sys_Milliseconds(void)
const idKeyValue * MatchPrefix(const char *prefix, const idKeyValue *lastMatch=NULL) const
void ExpandForAxialBox(const idBounds &bounds)
idFileSystem * fileSystem
#define AREACONTENTS_OBSTACLE
int ContentsForAAS(int contents)
int SkipBracedSection(bool parseFirstBrace=true)
int GetHorzSubdivisions(void) const
const float * ToFloatPtr(void) const
void RunAASDir_f(const idCmdArgs &args)
#define AREACONTENTS_SOLID
void SetEntityNum(int num)
bool ExpandedChopAllowed(idBrush *b1, idBrush *b2)
const char * GetMaterial(void) const
idBrushSide * GetSide(int i) const
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
void LedgeSubdivision(idBrushBSP &bsp)
void SetNormal(const idVec3 &normal)
idVec3 Cross(const idVec3 &a) const
void WriteBrushMap(const idStr &fileName, const idStr &ext, int contents)
bool FromDict(const char *name, const idDict *dict)
idBounds boundingBoxes[MAX_AAS_BOUNDING_BOXES]
idBrushList AddBrushesForMapEntity(const idMapEntity *mapEnt, int entityNum, idBrushList brushList)
int Split(idFixedWinding *back, const idPlane &plane, const float epsilon=ON_EPSILON)
idBrushBSPNode * GetRootNode(void) const
int Icmp(const char *text) const
void SubdivideExplicit(int horzSubdivisions, int vertSubdivisions, bool genNormals, bool removeLinear=false)
void WriteLedgeMap(const idStr &fileName, const idStr &ext)
#define DEGENERATE_DIST_EPSILON
idStr & BackSlashesToSlashes(void)
void SetContents(int contents)
virtual const idDict * FindEntityDefDict(const char *name, bool makeDefault=true) const
bool Build(const idStr &fileName, const idAASSettings *settings)
idList< idLedge > ledgeList
int GetHeight(void) const
int numGravitationalSubdivisions
int Icmpn(const char *text, int n) const
GLfloat GLfloat GLfloat v2
void Error(const char *str,...) id_attribute((format(printf
bool Write(const idStr &fileName, unsigned int mapFileCRC)
idBrush * Head(void) const
bool FromWinding(const idWinding &w, const idPlane &windingPlane)
#define AREACONTENTS_BBOX_BIT
void Subdivide(float maxHorizontalError, float maxVerticalError, float maxLength, bool genNormals=false)
const char * GetString(const char *key, const char *defaultString="") const
GLubyte GLubyte GLubyte GLubyte w
bool ExpandedMergeAllowed(idBrush *b1, idBrush *b2)
int GetNumEntities(void) const
const float DEFAULT_CURVE_MAX_LENGTH_CD
bool Parse(const char *filename, bool ignoreRegion=false, bool osPath=false)
bool CheckForEntities(const idMapFile *mapFile, idStrList &entityClassNames) const
void AddToTail(idBrush *brush)
void ChangeMultipleBoundingBoxContents_r(idBrushBSPNode *node, int mask)
static float Fabs(float f)
#define SFL_USED_SPLITTER
ID_TIME_T GetFileTime(void) const
void SetPrimitiveNum(int num)
const int GetContentFlags(void) const
idVec3 GetVector(const char *key, const char *defaultString=NULL) const
void SetContents(int contents)
bool Load(const idStr &fileName, unsigned int mapFileCRC)
const char * GetFile(int index) const
void ParseProcNodes(idLexer *src)
virtual void virtual void virtual void virtual void PrintWarnings(void)=0
bool GetExplicitlySubdivided(void) const
const idAASSettings * aasSettings
const idStr & GetValue(void) const
virtual void FreeFileList(idFileList *fileList)=0
aasProcNode_t * procNodes
virtual void Printf(const char *fmt,...) id_attribute((format(printf
int GetContents(void) const
float Normalize(bool fixDegenerate=true)
#define AREACONTENTS_WATER
bool ChoppedAwayByProcBSP(int nodeNum, idFixedWinding *w, const idVec3 &normal, const idVec3 &origin, const float radius)
idDeclManager * declManager
bool Build(idAASFileLocal *file)
idBrush * Next(void) const
void GravitationalSubdivision(idBrushBSP &bsp)
void LeakFile(const idStr &fileName)
int ExpectTokenString(const char *string)
GLfloat GLfloat GLfloat GLfloat v3
int Append(const type &obj)
idMapPrimitive * GetPrimitive(int i) const
void RunAAS_f(const idCmdArgs &args)
int AddUnique(const type &obj)
idBrushBSPNode * GetChild(int index) const
idBrushList AddBrushesForMapBrush(const idMapBrush *mapBrush, const idVec3 &origin, const idMat3 &axis, int entityNum, int primitiveNum, idBrushList brushList)
idMat3 ToMat3(void) const
idBrushList * Copy(void) const
void ClipBrushSidesWithProcBSP(idBrushList &brushList)
void RunReach_f(const idCmdArgs &args)
const idPlane & GetPlane(void) const
void * Mem_ClearedAlloc(const int size)
const char * GetMaterial(void) const
const char * c_str(void) const
void Build(idBrushList brushList, int skipContents, bool(*ChopAllowed)(idBrush *b1, idBrush *b2), bool(*MergeAllowed)(idBrush *b1, idBrush *b2))
void Merge(bool(*MergeAllowed)(idBrush *b1, idBrush *b2))
const char * Argv(int arg) const
float dot(float a[], float b[])
virtual void ClearWarnings(const char *reason)=0
virtual void SetRefreshOnPrint(bool set)=0
idMat3 GetMatrix(const char *key, const char *defaultString=NULL) const
bool FixDegeneracies(float distEpsilon)
int GetNumSides(void) const
bool MergeAllowed(idBrush *b1, idBrush *b2)
virtual void Error(const char *fmt,...) id_attribute((format(printf
int GetNumPrimitives(void) const
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
int ReadToken(idToken *token)
bool FromSides(idList< idBrushSide * > &sideList)
#define AREACONTENTS_CLUSTERPORTAL
void FitThroughPoint(const idVec3 &p)