X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=contrib%2Fbobtoolz%2FDBrush.h;h=d88bee252cd958a3761d7abcff40ef33705d2720;hp=7b3e8d6035ca47b69e0f1eb1b5b36452e4cf2989;hb=9dfae1c9b270ee369c6362903a9205b30751b95f;hpb=0a6d5683b0cfa1a0bd7ef64bada105dbe4ddd6e1 diff --git a/contrib/bobtoolz/DBrush.h b/contrib/bobtoolz/DBrush.h index 7b3e8d60..d88bee25 100644 --- a/contrib/bobtoolz/DBrush.h +++ b/contrib/bobtoolz/DBrush.h @@ -34,80 +34,106 @@ #include "str.h" class DPlane; + class DWinding; + class DPoint; + class _QERFaceData; -namespace scene -{ -class Node; -class Instance; +namespace scene { + class Node; + + class Instance; } -const int POINT_IN_BRUSH = 0; -const int POINT_ON_BRUSH = 1; +const int POINT_IN_BRUSH = 0; +const int POINT_ON_BRUSH = 1; const int POINT_OUT_BRUSH = 2; -class DBrush -{ +class DBrush { public: -DPlane* AddFace( const vec3_t va, const vec3_t vb, const vec3_t vc, const char* textureName, bool bDetail ); -void SaveToFile( FILE* pFile ); + DPlane *AddFace(const vec3_t va, const vec3_t vb, const vec3_t vc, const char *textureName, bool bDetail); + + void SaveToFile(FILE *pFile); + + void Rotate(vec3_t vOrigin, vec3_t vRotation); + + void RotateAboutCentre(vec3_t vRotation); + + DPlane *HasPlaneInverted(DPlane *chkPlane); + + DPlane *HasPlane(DPlane *chkPlane); + + DPlane *AddFace(const vec3_t va, const vec3_t vb, const vec3_t vc, const _QERFaceData *texData); + + bool + ResetTextures(const char *textureName, float fScale[2], float fShift[2], int rotation, const char *newTextureName, + int bResetTextureName, int bResetScale[2], int bResetShift[2], int bResetRotation); + + bool IsDetail(); + + bool HasTexture(const char *textureName); + + bool IntersectsWith(DBrush *chkBrush); + + bool IntersectsWith(DPlane *p1, DPlane *p2, vec3_t v); + + bool IsCutByPlane(DPlane *cuttingPlane); + + bool GetBounds(vec3_t min, vec3_t max); + + bool HasPoint(vec3_t pnt); + + bool BBoxCollision(DBrush *chkBrush); + + bool BBoxTouch(DBrush *chkBrush); + + int BuildPoints(); + + void BuildBounds(); + + void BuildFromWinding(DWinding *w); + + scene::Node *BuildInRadiant(bool allowDestruction, int *changeCnt, scene::Node *entity = NULL); + + void ResetChecks(std::list *exclusionList); + + void ClearFaces(); -void Rotate( vec3_t vOrigin, vec3_t vRotation ); -void RotateAboutCentre( vec3_t vRotation ); + void ClearPoints(); -DPlane* HasPlaneInverted( DPlane* chkPlane ); -DPlane* HasPlane( DPlane* chkPlane ); -DPlane* AddFace( const vec3_t va, const vec3_t vb, const vec3_t vc, const _QERFaceData* texData ); + int RemoveRedundantPlanes(void); -bool ResetTextures( const char* textureName, float fScale[2], float fShift[2], int rotation, const char* newTextureName, int bResetTextureName, int bResetScale[2], int bResetShift[2], int bResetRotation ); -bool IsDetail(); -bool HasTexture( const char* textureName ); -bool IntersectsWith( DBrush *chkBrush ); -bool IntersectsWith( DPlane* p1, DPlane* p2, vec3_t v ); -bool IsCutByPlane( DPlane* cuttingPlane ); -bool GetBounds( vec3_t min, vec3_t max ); -bool HasPoint( vec3_t pnt ); -bool BBoxCollision( DBrush* chkBrush ); -bool BBoxTouch( DBrush* chkBrush ); + void RemovePlane(DPlane *plane); -int BuildPoints(); -void BuildBounds(); -void BuildFromWinding( DWinding* w ); -scene::Node* BuildInRadiant( bool allowDestruction, int* changeCnt, scene::Node* entity = NULL ); + int PointPosition(vec3_t pnt); -void ResetChecks( std::list* exclusionList ); -void ClearFaces(); -void ClearPoints(); + void CutByPlane(DPlane *cutPlane, DBrush **newBrush1, DBrush **newBrush2); -int RemoveRedundantPlanes( void ); -void RemovePlane( DPlane* plane ); -int PointPosition( vec3_t pnt ); + void LoadFromBrush(scene::Instance &brush, bool textured); + void AddPoint(vec3_t pnt); -void CutByPlane( DPlane* cutPlane, DBrush** newBrush1, DBrush** newBrush2 ); + DPlane *FindPlaneWithClosestNormal(vec_t *normal); -void LoadFromBrush( scene::Instance& brush, bool textured ); -void AddPoint( vec3_t pnt ); + int FindPointsForPlane(DPlane *plane, DPoint **pnts, int maxpnts); -DPlane* FindPlaneWithClosestNormal( vec_t* normal ); -int FindPointsForPlane( DPlane* plane, DPoint** pnts, int maxpnts ); + DBrush(int ID = -1); -DBrush( int ID = -1 ); -virtual ~DBrush(); + virtual ~DBrush(); -bool operator==( DBrush* other ); + bool operator==(DBrush *other); // members -scene::Node* QER_entity; -scene::Node* QER_brush; -std::list faceList; -std::list pointList; -int m_nBrushID; -vec3_t bbox_min, bbox_max; -bool bBoundsBuilt; + scene::Node *QER_entity; + scene::Node *QER_brush; + std::list faceList; + std::list pointList; + int m_nBrushID; + vec3_t bbox_min, bbox_max; + bool bBoundsBuilt; }; //typedef CList DBrushList;