Performance improvements:

Lazy "Place on face" gizmo update.
Caching of MeshObject::raw_mesh_bounding_box() for the object size display.
ModelObject::bounding_box(), raw_mesh_bounding_box(), full_raw_mesh_bounding_box() will not copy the mesh.
TriangleMesh::transformed_bounding_box(const Transform3d &trafo) will not copy the mesh data.
get_options_for_bundle() will not return reference to temp value
is_splittable() calls cheap mesh.has_multiple_patches()
This commit is contained in:
bubnikv 2019-01-26 18:51:34 +01:00
parent 48d64b0842
commit 588c07c12a
10 changed files with 76 additions and 108 deletions

View file

@ -205,7 +205,7 @@ public:
// This bounding box is approximate and not snug.
// This bounding box is being cached.
const BoundingBoxf3& bounding_box() const;
void invalidate_bounding_box() { m_bounding_box_valid = false; }
void invalidate_bounding_box() { m_bounding_box_valid = false; m_raw_mesh_bounding_box_valid = false; }
// A mesh containing all transformed instances of this object.
TriangleMesh mesh() const;
@ -219,10 +219,10 @@ public:
BoundingBoxf3 raw_bounding_box() const;
// A snug bounding box around the transformed non-modifier object volumes.
BoundingBoxf3 instance_bounding_box(size_t instance_idx, bool dont_translate = false) const;
#if ENABLE_VOLUMES_CENTERING_FIXES
// Bounding box of non-transformed (non-rotated, non-scaled, non-translated) sum of all object volumes.
// A snug bounding box of non-transformed (non-rotated, non-scaled, non-translated) sum of non-modifier object volumes.
BoundingBoxf3 raw_mesh_bounding_box() const;
// A snug bounding box of non-transformed (non-rotated, non-scaled, non-translated) sum of all object volumes.
BoundingBoxf3 full_raw_mesh_bounding_box() const;
#endif // ENABLE_VOLUMES_CENTERING_FIXES
void center_around_origin();
void ensure_on_bed();
void translate_instances(const Vec3d& vector);
@ -261,7 +261,8 @@ protected:
void set_model(Model *model) { m_model = model; }
private:
ModelObject(Model *model) : m_model(model), origin_translation(Vec3d::Zero()), m_bounding_box_valid(false) {}
ModelObject(Model *model) : m_model(model), origin_translation(Vec3d::Zero()),
m_bounding_box_valid(false), m_raw_mesh_bounding_box_valid(false) {}
~ModelObject();
/* To be able to return an object from own copy / clone methods. Hopefully the compiler will do the "Copy elision" */
@ -280,6 +281,8 @@ private:
// Bounding box, cached.
mutable BoundingBoxf3 m_bounding_box;
mutable bool m_bounding_box_valid;
mutable BoundingBoxf3 m_raw_mesh_bounding_box;
mutable bool m_raw_mesh_bounding_box_valid;
};
// An object STL, or a modifier volume, over which a different set of parameters shall be applied.