Skip to content

Commit

Permalink
Fixed far_tutorial_6 refined primvar interpolation
Browse files Browse the repository at this point in the history
Adaptive refinement will only produce levels of refinement which are
actually needed even if the client specifies a greater max isolation level.

This change fixes the loop control used for primvar interpolation to
interpolate only levels which exist in the refinement.
  • Loading branch information
davidgyu committed Jan 23, 2016
1 parent 3aaf491 commit 6434301
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tutorials/far/tutorial_6/far_tutorial_6.cpp
Expand Up @@ -163,10 +163,13 @@ int main(int, char **) {
std::vector<Vertex> verts(nRefinerVertices + nLocalPoints);
memcpy(&verts[0], g_verts, g_nverts*3*sizeof(float));

// Adaptive refinement may result in fewer levels than maxIsolation.
int nRefinedLevels = refiner->GetNumLevels();

// Interpolate vertex primvar data : they are the control vertices
// of the limit patches (see far_tutorial_0 for details)
Vertex * src = &verts[0];
for (int level = 1; level <= maxIsolation; ++level) {
for (int level = 1; level < nRefinedLevels; ++level) {
Vertex * dst = src + refiner->GetLevel(level-1).GetNumVertices();
Far::PrimvarRefiner(*refiner).Interpolate(level, src, dst);
src = dst;
Expand Down

0 comments on commit 6434301

Please sign in to comment.