Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::GLVolume Class Reference

#include <src/slic3r/GUI/3DScene.hpp>

+ Collaboration diagram for Slic3r::GLVolume:

Classes

struct  CompositeID
 
class  NonManifoldEdges
 
class  SinkingContours
 

Public Types

enum  EHoverState : unsigned char { HS_None , HS_Hover , HS_Select , HS_Deselect }
 

Public Member Functions

 GLVolume (float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f)
 
 GLVolume (const ColorRGBA &color)
 
BoundingBoxf3 bounding_box () const
 
void set_color (const ColorRGBA &rgba)
 
void set_render_color (const ColorRGBA &rgba)
 
void set_render_color (bool force_transparent)
 
void set_color_from_model_volume (const ModelVolume &model_volume)
 
const Geometry::Transformationget_instance_transformation () const
 
void set_instance_transformation (const Geometry::Transformation &transformation)
 
void set_instance_transformation (const Transform3d &transform)
 
Vec3d get_instance_offset () const
 
double get_instance_offset (Axis axis) const
 
void set_instance_offset (const Vec3d &offset)
 
void set_instance_offset (Axis axis, double offset)
 
Vec3d get_instance_rotation () const
 
double get_instance_rotation (Axis axis) const
 
void set_instance_rotation (const Vec3d &rotation)
 
void set_instance_rotation (Axis axis, double rotation)
 
Vec3d get_instance_scaling_factor () const
 
double get_instance_scaling_factor (Axis axis) const
 
void set_instance_scaling_factor (const Vec3d &scaling_factor)
 
void set_instance_scaling_factor (Axis axis, double scaling_factor)
 
Vec3d get_instance_mirror () const
 
double get_instance_mirror (Axis axis) const
 
void set_instance_mirror (const Vec3d &mirror)
 
void set_instance_mirror (Axis axis, double mirror)
 
const Geometry::Transformationget_volume_transformation () const
 
void set_volume_transformation (const Geometry::Transformation &transformation)
 
void set_volume_transformation (const Transform3d &transform)
 
Vec3d get_volume_offset () const
 
double get_volume_offset (Axis axis) const
 
void set_volume_offset (const Vec3d &offset)
 
void set_volume_offset (Axis axis, double offset)
 
Vec3d get_volume_rotation () const
 
double get_volume_rotation (Axis axis) const
 
void set_volume_rotation (const Vec3d &rotation)
 
void set_volume_rotation (Axis axis, double rotation)
 
Vec3d get_volume_scaling_factor () const
 
double get_volume_scaling_factor (Axis axis) const
 
void set_volume_scaling_factor (const Vec3d &scaling_factor)
 
void set_volume_scaling_factor (Axis axis, double scaling_factor)
 
Vec3d get_volume_mirror () const
 
double get_volume_mirror (Axis axis) const
 
void set_volume_mirror (const Vec3d &mirror)
 
void set_volume_mirror (Axis axis, double mirror)
 
double get_sla_shift_z () const
 
void set_sla_shift_z (double z)
 
void set_convex_hull (std::shared_ptr< const TriangleMesh > convex_hull)
 
void set_convex_hull (const TriangleMesh &convex_hull)
 
void set_convex_hull (TriangleMesh &&convex_hull)
 
int object_idx () const
 
int volume_idx () const
 
int instance_idx () const
 
Transform3d world_matrix () const
 
bool is_left_handed () const
 
const BoundingBoxf3transformed_bounding_box () const
 
BoundingBoxf3 transformed_convex_hull_bounding_box (const Transform3d &trafo) const
 
const BoundingBoxf3transformed_convex_hull_bounding_box () const
 
BoundingBoxf3 transformed_non_sinking_bounding_box (const Transform3d &trafo) const
 
const BoundingBoxf3transformed_non_sinking_bounding_box () const
 
const TriangleMeshconvex_hull () const
 
bool empty () const
 
void set_range (double low, double high)
 
void render ()
 
void set_bounding_boxes_as_dirty ()
 
bool is_sla_support () const
 
bool is_sla_pad () const
 
bool is_sinking () const
 
bool is_below_printbed () const
 
void render_sinking_contours ()
 
void render_non_manifold_edges ()
 
size_t cpu_memory_used () const
 
size_t gpu_memory_used () const
 
size_t total_memory_used () const
 

Public Attributes

ColorRGBA color
 
ColorRGBA render_color
 
CompositeID composite_id
 
std::pair< size_t, size_t > geometry_id
 
int extruder_id
 
struct { 
 
bool selected: 1
 
bool disabled: 1
 
bool printable: 1
 
bool is_active: 1
 
bool zoom_to_volumes: 1
 
bool shader_outside_printer_detection_enabled: 1
 
bool is_outside: 1
 
bool is_modifier: 1
 
bool is_wipe_tower: 1
 
bool is_extrusion_path: 1
 
bool force_native_color: 1
 
bool force_neutral_color: 1
 
bool force_sinking_contours: 1
 
};  
 
EHoverState hover
 
GUI::GLModel model
 
std::unique_ptr< GUI::MeshRaycastermesh_raycaster
 
std::pair< size_t, size_t > tverts_range
 
std::vector< coordf_tprint_zs
 
std::vector< size_t > offsets
 

Static Public Attributes

static const ColorRGBA SELECTED_COLOR = ColorRGBA::GREEN()
 
static const ColorRGBA HOVER_SELECT_COLOR = { 0.4f, 0.9f, 0.1f, 1.0f }
 
static const ColorRGBA HOVER_DESELECT_COLOR = { 1.0f, 0.75f, 0.75f, 1.0f }
 
