mirror of
https://github.com/kristov/ldraw2stl.git
synced 2025-05-15 14:20:11 -07:00
Attempt to fix incorrectly inverted sub-parts
There was bad behaviour if there were nested include files combined with a recursive invert flag, resulting in incorrect surface normals for sub-parts. For example try ldraw/parts/3020.dat before this commit. This is not the best way to solve the problem, but it may suffice for now. IMO the best way would be to "flip" the invert flag between states, rather than explcitely set it to 1 or 0. That way recursively setting invert would simply flip the flag.
This commit is contained in:
parent
ac0c4d00b8
commit
c05cf2c4da
@ -128,7 +128,7 @@ sub handle_bfc_command {
|
||||
my $first = shift @items;
|
||||
|
||||
if ( $first && $first eq 'INVERTNEXT' ) {
|
||||
$self->invert( 1 );
|
||||
$self->invert(1);
|
||||
$self->DEBUG('handle_bfc_command(): inverted model');
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,6 @@ sub parse_sub_file_reference {
|
||||
my $subparser = __PACKAGE__->new( {
|
||||
file => $subpart_filename,
|
||||
ldraw_path => $self->ldraw_path,
|
||||
invert => $self->invert,
|
||||
debug => $self->debug,
|
||||
d_indent => $self->d_indent + 2,
|
||||
} );
|
||||
@ -210,6 +209,7 @@ sub parse_sub_file_reference {
|
||||
$vec->[1] = $new_vec[1];
|
||||
$vec->[2] = $new_vec[2];
|
||||
}
|
||||
$triangle->[4] = [ $self->calc_surface_normal($triangle->[0], $triangle->[1], $triangle->[2]) ];
|
||||
push @{ $self->{triangles} }, $triangle;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user