Changed function signatures to remove const qualifiers

Changed several function signatures across multiple files to remove the `const` qualifier from parameters of type `vec3s` for improved flexibility.
Changed `material_collection_create` to `material_collection_init` for better initialization handling.
Changed `scene_create` to `scene_init` to return a boolean indicating success or failure.
Changed `render_target_create` to `render_target_init` for consistent initialization practices.
Changed `window_create` to remove `const` from its parameters for consistency.
Changed `evaluate_bsdf_directional` and `evaluate_bsdf_const_sky` to remove `const` from their parameters.
Changed `sample_bsdf_simple_lit` and `sample_bsdf_pdf_simple_lit` to remove `const` from the `normal` parameter.
Changed `scene_render` to take a pointer to `render_target_t` instead of returning it directly.
Updated `main.c` to reflect new initialization functions for better memory management.
This commit is contained in:
2025-04-18 10:51:46 +09:00
parent bfc94f0008
commit 1162575545
27 changed files with 231 additions and 166 deletions

View File

@@ -6,7 +6,7 @@
// TODO: Implement a faster methods like BVH, KD-Tree or uniform grid acceleration
// TODO: Split the diffuse and specular into different Monte Carlo, so we can decide the sample count for each one
vec3s path_trace(const scene_t* scene, const ray_t ray, const uint32_t sample_index, const int max_depth)
vec3s path_trace(const scene_t* scene, ray_t ray, uint32_t sample_index, int max_depth)
{
const triangle_collection_t* triangles = &scene->triangles;
const material_collection_t* materials = &scene->materials;

View File

@@ -1,6 +1,6 @@
#include "algorithm/RayIntersection.h"
hit_result_t ray_intersect(const triangle_t triangle, const ray_t ray)
hit_result_t ray_intersect( triangle_t triangle, ray_t ray)
{
hit_result_t result = {0};
@@ -80,7 +80,7 @@ hit_result_t ray_intersect(const triangle_t triangle, const ray_t ray)
return result;
}
hit_result_t ray_intersect_closest(const triangle_collection_t* triangles, const ray_t ray)
hit_result_t ray_intersect_closest(const triangle_collection_t* triangles, ray_t ray)
{
hit_result_t closest_hit = {0};
closest_hit.distance = FLT_MAX;
@@ -98,7 +98,7 @@ hit_result_t ray_intersect_closest(const triangle_collection_t* triangles, const
return closest_hit;
}
hit_result_t ray_intersect_any(const triangle_collection_t* triangles, const ray_t ray)
hit_result_t ray_intersect_any(const triangle_collection_t* triangles, ray_t ray)
{
for (uint64_t i = 0; i < triangles->count; i++)
{