Files
OrcaSlicer-bambulab/src/slic3r/GUI/GLCanvas3DManager.hpp
T

116 lines
2.6 KiB
C++
Raw Normal View History

2018-05-09 10:47:04 +02:00
#ifndef slic3r_GLCanvas3DManager_hpp_
#define slic3r_GLCanvas3DManager_hpp_
#include "libslic3r/BoundingBox.hpp"
2018-05-09 10:47:04 +02:00
#include <map>
2018-06-11 15:13:13 +02:00
#include <vector>
2018-10-01 16:48:08 +02:00
class wxWindow;
2018-06-11 15:13:13 +02:00
class wxGLCanvas;
class wxGLContext;
2018-05-09 10:47:04 +02:00
namespace Slic3r {
2018-06-11 15:13:13 +02:00
2018-11-22 15:29:59 +01:00
class BackgroundSlicingProcess;
2018-06-11 15:13:13 +02:00
class DynamicPrintConfig;
class Model;
class ExPolygon;
typedef std::vector<ExPolygon> ExPolygons;
class ModelObject;
class PrintObject;
2018-05-09 10:47:04 +02:00
namespace GUI {
2018-06-11 15:13:13 +02:00
class GLCanvas3D;
class Bed3D;
class GLToolbar;
struct Camera;
2018-06-11 15:13:13 +02:00
2018-05-09 10:47:04 +02:00
class GLCanvas3DManager
{
public:
class GLInfo
{
mutable bool m_detected;
mutable std::string m_version;
mutable std::string m_glsl_version;
mutable std::string m_vendor;
mutable std::string m_renderer;
mutable int m_max_tex_size;
mutable float m_max_anisotropy;
public:
GLInfo();
const std::string& get_version() const;
const std::string& get_glsl_version() const;
const std::string& get_vendor() const;
const std::string& get_renderer() const;
int get_max_tex_size() const;
float get_max_anisotropy() const;
bool is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const;
std::string to_string(bool format_as_html, bool extensions) const;
private:
void detect() const;
};
2018-06-04 10:14:09 +02:00
private:
2018-10-02 14:01:22 +02:00
enum EMultisampleState : unsigned char
{
MS_Unknown,
MS_Enabled,
MS_Disabled
};
2018-05-09 10:47:04 +02:00
typedef std::map<wxGLCanvas*, GLCanvas3D*> CanvasesMap;
CanvasesMap m_canvases;
2018-10-04 10:41:11 +02:00
wxGLContext* m_context;
static GLInfo s_gl_info;
2018-05-09 10:47:04 +02:00
bool m_gl_initialized;
2018-10-02 14:01:22 +02:00
static EMultisampleState s_multisample;
2019-05-21 14:19:03 +02:00
static bool s_compressed_textures_supported;
2018-05-09 10:47:04 +02:00
public:
GLCanvas3DManager();
2018-10-04 10:41:11 +02:00
~GLCanvas3DManager();
2018-05-09 10:47:04 +02:00
bool add(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar);
2018-05-09 10:47:04 +02:00
bool remove(wxGLCanvas* canvas);
void remove_all();
unsigned int count() const;
void init_gl();
bool init(wxGLCanvas* canvas);
2018-05-23 09:57:44 +02:00
GLCanvas3D* get_canvas(wxGLCanvas* canvas);
2018-05-18 14:08:59 +02:00
2018-10-02 14:01:22 +02:00
static bool can_multisample() { return s_multisample == MS_Enabled; }
2019-05-21 14:19:03 +02:00
static bool are_compressed_textures_supported() { return s_compressed_textures_supported; }
2018-10-01 16:48:08 +02:00
static wxGLCanvas* create_wxglcanvas(wxWindow *parent);
2018-10-02 14:01:22 +02:00
static const GLInfo& get_gl_info() { return s_gl_info; }
2018-05-09 10:47:04 +02:00
private:
2019-05-21 14:19:03 +02:00
CanvasesMap::iterator do_get_canvas(wxGLCanvas* canvas);
CanvasesMap::const_iterator do_get_canvas(wxGLCanvas* canvas) const;
2019-05-21 14:19:03 +02:00
bool init(GLCanvas3D& canvas);
static void detect_multisample(int* attribList);
2018-05-09 10:47:04 +02:00
};
} // namespace GUI
} // namespace Slic3r
#endif // slic3r_GLCanvas3DManager_hpp_