Tech ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL - Replace GLIndexedVertexArray with GLModel: MeshClipper::m_vertex_array

This commit is contained in:
enricoturri1966 2022-02-10 08:24:36 +01:00
parent 443a42c6d8
commit be6922795d
4 changed files with 81 additions and 1 deletions

View file

@ -6,7 +6,11 @@
#include "libslic3r/SLA/IndexedMesh.hpp"
#include "admesh/stl.h"
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
#include "slic3r/GUI/GLModel.hpp"
#else
#include "slic3r/GUI/3DScene.hpp"
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
#include <cfloat>
@ -69,7 +73,8 @@ public:
// MeshClipper class cuts a mesh and is able to return a triangulated cut.
class MeshClipper {
class MeshClipper
{
public:
// Inform MeshClipper about which plane we want to use to cut the mesh
// This is supposed to be in world coordinates.
@ -92,7 +97,11 @@ public:
// Render the triangulated cut. Transformation matrices should
// be set in world coords.
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
void render_cut(const ColorRGBA& color);
#else
void render_cut();
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
private:
void recalculate_triangles();
@ -103,7 +112,11 @@ private:
ClippingPlane m_plane;
ClippingPlane m_limiting_plane = ClippingPlane::ClipsNothing();
std::vector<Vec2f> m_triangles2d;
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
GLModel m_model;
#else
GLIndexedVertexArray m_vertex_array;
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
bool m_triangles_valid = false;
};