Skip to content

Commit

Permalink
Merge pull request #363 from kingiler/master
Browse files Browse the repository at this point in the history
Fix displacement for plymesh
  • Loading branch information
mmp authored Oct 18, 2023
2 parents 6d9d64e + 6150152 commit 4f920f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pbrt/util/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ struct TriQuadMesh {
outputMesh.ConvertToOnlyTriangles();
if (outputMesh.n.empty())
outputMesh.ComputeNormals();
std::vector<int> oldTriIndices(outputMesh.triIndices);
outputMesh.triIndices.clear();

// Refine
HashMap<std::pair<int, int>, int, HashIntPair> edgeSplit({});
for (int i = 0; i < triIndices.size() / 3; ++i)
outputMesh.Refine(dist, maxDist, triIndices[3 * i], triIndices[3 * i + 1],
triIndices[3 * i + 2], edgeSplit);
for (int i = 0; i < oldTriIndices.size() / 3; ++i)
outputMesh.Refine(dist, maxDist, oldTriIndices[3 * i],
oldTriIndices[3 * i + 1], oldTriIndices[3 * i + 2],
edgeSplit);

// Displace
displace(outputMesh.p.data(), outputMesh.n.data(), outputMesh.uv.data(),
Expand Down

0 comments on commit 4f920f8

Please sign in to comment.