~ | Refraction change

This commit is contained in:
TheRedShip
2025-01-12 19:05:03 +01:00
parent 5d5c9d432e
commit 1908057434
8 changed files with 15 additions and 10 deletions

View File

@ -142,6 +142,7 @@ void Scene::updateGPUData()
gpu_mat.emission = material->emission;
gpu_mat.roughness = material->roughness;
gpu_mat.metallic = material->metallic;
gpu_mat.refraction = material->refraction;
gpu_mat.type = material->type;
_gpu_materials.push_back(gpu_mat);

View File

@ -61,13 +61,13 @@ void SceneParser::parseMaterial(std::stringstream &line)
{
float r,g,b;
float emission;
float roughness;
float rough_refrac;
float metallic;
std::string type;
Material *mat;
if (!(line >> r >> g >> b >> emission >> roughness >> metallic))
if (!(line >> r >> g >> b >> emission >> rough_refrac >> metallic))
throw std::runtime_error("Material: Missing material properties");
if (!(line >> type))
@ -77,8 +77,9 @@ void SceneParser::parseMaterial(std::stringstream &line)
mat->color = glm::vec3(r / 255.0f, g / 255.0f, b / 255.0f);
mat->emission = emission;
mat->roughness = roughness;
mat->roughness = rough_refrac;
mat->metallic = metallic;
mat->refraction = rough_refrac;
mat->type = 0;
if (type == "LAM")

View File

@ -200,11 +200,12 @@ void Window::imGuiRender()
has_changed |= ImGui::SliderFloat("Emission", &mat.emission, 0.0f, 10.0f);
if (mat.type == 1)
has_changed |= ImGui::SliderFloat("Roughness", &mat.roughness, 0.0f, 5.0f);
has_changed |= ImGui::SliderFloat("Refraction", &mat.refraction, 1.0f, 5.0f);
else
{
has_changed |= ImGui::SliderFloat("Roughness", &mat.roughness, 0.0f, 1.0f);
has_changed |= ImGui::SliderFloat("Metallic", &mat.metallic, 0.0f, 1.0f);
has_changed |= ImGui::SliderFloat("Metallic", &mat.metallic, 0.0f, 1.0f);
}
has_changed |= ImGui::SliderInt("Type", &mat.type, 0, 1);
ImGui::PopID();