Tech ENABLE_GLBEGIN_GLEND_REMOVAL - Removed Slic3r::GUI::GeometryBuffer from 3DBed.hpp and replaced with GLModel

(cherry picked from commit prusa3d/PrusaSlicer@6b041429f6)
This commit is contained in:
enricoturri1966 2023-10-21 23:35:34 +08:00 committed by Noisyfox
parent 499b9d1be8
commit f9de4ec399
8 changed files with 354 additions and 442 deletions

View file

@ -5,7 +5,8 @@
#include "3DScene.hpp"
#include "GLModel.hpp"
#include <libslic3r/BuildVolume.hpp>
#include "libslic3r/BuildVolume.hpp"
#include "libslic3r/ExPolygon.hpp"
#include <tuple>
#include <array>
@ -15,6 +16,7 @@ namespace GUI {
class GLCanvas3D;
/*
class GeometryBuffer
{
struct Vertex
@ -38,6 +40,9 @@ public:
size_t get_tex_coords_offset() const { return (size_t)(3 * sizeof(float)); }
unsigned int get_vertices_count() const { return (unsigned int)m_vertices.size(); }
};
*/
bool init_model_from_poly(GLModel &model, const ExPolygon &poly, float z);
class Bed3D
{
@ -91,14 +96,13 @@ private:
BoundingBoxf3 m_extended_bounding_box;
// Slightly expanded print bed polygon, for collision detection.
//Polygon m_polygon;
GeometryBuffer m_triangles;
//GeometryBuffer m_gridlines;
GLModel m_triangles;
//GLModel m_gridlines;
GLTexture m_texture;
// temporary texture shown until the main texture has still no levels compressed
//GLTexture m_temp_texture;
GLModel m_model;
Vec3d m_model_offset{ Vec3d::Zero() };
unsigned int m_vbo_id{ 0 };
Axes m_axes;
float m_scale_factor{ 1.0f };
@ -109,7 +113,7 @@ private:
public:
Bed3D() = default;
~Bed3D() { release_VBOs(); }
~Bed3D() = default;
// Update print bed model from configuration.
// Return true if the bed shape changed, so the calee will update the UI.
@ -151,11 +155,9 @@ private:
//BBS: add partplate related logic
// Calculate an extended bounding box from axes and current model for visualization purposes.
BoundingBoxf3 calc_extended_bounding_box(bool consider_model_offset = true) const;
void calc_triangles(const ExPolygon& poly);
void calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox);
void update_model_offset() const;
//BBS: with offset
GeometryBuffer update_bed_triangles() const;
void update_bed_triangles();
static std::tuple<Type, std::string, std::string> detect_type(const Pointfs& shape);
void render_internal(GLCanvas3D& canvas, bool bottom, float scale_factor,
bool show_axes);
@ -165,7 +167,6 @@ private:
void render_model();
void render_custom(GLCanvas3D& canvas, bool bottom);
void render_default(bool bottom);
void release_VBOs();
};
} // GUI