Fixed checking only first intersection
This commit is contained in:
parent
ed9c300d77
commit
01c4b95c56
1 changed files with 4 additions and 5 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
#include "objmodel.h"
|
||||
|
||||
|
@ -68,11 +67,11 @@ void ObjModel::loadObj(const std::string& fileName, Vector3d scale, Vector3d tra
|
|||
}
|
||||
|
||||
bool ObjModel::intersect(Ray &ray) const {
|
||||
return std::any_of(this->faces.begin(),
|
||||
this->faces.end(),
|
||||
[&ray](auto& face){
|
||||
return std::count_if(this->faces.begin(),
|
||||
this->faces.end(),
|
||||
[&ray](auto& face){
|
||||
return face.intersect(ray);
|
||||
});
|
||||
}) > 0;
|
||||
}
|
||||
|
||||
float ObjModel::minimumBounds(int dimension) const {
|
||||
|
|
Loading…
Reference in a new issue