Make plater work with new XS code
This commit is contained in:
parent
4c96a52012
commit
d4512a12df
@ -1271,9 +1271,8 @@ sub _trigger_model_object {
|
||||
my $mesh = $model_object->mesh;
|
||||
$mesh->repair;
|
||||
$self->convex_hull(Slic3r::Polygon->new(@{Math::ConvexHull::MonotoneChain::convex_hull($mesh->vertices)}));
|
||||
$self->facets(scalar @{$mesh->facets});
|
||||
$self->facets($mesh->facets_count);
|
||||
$self->vertices(scalar @{$mesh->vertices});
|
||||
|
||||
$self->materials($model_object->materials_count);
|
||||
}
|
||||
}
|
||||
|
@ -49,13 +49,14 @@ sub new {
|
||||
color => COLORS->[ $color_idx % scalar(@{&COLORS}) ],
|
||||
};
|
||||
|
||||
my ($vertices, $facets) = ($mesh->vertices, $mesh->facets);
|
||||
{
|
||||
my @verts = map @{ $mesh->vertices->[$_] }, map @$_, @{$mesh->facets};
|
||||
my @verts = map @{ $vertices->[$_] }, map @$_, @$facets;
|
||||
$v->{verts} = OpenGL::Array->new_list(GL_FLOAT, @verts);
|
||||
}
|
||||
|
||||
{
|
||||
my @norms = map { @$_, @$_, @$_ } map normalize(triangle_normal(map $mesh->vertices->[$_], @$_)), @{$mesh->facets};
|
||||
my @norms = map { @$_, @$_, @$_ } map normalize(triangle_normal(map $vertices->[$_], @$_)), @$facets;
|
||||
$v->{norms} = OpenGL::Array->new_list(GL_FLOAT, @norms);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,12 @@
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
TriangleMesh::TriangleMesh()
|
||||
: repaired(false)
|
||||
{
|
||||
stl_initialize(&this->stl);
|
||||
}
|
||||
|
||||
TriangleMesh::TriangleMesh(const TriangleMesh &other)
|
||||
: stl(other.stl), repaired(other.repaired)
|
||||
{
|
||||
@ -64,7 +70,6 @@ TriangleMesh::write_binary(char* output_file)
|
||||
|
||||
void TriangleMesh::ReadFromPerl(SV* vertices, SV* facets)
|
||||
{
|
||||
stl_initialize(&stl);
|
||||
stl.stats.type = inmemory;
|
||||
|
||||
// count facets and allocate memory
|
||||
@ -559,7 +564,6 @@ TriangleMesh::split() const
|
||||
|
||||
TriangleMesh* mesh = new TriangleMesh;
|
||||
meshes.push_back(mesh);
|
||||
stl_initialize(&mesh->stl);
|
||||
mesh->stl.stats.type = inmemory;
|
||||
mesh->stl.stats.number_of_facets = facets.size();
|
||||
mesh->stl.stats.original_num_facets = mesh->stl.stats.number_of_facets;
|
||||
|
@ -15,7 +15,7 @@ typedef std::vector<TriangleMesh*> TriangleMeshPtrs;
|
||||
class TriangleMesh
|
||||
{
|
||||
public:
|
||||
TriangleMesh() : repaired(false) {};
|
||||
TriangleMesh();
|
||||
TriangleMesh(const TriangleMesh &other);
|
||||
~TriangleMesh();
|
||||
SV* to_SV();
|
||||
|
Loading…
Reference in New Issue
Block a user