mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | Refraction index dieletric material
This commit is contained in:
@ -108,6 +108,7 @@ void Scene::updateGPUData()
|
||||
gpu_mat.emission = material->emission;
|
||||
gpu_mat.roughness = material->roughness;
|
||||
gpu_mat.metallic = material->metallic;
|
||||
gpu_mat.type = material->type;
|
||||
|
||||
_gpu_materials.push_back(gpu_mat);
|
||||
}
|
||||
|
@ -45,17 +45,23 @@ void SceneParser::parseMaterial(std::stringstream &line)
|
||||
float emission;
|
||||
float roughness;
|
||||
float metallic;
|
||||
int type;
|
||||
|
||||
Material *mat;
|
||||
|
||||
if (!(line >> r >> g >> b >> emission >> roughness >> metallic))
|
||||
throw std::runtime_error("Material: Missing material properties");
|
||||
|
||||
if (!(line >> type))
|
||||
type = 0;
|
||||
|
||||
mat = new Material;
|
||||
|
||||
mat->color = glm::vec3(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
mat->emission = emission;
|
||||
mat->roughness = roughness;
|
||||
mat->metallic = metallic;
|
||||
mat->type = type;
|
||||
|
||||
_scene->addMaterial(mat);
|
||||
}
|
||||
|
@ -48,13 +48,26 @@ const char *loadFileWithIncludes(const std::string& path)
|
||||
}
|
||||
|
||||
|
||||
void printWithLineNumbers(const char *str)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
std::istringstream stream(str);
|
||||
std::string line;
|
||||
int lineNumber = 1;
|
||||
|
||||
while (std::getline(stream, line))
|
||||
std::cout << lineNumber++ << ": " << line << std::endl;
|
||||
}
|
||||
|
||||
Shader::Shader(std::string vertexPath, std::string fragmentPath, std::string computePath)
|
||||
{
|
||||
const char *vertexCode = loadFileWithIncludes(vertexPath);
|
||||
const char *fragmentCode = loadFileWithIncludes(fragmentPath);
|
||||
const char *computeCode = loadFileWithIncludes(computePath);
|
||||
|
||||
std::cout << computeCode << std::endl;
|
||||
printWithLineNumbers(computeCode);
|
||||
|
||||
_vertex = glCreateShader(GL_VERTEX_SHADER);
|
||||
|
||||
|
Reference in New Issue
Block a user