Use auto instead of decltype in cast_scene
This commit is contained in:
parent
0aa202e8a1
commit
427ccb666b
1 changed files with 2 additions and 2 deletions
|
@ -191,14 +191,14 @@ std::optional<SceneResult> cast_scene(const Ray ray, Scene& scene, const bool us
|
||||||
if (depth > max_depth)
|
if (depth > max_depth)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const std::function<decltype(test_scene)> scene_func = use_bvh ? test_scene_octree : test_scene;
|
const auto scene_func = use_bvh ? test_scene_octree : test_scene;
|
||||||
|
|
||||||
if (auto hit = scene_func(ray, scene)) {
|
if (auto hit = scene_func(ray, scene)) {
|
||||||
const float diffuse = lighting::point_light(hit->position, light_position, hit->normal);
|
const float diffuse = lighting::point_light(hit->position, light_position, hit->normal);
|
||||||
SceneResult result = {};
|
SceneResult result = {};
|
||||||
|
|
||||||
// direct lighting calculation
|
// direct lighting calculation
|
||||||
// currently only supports only one light (directional)
|
// currently only supports one light (directional)
|
||||||
if (glm::dot(light_position - hit->position, hit->normal) > 0) {
|
if (glm::dot(light_position - hit->position, hit->normal) > 0) {
|
||||||
const glm::vec3 light_dir = glm::normalize(light_position - hit->position);
|
const glm::vec3 light_dir = glm::normalize(light_position - hit->position);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue