brush.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1997-2006 Id Software, Inc.
  4. This file is part of Quake 2 Tools source code.
  5. Quake 2 Tools source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake 2 Tools source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Quake 2 Tools source code; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. // brush.h
  19. typedef struct
  20. {
  21. int numpoints;
  22. int maxpoints;
  23. float points[8][5]; // variable sized
  24. } winding_t;
  25. // the normals on planes point OUT of the brush
  26. #define MAXPOINTS 16
  27. typedef struct face_s
  28. {
  29. struct face_s *next;
  30. vec3_t planepts[3];
  31. texdef_t texdef;
  32. plane_t plane;
  33. winding_t *face_winding;
  34. vec3_t d_color;
  35. qtexture_t *d_texture;
  36. // int d_numpoints;
  37. // vec3_t *d_points;
  38. } face_t;
  39. #define MAX_FACES 16
  40. typedef struct brush_s
  41. {
  42. struct brush_s *prev, *next; // links in active/selected
  43. struct brush_s *oprev, *onext; // links in entity
  44. struct entity_s *owner;
  45. vec3_t mins, maxs;
  46. face_t *brush_faces;
  47. } brush_t;
  48. void Brush_AddToList (brush_t *b, brush_t *list);
  49. void Brush_Build(brush_t *b);
  50. void Brush_BuildWindings( brush_t *b );
  51. brush_t *Brush_Clone (brush_t *b);
  52. brush_t *Brush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef);
  53. void Brush_Draw( brush_t *b );
  54. void Brush_DrawXY( brush_t *b );
  55. void Brush_Free (brush_t *b);
  56. void Brush_MakeSided (int sides);
  57. void Brush_Move (brush_t *b, vec3_t move);
  58. brush_t *Brush_Parse (void);
  59. face_t *Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist);
  60. void Brush_RemoveFromList (brush_t *b);
  61. void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear);
  62. void Brush_SetTexture (brush_t *b, texdef_t *texdef);
  63. void Brush_SideSelect (brush_t *b, vec3_t origin, vec3_t dir, qboolean shear);
  64. void Brush_Write (brush_t *b, FILE *f);
  65. void Brush_RemoveEmptyFaces ( brush_t *b );
  66. int AddPlanept (float *f);
  67. face_t *Face_Clone (face_t *f);
  68. void Face_Draw( face_t *face );
  69. winding_t *MakeFaceWinding (brush_t *b, face_t *face);