Fixed cdf and added Standard Lit
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "Geometry/GeometryUtilities.h"
|
||||
#include "Geometry/Mesh.h"
|
||||
#include "Lighting/SkyLight.h"
|
||||
#include "Material/SimpleLit.h"
|
||||
#include "Material/StandardLit.h"
|
||||
#include "Rendering/AOV.h"
|
||||
#include "Rendering/PostProcessing.h"
|
||||
#include "Rendering/Scene.h"
|
||||
@@ -32,36 +32,55 @@ static bool scene_setup(scene_t* scene)
|
||||
directional_light_t* sun_light = &scene->lights.directional_lights[sun.id];
|
||||
sun_light->direction = glms_vec3_normalize((vec3s){0.6f, 1.0f, 0.25f});
|
||||
sun_light->color = (vec3s){1.0f, 0.93f, 0.87f};
|
||||
sun_light->intensity = 2.0f;
|
||||
sun_light->intensity = 1.0f;
|
||||
sun_light->angular_diameter = 0.53f;
|
||||
|
||||
//scene->lights.sky_light = sky_create_constant_sky(&(constant_sky_data_t)
|
||||
//{
|
||||
// .color = (vec3s){0.73f, 0.82f, 1.0f},
|
||||
// .intensity = 1.0f,
|
||||
//});
|
||||
texture_entity_t hdri = texture_load(HDRI_PATH, false, false, FLOAT_32, &scene->textures);
|
||||
scene->textures.buffer[hdri.id].texture.wrap_mode = CLAMP;
|
||||
// scene->lights.sky_light = sky_create_constant_sky(&(constant_sky_data_t)
|
||||
// {
|
||||
// .color = (vec3s){0.73f, 0.82f, 1.0f},
|
||||
// .intensity = 1.0f,
|
||||
// });
|
||||
texture_handle_t hdri = texture_load(HDRI_PATH, false, false, FLOAT_32, &scene->textures);
|
||||
scene->textures.buffer[hdri.id].texture.wrap_mode = WM_CLAMP;
|
||||
scene->textures.buffer[hdri.id].texture.filter_mode = FM_LINEAR;
|
||||
scene->lights.sky_light = sky_create_hdr_sky(&scene->textures, hdri, 1.0f);
|
||||
|
||||
return scene->lights.sky_light.data != NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool load_assets(scene_t* scene)
|
||||
{
|
||||
#if 1
|
||||
mesh_load(SCENE_PATH, scene);
|
||||
//material_entity_t floor_material = material_create_simple_lit_default(&(simple_lit_properties_t)
|
||||
//{
|
||||
// .albedo = (vec3s){0.8f, 0.8f, 0.8f},
|
||||
// .roughness = 0.95f,
|
||||
// .metallic = 0.0f,
|
||||
// .albedo_texture = invalid_texture_entity(),
|
||||
// .metallic_texture = invalid_texture_entity(),
|
||||
// .roughness_texture = invalid_texture_entity(),
|
||||
// .normal_texture = invalid_texture_entity(),
|
||||
//}, &scene->materials);
|
||||
//quad_create((vec3s){0.0f, 0.0f, 0.0f}, (vec3s){0.0f, 1.0f, 0.0f}, (vec3s){1.0f, 0.0f, 0.0f}, 10.0f, floor_material.id, &scene->triangles);
|
||||
//quad_create((vec3s){0.0f, 0.5f, 0.0f}, (vec3s){1.0f, 0.0f, 0.0f}, (vec3s){0.0f, 1.0f, 0.0f}, 1.0f, floor_material.id, &scene->triangles);
|
||||
#else
|
||||
material_handle_t floor_material = material_create_standard_lit_default(&(standard_lit_properties_t)
|
||||
{
|
||||
.albedo = (vec3s){0.95f, 0.95f, 0.95f},
|
||||
.roughness = 0.95f,
|
||||
.diffuse_roughness = 0.05f,
|
||||
.metallic = 0.0f,
|
||||
.albedo_texture = invalid_texture_handle(),
|
||||
.metallic_texture = invalid_texture_handle(),
|
||||
.roughness_texture = invalid_texture_handle(),
|
||||
.normal_texture = invalid_texture_handle(),
|
||||
}, &scene->materials);
|
||||
|
||||
material_handle_t quad_material = material_create_standard_lit_default(
|
||||
&(standard_lit_properties_t){
|
||||
.albedo = (vec3s){0.8f, 0.0f, 0.0f},
|
||||
.roughness = 0.05f,
|
||||
.diffuse_roughness = 0.05f,
|
||||
.metallic = 0.0f,
|
||||
.albedo_texture = invalid_texture_handle(),
|
||||
.metallic_texture = invalid_texture_handle(),
|
||||
.roughness_texture = invalid_texture_handle(),
|
||||
.normal_texture = invalid_texture_handle(),
|
||||
},
|
||||
&scene->materials);
|
||||
|
||||
quad_create((vec3s){0.0f, 1.0f, 0.0f}, (vec3s){0.0f, 1.0f, 0.0f}, (vec3s){1.0f, 0.0f, 0.0f}, 10.0f, floor_material.id, &scene->triangles);
|
||||
quad_create((vec3s){0.0f, 1.5f, 0.0f}, (vec3s){1.0f, 0.0f, 0.0f}, (vec3s){0.0f, 1.0f, 0.0f}, 1.0f, quad_material.id, &scene->triangles);
|
||||
#endif
|
||||
|
||||
return scene_build_bvh(scene);
|
||||
}
|
||||
@@ -166,7 +185,7 @@ static int run_main_loop(render_job_t* job, uint8_t aov_index)
|
||||
// int main()
|
||||
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ PWSTR pCmdLine, _In_ int nCmdShow)
|
||||
{
|
||||
omp_set_num_threads(16);
|
||||
omp_set_num_threads(omp_get_max_threads());
|
||||
|
||||
scene_t scene = {0};
|
||||
render_job_t* job = NULL;
|
||||
|
||||
Reference in New Issue
Block a user