mesh.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * 3D Engine
  3. * mesh.h:
  4. * Based on pikuma.com 3D software renderer in C
  5. * Copyright (c) 2021 986-Studio. All rights reserved.
  6. *
  7. * Created by Manoël Trapier on 04/03/2021.
  8. */
  9. #ifndef THREEDENGINE_SOURCE_INCLUDE_MESH_H
  10. #define THREEDENGINE_SOURCE_INCLUDE_MESH_H
  11. #include <vector.h>
  12. #include <triangle.h>
  13. #include <texture.h>
  14. /***********************************************************************************************************************
  15. * Data types
  16. **********************************************************************************************************************/
  17. typedef struct mesh_t
  18. {
  19. vec3_t *vertices; /**< List of vertices */
  20. vec3_t *normalVertices; /**< List of normal vertices */
  21. tex2_t *textureVertices; /**< List of texture vertices */
  22. face_t *faces; /**< List of faces */
  23. vec3_t rotation; /**< Rotation of the object */
  24. vec3_t scale; /**< Scaling of the object */
  25. vec3_t translation; /**< Translation of the object */
  26. texture_t texture; /**< Texture to apply to the object */
  27. } mesh_t;
  28. /***********************************************************************************************************************
  29. * Prototypes
  30. **********************************************************************************************************************/
  31. void loadCubeMeshData(mesh_t *mesh);
  32. void loadOBJFile(mesh_t *mesh, const char *filepath);
  33. void meshFree(mesh_t *mesh);
  34. #endif /* THREEDENGINE_SOURCE_INCLUDE_MESH_H */