Update project structure and improve performance
Added new files for BVH, AABB, and Debug functionalities. Added new utility functions in Common.h. Added gamma correction function in PostProcessing.h. Changed the return type of path_trace to vec4s for alpha blending. Changed BSDF function signatures to include sample index and bounce. Changed the BSDF.h to replace inline functions with declarations. Changed the Light and SkyLight evaluation functions to include throughput and sample index. Changed the sphere creation function in GeometryUtilities.h for better quality. Changed the scene structure to include a BVH tree for improved ray intersection. Changed the scene initialization parameters for better performance. Created new Debug functions for ray intersection counting. Created new functions for triangle collection management in Triangle.c. Improved pixel updating logic in Window.c. Improved ray intersection performance with new BVH implementation. Removed unused includes from Common.h. Removed old library linking methods in CMakeLists.txt.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef LIGHT_H
|
||||
#define LIGHT_H
|
||||
|
||||
#include "Algorithm/BVH.h"
|
||||
#include "Algorithm/Sobol.h"
|
||||
#include "Geometry/Triangle.h"
|
||||
#include "Material/Material.h"
|
||||
@@ -11,13 +12,14 @@ typedef struct
|
||||
vec3s normal;
|
||||
vec3s hit_point;
|
||||
vec3s wo;
|
||||
vec3s throughput;
|
||||
|
||||
const triangle_collection_t* triangles;
|
||||
uint16_t bounce_depth;
|
||||
|
||||
const bvh_tree_t* bvh_tree;
|
||||
const material_t* material;
|
||||
} light_shading_context_t;
|
||||
|
||||
typedef vec3s (*evaluate_bsdf_sky_f) (const void* data, const light_shading_context_t* context, sobol_state_t* sobol_state);
|
||||
typedef vec3s (*evaluate_bsdf_sky_f) (const void* data, const light_shading_context_t* context, vec3s throughput, uint32_t index);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
#include "Geometry/Triangle.h"
|
||||
#include "Rendering/Scene.h"
|
||||
|
||||
vec3s evaluate_bsdf_directional( directional_light_t light, const light_shading_context_t* context, sobol_state_t* sobol_state);
|
||||
vec3s evaluate_bsdf_directional( directional_light_t light, const light_shading_context_t* context, vec3s throughput, uint32_t sample_index);
|
||||
|
||||
inline vec3s evaluate_bsdf_sky(const scene_t* scene, const light_shading_context_t* context, sobol_state_t* sobol_state)
|
||||
inline vec3s evaluate_bsdf_sky(const scene_t* scene, const light_shading_context_t* context, vec3s throughput, uint32_t sample_index)
|
||||
{
|
||||
vec3s ske_color = glms_vec3_zero();
|
||||
if (scene->lights.sky_light.evaluate_bsdf_sky != NULL)
|
||||
{
|
||||
ske_color = scene->lights.sky_light.evaluate_bsdf_sky(scene->lights.sky_light.data, context, sobol_state);
|
||||
ske_color = scene->lights.sky_light.evaluate_bsdf_sky(scene->lights.sky_light.data, context, throughput, sample_index);
|
||||
}
|
||||
|
||||
return ske_color;
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
typedef struct
|
||||
{
|
||||
vec3s color;
|
||||
float intensity;
|
||||
} constant_sky_data_t;
|
||||
|
||||
vec3s evaluate_bsdf_const_sky(const void* data, const light_shading_context_t* context, sobol_state_t* sobol_state);
|
||||
vec3s evaluate_bsdf_const_sky(const void* data, const light_shading_context_t* context, vec3s throughput, uint32_t sample_index);
|
||||
|
||||
inline sky_light_t sky_create_constant_sky(const constant_sky_data_t* data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user