+ | Optimization + reflection

This commit is contained in:
TheRedShip
2025-01-02 16:33:21 +01:00
parent 21f2e84b61
commit 5d92a82b66
14 changed files with 204 additions and 101 deletions

View File

@ -72,17 +72,24 @@ void Scene::updateGPUData()
mat = getMaterial(obj->getMaterialIndex());
gpu_obj.position = obj->getPosition();
gpu_obj.color = mat->color;
gpu_obj.emission = mat->emission;
gpu_obj.roughness = mat->roughness;
gpu_obj.specular = mat->specular;
gpu_obj.type = static_cast<int>(obj->getType());
if (obj->getType() == Object::Type::SPHERE)
{
auto sphere = static_cast<const Sphere*>(obj);
auto sphere = static_cast<const Sphere *>(obj);
gpu_obj.radius = sphere->getRadius();
}
else if (obj->getType() == Object::Type::PLANE)
{
auto plane = static_cast<const Plane *>(obj);
gpu_obj.normal = plane->getNormal();
}
_gpu_objects.push_back(gpu_obj);
}