Do not generate volumes' raycaster for preview

This commit is contained in:
enricoturri1966 2022-12-12 08:27:19 +01:00
parent 0d512a4256
commit 2bcb62d447
3 changed files with 10 additions and 6 deletions

View file

@ -437,9 +437,9 @@ std::vector<int> GLVolumeCollection::load_object(
int GLVolumeCollection::load_object_volume(
const ModelObject* model_object,
int obj_idx,
int volume_idx,
int instance_idx)
int obj_idx,
int volume_idx,
int instance_idx)
{
const ModelVolume *model_volume = model_object->volumes[volume_idx];
const int extruder_id = model_volume->extruder_id();
@ -452,10 +452,12 @@ int GLVolumeCollection::load_object_volume(
v.printable = instance->printable;
#if ENABLE_SMOOTH_NORMALS
v.model.init_from(*mesh, true);
v.mesh_raycaster = std::make_unique<GUI::MeshRaycaster>(mesh);
if (m_use_raycasters)
v.mesh_raycaster = std::make_unique<GUI::MeshRaycaster>(mesh);
#else
v.model.init_from(*mesh);
v.mesh_raycaster = std::make_unique<GUI::MeshRaycaster>(mesh);
if (m_use_raycasters)
v.mesh_raycaster = std::make_unique<GUI::MeshRaycaster>(mesh);
#endif // ENABLE_SMOOTH_NORMALS
v.composite_id = GLVolume::CompositeID(obj_idx, volume_idx, instance_idx);
if (model_volume->is_model_part()) {

View file

@ -397,6 +397,7 @@ private:
Slope m_slope;
bool m_show_sinking_contours{ false };
bool m_show_non_manifold_edges{ true };
bool m_use_raycasters{ true };
public:
GLVolumePtrs volumes;
@ -445,6 +446,7 @@ public:
bool empty() const { return volumes.empty(); }
void set_range(double low, double high) { for (GLVolume* vol : this->volumes) vol->set_range(low, high); }
void set_use_raycasters(bool value) { m_use_raycasters = value; }
void set_print_volume(const PrintVolume& print_volume) { m_print_volume = print_volume; }
void set_z_range(float min_z, float max_z) { m_z_range[0] = min_z; m_z_range[1] = max_z; }

View file

@ -643,7 +643,7 @@ const ColorRGBA GCodeViewer::Neutral_Color = ColorRGBA::DARK_GRAY();
GCodeViewer::GCodeViewer()
{
m_extrusions.reset_role_visibility_flags();
m_shells.volumes.set_use_raycasters(false);
// m_sequential_view.skip_invisible_moves = true;
}