Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
60330de5
Commit
60330de5
authored
Aug 02, 2014
by
Andrew Zonenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3D model vertex normals are now calculated in parallel
parent
76436943
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
3d_mesh_model.cpp
3d-viewer/3d_mesh_model.cpp
+5
-4
No files found.
3d-viewer/3d_mesh_model.cpp
View file @
60330de5
...
@@ -354,13 +354,16 @@ void S3D_MESH::calcPerPointNormals ()
...
@@ -354,13 +354,16 @@ 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
m_PerFaceVertexNormals
.
resize
(
m_CoordIndex
.
size
());
// for each face A in mesh
// for each face A in mesh
#pragma omp parallel for
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
;
std
::
vector
<
glm
::
vec3
>&
face_A_normals
=
m_PerFaceVertexNormals
[
each_face_A_idx
];
face_A_normals
.
clear
();
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
...
@@ -402,7 +405,5 @@ void S3D_MESH::calcPerPointNormals ()
...
@@ -402,7 +405,5 @@ void S3D_MESH::calcPerPointNormals ()
}
}
}
}
m_PerFaceVertexNormals
.
push_back
(
face_A_normals
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment