mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
+ | Transparency Material
This commit is contained in:
@ -17,7 +17,7 @@ Scene::Scene()
|
||||
_camera = new Camera(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), -90.0f, 0.0f);
|
||||
|
||||
_gpu_volume.enabled = 0;
|
||||
_gpu_volume.sigma_a = glm::vec3(0.0f);
|
||||
_gpu_volume.sigma_a = glm::vec3(0.0001f);
|
||||
_gpu_volume.sigma_s = glm::vec3(0.0800f);
|
||||
_gpu_volume.sigma_t = _gpu_volume.sigma_a + _gpu_volume.sigma_s;
|
||||
_gpu_volume.g = 0.9f;
|
||||
|
@ -52,6 +52,8 @@ void SceneParser::parseMaterial(std::stringstream &line)
|
||||
mat->type = 0;
|
||||
else if (type == "DIE")
|
||||
mat->type = 1;
|
||||
else if (type == "TRN")
|
||||
mat->type = 2;
|
||||
|
||||
_scene->addMaterial(mat);
|
||||
}
|
||||
@ -156,7 +158,7 @@ void SceneParser::parseMtl(std::stringstream &input_line, std::map<std::string,
|
||||
if(matName.empty())
|
||||
throw std::runtime_error("OBJ: syntax error in material file, missing material name");
|
||||
mat = new Material;
|
||||
bzero(mat, sizeof(Material));
|
||||
memset(mat, 0, sizeof(Material));
|
||||
mat->metallic = 1.0f;
|
||||
continue;
|
||||
}
|
||||
|
@ -199,14 +199,20 @@ void Window::imGuiRender()
|
||||
has_changed |= ImGui::ColorEdit3("Color", &mat.color[0]);
|
||||
has_changed |= ImGui::SliderFloat("Emission", &mat.emission, 0.0f, 10.0f);
|
||||
|
||||
if (mat.type == 1)
|
||||
has_changed |= ImGui::SliderFloat("Refraction", &mat.refraction, 1.0f, 5.0f);
|
||||
else
|
||||
if (mat.type == 0)
|
||||
{
|
||||
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, 1);
|
||||
else if (mat.type == 1)
|
||||
has_changed |= ImGui::SliderFloat("Refraction", &mat.refraction, 1.0f, 5.0f);
|
||||
else if (mat.type == 2)
|
||||
{
|
||||
has_changed |= ImGui::SliderFloat("Transparency", &mat.roughness, 0.0f, 1.0f);
|
||||
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);
|
||||
|
||||
ImGui::PopID();
|
||||
|
||||
|
Reference in New Issue
Block a user