diff options
author | Leon Leno <lone_noel> | 2021-03-26 03:59:29 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-26 03:59:29 +0300 |
commit | 2f772520862db0ad7edfa614dad0e8d2d65201e2 (patch) | |
tree | d49b7110483cc1aac4c5d62b0ab5222fd5d35880 | |
parent | de1eeaa3d24ae44106f2084667f73c07ae30c0de (diff) |
Fix: Geometry Nodes: Incorrect offsets for plane primitive
The recent commit that changed the size (rB83df3545246aada) left out
a few changed. This patch also adjusts the positioning and UV scale of
the generated plane accordingly.
Differential Revision: https://developer.blender.org/D10822
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc index eff84d7d1ad..b2d418d3c80 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc @@ -51,8 +51,8 @@ static void calculate_uvs(Mesh *mesh, Span<MVert> verts, Span<MLoop> loops, cons for (const int i : loops.index_range()) { const float3 &co = verts[loops[i].v].co; - uvs[i].x = (co.x + size) / (size * 2.0f); - uvs[i].y = (co.y + size) / (size * 2.0f); + uvs[i].x = (co.x + (size * 0.5)) / size; + uvs[i].y = (co.y + (size * 0.5)) / size; } uv_attribute.apply_span_and_save(); @@ -75,9 +75,9 @@ static Mesh *create_plane_mesh(const int verts_x, const int verts_y, const float { const float dx = size / edges_x; const float dy = size / edges_y; - float x = -size; + float x = -size * 0.5; for (const int x_index : IndexRange(verts_x)) { - float y = -size; + float y = -size * 0.5; for (const int y_index : IndexRange(verts_y)) { const int vert_index = x_index * verts_y + y_index; verts[vert_index].co[0] = x; |