Skip to content

Commit

Permalink
Fix hole filling, broke in a03ea60, 89f1bf1
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoehrle committed Jul 20, 2016
1 parent d512755 commit 544f371
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/tex/generate_texture_patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ bool fill_hole(std::vector<std::size_t> const & hole, UniGraph const & graph,
std::size_t vi0 = border[j];
std::size_t vi1 = border[(j + 1) % border.size()];
std::vector<VertexProjectionInfo> const & vpi0 = vertex_projection_infos->at(vi0);
std::vector<VertexProjectionInfo> const & vpi1 = vertex_projection_infos->at(vi0);
std::vector<VertexProjectionInfo> const & vpi1 = vertex_projection_infos->at(vi1);
/* According to the previous checks (vertex class within the origial
* mesh and boundary) there already has to be at least one projection
* of each border vertex. */
Expand Down
4 changes: 4 additions & 0 deletions libs/tex/local_seam_leveling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ local_seam_leveling(UniGraph const & graph, mve::TriangleMesh::ConstPtr mesh,
/* Sample vertex colors. */
for (std::size_t i = 0; i < vertex_colors.size(); ++i) {
std::vector<VertexProjectionInfo> const & projection_infos = vertex_projection_infos[i];
if (projection_infos.size() <= 1) continue;

math::Accum<math::Vec3f> color_accum(math::Vec3f(0.0f));
for (VertexProjectionInfo const & projection_info : projection_infos) {
Expand All @@ -162,6 +163,8 @@ local_seam_leveling(UniGraph const & graph, mve::TriangleMesh::ConstPtr mesh,
math::Vec3f color = texture_patch->get_pixel_value(projection_info.projection);
color_accum.add(color, 1.0f);
}
if (color_accum.w == 0.0f) continue;

vertex_colors[i] = color_accum.normalized();

for (VertexProjectionInfo const & projection_info : projection_infos) {
Expand Down Expand Up @@ -193,6 +196,7 @@ local_seam_leveling(UniGraph const & graph, mve::TriangleMesh::ConstPtr mesh,
if (texture_patch->get_label() != 0) {
texture_patch->prepare_blending_mask(STRIP_SIZE);
}

texture_patch->blend(image);
texture_patch->release_blending_mask();
texture_patch_counter.inc();
Expand Down

0 comments on commit 544f371

Please sign in to comment.