+ | New map portal and checkerboard

This commit is contained in:
TheRedShip
2025-02-18 23:26:35 +01:00
parent b3bc2cc659
commit 82240d02c1
7 changed files with 54 additions and 16 deletions

View File

@ -30,7 +30,7 @@ void SceneParser::parseMaterial(std::stringstream &line)
float rough_refrac;
float metallic;
std::string type;
int texture_index;
float texture_index;
Material *mat;
@ -46,7 +46,7 @@ void SceneParser::parseMaterial(std::stringstream &line)
mat->roughness = rough_refrac;
mat->metallic = metallic;
mat->refraction = rough_refrac;
mat->type = -1;
if (type == "LAM")
mat->type = 0;
@ -54,6 +54,8 @@ void SceneParser::parseMaterial(std::stringstream &line)
mat->type = 1;
else if (type == "TRN")
mat->type = 2;
else if (type == "CHK")
mat->type = 3;
texture_index = -1;
if (mat->type != -1)
@ -61,7 +63,13 @@ void SceneParser::parseMaterial(std::stringstream &line)
else
mat->type = 0;
mat->texture_index = texture_index;
if (mat->type == 3) // i know it's ugly
{
mat->refraction = texture_index;
texture_index = -1;
}
mat->texture_index = (int)texture_index;
mat->emission_texture_index = -1;
_scene->addMaterial(mat);
}

View File

@ -248,7 +248,13 @@ void Window::imGuiRender(ShaderProgram &raytracing_program)
has_changed |= ImGui::SliderFloat("Refraction", &mat.refraction, 1.0f, 2.0f);
has_changed |= ImGui::SliderFloat("Proba", &mat.metallic, 0., 1.);
}
has_changed |= ImGui::SliderInt("Type", &mat.type, 0, 2);
else if (mat.type == 3)
{
has_changed |= ImGui::SliderFloat("Checker Scale", &mat.refraction, 0.0f, 40.0f);
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::SliderInt("Type", &mat.type, 0, 3);
ImGui::PopID();