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;
|
my $mesh = $model_object->mesh;
|
||||||
$mesh->repair;
|
$mesh->repair;
|
||||||
$self->convex_hull(Slic3r::Polygon->new(@{Math::ConvexHull::MonotoneChain::convex_hull($mesh->vertices)}));
|
$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->vertices(scalar @{$mesh->vertices});
|
||||||
|
|
||||||
$self->materials($model_object->materials_count);
|
$self->materials($model_object->materials_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,14 @@ sub new {
|
|||||||
color => COLORS->[ $color_idx % scalar(@{&COLORS}) ],
|
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);
|
$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);
|
$v->{norms} = OpenGL::Array->new_list(GL_FLOAT, @norms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
TriangleMesh::TriangleMesh()
|
||||||
|
: repaired(false)
|
||||||
|
{
|
||||||
|
stl_initialize(&this->stl);
|
||||||
|
}
|
||||||
|
|
||||||
TriangleMesh::TriangleMesh(const TriangleMesh &other)
|
TriangleMesh::TriangleMesh(const TriangleMesh &other)
|
||||||
: stl(other.stl), repaired(other.repaired)
|
: stl(other.stl), repaired(other.repaired)
|
||||||
{
|
{
|
||||||
@ -64,7 +70,6 @@ TriangleMesh::write_binary(char* output_file)
|
|||||||
|
|
||||||
void TriangleMesh::ReadFromPerl(SV* vertices, SV* facets)
|
void TriangleMesh::ReadFromPerl(SV* vertices, SV* facets)
|
||||||
{
|
{
|
||||||
stl_initialize(&stl);
|
|
||||||
stl.stats.type = inmemory;
|
stl.stats.type = inmemory;
|
||||||
|
|
||||||
// count facets and allocate memory
|
// count facets and allocate memory
|
||||||
@ -559,7 +564,6 @@ TriangleMesh::split() const
|
|||||||
|
|
||||||
TriangleMesh* mesh = new TriangleMesh;
|
TriangleMesh* mesh = new TriangleMesh;
|
||||||
meshes.push_back(mesh);
|
meshes.push_back(mesh);
|
||||||
stl_initialize(&mesh->stl);
|
|
||||||
mesh->stl.stats.type = inmemory;
|
mesh->stl.stats.type = inmemory;
|
||||||
mesh->stl.stats.number_of_facets = facets.size();
|
mesh->stl.stats.number_of_facets = facets.size();
|
||||||
mesh->stl.stats.original_num_facets = mesh->stl.stats.number_of_facets;
|
mesh->stl.stats.original_num_facets = mesh->stl.stats.number_of_facets;
|
||||||
|
@ -15,7 +15,7 @@ typedef std::vector<TriangleMesh*> TriangleMeshPtrs;
|
|||||||
class TriangleMesh
|
class TriangleMesh
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TriangleMesh() : repaired(false) {};
|
TriangleMesh();
|
||||||
TriangleMesh(const TriangleMesh &other);
|
TriangleMesh(const TriangleMesh &other);
|
||||||
~TriangleMesh();
|
~TriangleMesh();
|
||||||
SV* to_SV();
|
SV* to_SV();
|
||||||
|
Loading…
Reference in New Issue
Block a user