GLVolume : set color from the model volume to correct part rendering on the Scene
This commit is contained in:
parent
6997f7f5b5
commit
adbf1b674b
@ -280,6 +280,26 @@ void GLVolume::set_render_color()
|
|||||||
set_render_color(color, 4);
|
set_render_color(color, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLVolume::set_color_from_model_volume(const ModelVolume *model_volume)
|
||||||
|
{
|
||||||
|
if (model_volume->is_modifier()) {
|
||||||
|
color[0] = 0.2f;
|
||||||
|
color[1] = 1.0f;
|
||||||
|
color[2] = 0.2f;
|
||||||
|
}
|
||||||
|
else if (model_volume->is_support_blocker()) {
|
||||||
|
color[0] = 1.0f;
|
||||||
|
color[1] = 0.2f;
|
||||||
|
color[2] = 0.2f;
|
||||||
|
}
|
||||||
|
else if (model_volume->is_support_enforcer()) {
|
||||||
|
color[0] = 0.2f;
|
||||||
|
color[1] = 0.2f;
|
||||||
|
color[2] = 1.0f;
|
||||||
|
}
|
||||||
|
color[3] = model_volume->is_model_part() ? 1.f : 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
#if !ENABLE_MODELVOLUME_TRANSFORM
|
#if !ENABLE_MODELVOLUME_TRANSFORM
|
||||||
const Vec3d& GLVolume::get_rotation() const
|
const Vec3d& GLVolume::get_rotation() const
|
||||||
{
|
{
|
||||||
@ -767,7 +787,7 @@ int GLVolumeCollection::load_object_volume(
|
|||||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||||
float color[4];
|
float color[4];
|
||||||
memcpy(color, colors[((color_by == "volume") ? volume_idx : obj_idx) % 4], sizeof(float) * 3);
|
memcpy(color, colors[((color_by == "volume") ? volume_idx : obj_idx) % 4], sizeof(float) * 3);
|
||||||
if (model_volume->is_support_blocker()) {
|
/* if (model_volume->is_support_blocker()) {
|
||||||
color[0] = 1.0f;
|
color[0] = 1.0f;
|
||||||
color[1] = 0.2f;
|
color[1] = 0.2f;
|
||||||
color[2] = 0.2f;
|
color[2] = 0.2f;
|
||||||
@ -776,9 +796,10 @@ int GLVolumeCollection::load_object_volume(
|
|||||||
color[1] = 0.2f;
|
color[1] = 0.2f;
|
||||||
color[2] = 1.0f;
|
color[2] = 1.0f;
|
||||||
}
|
}
|
||||||
color[3] = model_volume->is_model_part() ? 1.f : 0.5f;
|
color[3] = model_volume->is_model_part() ? 1.f : 0.5f; */
|
||||||
this->volumes.emplace_back(new GLVolume(color));
|
this->volumes.emplace_back(new GLVolume(color));
|
||||||
GLVolume &v = *this->volumes.back();
|
GLVolume &v = *this->volumes.back();
|
||||||
|
v.set_color_from_model_volume(model_volume);
|
||||||
if (use_VBOs)
|
if (use_VBOs)
|
||||||
v.indexed_vertex_array.load_mesh_full_shading(mesh);
|
v.indexed_vertex_array.load_mesh_full_shading(mesh);
|
||||||
else
|
else
|
||||||
|
@ -358,6 +358,8 @@ public:
|
|||||||
void set_render_color(const float* rgba, unsigned int size);
|
void set_render_color(const float* rgba, unsigned int size);
|
||||||
// Sets render color in dependence of current state
|
// Sets render color in dependence of current state
|
||||||
void set_render_color();
|
void set_render_color();
|
||||||
|
// set color according to model volume
|
||||||
|
void set_color_from_model_volume(const ModelVolume *model_volume);
|
||||||
|
|
||||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||||
const Geometry::Transformation& get_instance_transformation() const { return m_instance_transformation; }
|
const Geometry::Transformation& get_instance_transformation() const { return m_instance_transformation; }
|
||||||
|
@ -4102,6 +4102,9 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
if (extruder_id != -1)
|
if (extruder_id != -1)
|
||||||
volume->extruder_id = extruder_id;
|
volume->extruder_id = extruder_id;
|
||||||
|
|
||||||
|
volume->is_modifier = !mvs->model_volume->is_model_part();
|
||||||
|
volume->set_color_from_model_volume(mvs->model_volume);
|
||||||
|
|
||||||
// updates volumes transformations
|
// updates volumes transformations
|
||||||
volume->set_instance_transformation(mvs->model_volume->get_object()->instances[mvs->composite_id.instance_id]->get_transformation());
|
volume->set_instance_transformation(mvs->model_volume->get_object()->instances[mvs->composite_id.instance_id]->get_transformation());
|
||||||
volume->set_volume_transformation(mvs->model_volume->get_transformation());
|
volume->set_volume_transformation(mvs->model_volume->get_transformation());
|
||||||
|
Loading…
Reference in New Issue
Block a user