Commit: 88f98c0df4109dab264dda2239f1086f99d0ff4c
Author: Jeroen Bakker
Date: Wed Jul 6 13:26:39 2022 +0200
Branches: temp-T97352-3d-texturing-seam-bleeding-b2
https://developer.blender.org/rB88f98c0df4109dab264dda2239f1086f99d0ff4c
Improve performance fan uv coordinates.
===================================================================
M source/blender/blenkernel/intern/uv_islands.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/uv_islands.cc
b/source/blender/blenkernel/intern/uv_islands.cc
index d3d31ecaa03..3bd9566898f 100644
--- a/source/blender/blenkernel/intern/uv_islands.cc
+++ b/source/blender/blenkernel/intern/uv_islands.cc
@@ -185,24 +185,21 @@ struct Fan {
}
}
- void init_uv_coordinates(UVVertex &uv_vertex, const UVIsland &island)
+ void init_uv_coordinates(UVVertex &uv_vertex)
{
for (InnerEdge &fan_edge : inner_edges) {
- int2 test_edge =
int2(fan_edge.primitive->vertices[fan_edge.vert_order[0]].vertex->v,
-
fan_edge.primitive->vertices[fan_edge.vert_order[1]].vertex->v);
- for (const UVPrimitive &uv_primitive : island.uv_primitives) {
- for (UVEdge *edge : uv_primitive.edges) {
- int2 o(edge->vertices[0]->vertex->v, edge->vertices[1]->vertex->v);
- if ((test_edge.x == o.x && test_edge.y == o.y) ||
- (test_edge.x == o.y && test_edge.y == o.x)) {
- fan_edge.uvs[0] = uv_vertex.uv;
- for (int i = 0; i < 2; i++) {
- if (edge->vertices[i]->uv == uv_vertex.uv) {
- fan_edge.uvs[1] = edge->vertices[1 - i]->uv;
- break;
- }
- }
- }
+ int64_t other_v =
fan_edge.primitive->vertices[fan_edge.vert_order[0]].vertex->v;
+ if (other_v == uv_vertex.vertex->v) {
+ other_v =
fan_edge.primitive->vertices[fan_edge.vert_order[1]].vertex->v;
+ }
+
+ for (UVEdge *edge : uv_vertex.uv_edges) {
+ const UVVertex *other_uv_vertex =
edge->get_other_uv_vertex(uv_vertex.vertex);
+ int64_t other_edge_v = other_uv_vertex->vertex->v;
+ if (other_v == other_edge_v) {
+ fan_edge.uvs[0] = uv_vertex.uv;
+ fan_edge.uvs[1] = other_uv_vertex->uv;
+ break;
}
}
}
@@ -361,7 +358,7 @@ static void extend_at_vert(UVIsland &island, UVBorderCorner
&corner)
printf("TODO: Unknown how to handle non-manifold meshes.\n");
return;
}
- fan.init_uv_coordinates(*uv_vertex, island);
+ fan.init_uv_coordinates(*uv_vertex);
fan.mark_already_added_segments(*uv_vertex);
#ifdef VALIDATE
print(fan);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs