SELECT.H 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __SELECT_H_
  21. #define __SELECT_H_
  22. typedef enum
  23. {
  24. sel_brush,
  25. // sel_sticky_brush,
  26. // sel_face,
  27. sel_vertex,
  28. sel_edge,
  29. sel_singlevertex,
  30. sel_curvepoint,
  31. sel_area,
  32. sel_addpoint, // for dropping points
  33. sel_editpoint // for editing points
  34. } select_t;
  35. class CDragPoint {
  36. public:
  37. idVec3 vec;
  38. brush_t *pBrush;
  39. int nType;
  40. bool priority;
  41. CDragPoint() {};
  42. CDragPoint(brush_t *b, idVec3 v, int type, bool p) {
  43. pBrush = b;
  44. VectorCopy(v, vec);
  45. nType = type;
  46. priority = p;
  47. }
  48. void Set(brush_t *b, idVec3 v, int type) {
  49. pBrush = b;
  50. VectorCopy(v, vec);
  51. nType = type;
  52. }
  53. bool PointWithin(idVec3 p, int nView = -1);
  54. };
  55. typedef struct
  56. {
  57. brush_t *brush;
  58. face_t *face;
  59. CDragPoint *point;
  60. float dist;
  61. bool selected;
  62. } qertrace_t;
  63. #define SF_SELECTED_ONLY 0x01
  64. #define SF_ENTITIES_FIRST 0x02
  65. #define SF_SINGLEFACE 0x04
  66. #define SF_IGNORECURVES 0x08
  67. #define SF_IGNOREGROUPS 0x10
  68. #define SF_CYCLE 0x20
  69. qertrace_t Test_Ray ( const idVec3 &origin, const idVec3 &dir, int flags );
  70. CDragPoint *PointRay( const idVec3 &org, const idVec3 &dir, float *dist);
  71. void SelectCurvePointByRay( const idVec3 &org, const idVec3 &dir, int buttons);
  72. void SelectSplinePointByRay( const idVec3 &org, const idVec3 &dir, int buttons);
  73. void Select_GetBounds (idVec3 &mins, idVec3 &maxs);
  74. void Select_Brush (brush_t *b, bool bComplete = true, bool bStatus = true);
  75. void Select_Ray (idVec3 origin, idVec3 dir, int flags);
  76. void Select_Delete (void);
  77. void Select_Deselect (bool bDeselectFaces = true);
  78. void Select_Invert(void);
  79. void Select_Clone (void);
  80. void Select_Move (idVec3 delta, bool bSnap = true);
  81. void WINAPI Select_SetTexture (texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale = false, void* pPlugTexdef = NULL, bool update = true);
  82. void Select_FlipAxis (int axis);
  83. void Select_RotateAxis (int axis, float deg, bool bPaint = true, bool bMouse = false);
  84. void Select_CompleteTall (void);
  85. void Select_PartialTall (void);
  86. void Select_Touching (void);
  87. void Select_Inside (void);
  88. void Select_CenterOrigin();
  89. void Select_AllOfType();
  90. void Select_Reselect();
  91. void Select_FitTexture(float height = 1.0, float width = 1.0);
  92. void Select_InitializeRotation();
  93. void Select_FinalizeRotation();
  94. // absolute texture coordinates
  95. // TTimo NOTE: this is stuff for old brushes format and rotation texture lock .. sort of in-between with bush primitives
  96. void ComputeAbsolute(face_t* f, idVec3& p1, idVec3& p2, idVec3& p3);
  97. void AbsoluteToLocal( const idPlane &normal2, face_t* f, idVec3& p1, idVec3& p2, idVec3& p3);
  98. void Select_Hide(bool invert = false);
  99. void Select_ShowAllHidden();
  100. void Select_WireFrame( bool wireFrame );
  101. void Select_ForceVisible( bool visible );
  102. void Select_Name(const char *pName);
  103. void Select_AddProjectedLight();
  104. void Select_GetMid (idVec3 &mid);
  105. void Select_SetDefaultTexture(const idMaterial *mat, bool fitScale, bool setTexture);
  106. void Select_UpdateTextureName(const char *name);
  107. void Select_FlipTexture(bool y);
  108. void Select_SetPatchFit(float dim1, float dim2, float srcWidth, float srcHeight, float rot);
  109. void Select_SetPatchST(float s1, float t1, float s2, float t2);
  110. void Select_ProjectFaceOntoPatch( face_t *face );
  111. void Select_CopyPatchTextureCoords( patchMesh_t *p );
  112. void Select_AllTargets();
  113. void Select_Scale(float x, float y, float z);
  114. void Select_RotateTexture(float amt, bool absolute = false);
  115. void Select_ScaleTexture(float x, float y, bool update = true, bool absolute = true);
  116. void Select_DefaultTextureScale(bool horz, bool vert, bool update = true);
  117. void Select_ShiftTexture(float x, float y, bool autoAdjust = false);
  118. void Select_GetTrueMid (idVec3 &mid);
  119. void Select_Scale(float x, float y, float z);
  120. #endif