unified face coloring between selection tool and cdt_3 plugin

activated selection highlighting for T3 meshes
This commit is contained in:
Sven Oesau 2025-05-05 16:26:22 +02:00
parent a9469fc688
commit 91dc6a9200
4 changed files with 9 additions and 3 deletions

View File

@ -143,7 +143,12 @@ moveToGroup(CGAL::Three::Scene_group_item* group) {
void CGAL::Three::Scene_item::invalidateOpenGLBuffers() {}
void CGAL::Three::Scene_item::selection_changed(bool) {}
void CGAL::Three::Scene_item::selection_changed(bool p_is_selected) {
if (p_is_selected != is_selected)
{
is_selected = p_is_selected;
}
}
void CGAL::Three::Scene_item::setVisible(bool b)
{
visible_ = b;

View File

@ -734,7 +734,7 @@ void Scene_surface_mesh_item_priv::initialize_colors() const
if(item->property("recompute_colors").toBool())
{
colors_.clear();
compute_color_map(item->color(), (std::max)(1, max + 1 - min_patch_id),
compute_deterministic_color_map(item->color(), (std::max)(1, max + 1 - min_patch_id),
std::back_inserter(colors_));
qDebug()<<colors_.size()<<" colors in item";
}

View File

@ -1063,6 +1063,7 @@ void Scene_triangulation_3_item::draw(CGAL::Three::Viewer_interface* viewer) con
// it is only computed once and positions_poly is emptied at the end
getTriangleContainer(T3_faces)->setAlpha(alpha());
getTriangleContainer(T3_faces)->setIsSurface(is_surface());
getTriangleContainer(T3_faces)->setSelected(is_selected);
QOpenGLShaderProgram* program = viewer->getShaderProgram(getTriangleContainer(T3_faces)->getProgram());
program->bind();
if(d->is_filterable)

View File

@ -98,7 +98,7 @@ void main(void) {
vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec;
vec4 ret_color = vec4((my_color*light_amb).xyz + diffuse.xyz + specular.xyz,1);
if(is_selected)
out_color = vec4(ret_color.r+70.0/255.0, ret_color.g+70.0/255.0, ret_color.b+70.0/255.0, alpha);
out_color = vec4(ret_color.r+35.0/255.0, ret_color.g+35.0/255.0, ret_color.b+35.0/255.0, alpha);
else
out_color = vec4(ret_color.xyz, alpha);
}