static const ColorRGBA OUTSIDE_COLOR = { 0.0f, 0.38f, 0.8f, 1.0f }
 
static const ColorRGBA SELECTED_OUTSIDE_COLOR = { 0.19f, 0.58f, 1.0f, 1.0f }
 
static const ColorRGBA DISABLED_COLOR = ColorRGBA::DARK_GRAY()
 
static const ColorRGBA SLA_SUPPORT_COLOR = ColorRGBA::LIGHT_GRAY()
 
static const ColorRGBA SLA_PAD_COLOR = { 0.0f, 0.2f, 0.0f, 1.0f }
 
static const ColorRGBA NEUTRAL_COLOR = { 0.9f, 0.9f, 0.9f, 1.0f }
 
static const std::array< ColorRGBA, 4 > MODEL_COLOR
 

Private Attributes

Geometry::Transformation m_instance_transformation
 
Geometry::Transformation m_volume_transformation
 
double m_sla_shift_z
 
std::optional< BoundingBoxf3m_transformed_bounding_box
 
std::shared_ptr< const TriangleMeshm_convex_hull
 
std::optional< BoundingBoxf3m_transformed_convex_hull_bounding_box
 
std::optional< BoundingBoxf3m_transformed_non_sinking_bounding_box
 
SinkingContours m_sinking_contours
 
NonManifoldEdges m_non_manifold_edges
 

Detailed Description

Member Enumeration Documentation

◆ EHoverState

enum Slic3r::GLVolume::EHoverState : unsigned char
Enumerator
HS_None 
HS_Hover 
HS_Select 
HS_Deselect 
64 {
65 HS_None,
69 };
@ HS_Select
Definition 3DScene.hpp:67
@ HS_None
Definition 3DScene.hpp:65
@ HS_Hover
Definition 3DScene.hpp:66
@ HS_Deselect
Definition 3DScene.hpp:68

Constructor & Destructor Documentation

◆ GLVolume() [1/2]

Slic3r::GLVolume::GLVolume ( float  r = 1.0f,
float  g = 1.0f,
float  b = 1.0f,
float  a = 1.0f 
)
215 : m_sla_shift_z(0.0)
216 , m_sinking_contours(*this)
217 , m_non_manifold_edges(*this)
218 // geometry_id == 0 -> invalid
219 , geometry_id(std::pair<size_t, size_t>(0, 0))
220 , extruder_id(0)
221 , selected(false)
222 , disabled(false)
223 , printable(true)
224 , is_active(true)
225 , zoom_to_volumes(true)
226 , shader_outside_printer_detection_enabled(false)
227 , is_outside(false)
228 , hover(HS_None)
229 , is_modifier(false)
230 , is_wipe_tower(false)
231 , is_extrusion_path(false)
232 , force_native_color(false)
233 , force_neutral_color(false)
234 , force_sinking_contours(false)
235 , tverts_range(0, size_t(-1))
236{
237 color = { r, g, b, a };
239}
double m_sla_shift_z
Definition 3DScene.hpp:79
std::pair< size_t, size_t > geometry_id
Definition 3DScene.hpp:152
EHoverState hover
Definition 3DScene.hpp:187
ColorRGBA color
Definition 3DScene.hpp:126
std::pair< size_t, size_t > tverts_range
Definition 3DScene.hpp:193
void set_render_color(const ColorRGBA &rgba)
Definition 3DScene.hpp:207
int extruder_id
Definition 3DScene.hpp:154
SinkingContours m_sinking_contours
Definition 3DScene.hpp:105
NonManifoldEdges m_non_manifold_edges
Definition 3DScene.hpp:122

References color, and set_render_color().

+ Here is the call graph for this function:

◆ GLVolume() [2/2]

Slic3r::GLVolume::GLVolume ( const ColorRGBA color)
inline
72: GLVolume(color.r(), color.g(), color.b(), color.a()) {}
float a() const
Definition Color.hpp:97
float b() const
Definition Color.hpp:96
float r() const
Definition Color.hpp:94
float g() const
Definition Color.hpp:95
GLVolume(float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f)
Definition 3DScene.cpp:214

Member Function Documentation

◆ bounding_box()

BoundingBoxf3 Slic3r::GLVolume::bounding_box ( ) const
inline
202 {
203 return this->model.get_bounding_box();
204 }
GUI::GLModel model
Definition 3DScene.hpp:189
const BoundingBoxf3 & get_bounding_box() const
Definition GLModel.hpp:245

References Slic3r::GUI::GLModel::get_bounding_box().

Referenced by Slic3r::GUI::Selection::render_synchronized_volumes(), transformed_bounding_box(), and transformed_convex_hull_bounding_box().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convex_hull()

const TriangleMesh * Slic3r::GLVolume::convex_hull ( ) const
inline
293{ return m_convex_hull.get(); }
std::shared_ptr< const TriangleMesh > m_convex_hull
Definition 3DScene.hpp:83

References m_convex_hull.

Referenced by Slic3r::GUI::Selection::get_bounding_box_in_reference_system(), Slic3r::GUI::Selection::scale_to_fit_print_volume(), set_convex_hull(), set_convex_hull(), and set_convex_hull().

+ Here is the caller graph for this function:

◆ cpu_memory_used()

size_t Slic3r::GLVolume::cpu_memory_used ( ) const
inline
316 {
317 return sizeof(*this) + this->model.cpu_memory_used() + this->print_zs.capacity() * sizeof(coordf_t) +
318 this->offsets.capacity() * sizeof(size_t);
319 }
std::vector< coordf_t > print_zs
Definition 3DScene.hpp:197
std::vector< size_t > offsets
Definition 3DScene.hpp:199
size_t cpu_memory_used() const
Definition GLModel.hpp:252
double coordf_t
Definition GUI_ObjectList.hpp:36

