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.

chunkmesh.cpp 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #include "graphics/chunkmesh.h"
  2. #include "world.h"
  3. namespace vtk {
  4. ChunkMesh::ChunkMesh(World& world, glm::ivec3 chunkPos) :
  5. mLinkedWorld(world),
  6. mLinkedChunkPos(chunkPos)
  7. {
  8. }
  9. void ChunkMesh::rebuildChunkGeometry(const unsigned& vao) {
  10. //get the chunk from position
  11. auto chunk = mLinkedWorld.getChunk(mLinkedChunkPos);
  12. //temporary until I finish mesh providers
  13. float textUV [] = {
  14. 0.0f, 1.0f,
  15. 1.0f, 1.0f,
  16. 0.0f, 0.0f,
  17. 1.0f, 0.0f,
  18. 0.0f, 0.0f,
  19. 1.0f, 1.0f
  20. };
  21. float topModel [] = {
  22. //x y z
  23. 0.0f, 1.0f, 0.0f, //tl
  24. 1.0f, 1.0f, 0.0f, //tr
  25. 0.0f, 1.0f, 1.0f, //bl
  26. 1.0f, 1.0f, 1.0f, //br
  27. 0.0f, 1.0f, 1.0f, //bl
  28. 1.0f, 1.0f, 0.0f //tr
  29. };
  30. float bottomModel [] = {
  31. //x y z u v
  32. 0.0f, 0.0f, 1.0f, //tl
  33. 1.0f, 0.0f, 1.0f, //tr
  34. 0.0f, 0.0f, 0.0f, //bl
  35. 1.0f, 0.0f, 0.0f, //br
  36. 0.0f, 0.0f, 1.0f, //bl
  37. 1.0f, 0.0f, 1.0f //tr
  38. };
  39. float northModel [] = {
  40. //x y z u v
  41. 0.0f, 1.0f, 1.0f, //tl
  42. 1.0f, 1.0f, 1.0f, //tr
  43. 0.0f, 1.0f, 1.0f, //bl
  44. 1.0f, 0.0f, 1.0f, //br
  45. 0.0f, 0.0f, 1.0f, //bl
  46. 1.0f, 1.0f, 1.0f //tr
  47. };
  48. float southModel [] = {
  49. //x y z u v
  50. 1.0f, 1.0f, 0.0f, //tl
  51. 0.0f, 1.0f, 0.0f, //tr
  52. 1.0f, 0.0f, 0.0f, //bl
  53. 0.0f, 0.0f, 0.0f, //br
  54. 1.0f, 0.0f, 0.0f, //bl
  55. 0.0f, 1.0f, 0.0f //tr
  56. };
  57. float eastModel [] = {
  58. //x y z u v
  59. 1.0f, 1.0f, 1.0f, //tl
  60. 1.0f, 1.0f, 0.0f, //tr
  61. 1.0f, 0.0f, 1.0f, //bl
  62. 1.0f, 0.0f, 0.0f, //br
  63. 1.0f, 0.0f, 1.0f, //bl
  64. 1.0f, 1.0f, 0.0f //tr
  65. };
  66. float westModel [] = {
  67. //x y z u v
  68. 0.0f, 1.0f, 0.0f, //tl
  69. 0.0f, 1.0f, 1.0f, //tr
  70. 0.0f, 0.0f, 0.0f, //bl
  71. 0.0f, 0.0f, 1.0f, //br
  72. 0.0f, 0.0f, 0.0f, //bl
  73. 0.0f, 1.0f, 1.0f //tr
  74. };
  75. }
  76. void ChunkMesh::rebuildChunkLighting(const unsigned& vao) {
  77. }
  78. }