OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GLVolume Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/3DScene.hpp>

Inheritance diagram for Slic3r::GLVolume:
Collaboration diagram for Slic3r::GLVolume:

Classes

class  SinkingContours
struct  CompositeID

Public Types

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

Public Member Functions

 GLVolume (float r=1.f, float g=1.f, float b=1.f, float a=1.f)
 GLVolume (const ColorRGBA &color)
virtual ~GLVolume ()=default
BoundingBoxf3 bounding_box () const
void set_color (const ColorRGBA &rgba)
void set_render_color (const ColorRGBA &rgba)
void set_render_color ()
void set_color_from_model_volume (const ModelVolume &model_volume)
const Geometry::Transformation & get_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::Transformation & get_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)
void set_offset_to_assembly (const Vec3d &offset)
Vec3d get_offset_to_assembly ()
int object_idx () const
int volume_idx () const
int instance_idx () const
Transform3d world_matrix () const
bool is_left_handed () const
const BoundingBoxf3 & transformed_bounding_box () const
BoundingBoxf3 transformed_convex_hull_bounding_box (const Transform3d &trafo) const
const BoundingBoxf3 & transformed_convex_hull_bounding_box () const
BoundingBoxf3 transformed_non_sinking_bounding_box (const Transform3d &trafo) const
const BoundingBoxf3 & transformed_non_sinking_bounding_box () const
const TriangleMesh * convex_hull () const
bool empty () const
void set_range (double low, double high)
virtual void render ()
virtual void render_with_outline (const GUI::Size &cnv_size)
void simple_render (GLShaderProgram *shader, ModelObjectPtrs &model_objects, std::vector< ColorRGBA > &extruder_colors, bool ban_light=false, bool ban_color_volume=false)
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 ()
size_t cpu_memory_used () const
size_t gpu_memory_used () const
size_t total_memory_used () const

Static Public Member Functions

static void update_render_colors ()
static void load_render_colors ()
static ColorRGBA brighten_color (const ColorRGBA &color, float multiplier=1.25f)

Public Attributes

std::string name
ColorRGBA color
ColorRGBA render_color
CompositeID composite_id
std::pair< size_t, size_t > geometry_id
int extruder_id
size_t model_object_ID {0}
struct { 
bool selected: 1
bool disabled: 1
bool printable: 1
bool visible: 1
bool is_active: 1
bool on_hidden_plate: 1
bool zoom_to_volumes: 1
bool shader_outside_printer_detection_enabled: 1
bool is_outside: 1
bool partly_inside: 1
bool is_modifier: 1
bool is_wipe_tower: 1
bool is_extrusion_path: 1
bool force_transparent: 1
bool force_native_color: 1
bool force_neutral_color: 1
bool force_sinking_contours: 1
bool depth_bias: 1
bool picking: 1
bool slice_error: 1
}; 
EHoverState hover
GUI::GLModel model
std::unique_ptr< GUI::MeshRaycaster > mesh_raycaster
std::vector< GUI::GLModel > mmuseg_models
ObjectBase::Timestamp mmuseg_ts
std::pair< size_t, size_t > tverts_range
std::vector< coordf_t > print_zs
std::vector< size_t > offsets

Static Public Attributes

static ColorRGBA DISABLED_COLOR = ColorRGBA::DARK_GRAY()
static ColorRGBA SLA_SUPPORT_COLOR = ColorRGBA::LIGHT_GRAY()
static ColorRGBA SLA_PAD_COLOR = { 0.0f, 0.2f, 0.0f, 1.0f }
static ColorRGBA NEUTRAL_COLOR = { 0.8f, 0.8f, 0.8f, 1.0f }
static ColorRGBA UNPRINTABLE_COLOR = { 0.0f, 0.0f, 0.0f, 0.5f }
static std::array< ColorRGBA, 5 > MODEL_COLOR
static ColorRGBA MODEL_MIDIFIER_COL = {1.0f, 1.0f, 0.0f, 0.6f}
static ColorRGBA MODEL_NEGTIVE_COL = {0.3f, 0.3f, 0.3f, 0.4f}
static ColorRGBA SUPPORT_ENFORCER_COL = {0.3f, 0.3f, 1.0f, 0.4f}
static ColorRGBA SUPPORT_BLOCKER_COL = {1.0f, 0.3f, 0.3f, 0.4f}
static ColorRGBA MODEL_HIDDEN_COL = {0.f, 0.f, 0.f, 0.3f}
static ColorRGBA PRECISE_SEAM_CENTER_COL = {1.0f, 0.627f, 0.082f, 0.6f}
static ColorRGBA PRECISE_SEAM_LEFT_COL = {1.0f, 0.753f, 0.0f, 0.6f}
static ColorRGBA PRECISE_SEAM_RIGHT_COL = {1.0f, 0.514f, 0.0f, 0.6f}
static ColorRGBA PRECISE_SEAM_ENFORCED_COL = {0.412f, 0.820f, 0.412f, 0.6f}
static ColorRGBA PRECISE_SEAM_NEUTRAL_COL = {0.655f, 0.655f, 0.655f, 0.6f}
static ColorRGBA PRECISE_SEAM_BLOCKED_COL = {0.820f, 0.412f, 0.412f, 0.6f}
static float explosion_ratio = 1.0
static float last_explosion_ratio = 1.0

Protected Attributes

Geometry::Transformation m_instance_transformation
Geometry::Transformation m_volume_transformation
Vec3d m_offset_to_assembly { 0.0, 0.0, 0.0 }
double m_sla_shift_z
std::optional< BoundingBoxf3 > m_transformed_bounding_box
std::shared_ptr< const TriangleMesh > m_convex_hull
std::optional< BoundingBoxf3 > m_transformed_convex_hull_bounding_box
std::optional< BoundingBoxf3 > m_transformed_non_sinking_bounding_box
SinkingContours m_sinking_contours

Detailed Description

Member Enumeration Documentation

◆ EHoverState

enum Slic3r::GLVolume::EHoverState : unsigned char
Enumerator
HS_None 
HS_Hover 
HS_Select 
HS_Deselect 
121 {
122 HS_None,
123 HS_Hover,
124 HS_Select,
126 };
@ HS_Select
Definition 3DScene.hpp:124
@ HS_None
Definition 3DScene.hpp:122
@ HS_Hover
Definition 3DScene.hpp:123
@ HS_Deselect
Definition 3DScene.hpp:125

Constructor & Destructor Documentation

◆ GLVolume() [1/2]

Slic3r::GLVolume::GLVolume ( float r = 1.f,
float g = 1.f,
float b = 1.f,
float a = 1.f )
293 : m_sla_shift_z(0.0)
294 , m_sinking_contours(*this)
295 // geometry_id == 0 -> invalid
296 , geometry_id(std::pair<size_t, size_t>(0, 0))
297 , extruder_id(0)
298 , selected(false)
299 , disabled(false)
300 , printable(true)
301 , visible(true)
302 , is_active(true)
303 , on_hidden_plate(false)
304 , zoom_to_volumes(true)
305 , shader_outside_printer_detection_enabled(false)
306 , is_outside(false)
307 , partly_inside(false)
308 , hover(HS_None)
309 , is_modifier(false)
310 , slice_error(false)
311 , is_wipe_tower(false)
312 , is_extrusion_path(false)
313 , force_transparent(false)
314 , force_native_color(false)
315 , force_neutral_color(false)
316 , force_sinking_contours(false)
317 , depth_bias(false)
318 , picking(false)
319 , tverts_range(0, size_t(-1))
320{
321 color = { r, g, b, a };
323 mmuseg_ts = 0;
324}
double m_sla_shift_z
Definition 3DScene.hpp:140
std::pair< size_t, size_t > geometry_id
Definition 3DScene.hpp:196
void set_render_color()
Definition 3DScene.cpp:331
ObjectBase::Timestamp mmuseg_ts
Definition 3DScene.hpp:255
EHoverState hover
Definition 3DScene.hpp:248
ColorRGBA color
Definition 3DScene.hpp:170
std::pair< size_t, size_t > tverts_range
Definition 3DScene.hpp:258
int extruder_id
Definition 3DScene.hpp:198
SinkingContours m_sinking_contours
Definition 3DScene.hpp:166
@ disabled
Definition GLGizmoEmboss.cpp:223
bool is_active(id view)
Definition MacIME.mm:26

References color, extruder_id, geometry_id, hover, HS_None, m_sinking_contours, m_sla_shift_z, mmuseg_ts, set_render_color(), and tverts_range.

Referenced by GLVolume(), Slic3r::GLWipeTowerVolume::GLWipeTowerVolume(), and Slic3r::GLVolume::SinkingContours::SinkingContours().

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

◆ GLVolume() [2/2]

Slic3r::GLVolume::GLVolume ( const ColorRGBA & color)
inline
129: GLVolume(color.r(), color.g(), color.b(), color.a()) {}
GLVolume(float r=1.f, float g=1.f, float b=1.f, float a=1.f)
Definition 3DScene.cpp:292

References GLVolume(), and color.

Here is the call graph for this function:

◆ ~GLVolume()

virtual Slic3r::GLVolume::~GLVolume ( )
virtualdefault

Member Function Documentation

◆ bounding_box()

BoundingBoxf3 Slic3r::GLVolume::bounding_box ( ) const
inline
267 {
268 return this->model.get_bounding_box();
269 }
GUI::GLModel model
Definition 3DScene.hpp:250

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

Referenced by Slic3r::GUI::calc_distance(), Slic3r::GUI::PartPlate::contains(), Slic3r::GUI::CameraUtils::create_hull2d(), Slic3r::GUI::GLCanvas3D::get_wipe_tower_info(), Slic3r::GUI::Selection::render_synchronized_volumes(), transformed_bounding_box(), transformed_convex_hull_bounding_box(), and Slic3r::GUI::Selection::translate().

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

◆ brighten_color()

ColorRGBA Slic3r::GLVolume::brighten_color ( const ColorRGBA & color,
float multiplier = 1.25f )
static
241{
242 // Convert RGB to HSL, increase lightness, convert back
243
244 float r = color.r(), g = color.g(), b = color.b();
245
246 // RGB to HSL conversion
247 float max_val = std::max({r, g, b});
248 float min_val = std::min({r, g, b});
249 float l = (max_val + min_val) / 2.0f;
250 float h = 0.0f, s = 0.0f;
251
252 if (max_val != min_val) {
253 float delta = max_val - min_val;
254 s = l > 0.5f ? delta / (2.0f - max_val - min_val) : delta / (max_val + min_val);
255
256 if (max_val == r)
257 h = (g - b) / delta + (g < b ? 6.0f : 0.0f);
258 else if (max_val == g)
259 h = (b - r) / delta + 2.0f;
260 else
261 h = (r - g) / delta + 4.0f;
262 h /= 6.0f;
263 }
264
265 // Increase lightness by a fixed amount (0.25)
266 // Ensures even saturated colors become visibly brighter
267 l = std::min(l + 0.25f, 1.0f);
268
269 // HSL to RGB conversion
270 auto hue_to_rgb = [](float p, float q, float t) {
271 if (t < 0.0f) t += 1.0f;
272 if (t > 1.0f) t -= 1.0f;
273 if (t < 1.0f / 6.0f) return p + (q - p) * 6.0f * t;
274 if (t < 1.0f / 2.0f) return q;
275 if (t < 2.0f / 3.0f) return p + (q - p) * (2.0f / 3.0f - t) * 6.0f;
276 return p;
277 };
278
279 if (s == 0.0f) {
280 r = g = b = l; // achromatic (gray)
281 } else {
282 float q = l < 0.5f ? l * (1.0f + s) : l + s - l * s;
283 float p = 2.0f * l - q;
284 r = hue_to_rgb(p, q, h + 1.0f / 3.0f);
285 g = hue_to_rgb(p, q, h);
286 b = hue_to_rgb(p, q, h - 1.0f / 3.0f);
287 }
288
289 return ColorRGBA(r, g, b, color.a());
290}

References color.

Referenced by set_render_color(), and simple_render().

Here is the caller graph for this function:

◆ convex_hull()

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

References m_convex_hull.

Referenced by Slic3r::GUI::CameraUtils::create_hull2d(), Slic3r::GUI::Selection::get_bounding_box_in_reference_system(), Slic3r::GUI::Selection::get_bounding_sphere(), Slic3r::GUI::GLCanvas3D::reload_scene(), 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
389 {
390 return sizeof(*this) + this->model.cpu_memory_used() + this->print_zs.capacity() * sizeof(coordf_t) +
391 this->offsets.capacity() * sizeof(size_t);
392 }
std::vector< coordf_t > print_zs
Definition 3DScene.hpp:262
std::vector< size_t > offsets
Definition 3DScene.hpp:264
double coordf_t
Definition GUI_ObjectList.hpp:46

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
363{ return this->model.is_empty(); }

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
300{ return m_instance_transformation.get_mirror(); }
Geometry::Transformation m_instance_transformation
Definition 3DScene.hpp:134

References m_instance_transformation.

◆ get_instance_mirror() [2/2]

double Slic3r::GLVolume::get_instance_mirror ( Axis axis) const
inline
301{ return m_instance_transformation.get_mirror(axis); }

References m_instance_transformation.

◆ get_instance_offset() [1/2]

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

◆ get_instance_offset() [2/2]

double Slic3r::GLVolume::get_instance_offset ( Axis axis) const
inline
283{ return m_instance_transformation.get_offset(axis); }

References m_instance_transformation.

◆ get_instance_rotation() [1/2]

Vec3d Slic3r::GLVolume::get_instance_rotation ( ) const
inline
288{ return m_instance_transformation.get_rotation(); }

References m_instance_transformation.

Referenced by Slic3r::GUI::GizmoObjectManipulation::update_reset_buttons_visibility().

Here is the caller graph for this function:

◆ get_instance_rotation() [2/2]

double Slic3r::GLVolume::get_instance_rotation ( Axis axis) const
inline
289{ return m_instance_transformation.get_rotation(axis); }

References m_instance_transformation.

◆ get_instance_scaling_factor() [1/2]

Vec3d Slic3r::GLVolume::get_instance_scaling_factor ( ) const
inline
294{ return m_instance_transformation.get_scaling_factor(); }

References m_instance_transformation.

Referenced by Slic3r::GUI::GLGizmoScale3D::get_tooltip(), Slic3r::GUI::Selection::scale_and_translate(), and Slic3r::GUI::GizmoObjectManipulation::update_reset_buttons_visibility().

Here is the caller graph for this function:

◆ get_instance_scaling_factor() [2/2]

double Slic3r::GLVolume::get_instance_scaling_factor ( Axis axis) const
inline
295{ return m_instance_transformation.get_scaling_factor(axis); }

References m_instance_transformation.

◆ get_instance_transformation()

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

References m_instance_transformation.

Referenced by Slic3r::GUI::GLCanvas3D::_render_imex_ghosts(), Slic3r::GUI::GLGizmoBrimEars::auto_generate(), Slic3r::GUI::CameraUtils::create_hull2d(), Slic3r::GUI::GLGizmoRotate3D::data_changed(), Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), Slic3r::GUI::dragging_rotate_gizmo(), Slic3r::GUI::GLGizmoBrimEars::find_single(), Slic3r::GUI::GLGizmoBrimEars::first_layer_slicer(), Slic3r::GUI::Selection::flattening_rotate(), Slic3r::GUI::Selection::get_bounding_box_in_reference_system(), Slic3r::GUI::Selection::get_full_scaled_instance_bounding_box(), Slic3r::GUI::Selection::get_full_unscaled_instance_bounding_box(), Slic3r::GUI::Selection::get_scaled_instance_bounding_box(), Slic3r::GUI::Selection::get_unscaled_instance_bounding_box(), Slic3r::GUI::GLGizmoBrimEars::gizmo_event(), Slic3r::GUI::ObjectList::load_generic_subobject(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::GUI::GCodeViewer::load_shells(), Slic3r::GUI::GLGizmoFlatten::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoFlatten::on_render(), Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoAlignment::reference_basis(), Slic3r::GUI::GLGizmoBrimEars::register_single_mesh_pick(), Slic3r::GUI::GLGizmoMeasure::register_single_mesh_pick(), Slic3r::GUI::GLGizmoBrimEars::render_points(), Slic3r::GUI::Selection::render_synchronized_volumes(), Slic3r::GUI::GizmoObjectManipulation::reset_rotation_value(), Slic3r::GUI::Selection::set_caches(), Slic3r::GUI::Selection::synchronize_unselected_instances(), Slic3r::GUI::GLGizmoCut3D::transformed_bounding_box(), Slic3r::GUI::Selection::translate(), Slic3r::GUI::GLGizmoBrimEars::unproject_on_mesh(), Slic3r::GUI::GLCanvas3D::update_sequential_clearance(), and Slic3r::GUI::GizmoObjectManipulation::update_settings_value().

Here is the caller graph for this function:

◆ get_offset_to_assembly()

Vec3d Slic3r::GLVolume::get_offset_to_assembly ( )
inline
342{ return m_offset_to_assembly; }
Vec3d m_offset_to_assembly
Definition 3DScene.hpp:137

References m_offset_to_assembly.

◆ get_sla_shift_z()

◆ get_volume_mirror() [1/2]

Vec3d Slic3r::GLVolume::get_volume_mirror ( ) const
inline
328{ return m_volume_transformation.get_mirror(); }
Geometry::Transformation m_volume_transformation
Definition 3DScene.hpp:135

References m_volume_transformation.

◆ get_volume_mirror() [2/2]

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

References m_volume_transformation.

◆ get_volume_offset() [1/2]

Vec3d Slic3r::GLVolume::get_volume_offset ( ) const
inline
310{ return m_volume_transformation.get_offset(); }

References m_volume_transformation.

Referenced by Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::Selection::ensure_not_below_bed(), Slic3r::GUI::GCodeViewer::load_shells(), Slic3r::GUI::Selection::translate(), and Slic3r::GUI::GizmoObjectManipulation::update_settings_value().

Here is the caller graph for this function:

◆ get_volume_offset() [2/2]

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

References m_volume_transformation.

◆ get_volume_rotation() [1/2]

Vec3d Slic3r::GLVolume::get_volume_rotation ( ) const
inline
316{ return m_volume_transformation.get_rotation(); }

References m_volume_transformation.

Referenced by Slic3r::GUI::GizmoObjectManipulation::update_reset_buttons_visibility().

Here is the caller graph for this function:

◆ get_volume_rotation() [2/2]

double Slic3r::GLVolume::get_volume_rotation ( Axis axis) const
inline
317{ return m_volume_transformation.get_rotation(axis); }

References m_volume_transformation.

◆ get_volume_scaling_factor() [1/2]

Vec3d Slic3r::GLVolume::get_volume_scaling_factor ( ) const
inline
322{ return m_volume_transformation.get_scaling_factor(); }

References m_volume_transformation.

Referenced by Slic3r::GUI::GLGizmoScale3D::get_tooltip(), Slic3r::GUI::GizmoObjectManipulation::update_reset_buttons_visibility(), and Slic3r::GUI::GizmoObjectManipulation::update_settings_value().

Here is the caller graph for this function:

◆ get_volume_scaling_factor() [2/2]

double Slic3r::GLVolume::get_volume_scaling_factor ( Axis axis) const
inline
323{ return m_volume_transformation.get_scaling_factor(axis); }

References m_volume_transformation.

◆ get_volume_transformation()

const Geometry::Transformation & Slic3r::GLVolume::get_volume_transformation ( ) const
inline
306{ return m_volume_transformation; }

References m_volume_transformation.

Referenced by Slic3r::GUI::CameraUtils::create_hull2d(), Slic3r::GUI::GLGizmoRotate3D::data_changed(), Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), Slic3r::GUI::dragging_rotate_gizmo(), Slic3r::GUI::Plater::export_stl(), Slic3r::GUI::GLGizmoBrimEars::first_layer_slicer(), Slic3r::GUI::Selection::get_full_scaled_instance_bounding_box(), Slic3r::GUI::Selection::get_full_unscaled_instance_bounding_box(), Slic3r::GUI::Selection::get_full_unscaled_instance_local_bounding_box(), Slic3r::GUI::Selection::get_scaled_instance_bounding_box(), Slic3r::GUI::Selection::get_unscaled_instance_bounding_box(), anonymous_namespace{GLGizmoEmboss.cpp}::init_text_lines(), Slic3r::GUI::GLGizmoBrimEars::register_single_mesh_pick(), Slic3r::GUI::GLGizmoMeasure::register_single_mesh_pick(), Slic3r::GUI::Selection::render_synchronized_volumes(), Slic3r::GUI::GizmoObjectManipulation::reset_rotation_value(), Slic3r::GUI::selection_transform(), Slic3r::GUI::Selection::set_caches(), anonymous_namespace{SurfaceDrag.cpp}::start_dragging(), Slic3r::GUI::Selection::synchronize_unselected_volumes(), Slic3r::GUI::GLGizmoCut3D::transformed_bounding_box(), and Slic3r::GUI::GizmoObjectManipulation::update_settings_value().

Here is the caller graph for this function:

◆ gpu_memory_used()

size_t Slic3r::GLVolume::gpu_memory_used ( ) const
inline
394{ return this->model.gpu_memory_used(); }

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()

int Slic3r::GLVolume::instance_idx ( ) const
inline
346{ return this->composite_id.instance_id; }
CompositeID composite_id
Definition 3DScene.hpp:191

References Slic3r::GLVolume::CompositeID::instance_id.

Referenced by Slic3r::GUI::GLCanvas3D::_render_below_plate_volumes(), Slic3r::GUI::GLCanvas3D::_update_inactive_plates_visibility(), Slic3r::GUI::GLCanvas3D::_update_selection_from_hover(), Slic3r::GUI::GLCanvas3D::_update_volumes_hover_state(), Slic3r::GUI::Selection::add(), Slic3r::GUI::Selection::copy_to_clipboard(), Slic3r::GUI::GLGizmoAlignment::distribute_objects_generic(), Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::Selection::do_remove_instance(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), Slic3r::GUI::Selection::ensure_not_below_bed(), Slic3r::GUI::GLCanvas3D::ensure_on_bed(), Slic3r::GUI::Selection::ensure_on_bed(), Slic3r::GUI::get_model_instance(), Slic3r::GUI::get_model_instance(), Slic3r::GUI::Selection::get_volume_idxs_from_instance(), Slic3r::GUI::Selection::get_volume_idxs_from_volume(), Slic3r::GUI::Selection::is_from_fully_selected_instance(), Slic3r::GUI::Selection::is_single_full_instance(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::Selection::remove(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::Selection::rotate(), Slic3r::GUI::Selection::rotate(), Slic3r::GUI::Selection::scale_and_translate(), Slic3r::GUI::Plater::priv::set_current_panel(), Slic3r::GUI::Selection::synchronize_unselected_instances(), Slic3r::GUI::Selection::translate(), Slic3r::GUI::GLCanvas3D::update_instance_printable_state_for_object(), Slic3r::GUI::GLCanvas3D::update_sequential_clearance(), and Slic3r::GUI::Selection::update_type().

Here is the caller graph for this function:

◆ is_below_printbed()

bool Slic3r::GLVolume::is_below_printbed ( ) const
825{
826 return transformed_convex_hull_bounding_box().max.z() < 0.0;
827}
const BoundingBoxf3 & transformed_convex_hull_bounding_box() const
Definition 3DScene.cpp:477

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

Referenced by Slic3r::GUI::GLCanvas3D::_scene_cache_key(), Slic3r::GUI::GLCanvas3D::is_object_sinking(), and 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
459{
460 const Vec3d &m1 = m_instance_transformation.get_mirror();
461 const Vec3d &m2 = m_volume_transformation.get_mirror();
462 return m1.x() * m1.y() * m1.z() * m2.x() * m2.y() * m2.z() < 0.;
463}
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68

References m_instance_transformation, and m_volume_transformation.

Referenced by Slic3r::GLWipeTowerVolume::render(), Slic3r::GUI::GLGizmoBrimEars::render_points(), and simple_render().

Here is the caller graph for this function:

◆ is_sinking()

bool Slic3r::GLVolume::is_sinking ( ) const
817{
818 if (is_modifier || GUI::wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA)
819 return false;
820 const BoundingBoxf3& box = transformed_convex_hull_bounding_box();
821 return box.min.z() < SINKING_Z_THRESHOLD && box.max.z() >= SINKING_Z_THRESHOLD;
822}
@ ptSLA
Definition Config.hpp:233
static const float SINKING_Z_THRESHOLD
Definition Model.hpp:1967

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

Referenced by Slic3r::GUI::GLCanvas3D::_scene_cache_key(), Slic3r::GUI::GLCanvas3D::is_object_sinking(), and 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
814{ return this->composite_id.volume_id == -int(slaposPad); }
@ slaposPad
Definition SLAPrint.hpp:48

References composite_id, and Slic3r::slaposPad.

Referenced by Slic3r::GUI::GLGizmoCut3D::bounding_box(), Slic3r::GUI::SceneRaycaster::hit(), and Slic3r::GUI::GLGizmoCut3D::transformed_bounding_box().

Here is the caller graph for this function:

◆ is_sla_support()

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

References composite_id, and Slic3r::slaposSupportTree.

Referenced by Slic3r::GUI::GLGizmoCut3D::bounding_box(), Slic3r::GUI::SceneRaycaster::hit(), and Slic3r::GUI::GLGizmoCut3D::transformed_bounding_box().

Here is the caller graph for this function:

◆ load_render_colors()

void Slic3r::GLVolume::load_render_colors ( )
static
230{
238}
@ RenderCol_Negtive_Volume
Definition GUI_Colors.hpp:20
@ RenderCol_Model_Disable
Definition GUI_Colors.hpp:15
@ RenderCol_Support_Blocker
Definition GUI_Colors.hpp:22
@ RenderCol_Modifier
Definition GUI_Colors.hpp:19
@ RenderCol_Support_Enforcer
Definition GUI_Colors.hpp:21
@ RenderCol_Model_Neutral
Definition GUI_Colors.hpp:17
@ RenderCol_Model_Unprintable
Definition GUI_Colors.hpp:16
static ColorRGBA NEUTRAL_COLOR
Definition 3DScene.hpp:97
static ColorRGBA DISABLED_COLOR
Definition 3DScene.hpp:94
static ColorRGBA UNPRINTABLE_COLOR
Definition 3DScene.hpp:98
static std::array< ColorRGBA, 5 > MODEL_COLOR
Definition 3DScene.hpp:99
static ImVec4 to_ImVec4(const ColorRGB &color)
Definition ImGuiWrapper.cpp:1053
static ImVec4 colors[RenderCol_Count]
Definition GUI_Colors.hpp:40

References Slic3r::RenderColor::colors, DISABLED_COLOR, MODEL_COLOR, NEUTRAL_COLOR, RenderCol_Model_Disable, RenderCol_Model_Neutral, RenderCol_Model_Unprintable, RenderCol_Modifier, RenderCol_Negtive_Volume, RenderCol_Support_Blocker, RenderCol_Support_Enforcer, Slic3r::GUI::ImGuiWrapper::to_ImVec4(), and UNPRINTABLE_COLOR.

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

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

◆ object_idx()

int Slic3r::GLVolume::object_idx ( ) const
inline
344{ return this->composite_id.object_id; }

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

Referenced by Slic3r::GUI::GLCanvas3D::_render_below_plate_volumes(), Slic3r::GUI::GLCanvas3D::_render_section_view_caps(), Slic3r::GUI::GLCanvas3D::_set_warning_notification(), Slic3r::GUI::GLCanvas3D::_update_inactive_plates_visibility(), Slic3r::GUI::GLCanvas3D::_update_selection_from_hover(), Slic3r::GUI::GLCanvas3D::_update_volumes_hover_state(), Slic3r::GUI::Selection::add(), Slic3r::GUI::Plater::priv::can_reload_from_disk(), Slic3r::GUI::Selection::copy_to_clipboard(), Slic3r::GUI::GLGizmoAlignment::distribute_objects_generic(), Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::Selection::do_remove_instance(), Slic3r::GUI::Selection::do_remove_object(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), anonymous_namespace{SurfaceDrag.cpp}::dragging(), Slic3r::GUI::Selection::ensure_not_below_bed(), Slic3r::GUI::GLCanvas3D::ensure_on_bed(), Slic3r::GUI::Selection::ensure_on_bed(), Slic3r::GUI::Selection::erase(), Slic3r::GUI::Selection::get_bounding_box_in_reference_system(), Slic3r::GUI::Selection::get_bounding_sphere(), Slic3r::GUI::get_model_object(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::Selection::get_selected_single_object(), Slic3r::GUI::Selection::get_selected_single_volume(), Slic3r::GUI::Selection::get_volume_idxs_from_instance(), Slic3r::GUI::Selection::get_volume_idxs_from_volume(), Slic3r::GUI::GLCanvas3D::get_wipe_tower_info(), Slic3r::GUI::Selection::is_from_fully_selected_instance(), Slic3r::GUI::GLCanvas3D::is_object_sinking(), Slic3r::GUI::Selection::is_single_full_instance(), Slic3r::GUI::Selection::is_single_text(), Slic3r::GUI::GLCanvas3D::on_mouse(), Slic3r::GUI::GLGizmoMeasure::register_single_mesh_pick(), Slic3r::GUI::Plater::priv::reload_from_disk(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::Selection::remove(), Slic3r::GUI::Selection::remove_volume(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::Selection::render_synchronized_volumes(), Slic3r::GUI::Plater::priv::replace_all_with_stl(), Slic3r::GUI::Plater::priv::replace_with_stl(), Slic3r::GUI::Selection::rotate(), Slic3r::GUI::Selection::rotate(), Slic3r::GUI::Selection::scale_and_translate(), Slic3r::GUI::Plater::priv::set_current_panel(), Slic3r::GUI::ObjectList::set_volume_type(), simple_render(), Slic3r::GUI::Selection::synchronize_unselected_instances(), Slic3r::GUI::Selection::synchronize_unselected_volumes(), transformed_non_sinking_bounding_box(), Slic3r::GUI::Selection::translate(), Slic3r::GUI::Selection::translate(), Slic3r::GUI::Selection::translate(), Slic3r::GLVolume::SinkingContours::update(), Slic3r::GUI::GLCanvas3D::update_compacted_wipe_tower_clearance(), Slic3r::GUI::GLCanvas3D::update_instance_printable_state_for_object(), Slic3r::GUI::ObjectList::update_selections(), Slic3r::GUI::GLCanvas3D::update_sequential_clearance(), and Slic3r::GUI::Selection::update_type().

◆ render()

void Slic3r::GLVolume::render ( )
virtual

Reimplemented in Slic3r::GLWipeTowerVolume.

538{
539 if (!is_active)
540 return;
541
542 GLShaderProgram *shader = GUI::wxGetApp().get_current_shader();
543 if (shader == nullptr)
544 return;
545
546 ModelObjectPtrs &model_objects = GUI::wxGetApp().model().objects;
547 std::vector<ColorRGBA> colors = GUI::wxGetApp().plater()->get_extruders_colors();
548
549 simple_render(shader, model_objects, colors);
550}
void simple_render(GLShaderProgram *shader, ModelObjectPtrs &model_objects, std::vector< ColorRGBA > &extruder_colors, bool ban_light=false, bool ban_color_volume=false)
Definition 3DScene.cpp:706
std::vector< ModelObject * > ModelObjectPtrs
Definition CutUtils.hpp:13

References simple_render().

Referenced by Slic3r::GUI::GLCanvas3D::LayersEditing::render_volumes().

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

◆ render_sinking_contours()

void Slic3r::GLVolume::render_sinking_contours ( )
830{
831 if (!is_active)
832 return;
833 m_sinking_contours.render();
834}

References m_sinking_contours.

◆ render_with_outline()

void Slic3r::GLVolume::render_with_outline ( const GUI::Size & cnv_size)
virtual

Reimplemented in Slic3r::GLWipeTowerVolume.

554{
555 if (!is_active)
556 return;
557
558 GLShaderProgram *shader = GUI::wxGetApp().get_current_shader();
559 if (shader == nullptr)
560 return;
561
562 ModelObjectPtrs &model_objects = GUI::wxGetApp().model().objects;
563 std::vector<ColorRGBA> colors = GUI::wxGetApp().plater()->get_extruders_colors();
564
566 if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Unknown) {
567 // No supported, degrade to normal rendering
568 simple_render(shader, model_objects, colors);
569 return;
570 }
571 // 0th. render pass, render the model using stencil buffer
573 glsafe(::glStencilMask(0xFF));
577 glsafe(::glStencilFunc(GL_ALWAYS, 0xFF, 0xFF));
578 // This pass paints the visible surface, so it must go through simple_render() to keep
579 // per-triangle MMU paint colors; the later is_outline passes only draw the flat silhouette
580 // highlight and are fine using the single-color model.
581 simple_render(shader, model_objects, colors);
582 glsafe(::glStencilFunc(GL_NOTEQUAL, 0xFF, 0xFF));
583 glsafe(::glStencilMask(0x00));
584 shader->set_uniform("is_outline", true);
585 shader->set_uniform("screen_size", Vec2f{cnv_size.get_width(), cnv_size.get_height()});
586 if (tverts_range == std::make_pair<size_t, size_t>(0, -1))
587 model.render(shader);
588 else
589 model.render(this->tverts_range, shader);
590 shader->set_uniform("is_outline", false);
591 glsafe(::glStencilMask(0xFF));
593 // render the outline using depth buffer and discard the pixels that are not on the outline
594 // The silhouette is resolved per sample in the shader (see DetectSilho in gouraud.fs/phong.fs).
595 // That needs the GL 3.2 entry points and a shader that declares depth_tex as sampler2DMS, which
596 // only the 140 ones do and only under GL_ARB_texture_multisample - so ask the compiled program
597 // rather than the GL version, or a sampler2D ends up bound to a multisample texture.
598 // Only the Arb branch below allocates a multisample texture, so keep the target consistent with it.
599 const bool use_msaa_outline = framebuffers_type == GUI::OpenGLManager::EFramebufferType::Arb &&
600 GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 2) &&
601 shader->get_uniform_location("msaa_samples") >= 0;
602 const GLenum depth_tex_target = use_msaa_outline ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
603 // Keep the depth texture off image unit 0. The object shaders leave shadow_map (and
604 // environment_tex) at the default sampler value 0 whenever the shadow pass is skipped - which is
605 // the case with realistic view off - and GL forbids two sampler types referring to the same image
606 // unit. A sampler2DMS on unit 0 then makes every draw fail with INVALID_OPERATION on drivers that
607 // enforce it (Mesa), i.e. the model disappears entirely. Unit 5 is unused (shadow_map takes 4).
608 const int depth_tex_unit = OUTLINE_DEPTH_TEX_UNIT;
609 int aa_samples = 1;
610 if (use_msaa_outline) {
611 if (const AppConfig* app_config = GUI::wxGetApp().app_config; app_config != nullptr) {
612 const std::string value = app_config->get(SETTING_OPENGL_AA_SAMPLES);
613 if (value == "2" || value == "4" || value == "8" || value == "16")
614 aa_samples = ::atoi(value.c_str());
615 }
616 // Never request more samples than the driver supports for depth textures (a 1-sample texture
617 // is used when MSAA is disabled, keeping a single code path for the sampler2DMS shader).
618 GLint max_samples = 1;
620 if (aa_samples > max_samples)
621 aa_samples = max_samples < 1 ? 1 : max_samples;
622 if (aa_samples < 1)
623 aa_samples = 1;
624 }
625 // 1st. render pass, render the model into a separate render target that has only depth buffer
626 GLuint depth_fbo = 0;
627 GLuint depth_tex = 0;
628 if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Arb) {
629 glsafe(::glGenFramebuffers(1, &depth_fbo));
631
632 glsafe(::glActiveTexture(GL_TEXTURE0 + depth_tex_unit));
633 glsafe(::glGenTextures(1, &depth_tex));
634 glsafe(::glBindTexture(depth_tex_target, depth_tex));
635 if (use_msaa_outline) {
636 // Multisample textures do not take filter/wrap parameters.
637 glsafe(::glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, aa_samples, GL_DEPTH_COMPONENT32F, cnv_size.get_width(), cnv_size.get_height(), GL_TRUE));
638 } else {
643 glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, cnv_size.get_width(), cnv_size.get_height(), 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr));
644 }
645
646 glsafe(::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depth_tex_target, depth_tex, 0));
647 } else {
648 glsafe(::glGenFramebuffersEXT(1, &depth_fbo));
650
651 glsafe(::glActiveTexture(GL_TEXTURE0 + depth_tex_unit));
652 glsafe(::glGenTextures(1, &depth_tex));
658 glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, cnv_size.get_width(), cnv_size.get_height(), 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr));
659
661 }
662 // Unbind before drawing: the texture is this framebuffer's depth attachment, so leaving it bound
663 // to a sampled unit would be a feedback loop.
664 glsafe(::glBindTexture(depth_tex_target, 0));
667 if (tverts_range == std::make_pair<size_t, size_t>(0, -1))
668 model.render(shader);
669 else
670 model.render(this->tverts_range, shader);
671
672 // 2nd. render pass, just a normal render with the depth buffer passed as a texture
673 if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Arb) {
675 } else if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Ext) {
677 }
678 shader->set_uniform("is_outline", true);
679 shader->set_uniform("screen_size", Vec2f{cnv_size.get_width(), cnv_size.get_height()});
680 shader->set_uniform("msaa_samples", aa_samples);
681 glsafe(::glActiveTexture(GL_TEXTURE0 + depth_tex_unit));
682 glsafe(::glBindTexture(depth_tex_target, depth_tex));
684 shader->set_uniform("depth_tex", depth_tex_unit);
685 simple_render(shader, model_objects, colors);
686
687 // Some clean up to do
688 glsafe(::glActiveTexture(GL_TEXTURE0 + depth_tex_unit));
689 glsafe(::glBindTexture(depth_tex_target, 0));
691 shader->set_uniform("is_outline", false);
692 if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Arb) {
694 if (depth_fbo != 0)
695 glsafe(::glDeleteFramebuffers(1, &depth_fbo));
696 } else if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Ext) {
698 if (depth_fbo != 0)
699 glsafe(::glDeleteFramebuffersEXT(1, &depth_fbo));
700 }
701 if (depth_tex != 0)
702 glsafe(::glDeleteTextures(1, &depth_tex));
703}
static constexpr int OUTLINE_DEPTH_TEX_UNIT
Definition 3DScene.cpp:110
#define SETTING_OPENGL_AA_SAMPLES
Definition AppConfig.hpp:34
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
static EFramebufferType get_framebuffers_type()
Definition OpenGLManager.hpp:102
EFramebufferType
Definition OpenGLManager.hpp:21
@ Arb
Definition OpenGLManager.hpp:23
@ Ext
Definition OpenGLManager.hpp:24
@ Unknown
Definition OpenGLManager.hpp:22
#define glDeleteFramebuffersEXT
Definition gl.h:3567
#define GL_TRUE
Definition gl.h:1892
#define GL_ALWAYS
Definition gl.h:230
#define GL_TEXTURE0
Definition gl.h:1705
#define GL_TEXTURE_MIN_FILTER
Definition gl.h:1828
#define GL_DEPTH_ATTACHMENT_EXT
Definition gl.h:555
#define GL_DEPTH_COMPONENT32F
Definition gl.h:565
#define GL_TEXTURE_WRAP_S
Definition gl.h:1854
#define GL_NOTEQUAL
Definition gl.h:1216
#define glEnable
Definition gl.h:3667
#define glFramebufferTexture2D
Definition gl.h:3755
#define GL_LINEAR
Definition gl.h:930
#define GL_STENCIL_TEST
Definition gl.h:1664
#define glBindFramebufferEXT
Definition gl.h:3283
#define glTexParameteri
Definition gl.h:4911
int GLint
Definition gl.h:2062
#define GL_MAX_DEPTH_TEXTURE_SAMPLES
Definition gl.h:1058
#define glStencilOp
Definition gl.h:4783
#define GL_FLOAT
Definition gl.h:660
#define glGenFramebuffersEXT
Definition gl.h:3773
#define glGetIntegerv
Definition gl.h:3873
#define glTexImage2D
Definition gl.h:4895
#define glBindFramebuffer
Definition gl.h:3281
unsigned int GLenum
Definition gl.h:2054
#define glGenTextures
Definition gl.h:3787
#define glStencilFunc
Definition gl.h:4775
#define glBindTexture
Definition gl.h:3299
#define glFramebufferTexture2DEXT
Definition gl.h:3757
#define GL_FRAMEBUFFER
Definition gl.h:708
unsigned int GLuint
Definition gl.h:2063
#define glDeleteFramebuffers
Definition gl.h:3565
#define GL_TEXTURE_2D_MULTISAMPLE
Definition gl.h:1741
#define GL_DEPTH_COMPONENT
Definition gl.h:561
#define glClearStencil
Definition gl.h:3393
#define glTexImage2DMultisample
Definition gl.h:4897
#define GL_STENCIL_BUFFER_BIT
Definition gl.h:1646
#define GL_TEXTURE_WRAP_T
Definition gl.h:1855
#define GL_DEPTH_ATTACHMENT
Definition gl.h:554
#define GL_TEXTURE_MAG_FILTER
Definition gl.h:1822
#define glStencilMask
Definition gl.h:4779
#define GL_TEXTURE_2D
Definition gl.h:1739
#define glDisable
Definition gl.h:3607
#define GL_FRAMEBUFFER_EXT
Definition gl.h:740
#define GL_CLAMP_TO_EDGE
Definition gl.h:322
#define GL_REPLACE
Definition gl.h:1454
#define glDeleteTextures
Definition gl.h:3587
#define GL_DEPTH_BUFFER_BIT
Definition gl.h:558
#define glActiveTexture
Definition gl.h:3245
#define GL_KEEP
Definition gl.h:909
#define glGenFramebuffers
Definition gl.h:3771
#define glClear
Definition gl.h:3357
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:64

References Slic3r::GUI::OpenGLManager::Arb, Slic3r::GUI::OpenGLManager::Ext, Slic3r::GUI::OpenGLManager::get_framebuffers_type(), Slic3r::GUI::Size::get_height(), Slic3r::GLShaderProgram::get_uniform_location(), Slic3r::GUI::Size::get_width(), GL_ALWAYS, GL_CLAMP_TO_EDGE, GL_DEPTH_ATTACHMENT, GL_DEPTH_ATTACHMENT_EXT, GL_DEPTH_BUFFER_BIT, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32F, GL_FLOAT, GL_FRAMEBUFFER, GL_FRAMEBUFFER_EXT, GL_KEEP, GL_LINEAR, GL_MAX_DEPTH_TEXTURE_SAMPLES, GL_NOTEQUAL, GL_REPLACE, GL_STENCIL_BUFFER_BIT, GL_STENCIL_TEST, GL_TEXTURE0, GL_TEXTURE_2D, GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_TRUE, glActiveTexture, glBindFramebuffer, glBindFramebufferEXT, glBindTexture, glClear, glClearStencil, glDeleteFramebuffers, glDeleteFramebuffersEXT, glDeleteTextures, glDisable, glEnable, glFramebufferTexture2D, glFramebufferTexture2DEXT, glGenFramebuffers, glGenFramebuffersEXT, glGenTextures, glGetIntegerv, glsafe, glStencilFunc, glStencilMask, glStencilOp, glTexImage2D, glTexImage2DMultisample, glTexParameteri, model, OUTLINE_DEPTH_TEX_UNIT, Slic3r::GLShaderProgram::set_uniform(), SETTING_OPENGL_AA_SAMPLES, simple_render(), tverts_range, and Slic3r::GUI::OpenGLManager::Unknown.

Here is the call graph for this function:

◆ set_bounding_boxes_as_dirty()

void Slic3r::GLVolume::set_bounding_boxes_as_dirty ( )
inline
375 {
379 }
std::optional< BoundingBoxf3 > m_transformed_non_sinking_bounding_box
Definition 3DScene.hpp:148
std::optional< BoundingBoxf3 > m_transformed_bounding_box
Definition 3DScene.hpp:142
std::optional< BoundingBoxf3 > m_transformed_convex_hull_bounding_box
Definition 3DScene.hpp:146

References m_transformed_bounding_box, m_transformed_convex_hull_bounding_box, and m_transformed_non_sinking_bounding_box.

Referenced by Slic3r::GUI::GLCanvas3D::_render_assemble_control(), Slic3r::GUI::GLCanvas3D::on_mouse_wheel(), set_instance_mirror(), set_instance_mirror(), set_instance_offset(), set_instance_offset(), set_instance_rotation(), set_instance_rotation(), set_instance_scaling_factor(), set_instance_scaling_factor(), set_instance_transformation(), set_instance_transformation(), set_offset_to_assembly(), set_volume_mirror(), set_volume_mirror(), set_volume_offset(), set_volume_offset(), set_volume_rotation(), set_volume_rotation(), set_volume_scaling_factor(), set_volume_scaling_factor(), set_volume_transformation(), and set_volume_transformation().

Here is the caller graph for this function:

◆ set_color()

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

References color.

Referenced by Slic3r::GLVolumeCollection::load_object_volume(), and Slic3r::GUI::GLCanvas3D::reload_scene().

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
338{ m_convex_hull = std::make_shared<const TriangleMesh>(convex_hull); }
const TriangleMesh * convex_hull() const
Definition 3DScene.hpp:361

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
337{ 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(), Slic3r::GLVolumeCollection::load_real_wipe_tower_preview(), Slic3r::GLVolumeCollection::load_wipe_tower_preview(), and Slic3r::GUI::GLCanvas3D::reload_scene().

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
339{ 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
304{ m_instance_transformation.set_mirror(axis, mirror); set_bounding_boxes_as_dirty(); }
void set_bounding_boxes_as_dirty()
Definition 3DScene.hpp:375

References m_instance_transformation, and set_bounding_boxes_as_dirty().

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, and set_bounding_boxes_as_dirty().

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
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582

References m_instance_transformation, Slic3r::offset(), and set_bounding_boxes_as_dirty().

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(), and set_bounding_boxes_as_dirty().

Referenced by Slic3r::GUI::GLCanvas3D::_load_sla_shells(), Slic3r::GUI::GLCanvas3D::ensure_on_bed(), Slic3r::GUI::Selection::move_to_center(), Slic3r::GUI::GizmoObjectManipulation::reset_position_value(), Slic3r::GUI::Selection::translate(), 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
292{ m_instance_transformation.set_rotation(axis, rotation); set_bounding_boxes_as_dirty(); }

References m_instance_transformation, and set_bounding_boxes_as_dirty().

Here is the call graph for this function:

◆ set_instance_rotation() [2/2]

void Slic3r::GLVolume::set_instance_rotation ( const Vec3d & rotation)
inline
291{ m_instance_transformation.set_rotation(rotation); set_bounding_boxes_as_dirty(); }

References m_instance_transformation, and set_bounding_boxes_as_dirty().

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
298{ m_instance_transformation.set_scaling_factor(axis, scaling_factor); set_bounding_boxes_as_dirty(); }

References m_instance_transformation, and set_bounding_boxes_as_dirty().

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
297{ m_instance_transformation.set_scaling_factor(scaling_factor); set_bounding_boxes_as_dirty(); }

References m_instance_transformation, and set_bounding_boxes_as_dirty().

Here is the call graph for this function:

◆ set_instance_transformation() [1/2]

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

◆ set_instance_transformation() [2/2]

void Slic3r::GLVolume::set_instance_transformation ( const Transform3d & transform)
inline
Linef3 transform(const Linef3 &line, const Transform3d &t)
Definition Line.cpp:15

References m_instance_transformation, set_bounding_boxes_as_dirty(), and Slic3r::transform().

Here is the call graph for this function:

◆ set_offset_to_assembly()

void Slic3r::GLVolume::set_offset_to_assembly ( const Vec3d & offset)
inline

References m_offset_to_assembly, Slic3r::offset(), and set_bounding_boxes_as_dirty().

Referenced by Slic3r::GLVolumeCollection::load_object_volume(), and Slic3r::GUI::GLCanvas3D::reload_scene().

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

◆ set_range()

void Slic3r::GLVolume::set_range ( double low,
double high )
509{
510 this->tverts_range.first = 0;
511 this->tverts_range.second = this->model.indices_count();
512
513 if (!this->print_zs.empty()) {
514 // The Z layer range is specified.
515 // First test whether the Z span of this object is not out of (min_z, max_z) completely.
516 if (this->print_zs.front() > max_z || this->print_zs.back() < min_z)
517 this->tverts_range.second = 0;
518 else {
519 // Then find the lowest layer to be displayed.
520 size_t i = 0;
521 for (; i < this->print_zs.size() && this->print_zs[i] < min_z; ++i);
522 if (i == this->print_zs.size())
523 // This shall not happen.
524 this->tverts_range.second = 0;
525 else {
526 // Remember start of the layer.
527 this->tverts_range.first = this->offsets[i];
528 // Some layers are above $min_z. Which?
529 for (; i < this->print_zs.size() && this->print_zs[i] <= max_z; ++i);
530 if (i < this->print_zs.size())
531 this->tverts_range.second = this->offsets[i];
532 }
533 }
534 }
535}

References model, offsets, print_zs, and tverts_range.

◆ set_render_color() [1/2]

void Slic3r::GLVolume::set_render_color ( )
332{
333 bool outside = is_outside || is_below_printbed();
334
335 if (force_native_color || force_neutral_color) {
336#ifdef ENABBLE_OUTSIDE_COLOR
337 if (outside && shader_outside_printer_detection_enabled)
338 set_render_color(OUTSIDE_COLOR);
339 else {
340#endif
341 if (force_native_color)
343 else
345#ifdef ENABLE_OUTSIDE_COLOR
346 }
347#endif
348 }
349 else {
350 /* BBS
351 if (hover == HS_Select)
352 set_render_color(HOVER_SELECT_COLOR);
353 else if (hover == HS_Deselect)
354 set_render_color(HOVER_DESELECT_COLOR);
355 else if (selected)
356 set_render_color(outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR);
357 else if (disabled)
358 */
359 // Determine base color first
360 ColorRGBA base_color;
361
362 if (disabled) {
363 base_color = DISABLED_COLOR;
364 }
365#ifdef ENABLE_OUTSIDE_COLOR
366 else if (is_outside && shader_outside_printer_detection_enabled) {
367 base_color = OUTSIDE_COLOR;
368 }
369#endif
370 else {
371 // to make black not too hard too see
372 base_color = adjust_color_for_rendering(color);
373 }
374
375 // Apply selection brightening AFTER determining base color
376 if (selected && !disabled) {
377 set_render_color(brighten_color(base_color, 1.25f));
378 }
379 else {
380 set_render_color(base_color);
381 }
382 }
383
384 if (force_transparent) {
387 } else {
388 render_color.a(color.a());
389 }
390 }
391
392 //BBS set unprintable color
393 if (!printable) {
394 if (selected) {
396 } else {
398 }
399 }
400
401 //BBS set invisible color
402 if (!visible) {
404 }
405}
float FullTransparentModdifiedToFixAlpha
Definition 3DScene.cpp:102
Slic3r::ColorRGBA adjust_color_for_rendering(const Slic3r::ColorRGBA &colors)
Definition 3DScene.cpp:112
float FullyTransparentMaterialThreshold
Definition 3DScene.cpp:101
static ColorRGBA MODEL_HIDDEN_COL
Definition 3DScene.hpp:104
static ColorRGBA brighten_color(const ColorRGBA &color, float multiplier=1.25f)
Definition 3DScene.cpp:240
bool is_below_printbed() const
Definition 3DScene.cpp:824
ColorRGBA render_color
Definition 3DScene.hpp:172
@ outside
Definition CutSurface.cpp:237

References adjust_color_for_rendering(), brighten_color(), color, DISABLED_COLOR, FullTransparentModdifiedToFixAlpha, FullyTransparentMaterialThreshold, is_below_printbed(), MODEL_HIDDEN_COL, NEUTRAL_COLOR, render_color, set_render_color(), and UNPRINTABLE_COLOR.

Referenced by GLVolume(), and set_render_color().

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

◆ set_render_color() [2/2]

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

References render_color.

Referenced by Slic3r::GUI::GLCanvas3D::_render_below_plate_volumes(), Slic3r::GUI::Selection::clear(), and Slic3r::GUI::GCodeViewer::load_shells().

Here is the caller graph for this function:

◆ set_sla_shift_z()

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

References m_sla_shift_z.

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

Here is the caller graph for this function:

◆ set_volume_mirror() [1/2]

void Slic3r::GLVolume::set_volume_mirror ( Axis axis,
double mirror )
inline
332{ m_volume_transformation.set_mirror(axis, mirror); set_bounding_boxes_as_dirty(); }

References m_volume_transformation, and set_bounding_boxes_as_dirty().

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, and set_bounding_boxes_as_dirty().

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(), and set_bounding_boxes_as_dirty().

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(), and set_bounding_boxes_as_dirty().

Referenced by Slic3r::GUI::Selection::ensure_not_below_bed(), Slic3r::GLVolumeCollection::load_real_wipe_tower_preview(), Slic3r::GUI::GCodeViewer::load_shells(), Slic3r::GLVolumeCollection::load_wipe_tower_preview(), Slic3r::GUI::Selection::move_to_center(), Slic3r::GUI::GizmoObjectManipulation::reset_position_value(), Slic3r::GUI::Selection::translate(), 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
320{ m_volume_transformation.set_rotation(axis, rotation); set_bounding_boxes_as_dirty(); }

References m_volume_transformation, and set_bounding_boxes_as_dirty().

Here is the call graph for this function:

◆ set_volume_rotation() [2/2]

void Slic3r::GLVolume::set_volume_rotation ( const Vec3d & rotation)
inline
319{ m_volume_transformation.set_rotation(rotation); set_bounding_boxes_as_dirty(); }

References m_volume_transformation, and set_bounding_boxes_as_dirty().

Referenced by Slic3r::GLVolumeCollection::load_real_wipe_tower_preview(), and 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
326{ m_volume_transformation.set_scaling_factor(axis, scaling_factor); set_bounding_boxes_as_dirty(); }

References m_volume_transformation, and set_bounding_boxes_as_dirty().

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
325{ m_volume_transformation.set_scaling_factor(scaling_factor); set_bounding_boxes_as_dirty(); }

References m_volume_transformation, and set_bounding_boxes_as_dirty().

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::face_selected_volume_to_camera(), Slic3r::GLVolumeCollection::load_object_volume(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::GizmoObjectManipulation::reset_rotation_value(), Slic3r::GUI::Selection::rotate(), Slic3r::GUI::selection_transform(), Slic3r::GUI::Selection::synchronize_unselected_volumes(), and Slic3r::GUI::Selection::transform_volume_relative().

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(), and Slic3r::transform().

Here is the call graph for this function:

◆ simple_render()

void Slic3r::GLVolume::simple_render ( GLShaderProgram * shader,
ModelObjectPtrs & model_objects,
std::vector< ColorRGBA > & extruder_colors,
bool ban_light = false,
bool ban_color_volume = false )
707{
708 if (this->is_left_handed())
711
712 bool color_volume = false;
713 ModelObject* model_object = nullptr;
714 ModelVolume* model_volume = nullptr;
715 do {
716 if ((!printable) || object_idx() >= model_objects.size())
717 break;
718 model_object = model_objects[object_idx()];
719
720 if (volume_idx() >= model_object->volumes.size())
721 break;
722 model_volume = model_object->volumes[volume_idx()];
723 if (model_volume->mmu_segmentation_facets.empty())
724 break;
725
726 color_volume = true;
727 if (model_volume->mmu_segmentation_facets.timestamp() != mmuseg_ts) {
728 mmuseg_models.clear();
729 std::vector<indexed_triangle_set> its_per_color;
730 model_volume->mmu_segmentation_facets.get_facets(*model_volume, its_per_color);
731 mmuseg_models.resize(its_per_color.size());
732 for (int idx = 0; idx < its_per_color.size(); idx++) {
733 mmuseg_models[idx].init_from(its_per_color[idx]);
734 }
735
736 mmuseg_ts = model_volume->mmu_segmentation_facets.timestamp();
737 }
738 } while (0);
739
740 if (color_volume && !picking && !ban_color_volume) {
741 const bool brighten_selected = selected && !disabled && !force_native_color && !force_neutral_color;
742
743 // when force_transparent, we need to keep the alpha
744 if (force_native_color && render_color.is_transparent()) {
745 for (auto &extruder_color : extruder_colors)
746 extruder_color.a(render_color.a());
747 }
748
749 for (int idx = 0; idx < mmuseg_models.size(); idx++) {
750 GUI::GLModel &m = mmuseg_models[idx];
751 if (!m.is_initialized())
752 continue;
753
754 if (shader) {
755 if (idx == 0) {
756 int extruder_id = model_volume->extruder_id();
757 // ORCA: extruder_id may be 0 (unset) or point past the colour list after a
758 // filament is deleted/remapped, so clamp the index instead of reading out of
759 // bounds.
760 if (!extruder_colors.empty()) {
761 int color_idx = std::clamp(extruder_id - 1, 0, int(extruder_colors.size()) - 1);
762 //to make black not too hard too see
763 ColorRGBA new_color = adjust_color_for_rendering(extruder_colors[color_idx]);
764 if (brighten_selected)
765 new_color = brighten_color(new_color, 1.25f);
766 if (ban_light) {
767 new_color[3] = (255 - color_idx)/255.0f;
768 }
769 m.set_color(new_color);
770 // shader->set_uniform("uniform_color", new_color);
771 }
772 }
773 else {
774 if (idx <= extruder_colors.size()) {
775 //to make black not too hard too see
776 ColorRGBA new_color = adjust_color_for_rendering(extruder_colors[idx - 1]);
777 if (brighten_selected)
778 new_color = brighten_color(new_color, 1.25f);
779 if (ban_light) {
780 new_color[3] = (255 - (idx - 1))/255.0f;
781 }
782 m.set_color(new_color);
783 // shader->set_uniform("uniform_color", new_color);
784 }
785 else {
786 //to make black not too hard too see
787 ColorRGBA new_color = adjust_color_for_rendering(extruder_colors[0]);
788 if (brighten_selected)
789 new_color = brighten_color(new_color, 1.25f);
790 if (ban_light) {
791 new_color[3] = (255 - 0) / 255.0f;
792 }
793 m.set_color(new_color);
794 // shader->set_uniform("uniform_color", new_color);
795 }
796 }
797 }
798 if (tverts_range == std::make_pair<size_t, size_t>(0, -1))
799 m.render(shader);
800 else
801 m.render(this->tverts_range, shader);
802 }
803 } else {
804 if (tverts_range == std::make_pair<size_t, size_t>(0, -1))
805 model.render(shader);
806 else
807 model.render(this->tverts_range, shader);
808 }
809 if (this->is_left_handed())
811}
bool is_left_handed() const
Definition 3DScene.cpp:458
std::vector< GUI::GLModel > mmuseg_models
Definition 3DScene.hpp:254
int volume_idx() const
Definition 3DScene.hpp:345
int object_idx() const
Definition 3DScene.hpp:344
#define glCullFace
Definition gl.h:3555
#define GL_CW
Definition gl.h:520
#define GL_BACK
Definition gl.h:266
#define GL_CCW
Definition gl.h:317
#define glFrontFace
Definition gl.h:3765

References adjust_color_for_rendering(), brighten_color(), Slic3r::FacetsAnnotation::empty(), extruder_id, Slic3r::ModelVolume::extruder_id(), Slic3r::FacetsAnnotation::get_facets(), GL_BACK, GL_CCW, GL_CW, glCullFace, glFrontFace, glsafe, Slic3r::GUI::GLModel::is_initialized(), is_left_handed(), Slic3r::ModelVolume::mmu_segmentation_facets, mmuseg_models, mmuseg_ts, model, object_idx(), Slic3r::GUI::GLModel::render(), render_color, Slic3r::GUI::GLModel::set_color(), Slic3r::ObjectWithTimestamp::timestamp(), tverts_range, volume_idx(), and Slic3r::ModelObject::volumes.

Referenced by Slic3r::GUI::GLCanvas3D::_render_below_plate_volumes(), render(), and render_with_outline().

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

◆ total_memory_used()

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

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
466{
468 const BoundingBoxf3& box = bounding_box();
469 assert(box.defined || box.min.x() >= box.max.x() || box.min.y() >= box.max.y() || box.min.z() >= box.max.z());
470 std::optional<BoundingBoxf3>* trans_box = const_cast<std::optional<BoundingBoxf3>*>(&m_transformed_bounding_box);
471 *trans_box = box.transformed(world_matrix());
473 }
475}
static float last_explosion_ratio
Definition 3DScene.hpp:118
Transform3d world_matrix() const
Definition 3DScene.cpp:447
BoundingBoxf3 bounding_box() const
Definition 3DScene.hpp:267
static float explosion_ratio
Definition 3DScene.hpp:117

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

Referenced by Slic3r::GUI::GLCanvas3D::_render_section_view_caps(), Slic3r::GUI::GLCanvas3D::_render_shadows(), Slic3r::GUI::DesignSketchTool::fit_box(), Slic3r::GUI::GCodeViewer::load_shells(), Slic3r::GUI::GLCanvas3D::Labels::render(), and Slic3r::GUI::GLCanvas3D::volumes_bounding_box().

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

◆ transformed_convex_hull_bounding_box() [1/2]

const BoundingBoxf3 & Slic3r::GLVolume::transformed_convex_hull_bounding_box ( ) const
478{
480 std::optional<BoundingBoxf3>* trans_box = const_cast<std::optional<BoundingBoxf3>*>(&m_transformed_convex_hull_bounding_box);
482 }
484}

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
487{
488 return (m_convex_hull && ! m_convex_hull->empty()) ?
489 m_convex_hull->transformed_bounding_box(trafo) :
490 bounding_box().transformed(trafo);
491}
BoundingBoxf3 transformed(const Transform3d &matrix) const
Definition BoundingBox.cpp:261

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

Referenced by Slic3r::GUI::GLCanvas3D::_update_inactive_plates_visibility(), Slic3r::GUI::GLGizmoCut3D::bounding_box(), Slic3r::GUI::GLGizmoPainterBase::bounding_box(), Slic3r::GUI::Selection::ensure_not_below_bed(), Slic3r::GUI::GLCanvas3D::ensure_on_bed(), Slic3r::GUI::Selection::ensure_on_bed(), Slic3r::GUI::Selection::get_full_scaled_instance_bounding_box(), Slic3r::GUI::Selection::get_full_unscaled_instance_bounding_box(), Slic3r::GUI::Selection::get_full_unscaled_instance_local_bounding_box(), Slic3r::GUI::Selection::get_scaled_instance_bounding_box(), Slic3r::GUI::Selection::get_unscaled_instance_bounding_box(), Slic3r::GUI::GLCanvas3D::CenterOfMass::model_markers(), Slic3r::GUI::GLGizmoMeshBoolean::on_render(), Slic3r::GUI::Selection::render_synchronized_volumes(), Slic3r::GUI::GLGizmoCut3D::transformed_bounding_box(), Slic3r::GUI::GLCanvas3D::update_compacted_wipe_tower_clearance(), Slic3r::GUI::GLGizmoPainterBase::update_contours(), and Slic3r::GUI::anonymous_namespace{GLGizmoAlignment.cpp}::volume_box_in_frame().

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
499{
501 std::optional<BoundingBoxf3>* trans_box = const_cast<std::optional<BoundingBoxf3>*>(&m_transformed_non_sinking_bounding_box);
502 const Transform3d& trafo = world_matrix();
503 *trans_box = transformed_non_sinking_bounding_box(trafo);
504 }
506}
const BoundingBoxf3 & transformed_non_sinking_bounding_box() const
Definition 3DScene.cpp:498
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96

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
494{
495 return GUI::wxGetApp().plater()->model().objects[object_idx()]->volumes[volume_idx()]->mesh().transformed_bounding_box(trafo, 0.0);
496}

References object_idx(), and volume_idx().

Here is the call graph for this function:

◆ update_render_colors()

void Slic3r::GLVolume::update_render_colors ( )
static

References Slic3r::RenderColor::colors, DISABLED_COLOR, Slic3r::GUI::ImGuiWrapper::from_ImVec4(), MODEL_COLOR, NEUTRAL_COLOR, RenderCol_Model_Disable, RenderCol_Model_Neutral, RenderCol_Model_Unprintable, RenderCol_Modifier, RenderCol_Negtive_Volume, RenderCol_Support_Blocker, RenderCol_Support_Enforcer, and UNPRINTABLE_COLOR.

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

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

◆ volume_idx()

int Slic3r::GLVolume::volume_idx ( ) const
inline
345{ return this->composite_id.volume_id; }

References Slic3r::GLVolume::CompositeID::volume_id.

Referenced by Slic3r::GUI::GLCanvas3D::_render_below_plate_volumes(), Slic3r::GUI::GLCanvas3D::_render_section_view_caps(), Slic3r::GUI::GLCanvas3D::_update_selection_from_hover(), Slic3r::GUI::Selection::add(), Slic3r::GUI::Plater::priv::can_reload_from_disk(), Slic3r::GUI::Selection::copy_to_clipboard(), Slic3r::GUI::GLGizmoAlignment::distribute_objects_generic(), Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), anonymous_namespace{SurfaceDrag.cpp}::dragging(), Slic3r::GUI::Selection::erase(), Slic3r::GUI::Plater::export_stl(), Slic3r::GUI::Selection::get_bounding_box_in_reference_system(), Slic3r::GUI::Selection::get_bounding_sphere(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::GLGizmoAlignment::get_selected_part_volumes(), Slic3r::GUI::Selection::get_selected_single_volume(), Slic3r::GUI::Plater::priv::get_selected_volume_idx(), Slic3r::GUI::Selection::get_volume_idxs_from_volume(), Slic3r::GUI::Selection::is_single_full_instance(), Slic3r::GUI::Selection::is_single_text(), Slic3r::GUI::GLCanvas3D::CenterOfMass::model_markers(), Slic3r::GUI::GLCanvas3D::on_mouse(), Slic3r::GUI::GLGizmoMeshBoolean::on_render(), Slic3r::GUI::GLGizmoMeasure::register_single_mesh_pick(), Slic3r::GUI::Plater::priv::reload_from_disk(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::Selection::remove_volume(), Slic3r::GUI::Selection::render_synchronized_volumes(), Slic3r::GUI::Plater::priv::replace_all_with_stl(), Slic3r::GUI::Plater::priv::replace_with_stl(), Slic3r::GUI::Selection::rotate(), Slic3r::GUI::Plater::priv::set_current_panel(), simple_render(), Slic3r::GUI::Selection::synchronize_unselected_volumes(), transformed_non_sinking_bounding_box(), and Slic3r::GUI::Selection::translate().

Here is the caller graph for this function:

◆ world_matrix()

Transform3d Slic3r::GLVolume::world_matrix ( ) const
448{
449 Transform3d m = m_instance_transformation.get_matrix() * m_volume_transformation.get_matrix();
451 Vec3d volofs2obj = m_volume_transformation.get_offset() * (GLVolume::explosion_ratio - 1.0);
452
453 m.translation()(2) += m_sla_shift_z;
454 m.translate(ofs2ass + volofs2obj);
455 return m;
456}

References explosion_ratio, m_instance_transformation, m_offset_to_assembly, m_sla_shift_z, and m_volume_transformation.

Referenced by Slic3r::GUI::GLCanvas3D::_render_below_plate_volumes(), Slic3r::GUI::GLCanvas3D::_render_section_view_caps(), Slic3r::GUI::GLCanvas3D::_render_shadows(), Slic3r::GUI::GLCanvas3D::_shadow_casters_signature(), Slic3r::GUI::calc_angle(), Slic3r::GUI::calc_distance(), Slic3r::GUI::GLGizmoSVG::calculate_scale(), Slic3r::GUI::face_selected_volume_to_camera(), Slic3r::GUI::Selection::get_bounding_box_in_reference_system(), Slic3r::GUI::Selection::get_bounding_sphere(), Slic3r::GUI::GLGizmoCut3D::has_valid_groove(), Slic3r::GUI::GLCanvas3D::CenterOfMass::model_markers(), Slic3r::GUI::GLGizmoEmboss::on_render(), Slic3r::GUI::GLGizmoSimplify::on_render(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::Selection::render_synchronized_volumes(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_volumes(), transformed_bounding_box(), transformed_convex_hull_bounding_box(), transformed_non_sinking_bounding_box(), Slic3r::GUI::GizmoObjectManipulation::update_settings_value(), Slic3r::GUI::anonymous_namespace{GLGizmoAlignment.cpp}::volume_box_in_frame(), and Slic3r::GUI::world_matrix_fixed().

Here is the caller graph for this function:

Member Data Documentation

◆ [struct]

struct { ... } Slic3r::GLVolume

◆ color

◆ composite_id

◆ DISABLED_COLOR

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

◆ explosion_ratio

◆ extruder_id

◆ geometry_id

◆ hover

◆ last_explosion_ratio

float Slic3r::GLVolume::last_explosion_ratio = 1.0
static

◆ m_convex_hull

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

◆ m_instance_transformation

◆ m_offset_to_assembly

Vec3d Slic3r::GLVolume::m_offset_to_assembly { 0.0, 0.0, 0.0 }
protected
137{ 0.0, 0.0, 0.0 };

Referenced by get_offset_to_assembly(), set_offset_to_assembly(), and world_matrix().

◆ m_sinking_contours

SinkingContours Slic3r::GLVolume::m_sinking_contours
protected

◆ m_sla_shift_z

double Slic3r::GLVolume::m_sla_shift_z
protected

◆ m_transformed_bounding_box

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

◆ m_transformed_convex_hull_bounding_box

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

◆ m_transformed_non_sinking_bounding_box

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

◆ m_volume_transformation

◆ mesh_raycaster

◆ mmuseg_models

std::vector<GUI::GLModel> Slic3r::GLVolume::mmuseg_models
mutable

Referenced by simple_render().

◆ mmuseg_ts

ObjectBase::Timestamp Slic3r::GLVolume::mmuseg_ts
mutable

Referenced by GLVolume(), and simple_render().

◆ model

◆ MODEL_COLOR

std::array< ColorRGBA, 5 > Slic3r::GLVolume::MODEL_COLOR
static
Initial value:
= { {
{ 1.0f, 1.0f, 0.0f, 1.f },
{ 1.0f, 0.5f, 0.5f, 1.f },
{ 0.5f, 1.0f, 0.5f, 1.f },
{ 0.5f, 0.5f, 1.0f, 1.f },
{ 1.0f, 1.0f, 0.0f, 1.f }
} }

Referenced by Slic3r::GUI::GLCanvas3D::_load_sla_shells(), Slic3r::GLVolumeCollection::load_object_volume(), load_render_colors(), and update_render_colors().

◆ MODEL_HIDDEN_COL

ColorRGBA Slic3r::GLVolume::MODEL_HIDDEN_COL = {0.f, 0.f, 0.f, 0.3f}
static

◆ MODEL_MIDIFIER_COL

ColorRGBA Slic3r::GLVolume::MODEL_MIDIFIER_COL = {1.0f, 1.0f, 0.0f, 0.6f}
static

◆ MODEL_NEGTIVE_COL

ColorRGBA Slic3r::GLVolume::MODEL_NEGTIVE_COL = {0.3f, 0.3f, 0.3f, 0.4f}
static

◆ model_object_ID

size_t Slic3r::GLVolume::model_object_ID {0}

◆ name

std::string Slic3r::GLVolume::name

◆ NEUTRAL_COLOR

◆ offsets

std::vector<size_t> Slic3r::GLVolume::offsets

◆ PRECISE_SEAM_BLOCKED_COL

ColorRGBA Slic3r::GLVolume::PRECISE_SEAM_BLOCKED_COL = {0.820f, 0.412f, 0.412f, 0.6f}
static

◆ PRECISE_SEAM_CENTER_COL

ColorRGBA Slic3r::GLVolume::PRECISE_SEAM_CENTER_COL = {1.0f, 0.627f, 0.082f, 0.6f}
static

◆ PRECISE_SEAM_ENFORCED_COL

ColorRGBA Slic3r::GLVolume::PRECISE_SEAM_ENFORCED_COL = {0.412f, 0.820f, 0.412f, 0.6f}
static

◆ PRECISE_SEAM_LEFT_COL

ColorRGBA Slic3r::GLVolume::PRECISE_SEAM_LEFT_COL = {1.0f, 0.753f, 0.0f, 0.6f}
static

◆ PRECISE_SEAM_NEUTRAL_COL

ColorRGBA Slic3r::GLVolume::PRECISE_SEAM_NEUTRAL_COL = {0.655f, 0.655f, 0.655f, 0.6f}
static

◆ PRECISE_SEAM_RIGHT_COL

ColorRGBA Slic3r::GLVolume::PRECISE_SEAM_RIGHT_COL = {1.0f, 0.514f, 0.0f, 0.6f}
static

◆ print_zs

std::vector<coordf_t> Slic3r::GLVolume::print_zs

Referenced by set_range().

◆ render_color

◆ SLA_PAD_COLOR

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

◆ SLA_SUPPORT_COLOR

◆ SUPPORT_BLOCKER_COL

ColorRGBA Slic3r::GLVolume::SUPPORT_BLOCKER_COL = {1.0f, 0.3f, 0.3f, 0.4f}
static

◆ SUPPORT_ENFORCER_COL

ColorRGBA Slic3r::GLVolume::SUPPORT_ENFORCER_COL = {0.3f, 0.3f, 1.0f, 0.4f}
static

◆ tverts_range

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

◆ UNPRINTABLE_COLOR


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/3DScene.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/3DScene.cpp