mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
parent
30bcadab3e
commit
1555904bef
3771 changed files with 1251328 additions and 0 deletions
84
xs/xsp/SurfaceCollection.xsp
Normal file
84
xs/xsp/SurfaceCollection.xsp
Normal file
|
@ -0,0 +1,84 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <xsinit.h>
|
||||
#include "libslic3r/SurfaceCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Surface::Collection} class SurfaceCollection {
|
||||
%name{_new} SurfaceCollection();
|
||||
~SurfaceCollection();
|
||||
void clear()
|
||||
%code{% THIS->surfaces.clear(); %};
|
||||
void append(Surface* surface)
|
||||
%code{% THIS->surfaces.push_back(*surface); %};
|
||||
int count()
|
||||
%code{% RETVAL = THIS->surfaces.size(); %};
|
||||
void simplify(double tolerance);
|
||||
%{
|
||||
|
||||
SV*
|
||||
SurfaceCollection::arrayref()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->surfaces.size()-1);
|
||||
int i = 0;
|
||||
for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) {
|
||||
av_store(av, i++, perl_to_SV_ref(*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
SV*
|
||||
SurfaceCollection::filter_by_type(surface_type)
|
||||
SurfaceType surface_type;
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) {
|
||||
if ((*it).surface_type == surface_type) av_push(av, perl_to_SV_ref(*it));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
SurfaceCollection::replace(index, surface)
|
||||
int index
|
||||
Surface* surface
|
||||
CODE:
|
||||
THIS->surfaces[index] = *surface;
|
||||
|
||||
void
|
||||
SurfaceCollection::set_surface_type(index, surface_type)
|
||||
int index
|
||||
SurfaceType surface_type;
|
||||
CODE:
|
||||
THIS->surfaces[index].surface_type = surface_type;
|
||||
|
||||
SV*
|
||||
SurfaceCollection::group()
|
||||
CODE:
|
||||
// perform grouping
|
||||
std::vector<SurfacesPtr> groups;
|
||||
THIS->group(&groups);
|
||||
|
||||
// build return arrayref
|
||||
AV* av = newAV();
|
||||
av_fill(av, groups.size()-1);
|
||||
size_t i = 0;
|
||||
for (std::vector<SurfacesPtr>::iterator it = groups.begin(); it != groups.end(); ++it) {
|
||||
AV* innerav = newAV();
|
||||
av_fill(innerav, it->size()-1);
|
||||
size_t j = 0;
|
||||
for (SurfacesPtr::iterator it_s = it->begin(); it_s != it->end(); ++it_s) {
|
||||
av_store(innerav, j++, perl_to_SV_clone_ref(**it_s));
|
||||
}
|
||||
av_store(av, i++, newRV_noinc((SV*)innerav));
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue