mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Use precomputed normals in 3D preview
This commit is contained in:
parent
d4512a12df
commit
bc48e17dff
3 changed files with 26 additions and 4 deletions
|
@ -49,14 +49,14 @@ sub new {
|
|||
color => COLORS->[ $color_idx % scalar(@{&COLORS}) ],
|
||||
};
|
||||
|
||||
my ($vertices, $facets) = ($mesh->vertices, $mesh->facets);
|
||||
{
|
||||
my @verts = map @{ $vertices->[$_] }, map @$_, @$facets;
|
||||
my $vertices = $mesh->vertices;
|
||||
my @verts = map @{ $vertices->[$_] }, map @$_, @{$mesh->facets};
|
||||
$v->{verts} = OpenGL::Array->new_list(GL_FLOAT, @verts);
|
||||
}
|
||||
|
||||
{
|
||||
my @norms = map { @$_, @$_, @$_ } map normalize(triangle_normal(map $vertices->[$_], @$_)), @$facets;
|
||||
my @norms = map @$_, @{$mesh->normals};
|
||||
$v->{norms} = OpenGL::Array->new_list(GL_FLOAT, @norms);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue