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:
@@ -22,12 +22,12 @@ inline vec3s fresnel_schlick_vec3(vec3s f0, float cos_theta)
|
||||
return glms_vec3_adds(glms_vec3_scale(f0, (1.0f - x5)), x5);
|
||||
}
|
||||
|
||||
inline float pdf_cosine_weighted_hemisphere(const vec3s normal, const vec3s wi)
|
||||
inline float pdf_cosine_weighted_hemisphere(vec3s normal, vec3s wi)
|
||||
{
|
||||
return fmaxf(glms_vec3_dot(wi, normal), 0.0f) / (float)M_PI;
|
||||
}
|
||||
|
||||
inline float pdf_blinn_phong_lobe(const vec3s normal, const vec3s wi, const vec3s wo, const float roughness)
|
||||
inline float pdf_blinn_phong_lobe(vec3s normal, vec3s wi, vec3s wo, float roughness)
|
||||
{
|
||||
// Check if wo and wi are on the same side of the surface normal geometry
|
||||
if (glms_vec3_dot(wo, normal) <= 0.0f || glms_vec3_dot(wi, normal) <= 0.0f)
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
#include "Geometry/Triangle.h"
|
||||
#include "Rendering/Scene.h"
|
||||
|
||||
vec3s path_trace(const scene_t* scene, const ray_t ray, const uint32_t sample_index, const int depth);
|
||||
vec3s path_trace(const scene_t* scene, ray_t ray, uint32_t sample_index, int depth);
|
||||
|
||||
#endif // PATH_TRACING_H
|
||||
|
||||
@@ -19,8 +19,8 @@ typedef struct
|
||||
bool hit;
|
||||
} hit_result_t;
|
||||
|
||||
hit_result_t ray_intersect(const triangle_t triangle, const ray_t ray);
|
||||
hit_result_t ray_intersect_closest(const triangle_collection_t* triangles, const ray_t ray);
|
||||
hit_result_t ray_intersect_any(const triangle_collection_t* triangles, const ray_t ray);
|
||||
hit_result_t ray_intersect( triangle_t triangle, ray_t ray);
|
||||
hit_result_t ray_intersect_closest(const triangle_collection_t* triangles, ray_t ray);
|
||||
hit_result_t ray_intersect_any(const triangle_collection_t* triangles, ray_t ray);
|
||||
|
||||
#endif // RAY_INTERSECTION_H
|
||||
|
||||
@@ -14,9 +14,9 @@ static uint32_t sobol_direction_vectors[SOBOL_DIMENSIONS][SOBOL_BITS];
|
||||
|
||||
// Precomputed table: s, a, and m_i's
|
||||
// https://web.maths.unsw.edu.au/~fkuo/sobol/
|
||||
static const int s_vals[SOBOL_DIMENSIONS - 1] = {1, 2, 3, 3, 4, 4, 5};
|
||||
static const int a_vals[SOBOL_DIMENSIONS - 1] = {0, 1, 1, 2, 1, 4, 2};
|
||||
static const int m_vals[SOBOL_DIMENSIONS - 1][5] = {
|
||||
static int s_vals[SOBOL_DIMENSIONS - 1] = {1, 2, 3, 3, 4, 4, 5};
|
||||
static int a_vals[SOBOL_DIMENSIONS - 1] = {0, 1, 1, 2, 1, 4, 2};
|
||||
static int m_vals[SOBOL_DIMENSIONS - 1][5] = {
|
||||
{1}, // dim 2
|
||||
{1, 3}, // dim 3
|
||||
{1, 3, 1}, // dim 4
|
||||
|
||||
Reference in New Issue
Block a user