Update project files and enhance rendering system
Added: - Updated `.gitignore` to ignore the `[Bb]uild/` directory. - Additional tasks added to the roadmap in `README.md` for light unit standardization and GPU backend support. Changed: - Removed line in `settings.json` that disabled error squiggles for C/C++ code. - Modified `Triangle.h` to include `material_id` in `triangle_t` and reorganized properties. - Reordered parameters in `triangle_collection_init` for clarity. - Updated `shading_context_t` in `Material.h` and added size parameter to `material_create`. - Streamlined initialization in `scene_init` and updated `scene_free` for proper resource management. - Updated `window_create` in `Window.h` to accept a `render_job_t` parameter. - Introduced `renderer_start` in `Renderer.c` to handle rendering jobs and optimized pixel rendering logic.
This commit is contained in:
@@ -10,7 +10,7 @@ typedef struct
|
||||
vec3s position;
|
||||
vec3s wi;
|
||||
vec3s wo;
|
||||
}shading_context_t;
|
||||
} shading_context_t;
|
||||
|
||||
typedef vec3s (*sample_bsdf_f)(const void* data, vec3s normal, vec3s wo, uint32_t index, uint32_t bounce, float* pdf_out);
|
||||
typedef float (*sample_bsdf_pdf_f)(const void* data, vec3s normal, vec3s wo, vec3s wi);
|
||||
@@ -24,14 +24,15 @@ typedef struct
|
||||
sample_bsdf_pdf_f sample_bsdf_pdf;
|
||||
evaluate_bsdf_f evaluate_bsdf;
|
||||
void* data;
|
||||
}material_t;
|
||||
} material_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t id;
|
||||
} material_entity_t;
|
||||
|
||||
//TODO: Handle material remove, we can use something like sparse set.
|
||||
// TODO: Handle material remove, we can use something like sparse set.
|
||||
// NOTE: 255 is invalid
|
||||
typedef struct
|
||||
{
|
||||
uint8_t count;
|
||||
@@ -43,7 +44,7 @@ bool material_collection_init(size_t size, material_collection_t* materials);
|
||||
void material_collection_resize(material_collection_t* materials, size_t size);
|
||||
void material_collection_free(material_collection_t* materials);
|
||||
|
||||
material_entity_t material_create(sample_bsdf_f sample, sample_bsdf_pdf_f sample_pdf, evaluate_bsdf_f evaluate, void* data, material_collection_t* collection);
|
||||
material_entity_t material_create(sample_bsdf_f sample, sample_bsdf_pdf_f sample_pdf, evaluate_bsdf_f evaluate, void* data, size_t size_of_data, material_collection_t* collection);
|
||||
|
||||
vec3s sample_material_bsdf(const material_t* material, vec3s normal, vec3s wo, uint32_t sample_index, uint32_t bounce, float* pdf_out);
|
||||
float sample_material_bsdf_pdf(const material_t* material, vec3s normal, vec3s wo, vec3s wi);
|
||||
|
||||
@@ -17,7 +17,7 @@ float sample_bsdf_pdf_simple_lit(const void* data, vec3s normal, vec3s wo, vec3s
|
||||
|
||||
inline material_entity_t material_create_simple_lit(simple_lit_data_t* lit_data, material_collection_t* collection)
|
||||
{
|
||||
return material_create(sample_bsdf_simple_lit, sample_bsdf_pdf_simple_lit, evaluate_bsdf_simple_lit, lit_data, collection);
|
||||
return material_create(sample_bsdf_simple_lit, sample_bsdf_pdf_simple_lit, evaluate_bsdf_simple_lit, lit_data, sizeof(simple_lit_data_t), collection);
|
||||
}
|
||||
|
||||
#endif // SIMPLE_LIT_H
|
||||
|
||||
Reference in New Issue
Block a user