functions.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef FUNCTIONS_H
  2. #define FUNCTIONS_H
  3. #include "custom_types.h"
  4. #include "sourparse.h"
  5. // ----- request functions
  6. // Load an object file
  7. RI_mesh* RI_request_mesh(char *filename);
  8. // Allocate a new actor
  9. RI_actor* RI_request_actor();
  10. // Allocate a new material
  11. RI_material* RI_request_material();
  12. // Load a texture
  13. RI_texture* RI_request_texture(char *filename);
  14. // Allocate a new texture without using an image file
  15. RI_texture* RI_request_empty_texture(RI_vector_2 resolution);
  16. // Allocate a new scene
  17. RI_scene* RI_request_scene();
  18. // ----- master services
  19. // Initialize RasterIver
  20. int RI_init(int RI_window_width, int RI_window_height, char *RI_window_title);
  21. // Stop RasterIver safely and free memory
  22. int RI_stop(int result);
  23. // Tick RasterIver.
  24. // Copies the window's texture (ri.frame_buffer.image_buffer) onto the screen, calls SDL_RenderPresent, handles SDL events, increases ri.frame by 1, and optionally clears the window's texture
  25. void RI_tick(int clear_window_texture_after_rendering);
  26. // ----- rendering services
  27. // Render a scene to a texture
  28. int RI_render(RI_scene *scene, RI_texture *target_texture, int clear_texture);
  29. // Renders text to a texture
  30. void RI_render_text(SP_font *font, RI_texture *target_texture, RI_vector_2f position, uint32_t color, int bezier_resolution, double size, char *text);
  31. // Draws a line on a texture
  32. void RI_draw_line(RI_texture *target_texture, RI_vector_2 point_a, RI_vector_2 point_b, uint32_t color);
  33. // Sets all pixels in a texture to a color
  34. void RI_wipe_texture(RI_texture *target_texture, uint32_t color);
  35. // ----- memory
  36. // Unallocated a scene
  37. void RI_free_scene(RI_scene *scene);
  38. // Unallocates a texture
  39. void RI_free_texture(RI_texture *texture);
  40. // Unallocates a material (NOT it's references)
  41. void RI_free_material(RI_material *material);
  42. // Unallocated a mesh
  43. void RI_free_mesh(RI_mesh *mesh);
  44. // Unallocated an actor (NOT it's references)
  45. void RI_free_actor(RI_actor *actor);
  46. // ------ other
  47. int RI_add_actors_to_scene(int RI_number_of_actors_to_add_to_scene, RI_actor **actors, RI_scene *scene);
  48. void RI_euler_rotation_to_quaternion(RI_vector_4f* quaternion, RI_vector_3f euler_rotation);
  49. RI_vector_2f v2_to_2f(RI_vector_2 v);
  50. RI_vector_2 v2f_to_2(RI_vector_2f v);
  51. #endif