Add HDR files and improve light handling
Added three binary files: `golden_gate_hills_1k.hdr`, `rogland_sunset_1k.hdr`, and `studio_small_03_1k.hdr`. Added a new inline function `weight_nee_light` in `BSDF.h` to compute the weighted contribution of light based on the next event estimation (NEE). Added a new function pointer type `sky_free_f` in `Light.h` for freeing sky light data. Added a new structure `hdr_sky_data_t` in `SkyLight.h` to hold HDR sky data, including texture and intensity. Changed the `RAY_EPSILON` definition in `Common.h` to a new value. Changed the `light_collection_free` function in `Light.h` to include freeing sky light data if it exists. Changed the `sky_create_hdr_sky` function in `SkyLight.h` to initialize HDR sky data and compute marginal and conditional distributions. Changed the `texture_load` function in `Texture.h` to accept a `stride` parameter for different texture formats. Changed the `evaluate_bsdf_directional` function in `LightEvaluation.c` to handle light intensity checks. Changed the `evaluate_bsdf_const_sky` function in `SkyLight.c` to use a pointer for sky data and added checks for intensity. Removed TODO comments related to handling triangle and material removal in `Triangle.h` and `Light.h`. Removed the old `weight_sky_light` function in `SkyLight.h` and replaced it with the new `weight_nee_light` function. Updated the `scene_setup` function in `main.c` to change camera position and light direction, and to load HDR textures. Increased the sample count in the rendering configuration in `main.c` for better quality rendering.
This commit is contained in:
@@ -20,6 +20,13 @@ typedef enum
|
||||
LINEAR,
|
||||
} filter_mode_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UINT_8 = 1,
|
||||
UINT_16 = 2,
|
||||
FLOAT_32 = 4,
|
||||
} stride_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t width;
|
||||
@@ -27,7 +34,8 @@ typedef struct
|
||||
wrap_mode_t wrap_mode;
|
||||
filter_mode_t filter_mode;
|
||||
uint8_t channel_count;
|
||||
uint8_t* data;
|
||||
stride_t stride;
|
||||
char* data;
|
||||
} texture_t;
|
||||
|
||||
typedef struct
|
||||
@@ -52,7 +60,7 @@ bool texture_collection_init(uint16_t size, texture_collection_t* textures);
|
||||
void texture_collection_resize(texture_collection_t* textures, uint16_t size);
|
||||
void texture_collection_free(texture_collection_t* textures);
|
||||
|
||||
texture_entity_t texture_load(const char* filename, bool srgb, texture_collection_t* textures);
|
||||
texture_entity_t texture_load(const char* filename, bool srgb, stride_t stride, texture_collection_t* textures);
|
||||
vec4s texture_sample(const texture_t* texture, float u, float v);
|
||||
void texture_free(texture_t* texture);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user