mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 04:37:52 -06:00
GCodeViewer -> Enhanced tool marker + refactoring (added new base class for OpenGL models)
This commit is contained in:
parent
c02a77d942
commit
769cca4b25
5 changed files with 286 additions and 133 deletions
46
src/slic3r/GUI/GLModel.hpp
Normal file
46
src/slic3r/GUI/GLModel.hpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#ifndef slic3r_GLModel_hpp_
|
||||
#define slic3r_GLModel_hpp_
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class TriangleMesh;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
struct GLModelInitializationData
|
||||
{
|
||||
std::vector<Vec3f> positions;
|
||||
std::vector<Vec3f> normals;
|
||||
std::vector<Vec3i> triangles;
|
||||
};
|
||||
|
||||
class GL_Model
|
||||
{
|
||||
unsigned int m_vbo_id{ 0 };
|
||||
unsigned int m_ibo_id{ 0 };
|
||||
size_t m_indices_count{ 0 };
|
||||
|
||||
public:
|
||||
virtual ~GL_Model() { reset(); }
|
||||
|
||||
bool init_from(const GLModelInitializationData& data);
|
||||
bool init_from(const TriangleMesh& mesh);
|
||||
void reset();
|
||||
void render() const;
|
||||
|
||||
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
|
||||
GLModelInitializationData stilized_arrow(int resolution, float tip_radius, float tip_height,
|
||||
float stem_radius, float stem_height);
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_GLModel_hpp_
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue