SetBrush.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. #define MAX_FACES 16
  2. typedef float vec5_t[5];
  3. typedef struct
  4. {
  5. int numpoints;
  6. vec5_t points[8]; // variable sized
  7. } winding_t;
  8. #define MAX_POINTS_ON_WINDING 64
  9. typedef struct
  10. {
  11. vec3_t normal;
  12. float dist;
  13. } plane_t;
  14. typedef struct
  15. {
  16. // implicit rep
  17. vec3_t planepts[3];
  18. texturedef_t texture;
  19. // cached rep
  20. plane_t plane;
  21. qtexture_t *qtexture;
  22. float light; // 0 - 1.0
  23. winding_t *w;
  24. } face_t;
  25. #define ON_EPSILON 0.1
  26. #define FP_EPSILON 0.01
  27. #define VECTOR_EPSILON 0.0001
  28. #define SIDE_FRONT 0
  29. #define SIDE_BACK 1
  30. #define SIDE_ON 2
  31. winding_t *ClipWinding (winding_t *in, plane_t *split);
  32. winding_t *CopyWinding (winding_t *w);
  33. winding_t *NewWinding (int points);
  34. @interface SetBrush : Object
  35. {
  36. BOOL regioned; // not active
  37. BOOL selected;
  38. BOOL invalid; // not a proper polyhedron
  39. id parent; // the entity this brush is in
  40. vec3_t bmins, bmaxs;
  41. vec3_t entitycolor;
  42. int numfaces;
  43. face_t faces[MAX_FACES];
  44. }
  45. - initOwner: own mins:(float *)mins maxs:(float *)maxs texture:(texturedef_t *)tex;
  46. - initFromTokens: own;
  47. - setMins:(float *)mins maxs:(float *)maxs;
  48. - parent;
  49. - setParent: (id)p;
  50. - setEntityColor: (vec3_t)color;
  51. - calcWindings;
  52. - writeToFILE: (FILE *)f region: (BOOL)reg;
  53. - (BOOL)selected;
  54. - (BOOL)regioned;
  55. - setSelected: (BOOL)s;
  56. - setRegioned: (BOOL)s;
  57. - getMins: (vec3_t)mins maxs: (vec3_t)maxs;
  58. - (BOOL)containsPoint: (vec3_t)pt;
  59. - freeWindings;
  60. - removeIfInvalid;
  61. extern vec3_t region_min, region_max;
  62. - newRegion;
  63. - (texturedef_t *)texturedef;
  64. - (texturedef_t *)texturedefForFace: (int)f;
  65. - setTexturedef: (texturedef_t *)tex;
  66. - setTexturedef: (texturedef_t *)tex forFace:(int)f;
  67. - XYDrawSelf;
  68. - ZDrawSelf;
  69. - CameraDrawSelf;
  70. - XYRenderSelf;
  71. - CameraRenderSelf;
  72. - hitByRay: (vec3_t)p1 : (vec3_t) p2 : (float *)time : (int *)face;
  73. //
  74. // single brush actions
  75. //
  76. extern int numcontrolpoints;
  77. extern float *controlpoints[MAX_FACES*3];
  78. - getZdragface: (vec3_t)dragpoint;
  79. - getXYdragface: (vec3_t)dragpoint;
  80. - getXYShearPoints: (vec3_t)dragpoint;
  81. - addFace: (face_t *)f;
  82. //
  83. // multiple brush actions
  84. //
  85. - carveByClipper;
  86. extern vec3_t sb_translate;
  87. - translate;
  88. extern id carve_in, carve_out;
  89. - select;
  90. - deselect;
  91. - remove;
  92. - flushTextures;
  93. extern vec3_t sb_mins, sb_maxs;
  94. - addToBBox;
  95. extern vec3_t sel_x, sel_y, sel_z;
  96. extern vec3_t sel_org;
  97. - transform;
  98. - flipNormals;
  99. - carve;
  100. - setCarveVars;
  101. extern id sb_newowner;
  102. - moveToEntity;
  103. - takeCurrentTexture;
  104. extern vec3_t select_min, select_max;
  105. - selectPartial;
  106. - selectComplete;
  107. - regionPartial;
  108. - regionComplete;
  109. extern float sb_floor_dir, sb_floor_dist;
  110. - feetToFloor;
  111. - (int) getNumBrushFaces;
  112. - (face_t *)getBrushFace: (int)which;
  113. @end