mesh.h 984 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef MESH_H
  2. #define MESH_H
  3. #include "vector3D.h"
  4. #include <vector>
  5. //Struct containing information relevant to the renderer about the vertices, normals and
  6. //texture coordinates of a model. Also keeps track of useful stuff for iterations.
  7. struct Mesh{
  8. //Per vertex values
  9. int numVertices = 0;
  10. std::vector<Vector3f> vertices;
  11. std::vector<Vector3f> normals;
  12. std::vector<Vector3f> texels;
  13. std::vector<Vector3f> tangents;
  14. std::vector<Vector3f> biTangents;
  15. //Per face values
  16. int numFaces = 0;
  17. std::vector<Vector3f> fNormals; //Normals for the whole face
  18. std::vector<Vector3i> vertexIndices;
  19. std::vector<Vector3i> textureIndices;
  20. std::vector<Vector3i> normalsIndices;
  21. //Simple mesh description for debugging.
  22. void describeMesh();
  23. //Builds facet normals used in early back face culling
  24. void buildFacetNormals();
  25. //Builds tangent and bitangent vectors for normal mapping
  26. void buildTangentSpace();
  27. };
  28. #endif