race condition fix in wireframe.cpp

metadata
Wenzel Jakob 2011-12-30 22:18:33 +01:00
parent e0a7438495
commit 63e629c106
1 changed files with 3 additions and 2 deletions

View File

@ -91,14 +91,15 @@ public:
to 10% of the average average edge length */
m_mutex->lock();
if (m_lineWidth == 0) {
Float lineWidth = 0;
for (size_t i=0; i<triMesh->getTriangleCount(); ++i) {
const Triangle &tri = triMesh->getTriangles()[i];
for (int j=0; j<3; ++j)
m_lineWidth += (positions[tri.idx[j]]
lineWidth += (positions[tri.idx[j]]
- positions[tri.idx[(j+1)%3]]).length();
}
m_lineWidth = 0.1f * m_lineWidth / (3 * triMesh->getTriangleCount());
m_lineWidth = 0.1f * lineWidth / (3 * triMesh->getTriangleCount());
}
m_mutex->unlock();
}