DPatch.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. BobToolz plugin for GtkRadiant
  3. Copyright (C) 2001 Gordon Biggans
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. */
  16. // DPatch.h: interface for the DPatch class.
  17. //
  18. //////////////////////////////////////////////////////////////////////
  19. #if !defined(AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_)
  20. #define AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_
  21. #include "StdAfx.h" // Added by ClassView
  22. #if _MSC_VER > 1000
  23. #pragma once
  24. #endif // _MSC_VER > 1000
  25. typedef struct
  26. {
  27. bool mergable;
  28. int pos1;
  29. int pos2;
  30. } patch_merge_t;
  31. typedef struct {
  32. float xyz[3];
  33. float st[2];
  34. float normal[3];
  35. float lightmap[2];
  36. } drawVert_t;
  37. class Patch;
  38. #define MAX_PATCH_WIDTH 16
  39. #define MAX_PATCH_HEIGHT 16
  40. #define MIN_PATCH_WIDTH 3
  41. #define MIN_PATCH_HEIGHT 3
  42. class DPatch
  43. {
  44. public:
  45. list<DPatch> Split(bool rows, bool cols);
  46. void Transpose();
  47. void Invert();
  48. DPatch* MergePatches(patch_merge_t merge_info, DPatch* p1, DPatch* p2);
  49. patch_merge_t IsMergable(DPatch* other);
  50. bool ResetTextures(const char *oldTextureName, const char *newTextureName);
  51. void RemoveFromRadiant(void);
  52. scene::Node* QER_brush;
  53. void LoadFromBrush(scene::Node* brush);
  54. void BuildInRadiant(void* entity = NULL);
  55. void SetTexture(const char* textureName);
  56. char texture[256];
  57. int width, height;
  58. drawVert_t points[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];
  59. DPatch();
  60. virtual ~DPatch();
  61. };
  62. #endif // !defined(AFX_DPATCH_H__26C6B083_CE5B_420B_836B_1DDA733C04CE__INCLUDED_)