References Slic3r::GUI::GLModel::cpu_memory_used().

Referenced by total_memory_used().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty()

bool Slic3r::GLVolume::empty ( ) const
inline
295{ return this->model.is_empty(); }
bool is_empty() const
Definition GLModel.hpp:243

References Slic3r::GUI::GLModel::is_empty().

+ Here is the call graph for this function:

◆ get_instance_mirror() [1/2]

Vec3d Slic3r::GLVolume::get_instance_mirror ( ) const
inline
Geometry::Transformation m_instance_transformation
Definition 3DScene.hpp:75
Vec3d get_mirror() const
Definition Geometry.cpp:522

References Slic3r::Geometry::Transformation::get_mirror(), and m_instance_transformation.

+ Here is the call graph for this function:

◆ get_instance_mirror() [2/2]

double Slic3r::GLVolume::get_instance_mirror ( Axis  axis) const
inline

References Slic3r::Geometry::Transformation::get_mirror(), and m_instance_transformation.

+ Here is the call graph for this function:

◆ get_instance_offset() [1/2]

Vec3d Slic3r::GLVolume::get_instance_offset ( ) const
inline
Vec3d get_offset() const
Definition Geometry.hpp:387

References Slic3r::Geometry::Transformation::get_offset(), and m_instance_transformation.

