Skip to content
Snippets Groups Projects
Commit f2befadb authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

adapted to c++14 changes

parent 50a453bd
No related merge requests found
...@@ -420,30 +420,37 @@ inline void Raytracer::traceRayInGlobalBodyStorage(const Ray& ray, BodyID& body_ ...@@ -420,30 +420,37 @@ inline void Raytracer::traceRayInGlobalBodyStorage(const Ray& ray, BodyID& body_
IntersectsFunctor func(ray, t, n); IntersectsFunctor func(ray, t, n);
for(auto bodyIt: *globalBodyStorage_) { for(auto bodyIt = globalBodyStorage_->begin(); bodyIt != globalBodyStorage_->end(); ++bodyIt)
if (!isBodyVisibleFunc_(bodyIt)) { {
if (!isBodyVisibleFunc_(bodyIt.getBodyID()))
{
continue; continue;
} }
bool isPlane = (bodyIt->getTypeID() == Plane::getStaticTypeID()); bool isPlane = (bodyIt->getTypeID() == Plane::getStaticTypeID());
if (isPlane) { if (isPlane)
PlaneID plane = (PlaneID)bodyIt; {
if (!isPlaneVisible(plane, ray)) { PlaneID plane = (PlaneID)bodyIt.getBodyID();
if (!isPlaneVisible(plane, ray))
{
continue; continue;
} }
} }
bool intersects = SingleCast<BodyTypeTuple, IntersectsFunctor, bool>::execute(bodyIt, func); bool intersects = SingleCast<BodyTypeTuple, IntersectsFunctor, bool>::execute(bodyIt.getBodyID(), func);
if (intersects && t < t_closest) { if (intersects && t < t_closest)
if (isPlane && confinePlanesToDomain_) { {
if (isPlane && confinePlanesToDomain_)
{
Vec3 intersectionPoint = ray.getOrigin()+ray.getDirection()*t; Vec3 intersectionPoint = ray.getOrigin()+ray.getDirection()*t;
if (!forest_->getDomain().contains(intersectionPoint, real_t(1e-8))) { if (!forest_->getDomain().contains(intersectionPoint, real_t(1e-8)))
{
continue; continue;
} }
} }
// body was shot by ray and is currently closest to camera // body was shot by ray and is currently closest to camera
t_closest = t; t_closest = t;
body_closest = bodyIt; body_closest = bodyIt.getBodyID();
n_closest = n; n_closest = n;
} }
} }
...@@ -466,15 +473,15 @@ inline void Raytracer::traceRayNaively(const Ray& ray, BodyID& body_closest, rea ...@@ -466,15 +473,15 @@ inline void Raytracer::traceRayNaively(const Ray& ray, BodyID& body_closest, rea
for (auto blockIt = forest_->begin(); blockIt != forest_->end(); ++blockIt) { for (auto blockIt = forest_->begin(); blockIt != forest_->end(); ++blockIt) {
for (auto bodyIt = LocalBodyIterator::begin(*blockIt, storageID_); bodyIt != LocalBodyIterator::end(); ++bodyIt) { for (auto bodyIt = LocalBodyIterator::begin(*blockIt, storageID_); bodyIt != LocalBodyIterator::end(); ++bodyIt) {
if (!isBodyVisibleFunc_(*bodyIt)) { if (!isBodyVisibleFunc_(bodyIt.getBodyID())) {
continue; continue;
} }
bool intersects = SingleCast<BodyTypeTuple, IntersectsFunctor, bool>::execute(*bodyIt, func); bool intersects = SingleCast<BodyTypeTuple, IntersectsFunctor, bool>::execute(bodyIt.getBodyID(), func);
if (intersects && t < t_closest) { if (intersects && t < t_closest) {
// body was shot by ray and is currently closest to camera // body was shot by ray and is currently closest to camera
t_closest = t; t_closest = t;
body_closest = *bodyIt; body_closest = bodyIt.getBodyID();
n_closest = n; n_closest = n;
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment