Refactor some of the code.
This commit is contained in:
@@ -58,22 +58,10 @@ static bool load_assets(scene_t* scene)
|
||||
|
||||
static bool initialize_renderer(const rendering_config_t* config, render_job_t** outJob, render_target_t* outImg, scene_t* outScene)
|
||||
{
|
||||
if (!scene_setup(outScene))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!load_assets(outScene))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!scene_build_bvh(outScene))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!render_target_init(config->width, config->height, outImg))
|
||||
if (!scene_setup(outScene)
|
||||
|| !load_assets(outScene)
|
||||
|| !scene_build_bvh(outScene)
|
||||
|| !render_target_init(config->width, config->height, outImg))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -90,7 +78,7 @@ static bool initialize_renderer(const rendering_config_t* config, render_job_t**
|
||||
.config = config,
|
||||
|
||||
.rendering_type = TILE_BASED,
|
||||
.rendering_flag = DEBUG_NONE,
|
||||
.debug_flag = DEBUG_NONE,
|
||||
.is_done = false,
|
||||
};
|
||||
|
||||
@@ -174,20 +162,15 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
render_job_t* job = NULL;
|
||||
|
||||
rendering_config_t config = {
|
||||
.width = 1920 / 4,
|
||||
.height = 1080 / 4,
|
||||
.sample_count = 64,
|
||||
.width = 1920 / 2,
|
||||
.height = 1080 / 2,
|
||||
.sample_count = 64 * 4,
|
||||
.max_depth = 4,
|
||||
.bucket_size = 64,
|
||||
};
|
||||
|
||||
if (!initialize_renderer(&config, &job, &img, &scene))
|
||||
{
|
||||
shutdown_renderer(job, &img, &scene);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!window_create(TITLE, hInstance, config.width, config.height, job))
|
||||
if (!initialize_renderer(&config, &job, &img, &scene)
|
||||
|| !window_create(TITLE, hInstance, config.width, config.height, job))
|
||||
{
|
||||
shutdown_renderer(job, &img, &scene);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user