BlockRenderer.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef BLOCKRENDERER_H
  2. #define BLOCKRENDERER_H
  3. #include <vector>
  4. #include "client/engine/Mesh.h"
  5. using namespace std;
  6. class BlockRenderer
  7. {
  8. public:
  9. BlockRenderer();
  10. void addTriangle(float p1x, float p1y, float p1z, float p1nx, float p1ny, float p1nz, float p1texX, float p1texY,
  11. float p2x, float p2y, float p2z, float p2nx, float p2ny, float p2nz, float p2texX, float p2texY,
  12. float p3x, float p3y, float p3z, float p3nx, float p3ny, float p3nz, float p3texX, float p3texY,
  13. int cullData);
  14. void addCuboid(float sx, float sy, float sz, float ex, float ey, float ez,
  15. float topTexStartX, float topTexStartY, float topTexEndX, float topTexEndY,
  16. float bottomTexStartX, float bottomTexStartY, float bottomTexEndX, float bottomTexEndY,
  17. float northTexStartX, float northTexStartY, float northTexEndX, float northTexEndY,
  18. float southTexStartX, float southTexStartY, float southTexEndX, float southTexEndY,
  19. float eastTexStartX, float eastTexStartY, float eastTexEndX, float eastTexEndY,
  20. float westTexStartX, float westTexStartY, float westTexEndX, float westTexEndY);
  21. void addToMesh(Mesh& m, int offsetX, int offsetY, int offsetZ, int cullData) const;
  22. private:
  23. struct Triangle
  24. {
  25. float p1x;
  26. float p1y;
  27. float p1z;
  28. float p1nx;
  29. float p1ny;
  30. float p1nz;
  31. float p1texX;
  32. float p1texY;
  33. float p2x;
  34. float p2y;
  35. float p2z;
  36. float p2nx;
  37. float p2ny;
  38. float p2nz;
  39. float p2texX;
  40. float p2texY;
  41. float p3x;
  42. float p3y;
  43. float p3z;
  44. float p3nx;
  45. float p3ny;
  46. float p3nz;
  47. float p3texX;
  48. float p3texY;
  49. int cullData;
  50. };
  51. vector<Triangle> data;
  52. };
  53. #endif