Referenced by Slic3r::GUI::ObjectList::load_generic_subobject(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::GUI::GLGizmoCut3D::process_cut_line(), and Slic3r::GUI::GLGizmoScale3D::update_render_data().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_instance_offset() [2/2]

double Slic3r::GLVolume::get_instance_offset ( Axis  axis) const
inline

References Slic3r::Geometry::Transformation::get_offset(), and m_instance_transformation.

+ Here is the call graph for this function:

◆ get_instance_rotation() [1/2]

Vec3d Slic3r::GLVolume::get_instance_rotation ( ) const
inline
Vec3d get_rotation() const
Definition Geometry.cpp:454

References Slic3r::Geometry::Transformation::get_rotation(), and m_instance_transformation.

+ Here is the call graph for this function:

◆ get_instance_rotation() [2/2]

double Slic3r::GLVolume::get_instance_rotation ( Axis  axis) const
inline

References Slic3r::Geometry::Transformation::get_rotation(), and m_instance_transformation.

+ Here is the call graph for this function:

◆ get_instance_scaling_factor() [1/2]

Vec3d Slic3r::GLVolume::get_instance_scaling_factor ( ) const
inline
Vec3d get_scaling_factor() const
Definition Geometry.cpp:486

References Slic3r::Geometry::Transformation::get_scaling_factor(), and m_instance_transformation.

+ Here is the call graph for this function:

◆ get_instance_scaling_factor() [2/2]

double Slic3r::GLVolume::get_instance_scaling_factor ( Axis  axis) const
inline

References Slic3r::Geometry::Transformation::get_scaling_factor(), and m_instance_transformation.

+ Here is the call graph for this function:

◆ get_instance_transformation()

◆ get_sla_shift_z()

◆ get_volume_mirror() [1/2]

Vec3d Slic3r::GLVolume::get_volume_mirror ( ) const
inline
Geometry::Transformation m_volume_transformation
Definition 3DScene.hpp:76

References Slic3r::Geometry::Transformation::get_mirror(), and m_volume_transformation.

+ Here is the call graph for this function:

◆ get_volume_mirror() [2/2]

double Slic3r::GLVolume::get_volume_mirror ( Axis  axis) const
inline
264{ return m_volume_transformation.get_mirror(axis); }

References Slic3r::Geometry::Transformation::get_mirror(), and m_volume_transformation.

+ Here is the call graph for this function:

◆ get_volume_offset() [1/2]

Vec3d Slic3r::GLVolume::get_volume_offset ( ) const
inline

References Slic3r::Geometry::Transformation::get_offset(), and m_volume_transformation.

Referenced by Slic3r::GUI::GCodeViewer::load_shells().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_volume_offset() [2/2]

double Slic3r::GLVolume::get_volume_offset ( Axis  axis) const
inline
246{ return m_volume_transformation.get_offset(axis); }

References Slic3r::Geometry::Transformation::get_offset(), and m_volume_transformation.

+ Here is the call graph for this function:

◆ get_volume_rotation() [1/2]

Vec3d Slic3r::GLVolume::get_volume_rotation ( ) const
inline

References Slic3r::Geometry::Transformation::get_rotation(), and m_volume_transformation.

+ Here is the call graph for this function:

◆ get_volume_rotation() [2/2]

double Slic3r::GLVolume::get_volume_rotation ( Axis  axis) const
inline

References Slic3r::Geometry::Transformation::get_rotation(), and m_volume_transformation.

+ Here is the call graph for this function:

◆ get_volume_scaling_factor() [1/2]

Vec3d Slic3r::GLVolume::get_volume_scaling_factor ( ) const
inline

References Slic3r::Geometry::Transformation::get_scaling_factor(), and m_volume_transformation.

+ Here is the call graph for this function:

◆ get_volume_scaling_factor() [2/2]

double Slic3r::GLVolume::get_volume_scaling_factor ( Axis  axis) const
inline

References Slic3r::Geometry::Transformation::get_scaling_factor(), and m_volume_transformation.

+ Here is the call graph for this function:

◆ get_volume_transformation()

const Geometry::Transformation & Slic3r::GLVolume::get_volume_transformation ( ) const
inline

◆ gpu_memory_used()

size_t Slic3r::GLVolume::gpu_memory_used ( ) const
inline
321{ return this->model.gpu_memory_used(); }
size_t gpu_memory_used() const
Definition GLModel.hpp:260

References Slic3r::GUI::GLModel::gpu_memory_used().

Referenced by total_memory_used().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ instance_idx()

◆ is_below_printbed()

bool Slic3r::GLVolume::is_below_printbed ( ) const
416{
417 return transformed_convex_hull_bounding_box().max.z() < 0.0;
418}
PointType max
Definition BoundingBox.hpp:17
const BoundingBoxf3 & transformed_convex_hull_bounding_box() const
Definition 3DScene.cpp:320

References Slic3r::BoundingBoxBase< PointType, APointsType >::max, and transformed_convex_hull_bounding_box().

Referenced by set_render_color().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_left_handed()

bool Slic3r::GLVolume::is_left_handed ( ) const
303{
306 return m1.x() * m1.y() * m1.z() * m2.x() * m2.y() * m2.z() < 0.;
307}
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:52

References Slic3r::Geometry::Transformation::get_mirror(), m_instance_transformation, and m_volume_transformation.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_sinking()

bool Slic3r::GLVolume::is_sinking ( ) const
408{
409 if (is_modifier || GUI::wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA)
410 return false;
411 const BoundingBoxf3& box = transformed_convex_hull_bounding_box();
412 return box.min.z() < SINKING_Z_THRESHOLD && box.max.z() >= SINKING_Z_THRESHOLD;
413}
@ ptSLA
Definition Config.hpp:209
static const float SINKING_Z_THRESHOLD
Definition Model.hpp:1409

References Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, Slic3r::ptSLA, Slic3r::SINKING_Z_THRESHOLD, and transformed_convex_hull_bounding_box().

Referenced by Slic3r::GUI::Selection::set_caches().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_sla_pad()

bool Slic3r::GLVolume::is_sla_pad ( ) const
405{ return this->composite_id.volume_id == -int(slaposPad); }
@ slaposPad
Definition SLAPrint.hpp:34
int volume_id
Definition 3DScene.hpp:139

References composite_id, Slic3r::slaposPad, and Slic3r::GLVolume::CompositeID::volume_id.

Referenced by Slic3r::GUI::GLGizmoSlaBase::register_volume_raycasters_for_picking().

+ Here is the caller graph for this function:

◆ is_sla_support()

bool Slic3r::GLVolume::is_sla_support ( ) const
404{ return this->composite_id.volume_id == -int(slaposSupportTree); }
@ slaposSupportTree
Definition SLAPrint.hpp:33

References composite_id, Slic3r::slaposSupportTree, and Slic3r::GLVolume::CompositeID::volume_id.

Referenced by Slic3r::GUI::GLGizmoSlaBase::register_volume_raycasters_for_picking().

+ Here is the caller graph for this function:

◆ object_idx()

int Slic3r::GLVolume::object_idx ( ) const
inline
276{ return this->composite_id.object_id; }
int object_id
Definition 3DScene.hpp:134

References Slic3r::GLVolume::CompositeID::object_id.

Referenced by Slic3r::GUI::GLCanvas3D::_update_selection_from_hover(), Slic3r::GUI::GLCanvas3D::_update_volumes_hover_state(), Slic3r::GUI::MenuFactory::append_menu_item_edit_text(), Slic3r::GUI::GLGizmoEmboss::create_volume(), Slic3r::GUI::Selection::do_remove_instance(), Slic3r::GUI::Selection::do_remove_object(), Slic3r::GUI::Selection::erase(), Slic3r::GUI::Selection::get_bounding_box_in_reference_system(), Slic3r::GUI::get_model_object(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::Selection::get_volume_idxs_from_instance(), Slic3r::GUI::Selection::get_volume_idxs_from_object(), Slic3r::GUI::Selection::get_volume_idxs_from_volume(), Slic3r::GUI::Selection::is_single_full_instance(), Slic3r::GUI::Selection::is_single_text(), Slic3r::GUI::GLCanvas3D::on_mouse(), Slic3r::GUI::processed_objects_idxs(), Slic3r::GUI::reloadable_volumes(), Slic3r::GUI::Selection::remove_volume(), Slic3r::GUI::Selection::render_synchronized_volumes(), Slic3r::GUI::Plater::priv::replace_with_stl(), priv::start_create_volume_on_surface_job(), Slic3r::GUI::Selection::synchronize_unselected_instances(), Slic3r::GUI::Selection::synchronize_unselected_volumes(), transformed_non_sinking_bounding_box(), Slic3r::GUI::Selection::translate(), Slic3r::GLVolume::SinkingContours::update(), Slic3r::GLVolume::NonManifoldEdges::update(), Slic3r::GUI::GLGizmoMeasure::update_if_needed(), Slic3r::GUI::ObjectList::update_selections(), and Slic3r::GUI::Selection::update_type().

+ Here is the caller graph for this function:

◆ render()

void Slic3r::GLVolume::render ( )
381{
382 if (!is_active)
383 return;
384
385 GLShaderProgram* shader = GUI::wxGetApp().get_current_shader();
386 if (shader == nullptr)
387 return;
388
389 const bool is_left_handed = this->is_left_handed();
390
391 if (is_left_handed)
392 glsafe(::glFrontFace(GL_CW));
393 glsafe(::glCullFace(GL_BACK));
394
395 if (tverts_range == std::make_pair<size_t, size_t>(0, -1))
396 model.render();
397 else
399
400 if (is_left_handed)
401 glsafe(::glFrontFace(GL_CCW));
402}
#define glsafe(cmd)
Definition 3DScene.hpp:25
bool is_left_handed() const
Definition 3DScene.cpp:302
void render()
Definition GLModel.cpp:755

References glsafe, is_left_handed(), model, Slic3r::GUI::GLModel::render(), and tverts_range.

+ Here is the call graph for this function:

◆ render_non_manifold_edges()

void Slic3r::GLVolume::render_non_manifold_edges ( )
426{
428}
void render()
Definition 3DScene.cpp:135

References m_non_manifold_edges, and Slic3r::GLVolume::NonManifoldEdges::render().

+ Here is the call graph for this function:

◆ render_sinking_contours()

void Slic3r::GLVolume::render_sinking_contours ( )
421{
423}
void render()
Definition 3DScene.cpp:69

References m_sinking_contours, and Slic3r::GLVolume::SinkingContours::render().

+ Here is the call graph for this function:

◆ set_bounding_boxes_as_dirty()

void Slic3r::GLVolume::set_bounding_boxes_as_dirty ( )
inline

◆ set_color()

void Slic3r::GLVolume::set_color ( const ColorRGBA rgba)
inline
206{ color = rgba; }

References color.

Referenced by Slic3r::GLVolumeCollection::load_object_volume(), and Slic3r::GUI::GLGizmoSlaBase::update_volumes().

+ Here is the caller graph for this function:

◆ set_color_from_model_volume()

void Slic3r::GLVolume::set_color_from_model_volume ( const ModelVolume model_volume)

◆ set_convex_hull() [1/3]

void Slic3r::GLVolume::set_convex_hull ( const TriangleMesh convex_hull)
inline
273{ m_convex_hull = std::make_shared<const TriangleMesh>(convex_hull); }
const TriangleMesh * convex_hull() const
Definition 3DScene.hpp:293

References convex_hull(), and m_convex_hull.

+ Here is the call graph for this function:

◆ set_convex_hull() [2/3]

void Slic3r::GLVolume::set_convex_hull ( std::shared_ptr< const TriangleMesh convex_hull)
inline
272{ m_convex_hull = std::move(convex_hull); }

References convex_hull(), and m_convex_hull.

Referenced by Slic3r::GUI::GLCanvas3D::_load_sla_shells(), Slic3r::GLVolumeCollection::load_object_auxiliary(), Slic3r::GLVolumeCollection::load_object_volume(), and Slic3r::GLVolumeCollection::load_wipe_tower_preview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_convex_hull() [3/3]

void Slic3r::GLVolume::set_convex_hull ( TriangleMesh &&  convex_hull)
inline
274{ m_convex_hull = std::make_shared<const TriangleMesh>(std::move(convex_hull)); }

References convex_hull(), and m_convex_hull.

+ Here is the call graph for this function:

◆ set_instance_mirror() [1/2]

void Slic3r::GLVolume::set_instance_mirror ( Axis  axis,
double  mirror 
)
inline
void set_bounding_boxes_as_dirty()
Definition 3DScene.hpp:301
void set_mirror(const Vec3d &mirror)
Definition Geometry.cpp:537

References m_instance_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_mirror().

+ Here is the call graph for this function:

◆ set_instance_mirror() [2/2]

void Slic3r::GLVolume::set_instance_mirror ( const Vec3d mirror)
inline

References m_instance_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_mirror().

Referenced by Slic3r::GUI::GLCanvas3D::_load_sla_shells().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_instance_offset() [1/2]

void Slic3r::GLVolume::set_instance_offset ( Axis  axis,
double  offset 
)
inline
void set_offset(const Vec3d &offset)
Definition Geometry.hpp:392
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, ClipperLib::JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:416

References m_instance_transformation, Slic3r::offset(), set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_offset().

+ Here is the call graph for this function:

◆ set_instance_offset() [2/2]

void Slic3r::GLVolume::set_instance_offset ( const Vec3d offset)
inline

References m_instance_transformation, Slic3r::offset(), set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_offset().

Referenced by Slic3r::GUI::GLCanvas3D::_load_sla_shells(), and Slic3r::GUI::Selection::translate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_instance_rotation() [1/2]

void Slic3r::GLVolume::set_instance_rotation ( Axis  axis,
double  rotation 
)
inline
void set_rotation(const Vec3d &rotation)
Definition Geometry.cpp:464

References m_instance_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_rotation().

+ Here is the call graph for this function:

◆ set_instance_rotation() [2/2]

void Slic3r::GLVolume::set_instance_rotation ( const Vec3d rotation)
inline

References m_instance_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_rotation().

Referenced by Slic3r::GUI::GLCanvas3D::_load_sla_shells().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_instance_scaling_factor() [1/2]

void Slic3r::GLVolume::set_instance_scaling_factor ( Axis  axis,
double  scaling_factor 
)
inline
void set_scaling_factor(const Vec3d &scaling_factor)
Definition Geometry.cpp:501

References m_instance_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_scaling_factor().

+ Here is the call graph for this function:

◆ set_instance_scaling_factor() [2/2]

void Slic3r::GLVolume::set_instance_scaling_factor ( const Vec3d scaling_factor)
inline

References m_instance_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_scaling_factor().

+ Here is the call graph for this function:

◆ set_instance_transformation() [1/2]

void Slic3r::GLVolume::set_instance_transformation ( const Geometry::Transformation transformation)
inline

References m_instance_transformation, and set_bounding_boxes_as_dirty().

Referenced by Slic3r::GUI::Selection::flattening_rotate(), Slic3r::GLVolumeCollection::load_object_auxiliary(), Slic3r::GLVolumeCollection::load_object_volume(), Slic3r::GUI::Selection::reset_skew(), Slic3r::GUI::Selection::scale_and_translate(), Slic3r::GUI::Selection::synchronize_unselected_instances(), Slic3r::GUI::Selection::translate(), and Slic3r::GUI::GLGizmoSlaBase::update_volumes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_instance_transformation() [2/2]

void Slic3r::GLVolume::set_instance_transformation ( const Transform3d transform)
inline
void set_matrix(const Transform3d &transform)
Definition Geometry.hpp:441
Linef3 transform(const Linef3 &line, const Transform3d &t)
Definition Line.cpp:10

References m_instance_transformation, set_bounding_boxes_as_dirty(), Slic3r::Geometry::Transformation::set_matrix(), and Slic3r::transform().

+ Here is the call graph for this function:

◆ set_range()

void Slic3r::GLVolume::set_range ( double  low,
double  high 
)
352{
353 this->tverts_range.first = 0;
354 this->tverts_range.second = this->model.indices_count();
355
356 if (!this->print_zs.empty()) {
357 // The Z layer range is specified.
358 // First test whether the Z span of this object is not out of (min_z, max_z) completely.
359 if (this->print_zs.front() > max_z || this->print_zs.back() < min_z)
360 this->tverts_range.second = 0;
361 else {
362 // Then find the lowest layer to be displayed.
363 size_t i = 0;
364 for (; i < this->print_zs.size() && this->print_zs[i] < min_z; ++i);
365 if (i == this->print_zs.size())
366 // This shall not happen.
367 this->tverts_range.second = 0;
368 else {
369 // Remember start of the layer.
370 this->tverts_range.first = this->offsets[i];
371 // Some layers are above $min_z. Which?
372 for (; i < this->print_zs.size() && this->print_zs[i] <= max_z; ++i);
373 if (i < this->print_zs.size())
374 this->tverts_range.second = this->offsets[i];
375 }
376 }
377 }
378}
size_t indices_count() const
Definition GLModel.hpp:213

References Slic3r::GUI::GLModel::indices_count(), model, offsets, print_zs, and tverts_range.

+ Here is the call graph for this function:

◆ set_render_color() [1/2]

void Slic3r::GLVolume::set_render_color ( bool  force_transparent)
242{
243 bool outside = is_outside || is_below_printbed();
244
245 if (force_native_color || force_neutral_color) {
246 if (outside && shader_outside_printer_detection_enabled)
248 else {
249 if (force_native_color)
251 else
253 }
254 }
255 else {
256 if (hover == HS_Select)
258 else if (hover == HS_Deselect)
260 else if (selected)
262 else if (disabled)
264 else if (outside && shader_outside_printer_detection_enabled)
266 else
268 }
269
270 if (!printable)
272
273 if (force_transparent)
275}
static const ColorRGBA HOVER_SELECT_COLOR
Definition 3DScene.hpp:53
static const ColorRGBA OUTSIDE_COLOR
Definition 3DScene.hpp:55
static const ColorRGBA SELECTED_COLOR
Definition 3DScene.hpp:52
static const ColorRGBA SELECTED_OUTSIDE_COLOR
Definition 3DScene.hpp:56
static const ColorRGBA DISABLED_COLOR
Definition 3DScene.hpp:57
static const ColorRGBA NEUTRAL_COLOR
Definition 3DScene.hpp:60
static const ColorRGBA HOVER_DESELECT_COLOR
Definition 3DScene.hpp:54
bool is_below_printbed() const
Definition 3DScene.cpp:415
ColorRGBA render_color
Definition 3DScene.hpp:128
ColorRGB saturate(const ColorRGB &color, float factor)
Definition Color.cpp:250

References Slic3r::ColorRGBA::a(), color, DISABLED_COLOR, hover, HOVER_DESELECT_COLOR, HOVER_SELECT_COLOR, HS_Deselect, HS_Select, is_below_printbed(), NEUTRAL_COLOR, OUTSIDE_COLOR, render_color, Slic3r::saturate(), SELECTED_COLOR, SELECTED_OUTSIDE_COLOR, and set_render_color().

+ Here is the call graph for this function:

◆ set_render_color() [2/2]

void Slic3r::GLVolume::set_render_color ( const ColorRGBA rgba)
inline
207{ render_color = rgba; }

References render_color.

Referenced by GLVolume(), and set_render_color().

+ Here is the caller graph for this function:

◆ set_sla_shift_z()

void Slic3r::GLVolume::set_sla_shift_z ( double  z)
inline
270{ m_sla_shift_z = z; }

References m_sla_shift_z.

Referenced by Slic3r::GUI::GLGizmoSlaBase::update_volumes().

+ Here is the caller graph for this function:

◆ set_volume_mirror() [1/2]

void Slic3r::GLVolume::set_volume_mirror ( Axis  axis,
double  mirror 
)
inline

References m_volume_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_mirror().

+ Here is the call graph for this function:

◆ set_volume_mirror() [2/2]

void Slic3r::GLVolume::set_volume_mirror ( const Vec3d mirror)
inline

References m_volume_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_mirror().

+ Here is the call graph for this function:

◆ set_volume_offset() [1/2]

void Slic3r::GLVolume::set_volume_offset ( Axis  axis,
double  offset 
)
inline

References m_volume_transformation, Slic3r::offset(), set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_offset().

+ Here is the call graph for this function:

◆ set_volume_offset() [2/2]

void Slic3r::GLVolume::set_volume_offset ( const Vec3d offset)
inline

References m_volume_transformation, Slic3r::offset(), set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_offset().

Referenced by Slic3r::GUI::GCodeViewer::load_shells(), Slic3r::GLVolumeCollection::load_wipe_tower_preview(), and Slic3r::GUI::Selection::translate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_volume_rotation() [1/2]

void Slic3r::GLVolume::set_volume_rotation ( Axis  axis,
double  rotation 
)
inline

References m_volume_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_rotation().

+ Here is the call graph for this function:

◆ set_volume_rotation() [2/2]

void Slic3r::GLVolume::set_volume_rotation ( const Vec3d rotation)
inline

References m_volume_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_rotation().

Referenced by Slic3r::GLVolumeCollection::load_wipe_tower_preview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_volume_scaling_factor() [1/2]

void Slic3r::GLVolume::set_volume_scaling_factor ( Axis  axis,
double  scaling_factor 
)
inline

References m_volume_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_scaling_factor().

+ Here is the call graph for this function:

◆ set_volume_scaling_factor() [2/2]

void Slic3r::GLVolume::set_volume_scaling_factor ( const Vec3d scaling_factor)
inline

References m_volume_transformation, set_bounding_boxes_as_dirty(), and Slic3r::Geometry::Transformation::set_scaling_factor().

+ Here is the call graph for this function:

◆ set_volume_transformation() [1/2]

void Slic3r::GLVolume::set_volume_transformation ( const Geometry::Transformation transformation)
inline

References m_volume_transformation, and set_bounding_boxes_as_dirty().

Referenced by Slic3r::GUI::ObjectManipulation::ObjectManipulation(), priv::apply_camera_dir(), Slic3r::GLVolumeCollection::load_object_volume(), Slic3r::GUI::Selection::reset_skew(), Slic3r::GUI::Selection::synchronize_unselected_volumes(), and Slic3r::GUI::GLGizmoSlaBase::update_volumes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_volume_transformation() [2/2]

void Slic3r::GLVolume::set_volume_transformation ( const Transform3d transform)
inline

References m_volume_transformation, set_bounding_boxes_as_dirty(), Slic3r::Geometry::Transformation::set_matrix(), and Slic3r::transform().

+ Here is the call graph for this function:

◆ total_memory_used()

size_t Slic3r::GLVolume::total_memory_used ( ) const
inline
322{ return this->cpu_memory_used() + this->gpu_memory_used(); }
size_t gpu_memory_used() const
Definition 3DScene.hpp:321
size_t cpu_memory_used() const
Definition 3DScene.hpp:316

References cpu_memory_used(), and gpu_memory_used().

+ Here is the call graph for this function:

◆ transformed_bounding_box()

const BoundingBoxf3 & Slic3r::GLVolume::transformed_bounding_box ( ) const
310{
311 if (!m_transformed_bounding_box.has_value()) {
312 const BoundingBoxf3& box = bounding_box();
313 assert(box.defined || box.min.x() >= box.max.x() || box.min.y() >= box.max.y() || box.min.z() >= box.max.z());
314 std::optional<BoundingBoxf3>* trans_box = const_cast<std::optional<BoundingBoxf3>*>(&m_transformed_bounding_box);
315 *trans_box = box.transformed(world_matrix());
316 }
318}
Transform3d world_matrix() const
Definition 3DScene.cpp:295
BoundingBoxf3 bounding_box() const
Definition 3DScene.hpp:202

References bounding_box(), Slic3r::BoundingBoxBase< PointType, APointsType >::defined, m_transformed_bounding_box, Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, Slic3r::BoundingBoxf3::transformed(), and world_matrix().

+ Here is the call graph for this function:

◆ transformed_convex_hull_bounding_box() [1/2]

const BoundingBoxf3 & Slic3r::GLVolume::transformed_convex_hull_bounding_box ( ) const
321{
323 std::optional<BoundingBoxf3>* trans_box = const_cast<std::optional<BoundingBoxf3>*>(&m_transformed_convex_hull_bounding_box);
325 }
327}

References m_transformed_convex_hull_bounding_box, transformed_convex_hull_bounding_box(), and world_matrix().

Referenced by is_below_printbed(), is_sinking(), and transformed_convex_hull_bounding_box().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transformed_convex_hull_bounding_box() [2/2]

BoundingBoxf3 Slic3r::GLVolume::transformed_convex_hull_bounding_box ( const Transform3d trafo) const
330{
331 return (m_convex_hull && ! m_convex_hull->empty()) ?
332 m_convex_hull->transformed_bounding_box(trafo) :
333 bounding_box().transformed(trafo);
334}
BoundingBoxf3 transformed(const Transform3d &matrix) const
Definition BoundingBox.cpp:227

References bounding_box(), m_convex_hull, and Slic3r::BoundingBoxf3::transformed().

Referenced by Slic3r::GUI::Selection::render_synchronized_volumes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transformed_non_sinking_bounding_box() [1/2]

const BoundingBoxf3 & Slic3r::GLVolume::transformed_non_sinking_bounding_box ( ) const
342{
344 std::optional<BoundingBoxf3>* trans_box = const_cast<std::optional<BoundingBoxf3>*>(&m_transformed_non_sinking_bounding_box);
345 const Transform3d& trafo = world_matrix();
346 *trans_box = transformed_non_sinking_bounding_box(trafo);
347 }
349}
const BoundingBoxf3 & transformed_non_sinking_bounding_box() const
Definition 3DScene.cpp:341
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:81

