Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CDXSmoothStroke::Update(CDXStroke::Info * info, CDXMeshVert* pVertices, CDXMeshIndex* pIndices)
- {
- CDXVec3 newPos = CDXVec3(0, 0, 0);
- UInt32 totalCount = 0;
- m_mesh->VisitAdjacencies(info->index, [&](CDXMeshFace & face)
- {
- CDXMeshIndex m1 = face.v1;
- if (m1 >= m_mesh->GetVertexCount())
- return false;
- CDXMeshIndex m2 = face.v2;
- if (m2 >= m_mesh->GetVertexCount())
- return false;
- CDXMeshIndex m3 = face.v3;
- if (m3 >= m_mesh->GetVertexCount())
- return false;
- CDXVec3 sum = pVertices[m1].Position + pVertices[m2].Position + pVertices[m3].Position;
- newPos += sum / 3;
- totalCount++;
- return false;
- });
- newPos /= totalCount;
- CDXVec3 difference = newPos - pVertices[info->index].Position;
- m_current.insert(CDXVectorPair(info->index, CDXVec3(0,0,0)));
- m_current[info->index] += difference;
- pVertices[info->index].Position += difference;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement