forked from bartvdbraak/blender
Subdiv: Fix wrong non-manifold subdivision in certain cases
Was happening when only partial subset of callbacks was specified. The reason was that there was a callback to specify edges sharpness but no callback to specify vertex sharpness, so the special case for non-manifold edges was not run. Fixes T75697: Multires in simple mode doesn't work correct on a plane
This commit is contained in:
parent
470f17f21c
commit
9aeb475e99
@ -173,8 +173,17 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags(
|
||||
setBaseVertexSharpness(refiner, vertex_index, Crease::SHARPNESS_INFINITE);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get sharpness provided by the converter.
|
||||
float sharpness = 0.0f;
|
||||
if (converter->getVertexSharpness != NULL) {
|
||||
float sharpness = converter->getVertexSharpness(converter, vertex_index);
|
||||
sharpness = converter->getVertexSharpness(converter, vertex_index);
|
||||
}
|
||||
|
||||
// If it's vertex where 2 non-manifold edges meet adjust vertex sharpness to
|
||||
// the edges.
|
||||
// This way having a plane with all 4 edges set to be sharp produces sharp
|
||||
// corners in the subdivided result.
|
||||
if (vertex_edges.size() == 2) {
|
||||
const int edge0 = vertex_edges[0], edge1 = vertex_edges[1];
|
||||
const float sharpness0 = refiner._levels[0]->getEdgeSharpness(edge0);
|
||||
@ -183,9 +192,9 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags(
|
||||
sharpness += min(sharpness0, sharpness1);
|
||||
sharpness = min(sharpness, 10.0f);
|
||||
}
|
||||
|
||||
setBaseVertexSharpness(refiner, vertex_index, sharpness);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user