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:
@@ -9,7 +9,7 @@
|
||||
#include "Geometry/GeometryUtilities.h"
|
||||
#include "Window.h"
|
||||
|
||||
static void save_img(render_target_t* source, const uint32_t width, const uint32_t height, const char* filename)
|
||||
static void save_img(render_target_t* source, uint32_t width, uint32_t height, const char* filename)
|
||||
{
|
||||
FILE* file_stream;
|
||||
fopen_s(&file_stream, filename, "wb");
|
||||
@@ -48,7 +48,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
omp_set_num_threads(16);
|
||||
sobol_init();
|
||||
|
||||
scene_t scene = scene_create(64, 8, 4);
|
||||
scene_t scene;
|
||||
if (!scene_init(64, 8, 4, &scene))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
scene.camera.position = (vec3s){0.0f, 0.0f, 5.0f};
|
||||
|
||||
@@ -142,7 +146,8 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
|
||||
#pragma endregion
|
||||
|
||||
render_target_t img = render_target_create(config.width, config.height);
|
||||
render_target_t img;
|
||||
render_target_init(config.width, config.height, &img);
|
||||
// render_target_t img = scene_render(&scene, config);
|
||||
// save_img(&img, config.width, config.height, "output.png");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user