#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/TextureImportDialog.hpp>
Public Types | |
| enum class | RenderMode { Original , MultiColor , FilamentMap } |
Public Member Functions | |
| TexturePreviewCanvas (wxWindow *parent, const wxGLAttributes &attrs) | |
| ~TexturePreviewCanvas () | |
| void | set_mesh_data (const std::vector< std::array< float, 3 > > &vertices, const std::vector< std::array< int, 3 > > &indices) |
| void | set_texture_data (const std::vector< std::array< float, 2 > > &uvs, const unsigned char *tex_data, int tex_w, int tex_h, int tex_channels) |
| void | set_texture_render_data (const std::vector< std::vector< unsigned char > > &tex_pixels_rgb, const std::vector< int > &tex_widths, const std::vector< int > &tex_heights, const std::vector< std::array< std::array< float, 2 >, 3 > > &face_uvs, const std::vector< int > &face_tex_ids) |
| void | set_painted_mesh_data (const std::vector< std::array< float, 3 > > &vertices, const std::vector< std::array< int, 3 > > &indices) |
| void | set_face_colors (const std::vector< std::array< std::size_t, 3 > > &face_colors) |
| void | set_original_face_colors (const std::vector< std::array< std::size_t, 3 > > &face_colors) |
| void | set_filament_color_map (const std::map< std::array< std::size_t, 3 >, std::array< float, 3 > > &color_map) |
| void | set_render_mode (RenderMode mode) |
| RenderMode | get_render_mode () const |
| void | set_computing_overlay (bool show) |
| void | reset_view () |
Private Types | |
| enum class | DragMode { None , Rotate , Pan } |
Private Member Functions | |
| void | on_paint (wxPaintEvent &evt) |
| void | on_size (wxSizeEvent &evt) |
| void | on_mouse (wxMouseEvent &evt) |
| void | ensure_gl_ready () |
| void | render () |
| void | render_mesh () |
| void | render_textured_original () |
| void | render_reset_overlay (const wxSize &logical_size, const wxSize &viewport_size) |
| void | upload_reset_icon_textures () |
| unsigned int | upload_reset_icon_texture (const std::string &icon_name) |
| wxRect | reset_overlay_rect () const |
| bool | handle_reset_overlay_mouse (wxMouseEvent &evt) |
| void | upload_textures () |
| void | compute_smooth_normals () |
| void | update_bounding_box () |
Private Attributes | |
| wxGLContext * | m_context = nullptr |
| bool | m_gl_initialized = false |
| RenderMode | m_mode = RenderMode::Original |
| float | m_zoom = 1.0f |
| float | m_rot_x = -30.0f |
| float | m_rot_y = 30.0f |
| float | m_pan_x = 0.0f |
| float | m_pan_y = 0.0f |
| wxPoint | m_last_mouse_pos |
| DragMode | m_drag_mode = DragMode::None |
| std::vector< std::array< float, 3 > > | m_vertices |
| std::vector< std::array< int, 3 > > | m_indices |
| std::vector< std::array< float, 2 > > | m_uvs |
| std::vector< std::array< float, 3 > > | m_painted_vertices |
| std::vector< std::array< int, 3 > > | m_painted_indices |
| std::vector< std::array< float, 3 > > | m_face_colors_rgb |
| std::vector< std::array< float, 3 > > | m_original_face_colors_rgb |
| std::vector< std::array< float, 3 > > | m_filament_colors_rgb |
| std::map< std::array< std::size_t, 3 >, std::array< float, 3 > > | m_color_map |
| unsigned int | m_tex_id = 0 |
| int | m_tex_w = 0 |
| int | m_tex_h = 0 |
| int | m_tex_channels = 3 |
| bool | m_tex_dirty = false |
| std::vector< unsigned char > | m_tex_data |
| std::vector< unsigned int > | m_gl_tex_ids |
| std::vector< std::vector< unsigned char > > | m_tex_pixels_rgb |
| std::vector< int > | m_tex_widths |
| std::vector< int > | m_tex_heights |
| std::vector< std::array< std::array< float, 2 >, 3 > > | m_face_uvs |
| std::vector< int > | m_face_tex_ids |
| bool | m_multi_tex_dirty = false |
| std::vector< std::array< float, 3 > > | m_vertex_normals |
| std::array< float, 3 > | m_center = {0, 0, 0} |
| float | m_radius = 1.0f |
| unsigned int | m_reset_icon_tex = 0 |
| unsigned int | m_reset_icon_hover_tex = 0 |
| unsigned int | m_reset_icon_dark_tex = 0 |
| unsigned int | m_reset_icon_dark_hover_tex = 0 |
| bool | m_reset_overlay_hovered = false |
| bool | m_reset_overlay_pressed = false |
|
strongprivate |
| Enumerator | |
|---|---|
| None | |
| Rotate | |
| Pan | |
|
strong |
| Slic3r::GUI::TexturePreviewCanvas::TexturePreviewCanvas | ( | wxWindow * | parent, |
| const wxGLAttributes & | attrs ) |
References m_context, m_drag_mode, m_reset_overlay_pressed, None, on_mouse(), on_paint(), and on_size().
| Slic3r::GUI::TexturePreviewCanvas::~TexturePreviewCanvas | ( | ) |
References glDeleteTextures, m_context, m_gl_tex_ids, m_reset_icon_dark_hover_tex, m_reset_icon_dark_tex, m_reset_icon_hover_tex, m_reset_icon_tex, and m_tex_id.
|
private |
References m_indices, m_vertex_normals, and m_vertices.
Referenced by set_mesh_data().
|
private |
References GL_AMBIENT, GL_AMBIENT_AND_DIFFUSE, GL_COLOR_MATERIAL, GL_DEPTH_TEST, GL_DIFFUSE, GL_FRONT_AND_BACK, GL_LIGHT0, GL_LIGHTING, GL_NO_ERROR, GL_POSITION, glColorMaterial, glEnable, glGetError, glGetString, glLightfv, and m_gl_initialized.
Referenced by on_paint().
|
inline |
References m_mode.
|
private |
References m_drag_mode, m_reset_overlay_hovered, m_reset_overlay_pressed, None, reset_overlay_rect(), reset_view(), and Slic3r::GUI::wxMouseEvent.
Referenced by on_mouse().
|
private |
References handle_reset_overlay_mouse(), m_drag_mode, m_last_mouse_pos, m_pan_x, m_pan_y, m_radius, m_rot_x, m_rot_y, m_zoom, None, Pan, Rotate, and Slic3r::GUI::wxMouseEvent.
Referenced by TexturePreviewCanvas().
|
private |
References ensure_gl_ready(), m_context, and render().
Referenced by TexturePreviewCanvas().
|
private |
Referenced by TexturePreviewCanvas().
|
private |
References StateColor::darkModeColorFor(), Slic3r::Geometry::dist(), Slic3r::f(), GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_MODELVIEW, GL_PROJECTION, gl_viewport_size(), glClear, glClearColor, glLoadIdentity, glMatrixMode, glMultMatrixf, glRotatef, glTranslatef, glViewport, m_center, m_pan_x, m_pan_y, M_PI, m_radius, m_rot_x, m_rot_y, m_zoom, render_mesh(), and render_reset_overlay().
Referenced by on_paint().
|
private |
References FilamentMap, GL_LIGHTING, GL_TEXTURE_2D, GL_TRIANGLES, glBegin, glColor3f, glColor3fv, glDisable, glEnable, glEnd, glNormal3f, glNormal3fv, glVertex3fv, m_face_colors_rgb, m_face_uvs, m_filament_colors_rgb, m_indices, m_mode, m_original_face_colors_rgb, m_painted_indices, m_painted_vertices, m_vertex_normals, m_vertices, Original, and render_textured_original().
Referenced by render().
|
private |
References GL_BLEND, GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_DEPTH_TEST, GL_ENABLE_BIT, GL_LIGHTING, GL_MODELVIEW, GL_MODULATE, GL_ONE_MINUS_SRC_ALPHA, GL_PROJECTION, GL_QUADS, GL_SRC_ALPHA, GL_TEXTURE_2D, GL_TEXTURE_BIT, GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, glBegin, glBindTexture, glBlendFunc, glColor4f, glDisable, glEnable, glEnd, glLoadIdentity, glMatrixMode, glOrtho, glPopAttrib, glPopMatrix, glPushAttrib, glPushMatrix, glTexCoord2f, glTexEnvi, glVertex2f, is_dark(), m_reset_icon_dark_hover_tex, m_reset_icon_dark_tex, m_reset_icon_hover_tex, m_reset_icon_tex, m_reset_overlay_hovered, reset_overlay_rect(), and upload_reset_icon_textures().
Referenced by render().
|
private |
References GL_LIGHTING, GL_TEXTURE_2D, GL_TRIANGLES, glBegin, glBindTexture, glColor3f, glColor3fv, glDisable, glEnable, glEnd, glNormal3f, glNormal3fv, glTexCoord2fv, glVertex3fv, m_face_tex_ids, m_face_uvs, m_gl_tex_ids, m_indices, m_original_face_colors_rgb, m_vertex_normals, m_vertices, and upload_textures().
Referenced by render_mesh().
|
private |
Referenced by handle_reset_overlay_mouse(), and render_reset_overlay().
| void Slic3r::GUI::TexturePreviewCanvas::reset_view | ( | ) |
| void Slic3r::GUI::TexturePreviewCanvas::set_computing_overlay | ( | bool | show | ) |
| void Slic3r::GUI::TexturePreviewCanvas::set_face_colors | ( | const std::vector< std::array< std::size_t, 3 > > & | face_colors | ) |
References Slic3r::GUI::convert_face_colors(), and m_face_colors_rgb.
| void Slic3r::GUI::TexturePreviewCanvas::set_filament_color_map | ( | const std::map< std::array< std::size_t, 3 >, std::array< float, 3 > > & | color_map | ) |
References m_color_map, m_face_colors_rgb, and m_filament_colors_rgb.
| void Slic3r::GUI::TexturePreviewCanvas::set_mesh_data | ( | const std::vector< std::array< float, 3 > > & | vertices, |
| const std::vector< std::array< int, 3 > > & | indices ) |
References compute_smooth_normals(), m_indices, m_vertices, and update_bounding_box().
| void Slic3r::GUI::TexturePreviewCanvas::set_original_face_colors | ( | const std::vector< std::array< std::size_t, 3 > > & | face_colors | ) |
References Slic3r::GUI::convert_face_colors(), and m_original_face_colors_rgb.
| void Slic3r::GUI::TexturePreviewCanvas::set_painted_mesh_data | ( | const std::vector< std::array< float, 3 > > & | vertices, |
| const std::vector< std::array< int, 3 > > & | indices ) |
References m_painted_indices, and m_painted_vertices.
| void Slic3r::GUI::TexturePreviewCanvas::set_render_mode | ( | RenderMode | mode | ) |
| void Slic3r::GUI::TexturePreviewCanvas::set_texture_data | ( | const std::vector< std::array< float, 2 > > & | uvs, |
| const unsigned char * | tex_data, | ||
| int | tex_w, | ||
| int | tex_h, | ||
| int | tex_channels ) |
References m_tex_channels, m_tex_data, m_tex_dirty, m_tex_h, m_tex_w, and m_uvs.
| void Slic3r::GUI::TexturePreviewCanvas::set_texture_render_data | ( | const std::vector< std::vector< unsigned char > > & | tex_pixels_rgb, |
| const std::vector< int > & | tex_widths, | ||
| const std::vector< int > & | tex_heights, | ||
| const std::vector< std::array< std::array< float, 2 >, 3 > > & | face_uvs, | ||
| const std::vector< int > & | face_tex_ids ) |
References m_face_tex_ids, m_face_uvs, m_multi_tex_dirty, m_tex_heights, m_tex_pixels_rgb, and m_tex_widths.
|
private |
References m_center, m_radius, and m_vertices.
Referenced by set_mesh_data().
|
private |
References create_scaled_bitmap(), GL_CLAMP_TO_EDGE, GL_LINEAR, GL_RGBA, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_UNPACK_ALIGNMENT, GL_UNSIGNED_BYTE, glBindTexture, glGenTextures, glPixelStorei, glTexImage2D, and glTexParameteri.
Referenced by upload_reset_icon_textures().
|
private |
References m_reset_icon_dark_hover_tex, m_reset_icon_dark_tex, m_reset_icon_hover_tex, m_reset_icon_tex, and upload_reset_icon_texture().
Referenced by render_reset_overlay().
|
private |
References Slic3r::empty(), GL_LINEAR, GL_REPEAT, GL_RGB, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_UNSIGNED_BYTE, glBindTexture, glDeleteTextures, glGenTextures, glTexImage2D, glTexParameteri, m_gl_tex_ids, m_multi_tex_dirty, m_tex_heights, m_tex_pixels_rgb, and m_tex_widths.
Referenced by render_textured_original().
|
private |
Referenced by render(), and update_bounding_box().
|
private |
Referenced by set_filament_color_map().
|
private |
Referenced by TexturePreviewCanvas(), ~TexturePreviewCanvas(), and on_paint().
|
private |
Referenced by TexturePreviewCanvas(), handle_reset_overlay_mouse(), and on_mouse().
|
private |
Referenced by render_mesh(), set_face_colors(), and set_filament_color_map().
|
private |
Referenced by render_textured_original(), and set_texture_render_data().
|
private |
Referenced by render_mesh(), render_textured_original(), and set_texture_render_data().
|
private |
Referenced by render_mesh(), and set_filament_color_map().
|
private |
Referenced by ensure_gl_ready().
|
private |
Referenced by ~TexturePreviewCanvas(), render_textured_original(), and upload_textures().
|
private |
Referenced by compute_smooth_normals(), render_mesh(), render_textured_original(), and set_mesh_data().
|
private |
Referenced by on_mouse().
|
private |
Referenced by get_render_mode(), render_mesh(), and set_render_mode().
|
private |
Referenced by set_texture_render_data(), and upload_textures().
|
private |
Referenced by render_mesh(), render_textured_original(), and set_original_face_colors().
|
private |
Referenced by render_mesh(), and set_painted_mesh_data().
|
private |
Referenced by render_mesh(), and set_painted_mesh_data().
|
private |
Referenced by on_mouse(), render(), and reset_view().
|
private |
Referenced by on_mouse(), render(), and reset_view().
|
private |
Referenced by on_mouse(), render(), and update_bounding_box().
|
private |
Referenced by ~TexturePreviewCanvas(), render_reset_overlay(), and upload_reset_icon_textures().
|
private |
Referenced by ~TexturePreviewCanvas(), render_reset_overlay(), and upload_reset_icon_textures().
|
private |
Referenced by ~TexturePreviewCanvas(), render_reset_overlay(), and upload_reset_icon_textures().
|
private |
Referenced by ~TexturePreviewCanvas(), render_reset_overlay(), and upload_reset_icon_textures().
|
private |
Referenced by handle_reset_overlay_mouse(), and render_reset_overlay().
|
private |
Referenced by TexturePreviewCanvas(), and handle_reset_overlay_mouse().
|
private |
Referenced by on_mouse(), render(), and reset_view().
|
private |
Referenced by on_mouse(), render(), and reset_view().
|
private |
Referenced by set_texture_data().
|
private |
Referenced by set_texture_data().
|
private |
Referenced by set_texture_data().
|
private |
Referenced by set_texture_data().
|
private |
Referenced by set_texture_render_data(), and upload_textures().
|
private |
Referenced by ~TexturePreviewCanvas().
|
private |
Referenced by set_texture_render_data(), and upload_textures().
|
private |
Referenced by set_texture_data().
|
private |
Referenced by set_texture_render_data(), and upload_textures().
|
private |
Referenced by set_texture_data().
|
private |
Referenced by compute_smooth_normals(), render_mesh(), and render_textured_original().
|
private |
Referenced by compute_smooth_normals(), render_mesh(), render_textured_original(), set_mesh_data(), and update_bounding_box().
|
private |
Referenced by on_mouse(), render(), and reset_view().