PolyPolygon.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * PolyPolygon.h
  3. * TAU
  4. *
  5. * Created by Ivan Safrin on 3/14/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package BasicTypes
  10. #pragma once
  11. #include <math.h>
  12. #include "PolyGlobals.h"
  13. #include "PolyVertex.h"
  14. #include "PolyVector3.h"
  15. #include "PolyVector2.h"
  16. #include "PolyRectangle.h"
  17. #include <vector>
  18. using std::vector;
  19. using std::min;
  20. using std::max;
  21. namespace Polycode {
  22. class _PolyExport Polygon {
  23. public:
  24. Polygon();
  25. ~Polygon();
  26. unsigned int getVertexCount();
  27. Vertex *getVertex(unsigned int index);
  28. Vertex *addVertex(float x, float y, float z);
  29. void addTexCoord(float u, float v);
  30. void addTexCoord2(float u, float v);
  31. Vector2 *getTexCoord(int index);
  32. Vector2 *getTexCoord2(int index);
  33. void addVertex(Vertex *vertex);
  34. Vertex *addVertex(float x, float y, float z, float u, float v);
  35. void calculateNormal();
  36. Vector3 getFaceNormal();
  37. Rectangle getBounds2D();
  38. void setNormal(Vector3 normal);
  39. bool useVertexNormals;
  40. void flipUVY();
  41. void setUseFaceUV(bool val);
  42. bool usesFaceUV();
  43. bool hasSecUVs;
  44. private:
  45. bool useFaceUV;
  46. unsigned int vertexCount;
  47. vector<Vertex*> vertices;
  48. vector<Vector2*> texCoords;
  49. vector<Vector2*> texCoords2;
  50. Vector3 *normal;
  51. };
  52. }