DirectRenderer.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef DIRECTRENDERER_H
  2. #define DIRECTRENDERER_H
  3. #include "../math/Matrix3D.h"
  4. #include "Texture.h"
  5. #include "Utils.h"
  6. using namespace std;
  7. class DirectRenderer
  8. {
  9. public:
  10. DirectRenderer();
  11. DirectRenderer(const DirectRenderer& orig);
  12. virtual ~DirectRenderer();
  13. void prepare();
  14. void drawRectangle(float minX, float minY, float maxX, float maxY, float tMinX, float tMinY, float tMaxX, float tMaxY, IntColor c);
  15. void drawRectangle(float minX, float minY, float maxX, float maxY, IntColor c);
  16. void drawRectangle(float minX, float minY, float maxX, float maxY, float tMinX, float tMinY, float tMaxX, float tMaxY);
  17. float drawString(float x, float y, bool shadow, string& s);
  18. void init();
  19. private:
  20. float addString(float x, float y, int& index, float* data, const IntColor* color, string& s);
  21. static const int FONTS_LENGTH = 3;
  22. static Texture FONTS[FONTS_LENGTH];
  23. static const char COLOR_CHAR = '&';
  24. static const unsigned int FONT_SIZE = 8;
  25. static const unsigned int LINE_STEP = 1;
  26. static const unsigned int SHADOW_STEP = 1;
  27. static const unsigned int MAX_STRING_LENGTH = 1024;
  28. static const int OBJECT_LENGTH = 96;
  29. static const int BUFFER_LENGTH = 256 * 1024 * OBJECT_LENGTH;
  30. GLuint vba = 0;
  31. GLuint vbo = 0;
  32. unsigned int offset = BUFFER_LENGTH - OBJECT_LENGTH;
  33. Matrix3D view;
  34. Matrix3D proj;
  35. };
  36. #endif