mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Code cleanup
This commit is contained in:
		
							parent
							
								
									be7b786fee
								
							
						
					
					
						commit
						7f267987cb
					
				
					 4 changed files with 4 additions and 386 deletions
				
			
		|  | @ -540,10 +540,7 @@ double GLVolume::layer_height_texture_z_to_row_id() const | |||
| 
 | ||||
| void GLVolume::generate_layer_height_texture(PrintObject *print_object, bool force) | ||||
| { | ||||
| //########################################################################################################################################3
 | ||||
|     LayersTexture *tex = this->layer_height_texture.get(); | ||||
| //    GLTexture *tex = this->layer_height_texture.get();
 | ||||
| //########################################################################################################################################3
 | ||||
|     if (tex == nullptr) | ||||
| 		// No layer_height_texture is assigned to this GLVolume, therefore the layer height texture cannot be filled.
 | ||||
| 		return; | ||||
|  | @ -591,10 +588,7 @@ std::vector<int> GLVolumeCollection::load_object( | |||
|     }; | ||||
| 
 | ||||
|     // Object will have a single common layer height texture for all volumes.
 | ||||
| //########################################################################################################################################3
 | ||||
|     std::shared_ptr<LayersTexture> layer_height_texture = std::make_shared<LayersTexture>(); | ||||
| //    std::shared_ptr<GLTexture> layer_height_texture = std::make_shared<GLTexture>();
 | ||||
| //########################################################################################################################################3
 | ||||
| 
 | ||||
|     std::vector<int> volumes_idx; | ||||
|     for (int volume_idx = 0; volume_idx < int(model_object->volumes.size()); ++ volume_idx) { | ||||
|  | @ -1599,41 +1593,9 @@ _3DScene::LegendTexture _3DScene::s_legend_texture; | |||
| _3DScene::WarningTexture _3DScene::s_warning_texture; | ||||
| GUI::GLCanvas3DManager _3DScene::s_canvas_mgr; | ||||
| 
 | ||||
| //########################################################################################################################################3
 | ||||
| //unsigned int _3DScene::TextureBase::finalize()
 | ||||
| //{
 | ||||
| //    if ((m_tex_id == 0) && !m_data.empty()) {
 | ||||
| //        // sends buffer to gpu
 | ||||
| //        ::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 | ||||
| //        ::glGenTextures(1, &m_tex_id);
 | ||||
| //        ::glBindTexture(GL_TEXTURE_2D, (GLuint)m_tex_id);
 | ||||
| //        ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_tex_width, (GLsizei)m_tex_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)m_data.data());
 | ||||
| //        ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 | ||||
| //        ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 | ||||
| //        ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
 | ||||
| //        ::glBindTexture(GL_TEXTURE_2D, 0);
 | ||||
| //        m_data.clear();
 | ||||
| //    }
 | ||||
| //    return (m_tex_width > 0 && m_tex_height > 0) ? m_tex_id : 0;
 | ||||
| //}
 | ||||
| //
 | ||||
| //void _3DScene::TextureBase::_destroy_texture()
 | ||||
| //{
 | ||||
| //    if (m_tex_id > 0)
 | ||||
| //    {
 | ||||
| //        ::glDeleteTextures(1, &m_tex_id);
 | ||||
| //        m_tex_id = 0;
 | ||||
| //        m_tex_height = 0;
 | ||||
| //        m_tex_width = 0;
 | ||||
| //    }
 | ||||
| //    m_data.clear();
 | ||||
| //}
 | ||||
| //########################################################################################################################################3
 | ||||
| 
 | ||||
| const unsigned char _3DScene::WarningTexture::Background_Color[3] = { 9, 91, 134 }; | ||||
| const unsigned char _3DScene::WarningTexture::Opacity = 255; | ||||
| 
 | ||||
| //########################################################################################################################################3
 | ||||
| bool _3DScene::WarningTexture::generate(const std::string& msg) | ||||
| { | ||||
|     reset(); | ||||
|  | @ -1701,73 +1663,10 @@ bool _3DScene::WarningTexture::generate(const std::string& msg) | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| //// Generate a texture data, but don't load it into the GPU yet, as the GPU context may not yet be valid.
 | ||||
| //bool _3DScene::WarningTexture::generate(const std::string& msg)
 | ||||
| //{
 | ||||
| //    // Mark the texture as released, but don't release the texture from the GPU yet.
 | ||||
| //    m_tex_width = m_tex_height = 0;
 | ||||
| //    m_data.clear();
 | ||||
| //
 | ||||
| //    if (msg.empty())
 | ||||
| //        return false;
 | ||||
| //
 | ||||
| //    wxMemoryDC memDC;
 | ||||
| //    // select default font
 | ||||
| //    memDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
 | ||||
| //
 | ||||
| //    // calculates texture size
 | ||||
| //    wxCoord w, h;
 | ||||
| //    memDC.GetTextExtent(msg, &w, &h);
 | ||||
| //    m_tex_width = (unsigned int)w;
 | ||||
| //    m_tex_height = (unsigned int)h;
 | ||||
| //
 | ||||
| //    // generates bitmap
 | ||||
| //    wxBitmap bitmap(m_tex_width, m_tex_height);
 | ||||
| //
 | ||||
| //#if defined(__APPLE__) || defined(_MSC_VER)
 | ||||
| //    bitmap.UseAlpha();
 | ||||
| //#endif
 | ||||
| //
 | ||||
| //    memDC.SelectObject(bitmap);
 | ||||
| //    memDC.SetBackground(wxBrush(wxColour(Background_Color[0], Background_Color[1], Background_Color[2])));
 | ||||
| //    memDC.Clear();
 | ||||
| //
 | ||||
| //    memDC.SetTextForeground(*wxWHITE);
 | ||||
| //
 | ||||
| //    // draw message
 | ||||
| //    memDC.DrawText(msg, 0, 0);
 | ||||
| //
 | ||||
| //    memDC.SelectObject(wxNullBitmap);
 | ||||
| //
 | ||||
| //    // Convert the bitmap into a linear data ready to be loaded into the GPU.
 | ||||
| //    {
 | ||||
| //        wxImage image = bitmap.ConvertToImage();
 | ||||
| //        image.SetMaskColour(Background_Color[0], Background_Color[1], Background_Color[2]);
 | ||||
| //
 | ||||
| //        // prepare buffer
 | ||||
| //        m_data.assign(4 * m_tex_width * m_tex_height, 0);
 | ||||
| //        for (unsigned int h = 0; h < m_tex_height; ++h)
 | ||||
| //        {
 | ||||
| //            unsigned int hh = h * m_tex_width;
 | ||||
| //            unsigned char* px_ptr = m_data.data() + 4 * hh;
 | ||||
| //            for (unsigned int w = 0; w < m_tex_width; ++w)
 | ||||
| //            {
 | ||||
| //                *px_ptr++ = image.GetRed(w, h);
 | ||||
| //                *px_ptr++ = image.GetGreen(w, h);
 | ||||
| //                *px_ptr++ = image.GetBlue(w, h);
 | ||||
| //                *px_ptr++ = image.IsTransparent(w, h) ? 0 : Opacity;
 | ||||
| //            }
 | ||||
| //        }
 | ||||
| //    }
 | ||||
| //    return true;
 | ||||
| //}
 | ||||
| //########################################################################################################################################3
 | ||||
| 
 | ||||
| const unsigned char _3DScene::LegendTexture::Squares_Border_Color[3] = { 64, 64, 64 }; | ||||
| const unsigned char _3DScene::LegendTexture::Background_Color[3] = { 9, 91, 134 }; | ||||
| const unsigned char _3DScene::LegendTexture::Opacity = 255; | ||||
| 
 | ||||
| //########################################################################################################################################3
 | ||||
| bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors) | ||||
| { | ||||
|     reset(); | ||||
|  | @ -1912,146 +1811,6 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| //// Generate a texture data, but don't load it into the GPU yet, as the GPU context may not yet be valid.
 | ||||
| //bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors)
 | ||||
| //{
 | ||||
| //    // Mark the texture as released, but don't release the texture from the GPU yet.
 | ||||
| //    m_tex_width = m_tex_height = 0;
 | ||||
| //    m_data.clear();
 | ||||
| //
 | ||||
| //    // collects items to render
 | ||||
| //    auto title = _(preview_data.get_legend_title());
 | ||||
| //    const GCodePreviewData::LegendItemsList& items = preview_data.get_legend_items(tool_colors);
 | ||||
| //
 | ||||
| //    unsigned int items_count = (unsigned int)items.size();
 | ||||
| //    if (items_count == 0)
 | ||||
| //        // nothing to render, return
 | ||||
| //        return false;
 | ||||
| //
 | ||||
| //    wxMemoryDC memDC;
 | ||||
| //    // select default font
 | ||||
| //    memDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
 | ||||
| //
 | ||||
| //    // calculates texture size
 | ||||
| //    wxCoord w, h;
 | ||||
| //    memDC.GetTextExtent(title, &w, &h);
 | ||||
| //    unsigned int title_width = (unsigned int)w;
 | ||||
| //    unsigned int title_height = (unsigned int)h;
 | ||||
| //
 | ||||
| //    unsigned int max_text_width = 0;
 | ||||
| //    unsigned int max_text_height = 0;
 | ||||
| //    for (const GCodePreviewData::LegendItem& item : items)
 | ||||
| //    {
 | ||||
| //        memDC.GetTextExtent(GUI::from_u8(item.text), &w, &h);
 | ||||
| //        max_text_width = std::max(max_text_width, (unsigned int)w);
 | ||||
| //        max_text_height = std::max(max_text_height, (unsigned int)h);
 | ||||
| //    }
 | ||||
| //
 | ||||
| //    m_tex_width = std::max(2 * Px_Border + title_width, 2 * (Px_Border + Px_Square_Contour) + Px_Square + Px_Text_Offset + max_text_width);
 | ||||
| //    m_tex_height = 2 * (Px_Border + Px_Square_Contour) + title_height + Px_Title_Offset + items_count * Px_Square;
 | ||||
| //    if (items_count > 1)
 | ||||
| //        m_tex_height += (items_count - 1) * Px_Square_Contour;
 | ||||
| //
 | ||||
| //    // generates bitmap
 | ||||
| //    wxBitmap bitmap(m_tex_width, m_tex_height);
 | ||||
| //
 | ||||
| //#if defined(__APPLE__) || defined(_MSC_VER)
 | ||||
| //    bitmap.UseAlpha();
 | ||||
| //#endif
 | ||||
| //
 | ||||
| //    memDC.SelectObject(bitmap);
 | ||||
| //    memDC.SetBackground(wxBrush(wxColour(Background_Color[0], Background_Color[1], Background_Color[2])));
 | ||||
| //    memDC.Clear();
 | ||||
| //
 | ||||
| //    memDC.SetTextForeground(*wxWHITE);
 | ||||
| //
 | ||||
| //    // draw title
 | ||||
| //    unsigned int title_x = Px_Border;
 | ||||
| //    unsigned int title_y = Px_Border;
 | ||||
| //    memDC.DrawText(title, title_x, title_y);
 | ||||
| //
 | ||||
| //    // draw icons contours as background
 | ||||
| //    unsigned int squares_contour_x = Px_Border;
 | ||||
| //    unsigned int squares_contour_y = Px_Border + title_height + Px_Title_Offset;
 | ||||
| //    unsigned int squares_contour_width = Px_Square + 2 * Px_Square_Contour;
 | ||||
| //    unsigned int squares_contour_height = items_count * Px_Square + 2 * Px_Square_Contour;
 | ||||
| //    if (items_count > 1)
 | ||||
| //        squares_contour_height += (items_count - 1) * Px_Square_Contour;
 | ||||
| //
 | ||||
| //    wxColour color(Squares_Border_Color[0], Squares_Border_Color[1], Squares_Border_Color[2]);
 | ||||
| //    wxPen pen(color);
 | ||||
| //    wxBrush brush(color);
 | ||||
| //    memDC.SetPen(pen);
 | ||||
| //    memDC.SetBrush(brush);
 | ||||
| //    memDC.DrawRectangle(wxRect(squares_contour_x, squares_contour_y, squares_contour_width, squares_contour_height));
 | ||||
| //
 | ||||
| //    // draw items (colored icon + text)
 | ||||
| //    unsigned int icon_x = squares_contour_x + Px_Square_Contour;
 | ||||
| //    unsigned int icon_x_inner = icon_x + 1;
 | ||||
| //    unsigned int icon_y = squares_contour_y + Px_Square_Contour;
 | ||||
| //    unsigned int icon_y_step = Px_Square + Px_Square_Contour;
 | ||||
| //
 | ||||
| //    unsigned int text_x = icon_x + Px_Square + Px_Text_Offset;
 | ||||
| //    unsigned int text_y_offset = (Px_Square - max_text_height) / 2;
 | ||||
| //
 | ||||
| //    unsigned int px_inner_square = Px_Square - 2;
 | ||||
| //
 | ||||
| //    for (const GCodePreviewData::LegendItem& item : items)
 | ||||
| //    {
 | ||||
| //        // draw darker icon perimeter
 | ||||
| //        const std::vector<unsigned char>& item_color_bytes = item.color.as_bytes();
 | ||||
| //        wxImage::HSVValue dark_hsv = wxImage::RGBtoHSV(wxImage::RGBValue(item_color_bytes[0], item_color_bytes[1], item_color_bytes[2]));
 | ||||
| //        dark_hsv.value *= 0.75;
 | ||||
| //        wxImage::RGBValue dark_rgb = wxImage::HSVtoRGB(dark_hsv);
 | ||||
| //        color.Set(dark_rgb.red, dark_rgb.green, dark_rgb.blue, item_color_bytes[3]);
 | ||||
| //        pen.SetColour(color);
 | ||||
| //        brush.SetColour(color);
 | ||||
| //        memDC.SetPen(pen);
 | ||||
| //        memDC.SetBrush(brush);
 | ||||
| //        memDC.DrawRectangle(wxRect(icon_x, icon_y, Px_Square, Px_Square));
 | ||||
| //
 | ||||
| //        // draw icon interior
 | ||||
| //        color.Set(item_color_bytes[0], item_color_bytes[1], item_color_bytes[2], item_color_bytes[3]);
 | ||||
| //        pen.SetColour(color);
 | ||||
| //        brush.SetColour(color);
 | ||||
| //        memDC.SetPen(pen);
 | ||||
| //        memDC.SetBrush(brush);
 | ||||
| //        memDC.DrawRectangle(wxRect(icon_x_inner, icon_y + 1, px_inner_square, px_inner_square));
 | ||||
| //
 | ||||
| //        // draw text
 | ||||
| //		memDC.DrawText(GUI::from_u8(item.text), text_x, icon_y + text_y_offset);
 | ||||
| //
 | ||||
| //        // update y
 | ||||
| //        icon_y += icon_y_step;
 | ||||
| //    }
 | ||||
| //
 | ||||
| //    memDC.SelectObject(wxNullBitmap);
 | ||||
| //
 | ||||
| //    // Convert the bitmap into a linear data ready to be loaded into the GPU.
 | ||||
| //    {
 | ||||
| //        wxImage image = bitmap.ConvertToImage();
 | ||||
| //        image.SetMaskColour(Background_Color[0], Background_Color[1], Background_Color[2]);
 | ||||
| //
 | ||||
| //        // prepare buffer
 | ||||
| //        m_data.assign(4 * m_tex_width * m_tex_height, 0);
 | ||||
| //        for (unsigned int h = 0; h < m_tex_height; ++h)
 | ||||
| //        {
 | ||||
| //            unsigned int hh = h * m_tex_width;
 | ||||
| //            unsigned char* px_ptr = m_data.data() + 4 * hh;
 | ||||
| //            for (unsigned int w = 0; w < m_tex_width; ++w)
 | ||||
| //            {
 | ||||
| //                *px_ptr++ = image.GetRed(w, h);
 | ||||
| //                *px_ptr++ = image.GetGreen(w, h);
 | ||||
| //                *px_ptr++ = image.GetBlue(w, h);
 | ||||
| //                *px_ptr++ = image.IsTransparent(w, h) ? 0 : Opacity;
 | ||||
| //            }
 | ||||
| //        }
 | ||||
| //    }
 | ||||
| //    return true;
 | ||||
| //}
 | ||||
| //########################################################################################################################################3
 | ||||
| 
 | ||||
| void _3DScene::init_gl() | ||||
| { | ||||
|     s_canvas_mgr.init_gl(); | ||||
|  | @ -2459,27 +2218,11 @@ void _3DScene::generate_legend_texture(const GCodePreviewData& preview_data, con | |||
|     s_legend_texture.generate(preview_data, tool_colors); | ||||
| } | ||||
| 
 | ||||
| //###################################################################################################################################################
 | ||||
| //unsigned int _3DScene::get_legend_texture_width()
 | ||||
| //{
 | ||||
| //    return s_legend_texture.get_texture_width();
 | ||||
| //}
 | ||||
| //
 | ||||
| //unsigned int _3DScene::get_legend_texture_height()
 | ||||
| //{
 | ||||
| //    return s_legend_texture.get_texture_height();
 | ||||
| //}
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
| void _3DScene::reset_legend_texture() | ||||
| { | ||||
| //###################################################################################################################################################
 | ||||
|     s_legend_texture.reset(); | ||||
| //    s_legend_texture.reset_texture();
 | ||||
| //###################################################################################################################################################
 | ||||
| } | ||||
| 
 | ||||
| //###################################################################################################################################################
 | ||||
| unsigned int _3DScene::get_legend_texture_id() | ||||
| { | ||||
|     return s_legend_texture.get_id(); | ||||
|  | @ -2495,24 +2238,6 @@ int _3DScene::get_legend_texture_height() | |||
|     return s_legend_texture.get_height(); | ||||
| } | ||||
| 
 | ||||
| //unsigned int _3DScene::finalize_legend_texture()
 | ||||
| //{
 | ||||
| //    return s_legend_texture.finalize();
 | ||||
| //}
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
| //###################################################################################################################################################
 | ||||
| //unsigned int _3DScene::get_warning_texture_width()
 | ||||
| //{
 | ||||
| //    return s_warning_texture.get_texture_width();
 | ||||
| //}
 | ||||
| //
 | ||||
| //unsigned int _3DScene::get_warning_texture_height()
 | ||||
| //{
 | ||||
| //    return s_warning_texture.get_texture_height();
 | ||||
| //}
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
| void _3DScene::generate_warning_texture(const std::string& msg) | ||||
| { | ||||
|     s_warning_texture.generate(msg); | ||||
|  | @ -2520,13 +2245,9 @@ void _3DScene::generate_warning_texture(const std::string& msg) | |||
| 
 | ||||
| void _3DScene::reset_warning_texture() | ||||
| { | ||||
| //###################################################################################################################################################
 | ||||
|     s_warning_texture.reset(); | ||||
| //    s_warning_texture.reset_texture();
 | ||||
| //###################################################################################################################################################
 | ||||
| } | ||||
| 
 | ||||
| //###################################################################################################################################################
 | ||||
| unsigned int _3DScene::get_warning_texture_id() | ||||
| { | ||||
|     return s_warning_texture.get_id(); | ||||
|  | @ -2542,10 +2263,4 @@ int _3DScene::get_warning_texture_height() | |||
|     return s_warning_texture.get_height(); | ||||
| } | ||||
| 
 | ||||
| //unsigned int _3DScene::finalize_warning_texture()
 | ||||
| //{
 | ||||
| //    return s_warning_texture.finalize();
 | ||||
| //}
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
| } // namespace Slic3r
 | ||||
|  |  | |||
|  | @ -8,9 +8,7 @@ | |||
| #include "../../libslic3r/Utils.hpp" | ||||
| #include "../../libslic3r/Model.hpp" | ||||
| #include "../../slic3r/GUI/GLCanvas3DManager.hpp" | ||||
| //#################################################################################################################################
 | ||||
| #include "../../slic3r/GUI/GLTexture.hpp" | ||||
| //#################################################################################################################################
 | ||||
| 
 | ||||
| class wxBitmap; | ||||
| class wxWindow; | ||||
|  | @ -203,16 +201,10 @@ private: | |||
|     } | ||||
| }; | ||||
| 
 | ||||
| //########################################################################################################################################3
 | ||||
| class LayersTexture | ||||
| //class GLTexture
 | ||||
| //########################################################################################################################################3
 | ||||
| { | ||||
| public: | ||||
| //########################################################################################################################################3
 | ||||
|     LayersTexture() : width(0), height(0), levels(0), cells(0) {} | ||||
| //    GLTexture() : width(0), height(0), levels(0), cells(0) {}
 | ||||
| //########################################################################################################################################3
 | ||||
| 
 | ||||
|     // Texture data
 | ||||
|     std::vector<char>   data; | ||||
|  | @ -351,10 +343,7 @@ public: | |||
|     void                release_geometry() { this->indexed_vertex_array.release_geometry(); } | ||||
| 
 | ||||
|     /************************************************ Layer height texture ****************************************************/ | ||||
| //########################################################################################################################################3
 | ||||
|     std::shared_ptr<LayersTexture>  layer_height_texture; | ||||
| //    std::shared_ptr<GLTexture>  layer_height_texture;
 | ||||
| //########################################################################################################################################3
 | ||||
|     // Data to render this volume using the layer height texture
 | ||||
|     LayerHeightTextureData layer_height_texture_data; | ||||
| 
 | ||||
|  | @ -452,36 +441,6 @@ private: | |||
| 
 | ||||
| class _3DScene | ||||
| { | ||||
| //###################################################################################################################################################
 | ||||
| //    class TextureBase
 | ||||
| //    {
 | ||||
| //    protected:
 | ||||
| //        unsigned int m_tex_id;
 | ||||
| //        unsigned int m_tex_width;
 | ||||
| //        unsigned int m_tex_height;
 | ||||
| //
 | ||||
| //        // generate() fills in m_data with the pixels, while finalize() moves the data to the GPU before rendering.
 | ||||
| //        std::vector<unsigned char> m_data;
 | ||||
| //
 | ||||
| //    public:
 | ||||
| //        TextureBase() : m_tex_id(0), m_tex_width(0), m_tex_height(0) {}
 | ||||
| //        virtual ~TextureBase() { _destroy_texture(); }
 | ||||
| //
 | ||||
| //        // If not loaded, load the texture data into the GPU. Return a texture ID or 0 if the texture has zero size.
 | ||||
| //        unsigned int finalize();
 | ||||
| //
 | ||||
| //        unsigned int get_texture_id() const { return m_tex_id; }
 | ||||
| //        unsigned int get_texture_width() const { return m_tex_width; }
 | ||||
| //        unsigned int get_texture_height() const { return m_tex_height; }
 | ||||
| //
 | ||||
| //        void reset_texture() { _destroy_texture(); }
 | ||||
| //
 | ||||
| //    private:
 | ||||
| //        void _destroy_texture();
 | ||||
| //    };
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
| //###################################################################################################################################################
 | ||||
|     class WarningTexture : public GUI::GLTexture | ||||
|     { | ||||
|         static const unsigned char Background_Color[3]; | ||||
|  | @ -491,20 +450,6 @@ class _3DScene | |||
|         bool generate(const std::string& msg); | ||||
|     }; | ||||
| 
 | ||||
| //    class WarningTexture : public TextureBase
 | ||||
| //    {
 | ||||
| //        static const unsigned char Background_Color[3];
 | ||||
| //        static const unsigned char Opacity;
 | ||||
| //
 | ||||
| //    public:
 | ||||
| //        WarningTexture() : TextureBase() {}
 | ||||
| //
 | ||||
| //        // Generate a texture data, but don't load it into the GPU yet, as the glcontext may not be valid yet.
 | ||||
| //        bool generate(const std::string& msg);
 | ||||
| //    };
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
| //###################################################################################################################################################
 | ||||
|     class LegendTexture : public GUI::GLTexture | ||||
|     { | ||||
|         static const int Px_Title_Offset = 5; | ||||
|  | @ -520,25 +465,6 @@ class _3DScene | |||
|         bool generate(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors); | ||||
|     }; | ||||
|      | ||||
| //    class LegendTexture : public TextureBase
 | ||||
| //    {
 | ||||
| //        static const unsigned int Px_Title_Offset = 5;
 | ||||
| //        static const unsigned int Px_Text_Offset = 5;
 | ||||
| //        static const unsigned int Px_Square = 20;
 | ||||
| //        static const unsigned int Px_Square_Contour = 1;
 | ||||
| //        static const unsigned int Px_Border = Px_Square / 2;
 | ||||
| //        static const unsigned char Squares_Border_Color[3];
 | ||||
| //        static const unsigned char Background_Color[3];
 | ||||
| //        static const unsigned char Opacity;
 | ||||
| //
 | ||||
| //    public:
 | ||||
| //        LegendTexture() : TextureBase() {}
 | ||||
| //
 | ||||
| //        // Generate a texture data, but don't load it into the GPU yet, as the glcontext may not be valid yet.
 | ||||
| //        bool generate(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors);
 | ||||
| //    };
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
|     static LegendTexture s_legend_texture; | ||||
|     static WarningTexture s_warning_texture; | ||||
|     static GUI::GLCanvas3DManager s_canvas_mgr; | ||||
|  | @ -644,33 +570,19 @@ public: | |||
| 
 | ||||
|     // generates the legend texture in dependence of the current shown view type
 | ||||
|     static void generate_legend_texture(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors); | ||||
| //###################################################################################################################################################
 | ||||
| //    static unsigned int get_legend_texture_width();
 | ||||
| //    static unsigned int get_legend_texture_height();
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
|     static void reset_legend_texture(); | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
|     static unsigned int get_legend_texture_id(); | ||||
|     static int get_legend_texture_width(); | ||||
|     static int get_legend_texture_height(); | ||||
| //    static unsigned int finalize_legend_texture();
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
| //###################################################################################################################################################
 | ||||
| //    static unsigned int get_warning_texture_width();
 | ||||
| //    static unsigned int get_warning_texture_height();
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
|     // generates a warning texture containing the given message
 | ||||
|     static void generate_warning_texture(const std::string& msg); | ||||
|     static void reset_warning_texture(); | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
|     static unsigned int get_warning_texture_id(); | ||||
|     static int get_warning_texture_width(); | ||||
|     static int get_warning_texture_height(); | ||||
| //    static unsigned int finalize_warning_texture();
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
|     static void thick_lines_to_verts(const Lines& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, double top_z, GLVolume& volume); | ||||
|     static void thick_lines_to_verts(const Lines3& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, GLVolume& volume); | ||||
|  |  | |||
|  | @ -3594,7 +3594,7 @@ void GLCanvas3D::_render_warning_texture() const | |||
|         return; | ||||
| 
 | ||||
|     // If the warning texture has not been loaded into the GPU, do it now.
 | ||||
|     unsigned int tex_id = _3DScene::finalize_warning_texture(); | ||||
|     unsigned int tex_id = _3DScene::get_warning_texture_id(); | ||||
|     if (tex_id > 0) | ||||
|     { | ||||
|         unsigned int w = _3DScene::get_warning_texture_width(); | ||||
|  | @ -3627,7 +3627,7 @@ void GLCanvas3D::_render_legend_texture() const | |||
|         return; | ||||
| 
 | ||||
|     // If the legend texture has not been loaded into the GPU, do it now.
 | ||||
|     unsigned int tex_id = _3DScene::finalize_legend_texture(); | ||||
|     unsigned int tex_id = _3DScene::get_legend_texture_id(); | ||||
|     if (tex_id > 0) | ||||
|     { | ||||
|         unsigned int w = _3DScene::get_legend_texture_width(); | ||||
|  |  | |||
|  | @ -10,10 +10,7 @@ namespace GUI { | |||
| 
 | ||||
|     class GLTexture | ||||
|     { | ||||
| //###################################################################################################################################################
 | ||||
|     protected: | ||||
| //    private:
 | ||||
| //###################################################################################################################################################
 | ||||
|         unsigned int m_id; | ||||
|         int m_width; | ||||
|         int m_height; | ||||
|  | @ -21,10 +18,7 @@ namespace GUI { | |||
| 
 | ||||
|     public: | ||||
|         GLTexture(); | ||||
| //###################################################################################################################################################
 | ||||
|         virtual ~GLTexture(); | ||||
| //        ~GLTexture();
 | ||||
| //###################################################################################################################################################
 | ||||
| 
 | ||||
|         bool load_from_file(const std::string& filename, bool generate_mipmaps); | ||||
|         void reset(); | ||||
|  | @ -37,10 +31,7 @@ namespace GUI { | |||
| 
 | ||||
|         static void render_texture(unsigned int tex_id, float left, float right, float bottom, float top); | ||||
| 
 | ||||
| //###################################################################################################################################################
 | ||||
|     protected: | ||||
| //    private:
 | ||||
| //###################################################################################################################################################
 | ||||
|         void _generate_mipmaps(wxImage& image); | ||||
|     }; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri