Commit db0a53eb authored by Romain Pacanowski's avatar Romain Pacanowski

Faster computations of normals with OpenMP enabled

parent 8d219de4
......@@ -335,7 +335,7 @@ _Mesh<VEC3_TYPE>::computeNormals( std::vector<VEC3_TYPE> const & vertices,
unsigned int const num_faces = faces.size()/3;
// TODO Open MP
#pragma omp parallel for default(none) shared(normals,faces,vertices,std::cout) num_threads(1)
#pragma omp parallel for default(none) shared(normals,faces,vertices,std::cout) /*num_threads(1)*/
for( unsigned int f=0; f < num_faces; f++ )
{
unsigned int const i1 = faces[3*f];
......@@ -386,7 +386,7 @@ _Mesh<VEC3_TYPE>::computeNormals( std::vector<VEC3_TYPE> const & vertices,
//Normalization Pass
unsigned int nb_invalid_normal = 0;
#pragma omp parallel for num_threads(1)
#pragma omp parallel for
for (long unsigned int i = 0; i < normals.size(); i++)
{
double const length = normals[i].length();
......@@ -409,7 +409,7 @@ _Mesh<VEC3_TYPE>::computeNormals( std::vector<VEC3_TYPE> const & vertices,
#endif
}
std::cout << " Number of invalid normals " << nb_invalid_normal << " over " << normals.size() << " i.e., " << static_cast<double>(nb_invalid_normal)/normals.size() * 100.0 << " % " << std::endl;
std::cout << "[TRACE] Number of invalid normals " << nb_invalid_normal << " over " << normals.size() << " i.e., " << static_cast<double>(nb_invalid_normal)/normals.size() * 100.0 << " % " << std::endl;
}
......@@ -441,7 +441,7 @@ _Mesh<VEC3_TYPE>::computeTangents(std::vector<VEC3_TYPE> const &vertices,
}
}
std::cout << " Nb Invalid Tangents : " << nb_invalid_tangents << " i.e., " << static_cast<double>(nb_invalid_tangents) / tangents.size() << "%" << std::endl;
std::cout << "[TRACE] Nb Invalid Tangents : " << nb_invalid_tangents << " i.e., " << static_cast<double>(nb_invalid_tangents) / tangents.size() << "%" << std::endl;
}
......
Markdown is supported
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