Fixed a few code style issues, added #ifdef USE_OPENMP
This commit is contained in:
parent
60330de551
commit
b6e85e0f82
|
@ -31,6 +31,10 @@
|
||||||
#include <3d_mesh_model.h>
|
#include <3d_mesh_model.h>
|
||||||
#include <boost/geometry/algorithms/area.hpp>
|
#include <boost/geometry/algorithms/area.hpp>
|
||||||
|
|
||||||
|
#ifdef USE_OPENMP
|
||||||
|
#include <omp.h>
|
||||||
|
#endif /* USE_OPENMP */
|
||||||
|
|
||||||
S3D_MESH::S3D_MESH()
|
S3D_MESH::S3D_MESH()
|
||||||
{
|
{
|
||||||
isPerFaceNormalsComputed = false;
|
isPerFaceNormalsComputed = false;
|
||||||
|
@ -356,15 +360,17 @@ void S3D_MESH::calcPerPointNormals ()
|
||||||
m_PerFaceVertexNormals.clear();
|
m_PerFaceVertexNormals.clear();
|
||||||
|
|
||||||
// Pre-allocate space for the entire vector of vertex normals so we can do parallel writes
|
// Pre-allocate space for the entire vector of vertex normals so we can do parallel writes
|
||||||
m_PerFaceVertexNormals.resize(m_CoordIndex.size());
|
m_PerFaceVertexNormals.resize( m_CoordIndex.size() );
|
||||||
|
|
||||||
// for each face A in mesh
|
// for each face A in mesh
|
||||||
|
#ifdef USE_OPENMP
|
||||||
#pragma omp parallel for
|
#pragma omp parallel for
|
||||||
|
#endif
|
||||||
for( unsigned int each_face_A_idx = 0; each_face_A_idx < m_CoordIndex.size(); each_face_A_idx++ )
|
for( unsigned int each_face_A_idx = 0; each_face_A_idx < m_CoordIndex.size(); each_face_A_idx++ )
|
||||||
{
|
{
|
||||||
// n = face A facet normal
|
// n = face A facet normal
|
||||||
std::vector< glm::vec3 >& face_A_normals = m_PerFaceVertexNormals[each_face_A_idx];
|
std::vector< glm::vec3 >& face_A_normals = m_PerFaceVertexNormals[each_face_A_idx];
|
||||||
face_A_normals.resize(m_CoordIndex[each_face_A_idx].size());
|
face_A_normals.resize( m_CoordIndex[each_face_A_idx].size() );
|
||||||
|
|
||||||
// loop through all 3 vertices
|
// loop through all 3 vertices
|
||||||
// for each vert in face A
|
// for each vert in face A
|
||||||
|
|
Loading…
Reference in New Issue