this makes the check from nearest to farthest which should save a
lot of work. too bad that profiling currently runs with the aim
pointing into nothingness, so results aren't visible. may have to
check that again some time
#include "../graphics/Format.hpp"
#include "../graphics/Viewport.hpp"
+#include <algorithm>
#include <limits>
#include <glm/gtx/io.hpp>
#include <glm/gtx/transform.hpp>
float dist;
};
+bool CandidateLess(const Candidate &a, const Candidate &b) {
+ return a.dist < b.dist;
+}
+
std::vector<Candidate> candidates;
}
if (candidates.empty()) return false;
+ std::sort(candidates.begin(), candidates.end(), CandidateLess);
+
coll.chunk = nullptr;
coll.block = -1;
coll.depth = std::numeric_limits<float>::infinity();