References m_transformed_non_sinking_bounding_box, transformed_non_sinking_bounding_box(), and world_matrix().

Referenced by transformed_non_sinking_bounding_box().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transformed_non_sinking_bounding_box() [2/2]

BoundingBoxf3 Slic3r::GLVolume::transformed_non_sinking_bounding_box ( const Transform3d trafo) const
337{
338 return GUI::wxGetApp().plater()->model().objects[object_idx()]->volumes[volume_idx()]->mesh().transformed_bounding_box(trafo, 0.0);
339}
int volume_idx() const
Definition 3DScene.hpp:277
int object_idx() const
Definition 3DScene.hpp:276

References object_idx(), and volume_idx().

+ Here is the call graph for this function:

◆ volume_idx()

◆ world_matrix()

Transform3d Slic3r::GLVolume::world_matrix ( ) const
296{
298 m.translation()(2) += m_sla_shift_z;
299 return m;
300}
const Transform3d & get_matrix() const
Definition Geometry.hpp:437
EIGEN_DEVICE_FUNC ConstTranslationPart translation() const
Definition Transform.h:410

References Slic3r::Geometry::Transformation::get_matrix(), m_instance_transformation, m_sla_shift_z, m_volume_transformation, and Eigen::Transform< _Scalar, _Dim, _Mode, _Options >::translation().

