From 4e2a863384fb751a2f73f73359e75ffaf0216b5b Mon Sep 17 00:00:00 2001 From: ansgar <ansgar@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Sat, 29 May 2010 15:51:38 +0000 Subject: [PATCH] fixed several issues with trace/tube/hsc selection display git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/branches/new_gfx@2306 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/gfx/src/impl/cartoon_renderer.cc | 16 +++++++++++----- modules/gfx/src/impl/trace_renderer.cc | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/gfx/src/impl/cartoon_renderer.cc b/modules/gfx/src/impl/cartoon_renderer.cc index a737d4db5..5a10e13fa 100644 --- a/modules/gfx/src/impl/cartoon_renderer.cc +++ b/modules/gfx/src/impl/cartoon_renderer.cc @@ -54,7 +54,7 @@ void CartoonRenderer::SetForceTube(bool force_tube) void CartoonRenderer::PrepareRendering(const BackboneTrace& subset, IndexedVertexArray& va, SplineEntryListList& spline_list_list, - bool is_sel) + bool) { if(options_==NULL) { LOGN_DEBUG("CartoonRenderer: NULL options, not creating objects"); @@ -69,7 +69,6 @@ void CartoonRenderer::PrepareRendering(const BackboneTrace& subset, LOGN_DEBUG("CartoonRenderer: starting object build"); int spline_detail=std::max((unsigned int) 1, options_->GetSplineDetail()); - const Color& sel_clr=this->GetSelectionColor(); SplineEntryListList tmp_sll; for (int node_list=0; node_list<subset.GetListCount(); ++node_list) { LOGN_DEBUG("CartoonRenderer: collecting spline entries for node list " << node_list); @@ -90,8 +89,8 @@ void CartoonRenderer::PrepareRendering(const BackboneTrace& subset, } SplineEntry ee(entry.atom.GetPos(),entry.direction, entry.normal, entry.rad, - is_sel ? sel_clr : entry.color1, - is_sel ? sel_clr : entry.color2, + entry.color1, + entry.color2, type, entry.id); ee.v1 = entry.v1; spl.push_back(ee); @@ -128,6 +127,7 @@ void CartoonRenderer::PrepareRendering() } if (this->HasSelection() && (state_>0 || sel_state_>0)) { sel_va_.Clear(); + Color sel_color=GetSelectionColor(); // extract spline segments from list_list that match // (via id) the selection subset // first put all ids into a set for fast lookup @@ -150,6 +150,9 @@ void CartoonRenderer::PrepareRendering() // if a match is found, add all until a new id is found while(sc<slist.size() && slist.at(sc).id==curr_id) { nlist.push_back(slist[sc++]); + // override with the selection color + nlist.back().color1=sel_color; + nlist.back().color2=sel_color; } } else { // introduce break @@ -167,8 +170,11 @@ void CartoonRenderer::PrepareRendering() } } RebuildSplineObj(sel_va_, sel_spline_list_list_, true); - sel_va_.SetColorMaterial(false); + sel_va_.SetColorMaterial(true); sel_va_.SetLighting(false); + sel_va_.SetMode(0x4); + sel_va_.SetPolyMode(options_->GetPolyMode()); + sel_va_.SetOpacity(sel_color.Alpha()); } sel_state_=0; state_=0; diff --git a/modules/gfx/src/impl/trace_renderer.cc b/modules/gfx/src/impl/trace_renderer.cc index 23156bfc4..838a23a75 100644 --- a/modules/gfx/src/impl/trace_renderer.cc +++ b/modules/gfx/src/impl/trace_renderer.cc @@ -59,6 +59,7 @@ void TraceRenderer::PrepareRendering(BackboneTrace& trace_subset, va.SetColorMaterial(true); va.SetTwoSided(false); if(is_sel) { + va.SetOpacity(GetSelectionColor().Alpha()); for (int node_list=0; node_list<trace_subset.GetListCount(); ++node_list) { const NodeEntryList& nl=trace_subset.GetList(node_list); for(unsigned int i=0;i<nl.size();++i) { -- GitLab