bsp
|
00001 #ifndef _SETBRUSH_H_ 00002 #define _SETBRUSH_H_ 00003 00004 class Entity; 00005 class map; 00006 00007 extern bool fakebrush; 00008 00009 #define FP_EPSILON 0.01 00010 #define VECTOR_EPSILON 0.0001 00011 00012 #define SIDE_FRONT 0 00013 #define SIDE_BACK 1 00014 #define SIDE_ON 2 00015 00016 winding_t *ClipWinding (winding_t *in, plane_t *split); 00017 winding_t *CopyWinding (winding_t *w); 00018 winding_t *NewWinding (int points); 00019 00020 // flags "states" for brush 00021 #define B_SELECTED 0x01 00022 #define B_REGIONED 0x02 // not active 00023 #define B_INVALID 0x04 // not a proper polyhedron 00024 #define B_FILTERED 0x08 00025 #define B_LOCKED 0x10 00026 #define B_SAVESEL 0x20 00027 #define B_DRAWABLE 0x40 00028 00029 class SetBrush 00030 { 00031 public: 00032 SetBrush *p_next, *p_prev; 00033 00034 int flags; 00035 00036 Entity *parent; // the entity this brush is in 00037 vec3_t bmins, bmaxs; 00038 vec3_t bctr; 00039 COLORREF entitycolor; 00040 int numfaces; 00041 face_t *currentFace; // 0 up to numfaces-1 00042 face_t faces; // Double Linked List... 00043 00044 int group; 00045 int brushId; // for undo operations... 00046 int originalIndex; 00047 SetBrush *undoCameFrom; 00048 00049 SetBrush *next; // for memory management... 00050 00051 // METHODS 00052 SetBrush(); 00053 ~SetBrush(); 00054 SetBrush *copy(); 00055 00056 // Face handline stuff 00057 void addObject(face_t *); 00058 void removeObject(face_t *); 00059 int CountFaces(); 00060 void removeAllFaces(); 00061 00062 // Relies on parent... 00063 bool checkModifiable(); 00064 bool fakeBrush(HDC hdc, int mode, vec3_t, int, int, bool); 00065 bool getClippedBrush(SetBrush**major, SetBrush**minor); 00066 00067 void setSaveSelected(bool s); 00068 bool getSaveSelected(); 00069 00070 bool IsOriginBrush(); 00071 bool IsDetailBrush(); 00072 00073 bool IsFiltered(); 00074 00075 bool CalcFiltered(); 00076 void setFiltered(); 00077 00078 void setLocked(bool s); 00079 bool IsLocked(); 00080 00081 void setSelected(bool s); 00082 bool IsSelected(); 00083 00084 void setRegioned(bool s); 00085 bool IsRegioned(); 00086 00087 void setInvalid(bool s); 00088 bool IsInvalid(); 00089 00090 void setDrawable(); 00091 bool IsDrawable(); 00092 00093 void setRegioned(); 00094 void setRegionedPartial(); 00095 00096 void initOwner(Entity *own,float *mins,float *maxs,texturedef_t *tex); 00097 void initFromTokens(map *parent, Entity *own, Tokenizer &script); 00098 void setMins(float *mins,float *maxs); 00099 void drawConnections(HDC hdc,int); 00100 void renderConnections(); 00101 void setParent(Entity *p); 00102 00103 void setEntityColor(COLORREF color); 00104 void calcWindings(); 00105 00106 // For Q2 Support texture coordinate calculations... 00107 // 00108 // void BeginTexturingFace(face_t *, vec3_t); 00109 void EmitTextureCoordinates(float *, face_t *); 00110 00111 void writeToFILE(FILE *f,int grp); 00112 00113 void getMins(vec3_t mins, vec3_t maxs); 00114 00115 void snapPlanes(); 00116 void snapSelf(); 00117 00118 bool containsPoint(vec3_t pt); 00119 void freeWindings(bool free_qtexture = true); 00120 void removeUnusedFaces(); 00121 void newRegion(); 00122 00123 texturedef_t *texturedef(); 00124 texturedef_t *texturedefForFace(face_t *f); 00125 void setTexturedef(texturedef_t *tex); 00126 void setTexturedef(texturedef_t *tex, face_t *f); 00127 00128 void DrawCenterKnob(HDC hdc, int whichXY, LPSIZE XYSize, float u, float v) ; 00129 void DrawCenterAngle(HDC hdc, float ang, LPSIZE XYSize, float u, float v); 00130 void DrawOrigin(HDC hdc, int whichXY, LPSIZE XYSize, float u, float v); 00131 void DrawDetail(HDC hdc, int whichXY, LPSIZE XYSize, float u, float v); 00132 HPEN GetBrushPen(Entity *worldent, Entity *currentent); 00133 void glGetBrushColor(Entity *worldent,Entity *currentent, unsigned char *sR, unsigned char *sG, unsigned char *sB); 00134 void GetUV(int ViewType, vec3_t vp, float *u, float *v); 00135 00136 void XYDrawSelf(HDC hdc, vec3_t, int); 00137 void XYDrawSelfCur(HDC hdc, vec3_t, int); 00138 00139 void ClosestRenderSelf(); 00140 00141 void CameraRenderSelf(); 00142 void CameraDrawSelfSpecial(HDC hdc, 00143 float p, COLORREF linecolor, float Q[][4], float EZMin, float EZMax, LPRECT EClip, LPSIZE ESize); 00144 void hitByRay(vec3_t p1, vec3_t p2, float *time, face_t **face); 00145 void centerDistToRay(vec3_t p1, vec3_t p2, float *ctrdist); 00146 void clipRay(vec3_t p1, vec3_t p2,vec3_t frontpoint, face_t **f_face, 00147 vec3_t backpoint, face_t **b_face, int *fflag, int *bflag); 00148 00149 // 00150 // single brush actions 00151 // 00152 void getZdragface(vec3_t dragpoint, int); 00153 void getXYdragface(vec3_t dragpoint, int); 00154 float checkXYmultidragfaces(vec3_t dragpoint, int, face_t **); 00155 void getXYmultidragfaces(face_t *, int); 00156 00157 void addMultiPoint(float *); 00158 00159 bool checkXYEdgeDragFaces(vec3_t ,int); 00160 void getXYEdgeDragFaces(vec3_t dragpoint, int); 00161 00162 void getXYShearPoints(vec3_t dragpoint, int); 00163 void getShearPoints(face_t *face); 00164 void getXYdragvertex(vec3_t dragpoint, int); 00165 bool vertexClicked(vec3_t dragpoint, int ViewType); 00166 00167 void addFace(SetBrush *in,face_t *f); 00168 // 00169 // multiple brush actions 00170 // 00171 void carveByClipper(); 00172 void splitByClipper(); 00173 00174 void translate(); 00175 00176 void select(); 00177 void deselect(); 00178 void remove(); 00179 void flushTextures(); 00180 void addToBBoxCtr(); 00181 void addToBBox(); 00182 void transform(); 00183 00184 void flipNormals(); 00185 void setCarveVars(); 00186 00187 void moveToEntity(); 00188 void takeCurrentTexture(); 00189 00190 void selectPartial(); 00191 void selectComplete(); 00192 void regionPartial(); 00193 void regionComplete(); 00194 00195 void feetToFloor(); 00196 00197 bool pointAlreadyProcessed(vec3_t pt, face_t *max_face); 00198 void CameraRenderEdges(); 00199 void glCameraRenderEdges(); 00200 bool checkEdgeDragFaces(vec3_t p1, vec3_t p2); 00201 void getEdgeDragFaces(vec3_t v1, vec3_t v2); 00202 00203 // GLBSP stuff 00204 void glCameraRenderSkybox(); 00205 void glCameraRenderSelfTexture(); 00206 void glCameraRenderSelfTextureTrans(bool solids); 00207 void glCameraRenderSelfFixed(); 00208 void glCameraRenderSelfOutline(); 00209 void glCameraRenderSelfSelected(); 00210 void glCameraRenderSelfNoTexture(); 00211 void glCameraRenderSelfWireframe(); 00212 void glCameraRenderSelfFlat(); 00213 void glCameraRenderSelfFlatTrans(bool solids); 00214 00215 }; 00216 00217 #endif //_SETBRUSH_H_