#ifndef SKY_LIGHT_H #define SKY_LIGHT_H #include "Algorithm/BSDF.h" #include "Algorithm/RayIntersection.h" #include "Light.h" #include typedef struct { vec3s color; float intensity; } constant_sky_data_t; typedef struct { uint32_t width; uint32_t height; texture_handle_t texture; float intensity; float total_weight; // Normalized discrete probability mass per texel (sum==1), indexed by [y * width + x] float* pdf_uv_mass; // CDF tables for correct runtime sampling (keeps wi/pdf consistent) float* cdf_x; // size: width float* cdf_y_transposed; // size: width * height, layout: [x * height + y] } hdr_sky_data_t; sky_light_t sky_create_constant_sky(const constant_sky_data_t* data); path_output evaluate_bsdf_const_sky(const void* data, const light_shading_context_t* context, vec3s throughput, uint32_t sample_index); sky_light_t sky_create_hdr_sky(const texture_collection_t* textures, texture_handle_t hdri_entity, float intensity); path_output evaluate_bsdf_hdr_sky(const void* data, const light_shading_context_t* context, vec3s throughput, uint32_t sample_index); void hdr_sky_free(hdr_sky_data_t* data); #endif // SKY_LIGHT_H