mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-28 15:45:30 +00:00
Faster loading of 3D preview and much less memory used
This commit is contained in:
@@ -3,47 +3,26 @@
|
||||
#include <myinit.h>
|
||||
#include "libslic3r/GUI/3DScene.hpp"
|
||||
|
||||
%name{Slic3r::GUI::_3DScene::GLVertexArray} class GLVertexArray {
|
||||
GLVertexArray();
|
||||
~GLVertexArray();
|
||||
void load_mesh(TriangleMesh* mesh) const
|
||||
%code%{ THIS->load_mesh(*mesh); %};
|
||||
size_t size() const
|
||||
%code%{ RETVAL = THIS->verts.size(); %};
|
||||
void* verts_ptr() const
|
||||
%code%{ RETVAL = THIS->verts.empty() ? 0 : &THIS->verts.front(); %};
|
||||
void* norms_ptr() const
|
||||
%code%{ RETVAL = THIS->verts.empty() ? 0 : &THIS->norms.front(); %};
|
||||
};
|
||||
|
||||
%package{Slic3r::GUI::_3DScene};
|
||||
%{
|
||||
|
||||
void
|
||||
_extrusionentity_to_verts_do(Lines lines, std::vector<double> widths, std::vector<double> heights, bool closed, double top_z, Point* copy, SV* qverts, SV* qnorms, SV* tverts, SV* tnorms)
|
||||
_extrusionentity_to_verts_do(Lines lines, std::vector<double> widths, std::vector<double> heights, bool closed, double top_z, Point* copy, GLVertexArray* qverts, GLVertexArray* tverts)
|
||||
CODE:
|
||||
Pointf3s _qverts, _qnorms, _tverts, _tnorms;
|
||||
_3DScene::_extrusionentity_to_verts_do(lines, widths, heights, closed,
|
||||
top_z, *copy, &_qverts, &_qnorms, &_tverts, &_tnorms);
|
||||
|
||||
{
|
||||
AV* av = (AV*)SvRV(qverts);
|
||||
for (Pointf3s::const_iterator it = _qverts.begin(); it != _qverts.end(); ++it) {
|
||||
av_push(av, newSVnv(it->x));
|
||||
av_push(av, newSVnv(it->y));
|
||||
av_push(av, newSVnv(it->z));
|
||||
}
|
||||
}
|
||||
{
|
||||
AV* av = (AV*)SvRV(qnorms);
|
||||
for (Pointf3s::const_iterator it = _qnorms.begin(); it != _qnorms.end(); ++it) {
|
||||
av_push(av, newSVnv(it->x));
|
||||
av_push(av, newSVnv(it->y));
|
||||
av_push(av, newSVnv(it->z));
|
||||
}
|
||||
}
|
||||
{
|
||||
AV* av = (AV*)SvRV(tverts);
|
||||
for (Pointf3s::const_iterator it = _tverts.begin(); it != _tverts.end(); ++it) {
|
||||
av_push(av, newSVnv(it->x));
|
||||
av_push(av, newSVnv(it->y));
|
||||
av_push(av, newSVnv(it->z));
|
||||
}
|
||||
}
|
||||
{
|
||||
AV* av = (AV*)SvRV(tnorms);
|
||||
for (Pointf3s::const_iterator it = _tnorms.begin(); it != _tnorms.end(); ++it) {
|
||||
av_push(av, newSVnv(it->x));
|
||||
av_push(av, newSVnv(it->y));
|
||||
av_push(av, newSVnv(it->z));
|
||||
}
|
||||
}
|
||||
top_z, *copy, qverts, tverts);
|
||||
|
||||
%}
|
||||
Reference in New Issue
Block a user