Open Source Tomb Raider Engine
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

RoomMesh.h 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #include "system/Shader.h"
  15. struct RoomVertexTR2 {
  16. int x, y, z; // Vertex coordinates, relative to x/zOffset
  17. int light1, light2; // Almost always equal
  18. // Set of flags for special rendering effects
  19. // 0x8000 - Something to do with water surface?
  20. // 0x4000 - Underwater lighting modulation/movement if seen from above
  21. // 0x2000 - Water/Quicksand surface movement
  22. // 0x0010 - Normal?
  23. unsigned int attributes;
  24. };
  25. class RoomMesh {
  26. public:
  27. RoomMesh(const std::vector<RoomVertexTR2>& vertices,
  28. const std::vector<IndexedRectangle>& rectangles,
  29. const std::vector<IndexedRectangle>& triangles);
  30. void prepare();
  31. void display(glm::mat4 MVP);
  32. private:
  33. std::vector<unsigned short> indicesBuff;
  34. std::vector<glm::vec3> verticesBuff;
  35. std::vector<unsigned int> texturesBuff;
  36. ShaderBuffer indices, vertices, uvs;
  37. };
  38. #endif