Tech ENABLE_GCODE_VIEWER -> Bed axes rendered using the new OpenGL model class

This commit is contained in:
enricoturri1966 2020-05-12 11:33:50 +02:00
parent 3475604362
commit 8d5cea82f4
6 changed files with 154 additions and 37 deletions

View file

@ -2,6 +2,7 @@
#define slic3r_GLModel_hpp_
#include "libslic3r/Point.hpp"
#include "libslic3r/BoundingBox.hpp"
#include <vector>
namespace Slic3r {
@ -23,22 +24,26 @@ namespace GUI {
unsigned int m_ibo_id{ 0 };
size_t m_indices_count{ 0 };
BoundingBoxf3 m_bounding_box;
public:
virtual ~GL_Model() { reset(); }
bool init_from(const GLModelInitializationData& data);
bool init_from(const TriangleMesh& mesh);
void init_from(const GLModelInitializationData& data);
void init_from(const TriangleMesh& mesh);
void reset();
void render() const;
const BoundingBoxf3& get_bounding_box() const { return m_bounding_box; }
private:
void send_to_gpu(const std::vector<float>& vertices, const std::vector<unsigned int>& indices);
};
// create an arrow with cylindrical stem and conical tip, with the given dimensions and resolution
// the arrow tip is at 0,0,0
// the arrow has its axis of symmetry along the Z axis and is pointing downward
// the origin of the arrow is in the center of the stem cap
// the arrow has its axis of symmetry along the Z axis and is pointing upward
GLModelInitializationData stilized_arrow(int resolution, float tip_radius, float tip_height,
float stem_radius, float stem_height);