PrusaSlicer-NonPlainar/xs/xsp/GUI_3DScene.xsp
bubnikv 93cab990c7 Fixed some memory allocation issues of the new C++ 3d path preview
(reserved memory has to be shrank around the collected data).

Initial implementation of the vertex buffer objects for the 3d path preview.
2017-03-15 20:45:03 +01:00

115 lines
3.9 KiB
Plaintext

%module{Slic3r::XS};
#include <xsinit.h>
#include "slic3r/GUI/3DScene.hpp"
%name{Slic3r::GUI::_3DScene::GLVolume} class GLVolume {
GLVolume();
~GLVolume();
std::vector<double> color()
%code%{ RETVAL.reserve(4); RETVAL.push_back(THIS->color[0]); RETVAL.push_back(THIS->color[1]); RETVAL.push_back(THIS->color[2]); RETVAL.push_back(THIS->color[3]); %};
int composite_id()
%code%{ RETVAL = THIS->composite_id; %};
int select_group_id()
%code%{ RETVAL = THIS->select_group_id; %};
int drag_group_id()
%code%{ RETVAL = THIS->drag_group_id; %};
int selected()
%code%{ RETVAL = THIS->selected; %};
void set_selected(int i)
%code%{ THIS->selected = i; %};
int hover()
%code%{ RETVAL = THIS->hover; %};
void set_hover(int i)
%code%{ THIS->hover = i; %};
int object_idx() const;
int volume_idx() const;
int instance_idx() const;
Clone<Pointf3> origin() const
%code%{ RETVAL = THIS->origin; %};
void translate(double x, double y, double z)
%code%{ THIS->origin.translate(x, y, z); %};
Clone<BoundingBoxf3> bounding_box() const
%code%{ RETVAL = THIS->bounding_box; %};
Clone<BoundingBoxf3> transformed_bounding_box() const;
bool empty() const;
bool indexed() const;
void* triangles_to_render_ptr();
size_t triangles_to_render_cnt();
size_t geometry_size() const;
void* triangle_indices_ptr();
void* quad_indices_ptr();
size_t indexed_triangles_cnt();
size_t indexed_quads_cnt();
size_t triangle_indices_to_render_offset() const;
size_t quad_indices_to_render_offset() const;
size_t indexed_triangles_to_render_cnt() const;
size_t indexed_quads_to_render_cnt() const;
bool has_layer_height_texture();
int layer_height_texture_width();
int layer_height_texture_height();
int layer_height_texture_cells();
void* layer_height_texture_data_ptr_level0();
void* layer_height_texture_data_ptr_level1();
double layer_height_texture_z_to_row_id() const;
void generate_layer_height_texture(PrintObject *print_object, bool force);
};
%name{Slic3r::GUI::_3DScene::GLVolume::Collection} class GLVolumeCollection {
GLVolumeCollection();
~GLVolumeCollection();
std::vector<int> load_object(ModelObject *object, int obj_idx, std::vector<int> instance_idxs, std::string color_by, std::string select_by, std::string drag_by);
void erase()
%code{% THIS->clear(); %};
int count()
%code{% RETVAL = THIS->volumes.size(); %};
void set_range(double low, double high);
%{
SV*
GLVolumeCollection::arrayref()
CODE:
AV* av = newAV();
av_fill(av, THIS->volumes.size()-1);
int i = 0;
for (GLVolume *v : THIS->volumes) {
av_store(av, i++, perl_to_SV_ref(*v));
}
RETVAL = newRV_noinc((SV*)av);
OUTPUT:
RETVAL
%}
};
%package{Slic3r::GUI::_3DScene};
%{
void
_load_print_toolpaths(print, volumes, use_VBOs)
Print *print;
GLVolumeCollection *volumes;
bool use_VBOs;
CODE:
_3DScene::_load_print_toolpaths(print, volumes, use_VBOs);
void
_load_print_object_toolpaths(print_object, volumes, use_VBOs)
PrintObject *print_object;
GLVolumeCollection *volumes;
bool use_VBOs;
CODE:
_3DScene::_load_print_object_toolpaths(print_object, volumes, use_VBOs);
%}