Fix T91119: Curve to mesh node inverted face normals

Previously I thought I fixed this by reversing the face corner indices
in quads created by the curve to mesh node. But then we fixed a problem
with the transforms used in that node by inverting one of their
components, so the required direction also reversed. This commit
reverts rBcf28398471c84 and reverses the default direction of the
quadrilateral primitive so it's the same as the others.

Tests will be updated.
This commit is contained in:
Hans Goudey 2021-09-03 16:48:47 -05:00
parent 4fb7217043
commit 716682365c
Notes: blender-bot 2023-02-14 09:17:57 +01:00
Referenced by issue #91119, Curve to Mesh Inverted Face Normals
2 changed files with 26 additions and 26 deletions

View File

@ -30,10 +30,10 @@ static void geo_node_curve_primitive_quadrilateral_declare(NodeDeclarationBuilde
b.add_input<decl::Float>("Offset").default_value(1.0f).subtype(PROP_DISTANCE);
b.add_input<decl::Float>("Bottom Height").default_value(3.0f).min(0.0f).subtype(PROP_DISTANCE);
b.add_input<decl::Float>("Top Height").default_value(1.0f).subtype(PROP_DISTANCE);
b.add_input<decl::Vector>("Point 1").default_value({-1.0f, 1.0f, 0.0f}).subtype(PROP_DISTANCE);
b.add_input<decl::Vector>("Point 2").default_value({1.0f, 1.0f, 0.0f}).subtype(PROP_DISTANCE);
b.add_input<decl::Vector>("Point 3").default_value({1.0f, -1.0f, 0.0f}).subtype(PROP_DISTANCE);
b.add_input<decl::Vector>("Point 4").default_value({-1.0f, -1.0f, 0.0f}).subtype(PROP_DISTANCE);
b.add_input<decl::Vector>("Point 1").default_value({-1.0f, -1.0f, 0.0f}).subtype(PROP_DISTANCE);
b.add_input<decl::Vector>("Point 2").default_value({1.0f, -1.0f, 0.0f}).subtype(PROP_DISTANCE);
b.add_input<decl::Vector>("Point 3").default_value({1.0f, 1.0f, 0.0f}).subtype(PROP_DISTANCE);
b.add_input<decl::Vector>("Point 4").default_value({-1.0f, 1.0f, 0.0f}).subtype(PROP_DISTANCE);
b.add_output<decl::Geometry>("Curve");
}
@ -106,10 +106,10 @@ static void create_rectangle_curve(MutableSpan<float3> positions,
const float height,
const float width)
{
positions[0] = float3(width / 2.0f, -height / 2.0f, 0.0f);
positions[1] = float3(-width / 2.0f, -height / 2.0f, 0.0f);
positions[2] = float3(-width / 2.0f, height / 2.0f, 0.0f);
positions[3] = float3(width / 2.0f, height / 2.0f, 0.0f);
positions[0] = float3(width / 2.0f, height / 2.0f, 0.0f);
positions[1] = float3(-width / 2.0f, height / 2.0f, 0.0f);
positions[2] = float3(-width / 2.0f, -height / 2.0f, 0.0f);
positions[3] = float3(width / 2.0f, -height / 2.0f, 0.0f);
}
static void create_points_curve(MutableSpan<float3> positions,
@ -129,10 +129,10 @@ static void create_parallelogram_curve(MutableSpan<float3> positions,
const float width,
const float offset)
{
positions[0] = float3(width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
positions[1] = float3(-width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
positions[2] = float3(-width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
positions[3] = float3(width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
positions[0] = float3(width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
positions[1] = float3(-width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
positions[2] = float3(-width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
positions[3] = float3(width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
}
static void create_trapezoid_curve(MutableSpan<float3> positions,
const float bottom,
@ -140,10 +140,10 @@ static void create_trapezoid_curve(MutableSpan<float3> positions,
const float offset,
const float height)
{
positions[0] = float3(bottom / 2.0f, -height / 2.0f, 0.0f);
positions[1] = float3(-bottom / 2.0f, -height / 2.0f, 0.0f);
positions[2] = float3(-top / 2.0f + offset, height / 2.0f, 0.0f);
positions[3] = float3(top / 2.0f + offset, height / 2.0f, 0.0f);
positions[0] = float3(top / 2.0f + offset, height / 2.0f, 0.0f);
positions[1] = float3(-top / 2.0f + offset, height / 2.0f, 0.0f);
positions[2] = float3(-bottom / 2.0f, -height / 2.0f, 0.0f);
positions[3] = float3(bottom / 2.0f, -height / 2.0f, 0.0f);
}
static void create_kite_curve(MutableSpan<float3> positions,
@ -151,10 +151,10 @@ static void create_kite_curve(MutableSpan<float3> positions,
const float bottom_height,
const float top_height)
{
positions[0] = float3(-width / 2.0f, 0, 0);
positions[1] = float3(0, top_height, 0);
positions[2] = float3(width / 2, 0, 0);
positions[3] = float3(0, -bottom_height, 0);
positions[0] = float3(0, -bottom_height, 0);
positions[1] = float3(width / 2, 0, 0);
positions[2] = float3(0, top_height, 0);
positions[3] = float3(-width / 2.0f, 0, 0);
}
static void geo_node_curve_primitive_quadrilateral_exec(GeoNodeExecParams params)

View File

@ -164,16 +164,16 @@ static void spline_extrude_to_mesh_data(const Spline &spline,
MLoop &loop_a = r_loops[ring_segment_loop_offset];
loop_a.v = ring_vert_offset + i_profile;
loop_a.e = spline_edge_start + i_ring;
loop_a.e = ring_edge_start + i_profile;
MLoop &loop_b = r_loops[ring_segment_loop_offset + 1];
loop_b.v = next_ring_vert_offset + i_profile;
loop_b.e = next_ring_edge_offset + i_profile;
loop_b.v = ring_vert_offset + i_next_profile;
loop_b.e = next_spline_edge_start + i_ring;
MLoop &loop_c = r_loops[ring_segment_loop_offset + 2];
loop_c.v = next_ring_vert_offset + i_next_profile;
loop_c.e = next_spline_edge_start + i_ring;
loop_c.e = next_ring_edge_offset + i_profile;
MLoop &loop_d = r_loops[ring_segment_loop_offset + 3];
loop_d.v = ring_vert_offset + i_next_profile;
loop_d.e = ring_edge_start + i_profile;
loop_d.v = next_ring_vert_offset + i_profile;
loop_d.e = spline_edge_start + i_ring;
}
}