RAS_Polygon.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * ***** BEGIN GPL LICENSE BLOCK *****
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * 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. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software Foundation,
  16. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. *
  18. * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  19. * All rights reserved.
  20. *
  21. * The Original Code is: all of this file.
  22. *
  23. * Contributor(s): none yet.
  24. *
  25. * ***** END GPL LICENSE BLOCK *****
  26. */
  27. /** \file RAS_Polygon.h
  28. * \ingroup bgerast
  29. */
  30. #ifndef __RAS_POLYGON_H__
  31. #define __RAS_POLYGON_H__
  32. class RAS_DisplayArray;
  33. class RAS_MaterialBucket;
  34. class RAS_TexVert;
  35. #ifdef WITH_CXX_GUARDEDALLOC
  36. #include "MEM_guardedalloc.h"
  37. #endif
  38. /* polygon flags */
  39. class RAS_Polygon
  40. {
  41. /* location */
  42. RAS_MaterialBucket* m_bucket;
  43. RAS_DisplayArray* m_darray;
  44. unsigned short m_offset[4];
  45. unsigned short m_numvert;
  46. /* flags */
  47. #if 1
  48. unsigned short m_polyflags;
  49. #else
  50. unsigned char m_edgecode;
  51. unsigned char m_polyflags;
  52. #endif
  53. public:
  54. enum {
  55. VISIBLE = 1,
  56. COLLIDER = 2,
  57. TWOSIDE = 4
  58. };
  59. RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray* darray, int numvert);
  60. virtual ~RAS_Polygon() {};
  61. int VertexCount();
  62. RAS_TexVert* GetVertex(int i);
  63. void SetVertexOffset(int i, unsigned short offset);
  64. unsigned int GetVertexOffsetAbsolute(unsigned short i);
  65. // each bit is for a visible edge, starting with bit 1 for the first edge, bit 2 for second etc.
  66. // - Not used yet!
  67. /* int GetEdgeCode();
  68. void SetEdgeCode(int edgecode); */
  69. bool IsVisible();
  70. void SetVisible(bool visible);
  71. bool IsCollider();
  72. void SetCollider(bool collider);
  73. bool IsTwoside();
  74. void SetTwoside(bool twoside);
  75. RAS_MaterialBucket* GetMaterial();
  76. RAS_DisplayArray* GetDisplayArray();
  77. #ifdef WITH_CXX_GUARDEDALLOC
  78. MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_Polygon")
  79. #endif
  80. };
  81. #endif