diff --git a/graphics/src/font_manager.c b/graphics/src/font_manager.c index 0feeae56..f294389e 100644 --- a/graphics/src/font_manager.c +++ b/graphics/src/font_manager.c @@ -164,7 +164,7 @@ rse_err_t fonts_set_font_size(struct graphics_context_t* context, const uint32_t vertices[3].tex_coords[0] = 0.0; vertices[3].tex_coords[1] = 0.0; - STATUS_CHECK(create_mesh(context, vertices, indices, 4, 6, &font->font_characters[33].mesh_id)); + STATUS_CHECK(mesh_create(context, vertices, indices, 4, 6, &font->font_characters[33].mesh_id)); // } return RSE_ERROR_NO_ERROR; @@ -175,7 +175,7 @@ rse_err_t print_debug_text(struct graphics_context_t* context, uint32_t font_id, rse_err_t status = RSE_ERROR_NO_ERROR; (void)text; - STATUS_CHECK(create_mesh_instance(context, context->fonts_data.fonts[font_id].font_characters[33].mesh_id, (struct instance_data_t){{0.0f, 0.0f, 2.4f}, {0.0f, 0.0f, 0.0}, 1.0f, context->fonts_data.fonts[font_id].font_characters[33].texture_id})); + STATUS_CHECK(mesh_create_instance(context, context->fonts_data.fonts[font_id].font_characters[33].mesh_id, (struct instance_data_t){{0.0f, 0.0f, 2.4f}, {0.0f, 0.0f, 0.0}, 1.0f, context->fonts_data.fonts[font_id].font_characters[33].texture_id})); return status; } diff --git a/graphics/src/mesh_controller.c b/graphics/src/mesh_controller.c index a550d282..dfe22766 100644 --- a/graphics/src/mesh_controller.c +++ b/graphics/src/mesh_controller.c @@ -19,7 +19,7 @@ #include "utilities/errors_common.h" #include "vulkan_buffers.h" -rse_err_t create_mesh(struct graphics_context_t* context, +rse_err_t mesh_create(struct graphics_context_t* context, struct vertex_t* vertices, uint16_t* indices, size_t vertices_count, @@ -46,7 +46,7 @@ rse_err_t create_mesh(struct graphics_context_t* context, return status; } -rse_err_t create_mesh_instance(struct graphics_context_t* context, +rse_err_t mesh_create_instance(struct graphics_context_t* context, entity_t entity, struct instance_data_t instance_data) { diff --git a/graphics/src/mesh_controller.h b/graphics/src/mesh_controller.h index 9e53ac7b..2673ee3f 100644 --- a/graphics/src/mesh_controller.h +++ b/graphics/src/mesh_controller.h @@ -26,7 +26,7 @@ * @param indices_num indices count * @return uint16_t Mesh identifier. Can be useful for getting vertices, indices and instances */ -rse_err_t create_mesh(struct graphics_context_t* context, struct vertex_t* vertices, +rse_err_t mesh_create(struct graphics_context_t* context, struct vertex_t* vertices, uint16_t* indices, size_t vertices_count, size_t indices_count, uint32_t* mesh_id); @@ -38,7 +38,7 @@ rse_err_t create_mesh(struct graphics_context_t* context, struct vertex_t* verti * @param entity Entity we wat to update * @param instance_data New instance information */ -rse_err_t create_mesh_instance(struct graphics_context_t* context, entity_t entity, +rse_err_t mesh_create_instance(struct graphics_context_t* context, entity_t entity, struct instance_data_t instance_data); /** diff --git a/graphics/src/pipeline_builder.c b/graphics/src/pipeline_builder.c index 1e813e7d..2395cb1a 100644 --- a/graphics/src/pipeline_builder.c +++ b/graphics/src/pipeline_builder.c @@ -363,7 +363,7 @@ rse_err_t pipelines_build(struct graphics_context_t* context, struct pipeline_in return status; } -rse_err_t add_pipeline(const struct graphics_context_t* context, +rse_err_t pipeline_add(const struct graphics_context_t* context, struct pipeline_t* pipeline, struct pipeline_infos_t* pipelines_infos) { diff --git a/graphics/src/pipeline_builder.h b/graphics/src/pipeline_builder.h index 63d3f0df..a5c8cdc1 100644 --- a/graphics/src/pipeline_builder.h +++ b/graphics/src/pipeline_builder.h @@ -111,7 +111,7 @@ rse_err_t pipelines_build(struct graphics_context_t* context, struct pipeline_in * @param[out] pipeline_infos Array of pipelines infos, where new info should be added * @return RSE_SUCCESS on success, error code otherwise */ -rse_err_t add_pipeline(const struct graphics_context_t* context, +rse_err_t pipeline_add(const struct graphics_context_t* context, struct pipeline_t* pipeline, struct pipeline_infos_t* pipelines_infos); diff --git a/graphics/src/rse_graphics.c b/graphics/src/rse_graphics.c index a195d1dd..e2bb5515 100644 --- a/graphics/src/rse_graphics.c +++ b/graphics/src/rse_graphics.c @@ -105,7 +105,7 @@ rse_err_t rse_graphics_init(struct rse_graphics_context_t** context) rse_memset(ctx_ptr->context, 0, sizeof(struct graphics_context_t)); STATUS_CHECK(window_init(&ctx_ptr->context->window_handle, &ctx_ptr->context->is_framebuffer_resized)); - STATUS_CHECK(init_vulkan(ctx_ptr->context)); + STATUS_CHECK(vulkan_init(ctx_ptr->context)); return status; } @@ -125,8 +125,8 @@ rse_err_t rse_graphics_test_function(struct rse_graphics_context_t* rse_context) uint32_t static_mesh_renderer = 0U; uint16_t vertex_shader_id, fragment_shader_id; - load_texture_from_file(context, "../../test_image.jpg", &textures[0]); - load_texture_from_file(context, "../../test_image_2.jpg", &textures[1]); + texture_load_from_file(context, "../../test_image.jpg", &textures[0]); + texture_load_from_file(context, "../../test_image_2.jpg", &textures[1]); STATUS_CHECK(fonts_init()); STATUS_CHECK(fonts_load_from_file(context, "../../NotoSansMono-Regular.ttf", &font_id)); @@ -146,33 +146,33 @@ rse_err_t rse_graphics_test_function(struct rse_graphics_context_t* rse_context) // FIXME: Temporary array of vertices, for testing purposes uint16_t indices[] = {0, 1, 2, 2, 3, 0}; - create_mesh(context, vertices, indices, 4, 6, &mesh_id_1); + mesh_create(context, vertices, indices, 4, 6, &mesh_id_1); if (RSE_ERROR_NO_ERROR != - create_mesh_instance(context, + mesh_create_instance(context, mesh_id_1, (struct instance_data_t){{0.0f, 0.0f, 2.4f}, {0.0f, 0.0f, 0.0}, 1.0f, textures[1]})) { exit(1); } if (RSE_ERROR_NO_ERROR != - create_mesh_instance( + mesh_create_instance( context, mesh_id_1, (struct instance_data_t){{-0.5f, 0.0f, -1.0f}, {0.0f, 0.0f, glm_rad(10.0f)}, 1.0f, textures[0]})) { exit(1); } - create_mesh(context, vertices2, indices, 4, 6, &mesh_id_2); + mesh_create(context, vertices2, indices, 4, 6, &mesh_id_2); if (RSE_ERROR_NO_ERROR != - create_mesh_instance( + mesh_create_instance( context, mesh_id_2, (struct instance_data_t){{1.0f, 1.0f, 0.0f}, {0.0f, 0.0f, glm_rad(0.0f)}, 1.0f, textures[0]})) { exit(1); } - create_uniform_buffer(context, &model_view_projection_buffer, sizeof(struct uniform_buffer_object_t)); + buffer_create_uniform(context, &model_view_projection_buffer, sizeof(struct uniform_buffer_object_t)); model_view_projection_update(context, &model_view_projection_buffer); buffers_update(context); @@ -221,7 +221,7 @@ rse_err_t rse_graphics_test_function(struct rse_graphics_context_t* rse_context) pipeline_add_dynamic_state(&pipeline, VK_DYNAMIC_STATE_SCISSOR); pipeline_add_descriptor_sets(context, &pipeline, descriptor_set_handle); - add_pipeline(context, &pipeline, &pipeline_infos); + pipeline_add(context, &pipeline, &pipeline_infos); pipelines_build(context, &pipeline_infos); @@ -238,10 +238,10 @@ int rse_graphics_run(void* arg) struct rse_graphics_context_t* rse_context = (struct rse_graphics_context_t*)arg; struct graphics_context_t* context = rse_context->context; - STATUS_CHECK(run_vulkan(context)); + STATUS_CHECK(vulkan_run(context)); STATUS_CHECK(window_loop(context)); - deinit_vulkan(context); + vulkan_deinit(context); window_terminate(context->window_handle); rse_free(context->debug_overlay.pixels); diff --git a/graphics/src/vulkan_base.c b/graphics/src/vulkan_base.c index c2d08042..2924b530 100644 --- a/graphics/src/vulkan_base.c +++ b/graphics/src/vulkan_base.c @@ -534,7 +534,7 @@ static rse_err_t create_sync_objects(struct graphics_context_t* context) } -rse_err_t init_vulkan(struct graphics_context_t* context) +rse_err_t vulkan_init(struct graphics_context_t* context) { rse_err_t status = RSE_ERROR_NO_ERROR; @@ -553,7 +553,7 @@ rse_err_t init_vulkan(struct graphics_context_t* context) return status; } -rse_err_t run_vulkan(struct graphics_context_t* context) +rse_err_t vulkan_run(struct graphics_context_t* context) { rse_err_t status = RSE_ERROR_NO_ERROR; @@ -647,7 +647,7 @@ rse_err_t draw_frame(struct graphics_context_t* context) return status; } -void deinit_vulkan(struct graphics_context_t* context) +void vulkan_deinit(struct graphics_context_t* context) { destroy_buffers(context); for (size_t i = 0; i < SWAP_BUFFER_COUNT; ++i) { diff --git a/graphics/src/vulkan_base.h b/graphics/src/vulkan_base.h index 47385247..c2d97f82 100644 --- a/graphics/src/vulkan_base.h +++ b/graphics/src/vulkan_base.h @@ -23,7 +23,7 @@ * @param context Graphics context handle * @return rse_err_t 0 on success. Status code on failure */ -rse_err_t init_vulkan(struct graphics_context_t* context); +rse_err_t vulkan_init(struct graphics_context_t* context); /** * @brief Initialize Vulkan backend with descriptors @@ -31,14 +31,14 @@ rse_err_t init_vulkan(struct graphics_context_t* context); * @param context Graphics context handle * @return rse_err_t 0 on success. Status code on failure */ -rse_err_t run_vulkan(struct graphics_context_t* context); +rse_err_t vulkan_run(struct graphics_context_t* context); /** * @brief Deinitialize Vulkan backend * * @param context Graphics context handle * */ -void deinit_vulkan(struct graphics_context_t* context); +void vulkan_deinit(struct graphics_context_t* context); /** * @brief Draw frame on the screen. diff --git a/graphics/src/vulkan_buffers.c b/graphics/src/vulkan_buffers.c index c6201d4f..bd44f3ca 100644 --- a/graphics/src/vulkan_buffers.c +++ b/graphics/src/vulkan_buffers.c @@ -119,7 +119,7 @@ static rse_err_t create_instance_buffers(struct graphics_context_t* context) buffer_size = sizeof(struct instance_data_t) * MAX_INSTANCE_NUMBER; STATUS_CHECK( - create_uniform_buffer(context, &context->render_targets[RENDER_TARGET_3D].instance_buffer, buffer_size)); + buffer_create_uniform(context, &context->render_targets[RENDER_TARGET_3D].instance_buffer, buffer_size)); /* TODO: Move creation to somewhere else? */ STATUS_CHECK(create_buffer(context, CMD_BUFFER_SIZE, @@ -133,7 +133,7 @@ static rse_err_t create_instance_buffers(struct graphics_context_t* context) return RSE_ERROR_NO_ERROR; } -rse_err_t create_uniform_buffer(struct graphics_context_t* context, +rse_err_t buffer_create_uniform(struct graphics_context_t* context, struct vulkan_buffer_t* buffer, VkDeviceSize buffer_size) { diff --git a/graphics/src/vulkan_buffers.h b/graphics/src/vulkan_buffers.h index 1342e702..4a53d7f5 100644 --- a/graphics/src/vulkan_buffers.h +++ b/graphics/src/vulkan_buffers.h @@ -23,7 +23,7 @@ rse_err_t create_buffers(struct graphics_context_t* context); * @param buffer Buffer handle to hold new buffer * @return rse_err_t RSE_ERROR_NO_ERROR on success. */ -rse_err_t create_uniform_buffer(struct graphics_context_t* context, struct vulkan_buffer_t* buffer, +rse_err_t buffer_create_uniform(struct graphics_context_t* context, struct vulkan_buffer_t* buffer, VkDeviceSize buffer_size); /** diff --git a/graphics/src/vulkan_image.c b/graphics/src/vulkan_image.c index 1055c18b..fe2ad4c7 100644 --- a/graphics/src/vulkan_image.c +++ b/graphics/src/vulkan_image.c @@ -490,7 +490,7 @@ rse_err_t load_texture_from_bitmat(struct graphics_context_t* context, return status; } -rse_err_t load_texture_from_file(struct graphics_context_t* context, const char* file_path, uint16_t* texture_id) +rse_err_t texture_load_from_file(struct graphics_context_t* context, const char* file_path, uint16_t* texture_id) { rse_err_t status = RSE_ERROR_NO_ERROR; int width = 0; diff --git a/graphics/src/vulkan_image.h b/graphics/src/vulkan_image.h index 89fc1cc5..7ee0842d 100644 --- a/graphics/src/vulkan_image.h +++ b/graphics/src/vulkan_image.h @@ -48,7 +48,7 @@ rse_err_t load_texture_from_bitmat(struct graphics_context_t* context, const uns * @param texture_id Texture ID will be set up here * @return rse_err_t RSE_ERROR_NO_ERROR on success */ -rse_err_t load_texture_from_file(struct graphics_context_t* context, const char* file_path, uint16_t* texture_id); +rse_err_t texture_load_from_file(struct graphics_context_t* context, const char* file_path, uint16_t* texture_id); rse_err_t texture_update_image(struct graphics_context_t* context, const unsigned char* pixels,