CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/Fireworks/Core/src/FWEveDigitSetScalableMarker.cc

Go to the documentation of this file.
00001 #ifndef Fireworks_Core_FWMarkerDigitSetGL_h
00002 #define Fireworks_Core_FWMarkerDigitSetGL_h
00003 
00004 #include "TEveQuadSet.h"
00005 #include "TEveQuadSetGL.h"
00006 #include "TGLIncludes.h"
00007 #include "TGLRnrCtx.h"
00008 #include "TAttMarker.h"
00009 
00010 class FWEveDigitSetScalableMarker : public TEveQuadSet, public TAttMarker
00011 {
00012 public:
00013    FWEveDigitSetScalableMarker() {}
00014    virtual ~FWEveDigitSetScalableMarker() {}
00015    
00016    ClassDef( FWEveDigitSetScalableMarker, 0);
00017 };
00018 
00019 //--------------------------------------------
00020 class FWEveDigitSetScalableMarkerGL : public TEveQuadSetGL
00021 {
00022 public:
00023    FWEveDigitSetScalableMarkerGL() {}
00024    virtual ~FWEveDigitSetScalableMarkerGL() {}
00025    
00026    virtual void DirectDraw(TGLRnrCtx & rnrCtx) const
00027    {
00028       glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_POINT_BIT);
00029       glEnable(GL_POINT_SMOOTH);
00030       glDisable(GL_LIGHTING);
00031           
00032       TEveChunkManager::iterator qi(fM->GetPlex());
00033       if (rnrCtx.Highlight() && fHighlightSet)
00034          qi.fSelection = fHighlightSet;
00035       
00036       if (rnrCtx.SecSelection()) glPushName(0);
00037       
00038       glPointSize(((FWEveDigitSetScalableMarker*)fM)->GetMarkerSize());
00039       while (qi.next()) {
00040          TEveQuadSet::QFreeQuad_t* q =  (TEveQuadSet::QFreeQuad_t*) qi();
00041          if (q->fValue < 0)
00042             continue;
00043          TGLUtil::ColorAlpha(Color_t(q->fValue));
00044          if (rnrCtx.SecSelection()) glLoadName(qi.index());
00045          float* p = &q->fVertices[0];
00046          glBegin(GL_LINES);
00047          float c[3]  =  {0.5f*(p[0]+p[6]), 0.5f*(p[1]+p[7]), 0.5f*(p[2]+p[8])};
00048          
00049          float d = p[6] - p[0];
00050          glVertex3f( c[0] -d, c[1], c[2]); glVertex3f(c[0] + d, c[1], c[2]);
00051          glVertex3f( c[0] , c[1] -d, c[2]); glVertex3f(c[0] , c[1] +d, c[2]);
00052          glVertex3f( c[0] , c[1], c[2]-d); glVertex3f(c[0] , c[1], c[2] +d);
00053          
00054          glEnd();
00055          
00056          glBegin(GL_POINTS);
00057          glVertex3fv(&c[0]);
00058          glEnd();
00059          
00060       }
00061       
00062       glPopAttrib();
00063    }
00064    
00065    ClassDef(FWEveDigitSetScalableMarkerGL, 0);
00066 };
00067 
00068 
00069 #endif