mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-07-28 12:24:33 +03:00
OpenGL to c++ 1st installment - WIP
This commit is contained in:
86
xs/src/slic3r/GUI/GLCanvas3DManager.hpp
Normal file
86
xs/src/slic3r/GUI/GLCanvas3DManager.hpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#ifndef slic3r_GLCanvas3DManager_hpp_
|
||||
#define slic3r_GLCanvas3DManager_hpp_
|
||||
|
||||
#include "GLCanvas3D.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class GLCanvas3DManager
|
||||
{
|
||||
struct GLVersion
|
||||
{
|
||||
unsigned int vn_major;
|
||||
unsigned int vn_minor;
|
||||
|
||||
GLVersion();
|
||||
bool detect();
|
||||
|
||||
bool is_greater_or_equal_to(unsigned int major, unsigned int minor) const;
|
||||
};
|
||||
|
||||
struct LayerEditing
|
||||
{
|
||||
bool allowed;
|
||||
|
||||
LayerEditing();
|
||||
};
|
||||
|
||||
typedef std::map<wxGLCanvas*, GLCanvas3D*> CanvasesMap;
|
||||
|
||||
CanvasesMap m_canvases;
|
||||
GLVersion m_gl_version;
|
||||
LayerEditing m_layer_editing;
|
||||
bool m_gl_initialized;
|
||||
bool m_use_legacy_opengl;
|
||||
bool m_use_VBOs;
|
||||
|
||||
public:
|
||||
GLCanvas3DManager();
|
||||
|
||||
bool add(wxGLCanvas* canvas, wxGLContext* context);
|
||||
bool remove(wxGLCanvas* canvas);
|
||||
|
||||
void remove_all();
|
||||
|
||||
unsigned int count() const;
|
||||
|
||||
void init_gl();
|
||||
|
||||
bool use_VBOs() const;
|
||||
bool layer_editing_allowed() const;
|
||||
|
||||
bool is_dirty(wxGLCanvas* canvas) const;
|
||||
void set_dirty(wxGLCanvas* canvas, bool dirty);
|
||||
|
||||
bool is_shown_on_screen(wxGLCanvas* canvas) const;
|
||||
|
||||
unsigned int get_camera_type(wxGLCanvas* canvas) const;
|
||||
void set_camera_type(wxGLCanvas* canvas, unsigned int type);
|
||||
|
||||
float get_camera_zoom(wxGLCanvas* canvas) const;
|
||||
void set_camera_zoom(wxGLCanvas* canvas, float zoom);
|
||||
|
||||
float get_camera_phi(wxGLCanvas* canvas) const;
|
||||
void set_camera_phi(wxGLCanvas* canvas, float phi);
|
||||
|
||||
float get_camera_theta(wxGLCanvas* canvas) const;
|
||||
void set_camera_theta(wxGLCanvas* canvas, float theta);
|
||||
|
||||
float get_camera_distance(wxGLCanvas* canvas) const;
|
||||
void set_camera_distance(wxGLCanvas* canvas, float distance);
|
||||
|
||||
Pointf3 get_camera_target(wxGLCanvas* canvas) const;
|
||||
void set_camera_target(wxGLCanvas* canvas, const Pointf3* target);
|
||||
|
||||
private:
|
||||
CanvasesMap::iterator _get_canvas(wxGLCanvas* canvas);
|
||||
CanvasesMap::const_iterator _get_canvas(wxGLCanvas* canvas) const;
|
||||
};
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_GLCanvas3DManager_hpp_
|
||||
Reference in New Issue
Block a user