rasteriver.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef RASTERIVER_H
  2. #define RASTERIVER_H
  3. #include "functions.h"
  4. #include "values.h"
  5. #include "custom_types.h"
  6. #include "math.h"
  7. #include <SDL2/SDL.h>
  8. typedef struct {
  9. // rendering (non SDL)
  10. RI_texture *frame_buffer;
  11. double *z_buffer;
  12. int window_width;
  13. int window_height;
  14. char *window_title;
  15. // SDL specific
  16. SDL_Window *window;
  17. SDL_Renderer *renderer;
  18. SDL_Texture *texture;
  19. SDL_Event event;
  20. // RasterIver
  21. RI_vector_3f *loaded_mesh_vetex_positions; // original vertex positions from a loaded mesh
  22. RI_vector_3f *normals; // original normal vectors from a loaded mesh
  23. RI_vector_2f *uvs; // UV coords from a loaded mesh
  24. RI_vector_3f *transformed_vertex_positions; // vertex positions after trasformations (mesh & camera rotation & position changes, scale, etc)
  25. RI_vector_3f *transformed_normals; // normal vectors after rotation transformations (otherwise a normal's space would constantly be in local space instead of world space)
  26. RI_mesh *loaded_meshes;
  27. RI_texture *loaded_textures;
  28. RI_material *materials;
  29. RI_actor *actors;
  30. RI_texture error_texture;
  31. RI_texture error_bump_map;
  32. RI_texture error_normal_map;
  33. RI_material error_material;
  34. RI_mesh error_mesh;
  35. // miscellaneous
  36. int loaded_mesh_count;
  37. int loaded_texture_count;
  38. int material_count;
  39. int actor_count;
  40. int running;
  41. int frame;
  42. char* prefix;
  43. // memory manager
  44. RI_memory_allocation* allocation_table;
  45. int debug_memory;
  46. int allocation_search_limit;
  47. int current_allocation_index;
  48. int allocation_table_length;
  49. } RasterIver;
  50. RasterIver* RI_get_ri();
  51. #endif