Initial commit

This is working repository now. I had to clean this up due to
my f_ups, that made this simple repo around 200MB large.

Signed-off-by: Piotr Krygier <piotrkrygier@everyonecancode@xyz>
This commit is contained in:
Piotr Krygier
2022-06-28 09:54:41 +02:00
committed by Piotr Krygier
commit 493afb05e6
56 changed files with 5574 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
/**
* @file mesh_controller.h
* @author Piotr Krygier (piotrkrygier@everyonencancode.xyz)
* @brief Graphics context for Red Scarf Engine
* @version 0.1
* @date 2025-09-23
*
* @copyright Copyright (c) 2025
*
*/
#include <SDL3/SDL_log.h>
#include <stdbool.h>
#include <string.h>
#include "src/graphics_context.h"
#include "src/vulkan_commons.h"
#include "utilities/commons.h"
#include "utilities/entity.h"
#include "utilities/errors_common.h"
#include "vulkan_buffers.h"
rse_err_t create_mesh(struct graphics_context_t* context,
struct vertex_t* vertices,
uint16_t* indices,
size_t vertices_count,
size_t indices_count,
uint32_t* mesh_id)
{
rse_err_t status = RSE_ERROR_NO_ERROR;
if (mesh_id == NULL) {
SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "Provided mesh id handle is NULL");
return RSE_ERROR_NULL_POINTER;
}
*mesh_id = context->mesh_data.mesh_count;
if (context->mesh_data.mesh_count > MAX_MESH_NUMBER) {
SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "Could not allocate new mesh, reached maximum.");
return RSE_ERROR_INTERNAL_ERROR;
}
STATUS_CHECK(add_vertices(context, *mesh_id, vertices_count, vertices, indices_count, indices));
context->mesh_data.mesh_count++;
return status;
}
rse_err_t create_mesh_instance(struct graphics_context_t* context,
entity_t entity,
struct instance_data_t instance_data)
{
if (context->mesh_data.mesh_bucket[entity].instances_count >= MAX_INSTANCE_NUMBER) {
SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "Could not allocate new mesh, reached maximum.");
return RSE_ERROR_INTERNAL_ERROR;
}
return mesh_add_instance(context, entity, &instance_data);
}