texture.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Voxel-a-tord
  3. * texture.h:
  4. * Copyright (c) 2021-2022 986-Studio. All rights reserved.
  5. *
  6. * Created by Manoël Trapier on 07/03/2021.
  7. */
  8. #ifndef VOXELATOR_SOURCE_INCLUDE_TEXTURE_H
  9. #define VOXELATOR_SOURCE_INCLUDE_TEXTURE_H
  10. #include <stdint.h>
  11. #include <upng.h>
  12. #include <colour.h>
  13. /***********************************************************************************************************************
  14. * Data types
  15. **********************************************************************************************************************/
  16. typedef struct tex2_t
  17. {
  18. double u, v;
  19. } tex2_t;
  20. typedef struct texture_t
  21. {
  22. upng_t *png;
  23. colour_t *data;
  24. int width;
  25. int height;
  26. } texture_t;
  27. /***********************************************************************************************************************
  28. * Prototypes
  29. **********************************************************************************************************************/
  30. void loadTextureDateFromPng(texture_t *texture, const char *filepath);
  31. void textureCleanup(texture_t *texture);
  32. colour_t getTextureColour(texture_t *texture, tex2_t position);
  33. #endif /* VOXELATOR_SOURCE_INCLUDE_TEXTURE_H */