Referenced by Slic3r::GUI::GLGizmoEmboss::calculate_scale(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::Selection::get_bounding_box_in_reference_system(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_translate(), Slic3r::GUI::GLGizmoSimplify::on_render(), Slic3r::GUI::GLGizmoEmboss::on_stop_dragging(), Slic3r::GUI::GLGizmoSlaBase::register_volume_raycasters_for_picking(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::Selection::render_synchronized_volumes(), Slic3r::GUI::Selection::scale_to_fit_print_volume(), Slic3r::GUI::GLGizmoEmboss::set_volume_by_selection(), transformed_bounding_box(), transformed_convex_hull_bounding_box(), transformed_non_sinking_bounding_box(), Slic3r::GUI::GLGizmoSlaSupports::update_point_raycasters_for_picking_transform(), and Slic3r::GUI::world_matrix_fixed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ [struct]

struct { ... } Slic3r::GLVolume

◆ color

◆ composite_id

◆ DISABLED_COLOR

const ColorRGBA Slic3r::GLVolume::DISABLED_COLOR = ColorRGBA::DARK_GRAY()
static

Referenced by set_render_color().

◆ extruder_id

int Slic3r::GLVolume::extruder_id

◆ geometry_id

◆ hover

EHoverState Slic3r::GLVolume::hover

◆ HOVER_DESELECT_COLOR

const ColorRGBA Slic3r::GLVolume::HOVER_DESELECT_COLOR = { 1.0f, 0.75f, 0.75f, 1.0f }
static

Referenced by set_render_color().

◆ HOVER_SELECT_COLOR

const ColorRGBA Slic3r::GLVolume::HOVER_SELECT_COLOR = { 0.4f, 0.9f, 0.1f, 1.0f }
static

Referenced by set_render_color().

◆ m_convex_hull

std::shared_ptr<const TriangleMesh> Slic3r::GLVolume::m_convex_hull
private

◆ m_instance_transformation

◆ m_non_manifold_edges

NonManifoldEdges Slic3r::GLVolume::m_non_manifold_edges
private

◆ m_sinking_contours

SinkingContours Slic3r::GLVolume::m_sinking_contours
private

Referenced by render_sinking_contours().

◆ m_sla_shift_z

double Slic3r::GLVolume::m_sla_shift_z
private

◆ m_transformed_bounding_box

std::optional<BoundingBoxf3> Slic3r::GLVolume::m_transformed_bounding_box
private

◆ m_transformed_convex_hull_bounding_box

std::optional<BoundingBoxf3> Slic3r::GLVolume::m_transformed_convex_hull_bounding_box
private

◆ m_transformed_non_sinking_bounding_box

std::optional<BoundingBoxf3> Slic3r::GLVolume::m_transformed_non_sinking_bounding_box
private

◆ m_volume_transformation

◆ mesh_raycaster

◆ model

◆ MODEL_COLOR

const std::array< ColorRGBA, 4 > Slic3r::GLVolume::MODEL_COLOR
static
Initial value:
= { {
{ 1.0f, 0.5f, 0.5f, 1.0f },
{ 0.5f, 1.0f, 0.5f, 1.0f },
{ 0.5f, 0.5f, 1.0f, 1.0f }
} }
static const ColorRGBA YELLOW()
Definition Color.hpp:130

Referenced by Slic3r::GLVolumeCollection::load_object_auxiliary().

◆ NEUTRAL_COLOR

const ColorRGBA Slic3r::GLVolume::NEUTRAL_COLOR = { 0.9f, 0.9f, 0.9f, 1.0f }
static

◆ offsets

◆ OUTSIDE_COLOR

const ColorRGBA Slic3r::GLVolume::OUTSIDE_COLOR = { 0.0f, 0.38f, 0.8f, 1.0f }
static

Referenced by set_render_color().

◆ print_zs

◆ render_color

ColorRGBA Slic3r::GLVolume::render_color

◆ SELECTED_COLOR

const ColorRGBA Slic3r::GLVolume::SELECTED_COLOR = ColorRGBA::GREEN()
static

◆ SELECTED_OUTSIDE_COLOR

const ColorRGBA Slic3r::GLVolume::SELECTED_OUTSIDE_COLOR = { 0.19f, 0.58f, 1.0f, 1.0f }
static

Referenced by set_render_color().

◆ SLA_PAD_COLOR

const ColorRGBA Slic3r::GLVolume::SLA_PAD_COLOR = { 0.0f, 0.2f, 0.0f, 1.0f }
static

◆ SLA_SUPPORT_COLOR

const ColorRGBA Slic3r::GLVolume::SLA_SUPPORT_COLOR = ColorRGBA::LIGHT_GRAY()
static

◆ tverts_range

std::pair<size_t, size_t> Slic3r::GLVolume::tverts_range

Referenced by render(), and set_range().


The documentation for this class was generated from the following files: