Partial update of 3D scene (GLVolumes derived from Model and from

the SLAPrintObject).
Updated PrintBase to generate a unique timestamp at each step invalidation.
This commit is contained in:
bubnikv 2018-11-16 18:28:50 +01:00
parent a468078df3
commit c9a4c6c73c
15 changed files with 670 additions and 373 deletions

View file

@ -293,15 +293,25 @@ public:
float color[4];
// Color used to render this volume.
float render_color[4];
// Object ID, which is equal to the index of the respective ModelObject in Model.objects array.
int object_id;
// Volume ID, which is equal to the index of the respective ModelVolume in ModelObject.volumes array.
// If negative, it is an index of a geometry produced by the PrintObject for the respective ModelObject,
// and which has no associated ModelVolume in ModelObject.volumes. For example, SLA supports.
// Volume with a negative volume_id cannot be picked independently, it will pick the associated instance.
int volume_id;
// Instance ID, which is equal to the index of the respective ModelInstance in ModelObject.instances array.
int instance_id;
struct CompositeID {
CompositeID(int object_id, int volume_id, int instance_id) : object_id(object_id), volume_id(volume_id), instance_id(instance_id) {}
CompositeID() : object_id(-1), volume_id(-1), instance_id(-1) {}
// Object ID, which is equal to the index of the respective ModelObject in Model.objects array.
int object_id;
// Volume ID, which is equal to the index of the respective ModelVolume in ModelObject.volumes array.
// If negative, it is an index of a geometry produced by the PrintObject for the respective ModelObject,
// and which has no associated ModelVolume in ModelObject.volumes. For example, SLA supports.
// Volume with a negative volume_id cannot be picked independently, it will pick the associated instance.
int volume_id;
// Instance ID, which is equal to the index of the respective ModelInstance in ModelObject.instances array.
int instance_id;
};
CompositeID composite_id;
// Fingerprint of the source geometry. For ModelVolumes, it is the ModelVolume::ID and ModelInstanceID,
// for generated volumes it is the timestamp generated by PrintState::invalidate() or PrintState::set_done(),
// and the associated ModelInstanceID.
// Valid geometry_id should always be positive.
std::pair<size_t, size_t> geometry_id;
// An ID containing the extruder ID (used to select color).
int extruder_id;
// Is this object selected?
@ -414,9 +424,9 @@ public:
void set_convex_hull(const TriangleMesh& convex_hull);
int object_idx() const { return this->object_id; }
int volume_idx() const { return this->volume_id; }
int instance_idx() const { return this->instance_id; }
int object_idx() const { return this->composite_id.object_id; }
int volume_idx() const { return this->composite_id.volume_id; }
int instance_idx() const { return this->composite_id.instance_id; }
#if ENABLE_MODELVOLUME_TRANSFORM
Transform3d world_matrix() const { return m_instance_transformation.get_matrix() * m_volume_transformation.get_matrix(); }
@ -499,14 +509,24 @@ public:
const std::string &color_by,
bool use_VBOs);
// Load SLA auxiliary GLVolumes (for support trees or pad).
std::vector<int> load_object_auxiliary(
int load_object_volume(
const ModelObject *model_object,
const SLAPrintObject *print_object,
std::shared_ptr<LayersTexture> &layer_height_texture,
int obj_idx,
SLAPrintObjectStep milestone,
int volume_idx,
int instance_idx,
const std::string &color_by,
bool use_VBOs);
// Load SLA auxiliary GLVolumes (for support trees or pad).
void GLVolumeCollection::load_object_auxiliary(
const SLAPrintObject *print_object,
int obj_idx,
// pairs of <instance_idx, print_instance_idx>
const std::vector<std::pair<size_t, size_t>> &instances,
SLAPrintObjectStep milestone,
bool use_VBOs);
int load_wipe_tower_preview(
int obj_idx, float pos_x, float pos_y, float width, float depth, float height, float rotation_angle, bool use_VBOs, bool size_unknown, float brim_width);