mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
Translation of ModelVolume as transformation component (without modifying the mesh)
This commit is contained in:
@@ -723,7 +723,11 @@ std::vector<int> GLVolumeCollection::load_object(
|
||||
|
||||
for (int instance_idx : instance_idxs) {
|
||||
const ModelInstance *instance = model_object->instances[instance_idx];
|
||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||
const TriangleMesh& mesh = model_volume->mesh;
|
||||
#else
|
||||
TriangleMesh mesh = model_volume->mesh;
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
volumes_idx.push_back(int(this->volumes.size()));
|
||||
float color[4];
|
||||
memcpy(color, colors[((color_by == "volume") ? volume_idx : obj_idx) % 4], sizeof(float) * 3);
|
||||
@@ -758,7 +762,8 @@ std::vector<int> GLVolumeCollection::load_object(
|
||||
v.is_modifier = ! model_volume->is_model_part();
|
||||
v.shader_outside_printer_detection_enabled = model_volume->is_model_part();
|
||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||
v.set_transformation(instance->get_transformation());
|
||||
v.set_instance_transformation(instance->get_transformation());
|
||||
v.set_volume_transformation(model_volume->get_transformation());
|
||||
#else
|
||||
v.set_offset(instance->get_offset());
|
||||
v.set_rotation(instance->get_rotation());
|
||||
@@ -833,7 +838,11 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
||||
else
|
||||
v.indexed_vertex_array.load_mesh_flat_shading(mesh);
|
||||
|
||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||
v.set_volume_offset(Vec3d(pos_x, pos_y, 0.0));
|
||||
#else
|
||||
v.set_offset(Vec3d(pos_x, pos_y, 0.0));
|
||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
|
||||
// finalize_geometry() clears the vertex arrays, therefore the bounding box has to be computed before finalize_geometry().
|
||||
v.bounding_box = v.indexed_vertex_array.bounding_box();
|
||||
|
||||
Reference in New Issue
Block a user