mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 23:54:00 -06:00
Faster loading of 3D preview and much less memory used
This commit is contained in:
parent
8cfd2e33d8
commit
a5c0ffe963
8 changed files with 202 additions and 163 deletions
|
@ -4,15 +4,51 @@
|
|||
#include <myinit.h>
|
||||
#include "../Point.hpp"
|
||||
#include "../Line.hpp"
|
||||
#include "../TriangleMesh.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class GLVertexArray {
|
||||
public:
|
||||
std::vector<float> verts, norms;
|
||||
|
||||
void reserve(size_t len) {
|
||||
this->verts.reserve(len);
|
||||
this->norms.reserve(len);
|
||||
};
|
||||
void reserve_more(size_t len) {
|
||||
len += this->verts.size();
|
||||
this->reserve(len);
|
||||
};
|
||||
void push_vert(const Pointf3 &point) {
|
||||
this->verts.push_back(point.x);
|
||||
this->verts.push_back(point.y);
|
||||
this->verts.push_back(point.z);
|
||||
};
|
||||
void push_vert(float x, float y, float z) {
|
||||
this->verts.push_back(x);
|
||||
this->verts.push_back(y);
|
||||
this->verts.push_back(z);
|
||||
};
|
||||
void push_norm(const Pointf3 &point) {
|
||||
this->norms.push_back(point.x);
|
||||
this->norms.push_back(point.y);
|
||||
this->norms.push_back(point.z);
|
||||
};
|
||||
void push_norm(float x, float y, float z) {
|
||||
this->norms.push_back(x);
|
||||
this->norms.push_back(y);
|
||||
this->norms.push_back(z);
|
||||
};
|
||||
void load_mesh(const TriangleMesh &mesh);
|
||||
};
|
||||
|
||||
class _3DScene
|
||||
{
|
||||
public:
|
||||
static void _extrusionentity_to_verts_do(const Lines &lines, const std::vector<double> &widths,
|
||||
const std::vector<double> &heights, bool closed, double top_z, const Point ©,
|
||||
Pointf3s* qverts, Pointf3s* qnorms, Pointf3s* tverts, Pointf3s* tnorms);
|
||||
GLVertexArray* qverts, GLVertexArray* tverts);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue