mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 18:21:18 -06:00
Refactored rendering of the contour around areas selected by smart fill to prepare it for the FDM supports painting gizmo.
This commit is contained in:
parent
8c9c8a9cc4
commit
2b59a16dc7
4 changed files with 116 additions and 93 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include <cereal/types/vector.hpp>
|
||||
#include <GL/glew.h>
|
||||
|
||||
|
||||
|
||||
|
|
@ -26,6 +27,41 @@ enum class PainterGizmoType {
|
|||
MMU_SEGMENTATION
|
||||
};
|
||||
|
||||
class GLPaintContour
|
||||
{
|
||||
public:
|
||||
GLPaintContour() = default;
|
||||
|
||||
void render() const;
|
||||
|
||||
inline bool has_VBO() const { return this->m_contour_EBO_id != 0; }
|
||||
|
||||
// Release the geometry data, release OpenGL VBOs.
|
||||
void release_geometry();
|
||||
|
||||
// Finalize the initialization of the contour geometry and the indices, upload both to OpenGL VBO objects
|
||||
// and possibly releasing it if it has been loaded into the VBOs.
|
||||
void finalize_geometry();
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->contour_vertices.clear();
|
||||
this->contour_indices.clear();
|
||||
this->contour_indices_size = 0;
|
||||
}
|
||||
|
||||
std::vector<float> contour_vertices;
|
||||
std::vector<int> contour_indices;
|
||||
|
||||
// When the triangle indices are loaded into the graphics card as Vertex Buffer Objects,
|
||||
// the above mentioned std::vectors are cleared and the following variables keep their original length.
|
||||
size_t contour_indices_size{0};
|
||||
|
||||
// IDs of the Vertex Array Objects, into which the geometry has been loaded.
|
||||
// Zero if the VBOs are not sent to GPU yet.
|
||||
GLuint m_contour_VBO_id{0};
|
||||
GLuint m_contour_EBO_id{0};
|
||||
};
|
||||
|
||||
class TriangleSelectorGUI : public TriangleSelector {
|
||||
public:
|
||||
|
|
@ -49,12 +85,17 @@ public:
|
|||
protected:
|
||||
bool m_update_render_data = false;
|
||||
|
||||
static std::array<float, 4> get_seed_fill_color(const std::array<float, 4> &base_color);
|
||||
|
||||
private:
|
||||
void update_render_data();
|
||||
|
||||
GLIndexedVertexArray m_iva_enforcers;
|
||||
GLIndexedVertexArray m_iva_blockers;
|
||||
std::array<GLIndexedVertexArray, 3> m_varrays;
|
||||
|
||||
protected:
|
||||
GLPaintContour m_paint_contour;
|
||||
};
|
||||
|
||||
class GLGizmoTransparentRender
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue