Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RoomMesh.h 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*!
  2. * \file include/RoomMesh.h
  3. * \brief World Room Mesh
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _ROOM_MESH_H_
  8. #define _ROOM_MESH_H_
  9. #include <vector>
  10. #include <glm/mat4x4.hpp>
  11. #include <glm/vec2.hpp>
  12. #include <glm/vec3.hpp>
  13. #include "Mesh.h"
  14. struct RoomVertexTR2 {
  15. int x, y, z; // Vertex coordinates, relative to x/zOffset
  16. int light1, light2; // Almost always equal
  17. // Set of flags for special rendering effects
  18. // 0x8000 - Something to do with water surface?
  19. // 0x4000 - Underwater lighting modulation/movement if seen from above
  20. // 0x2000 - Water/Quicksand surface movement
  21. // 0x0010 - Normal?
  22. unsigned int attributes;
  23. };
  24. class RoomMesh {
  25. public:
  26. RoomMesh(const std::vector<RoomVertexTR2>& vertices,
  27. const std::vector<IndexedRectangle>& rectangles,
  28. const std::vector<IndexedRectangle>& triangles);
  29. void prepare();
  30. void display(glm::mat4 MVP);
  31. private:
  32. std::vector<unsigned short> indices;
  33. std::vector<glm::vec3> vertices;
  34. std::vector<glm::vec2> uvs;
  35. std::vector<unsigned int> textures;
  36. };
  37. #endif