3D Texturing: Adding more cases where seams can be fixed.

Case added where a corner in uv space share the same edge in 3d space.
This used to work, but was lost when implementing
the new approach.
This commit is contained in:
Jeroen Bakker 2023-01-27 14:39:58 +01:00
parent 3d7697b325
commit 46c68c46a5
2 changed files with 9 additions and 3 deletions

View File

@ -925,8 +925,7 @@ static void extend_at_vert(const MeshData &mesh_data,
* triangle when the corner angle is near 180 degrees. In order to fix this we will
* always add two segments both using the same fill primitive.
*/
if ((num_to_add == 0 && winding_solution.size() == 1) ||
(corner.angle > 1.0f && winding_solution.size() < 2)) {
if (winding_solution.size() < 2 && (num_to_add == 0 || corner.angle > 2.0f)) {
int fill_primitive_1_i = corner.second->uv_primitive->primitive_i;
int fill_primitive_2_i = corner.first->uv_primitive->primitive_i;
@ -1460,9 +1459,10 @@ UVIslands::UVIslands(const MeshData &mesh_data)
{
islands.reserve(mesh_data.uv_island_len);
for (int64_t uv_island_id = 0; uv_island_id < mesh_data.uv_island_len; uv_island_id++) {
for (const int64_t uv_island_id : IndexRange(mesh_data.uv_island_len)) {
islands.append_as(UVIsland());
UVIsland *uv_island = &islands.last();
uv_island->id = uv_island_id;
for (const int primitive_i : mesh_data.looptris.index_range()) {
if (mesh_data.uv_island_ids[primitive_i] == uv_island_id) {
add_primitive(mesh_data, *uv_island, primitive_i);

View File

@ -289,6 +289,12 @@ struct UVBorder {
};
struct UVIsland {
/**
* Id (Index) of the UVIsland. Contains the index of this island in UVIslands.
*
* Useful during debugging to set a breaking condition on a specific island/vert.
*/
int id;
VectorList<UVVertex> uv_vertices;
VectorList<UVEdge> uv_edges;
VectorList<UVPrimitive> uv_primitives;