00001
00002
00003 #ifndef PortalH
00004 #define PortalH
00005
00006 #include "vector.h"
00007 #include "vertex.h"
00008 #include "polygon.h"
00009 #include "plane.h"
00010
00011 struct BSP_node;
00012
00013 class PORTAL
00014 {
00015 public:
00016 PORTAL();
00017 ~PORTAL();
00018
00019 int Compare(const PORTAL& Portal);
00020 int GetMyPosition() const {return linkPosition;}
00021 void SetMyPosition(int newPosition) {linkPosition = newPosition;}
00022 int linkPosition;
00023
00024 VECTOR GetNormal();
00025 void SetNormal();
00026
00027 BSP_node* frontleaf;
00028 BSP_node* backleaf;
00029 int PortalId;
00030 int PartitionNodeId;
00031 unsigned int numVertices;
00032 unsigned int Texture;
00033 float Scale[2];
00034 float Shift[2];
00035 float Rotate;
00036 VERTEX* Vertex;
00037 };
00038
00039 PORTAL* CopyPortal(PORTAL* portal);
00040 void CreateLargePortal(POLYGON splittingPolygon, PORTAL* largePortal);
00041 int SplitPortal(PORTAL* portalToSplit, PLANE plane, VECTOR pointOnPlane, PORTAL* front, PORTAL* back);
00042 int SplitPortal(PORTAL* portalToSplit, POLYGON planePolygon, PORTAL* front, PORTAL* back);
00043 void MakePortalList();
00044 int ClassifyPortal(PORTAL* portal, POLYGON planePolygon);
00045 int ClassifyInvertedPortal(PORTAL* portal, POLYGON planePolygon);
00046 void InvertPortal(PORTAL* portal);
00047 void InvertPortals(BSP_node* node);
00048 void AddPortal(PORTAL* thisportal, BSP_node* node);
00049 void AddPortalsToLeaves(BSP_node* root);
00050 int ClipPortalToFrontLeaf(PORTAL* portal);
00051 int ClipPortalToBackLeaf(PORTAL* portal);
00052 void CheckForSinglePortals(BSP_node* node, BSP_node* originalnode, PORTAL* portal, int* flag);
00053 int RemoveExtraPortals(PORTAL* portal);
00054 void FindTruePortals(BSP_node* node);
00055
00056 #endif