texture.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #include <fpmath.h>
  14. /***********************************************************************************************************************
  15. * Data types
  16. **********************************************************************************************************************/
  17. typedef struct tex2_t
  18. {
  19. fp_num_t u, v;
  20. } tex2_t;
  21. typedef struct texture_t
  22. {
  23. upng_t *png;
  24. void *data;
  25. int width;
  26. int height;
  27. } texture_t;
  28. /***********************************************************************************************************************
  29. * Prototypes
  30. **********************************************************************************************************************/
  31. void loadTextureDateFromPng(texture_t *texture, const char *filepath);
  32. void textureCleanup(texture_t *texture);
  33. colour_t getTextureColour(texture_t *texture, tex2_t *position);
  34. #endif /* VOXELATOR_SOURCE_INCLUDE_TEXTURE_H */