#ifndef STANDARd_LIT_H #define STANDARd_LIT_H #include "Material.h" #include "Rendering/Texture.h" #include "cglm/common.h" #include "cglm/struct/vec3.h" typedef struct { vec3s albedo; vec3s normal; float diffuse_roughness; float roughness; float metallic; } standard_lit_surface_data_t; typedef struct { vec3s albedo; float diffuse_roughness; float roughness; float metallic; texture_handle_t albedo_texture; texture_handle_t normal_texture; texture_handle_t roughness_texture; texture_handle_t metallic_texture; } standard_lit_properties_t; path_output standard_lit_render_loop(const standard_lit_properties_t* properties, const shading_context_t* context); void standard_lit_render_aov(const standard_lit_properties_t* properties, const shading_context_t* context, aov_output_t* aov_output); inline material_handle_t material_create_standard_lit_default(const standard_lit_properties_t* properties, material_slot_map_t* collection) { material_t material = { .emission = glms_vec3_zero(), .properties_size = sizeof(standard_lit_properties_t), .properties = malloc(sizeof(standard_lit_properties_t)), .render_loop = (material_render_loop_f)standard_lit_render_loop, .render_aov = (material_render_aov_f)standard_lit_render_aov, }; if (material.properties == NULL) { return INVALID_HANDLE(material_handle_t); } memcpy(material.properties, properties, sizeof(standard_lit_properties_t)); material_handle_t handle; if (material_slot_map_add(collection, material, &handle.id, &handle.generation) != RESULT_SUCCESS) { free(material.properties); return INVALID_HANDLE(material_handle_t); } return handle; } #endif // STANDARd_LIT_H