00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveDigitSetGL.h"
00013
00014 #include "TGLRnrCtx.h"
00015 #include "TGLSelectRecord.h"
00016 #include "TGLIncludes.h"
00017
00018
00019
00020
00021
00022 ClassImp(TEveDigitSetGL);
00023
00024
00025 TEveDigitSetGL::TEveDigitSetGL() :
00026 TGLObject(), fHighlightSet(0)
00027 {
00028
00029 }
00030
00031
00032 Bool_t TEveDigitSetGL::SetupColor(const TEveDigitSet::DigitBase_t& q) const
00033 {
00034
00035
00036 TEveDigitSet& DS = * (TEveDigitSet*)fExternalObj;
00037
00038 if (DS.fSingleColor)
00039 {
00040 return kTRUE;
00041 }
00042 else if (DS.fValueIsColor)
00043 {
00044 if (q.fValue != 0)
00045 {
00046 TGLUtil::Color4ubv((UChar_t*) & q.fValue);
00047 return kTRUE;
00048 } else {
00049 return kFALSE;
00050 }
00051 }
00052 else
00053 {
00054 UChar_t c[4];
00055 Bool_t visible = DS.fPalette->ColorFromValue(q.fValue, DS.fDefaultValue, c);
00056 if (visible)
00057 TGLUtil::Color3ubv(c);
00058 return visible;
00059 }
00060 }
00061
00062
00063 void TEveDigitSetGL::SetBBox()
00064 {
00065
00066
00067 SetAxisAlignedBBox(((TEveDigitSet*)fExternalObj)->AssertBBox());
00068 }
00069
00070
00071 void TEveDigitSetGL::DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* pshp, Int_t ) const
00072 {
00073
00074
00075
00076 TEveDigitSet& DS = * (TEveDigitSet*)fExternalObj;
00077
00078 if (AlwaysSecondarySelect())
00079 {
00080 Float_t dr[2];
00081 glGetFloatv(GL_DEPTH_RANGE,dr);
00082
00083 if ( ! DS.RefHighlightedSet().empty())
00084 {
00085 fHighlightSet = & DS.RefHighlightedSet();
00086 TGLObject::DrawHighlight(rnrCtx, pshp, 3);
00087 }
00088 if ( ! DS.RefSelectedSet().empty())
00089 {
00090 glDepthRange(dr[0], 0.8*dr[1]);
00091 fHighlightSet = & DS.RefSelectedSet();
00092 TGLObject::DrawHighlight(rnrCtx, pshp, 1);
00093 glDepthRange(dr[0], dr[1]);
00094 }
00095 fHighlightSet = 0;
00096 }
00097 else
00098 {
00099 TGLObject::DrawHighlight(rnrCtx, pshp);
00100 }
00101 }
00102
00103
00104 void TEveDigitSetGL::ProcessSelection(TGLRnrCtx& , TGLSelectRecord& rec)
00105 {
00106
00107
00108
00109
00110 TEveDigitSet& DS = * (TEveDigitSet*)fExternalObj;
00111
00112 if (AlwaysSecondarySelect())
00113 {
00114 DS.ProcessGLSelection(rec);
00115 }
00116 else
00117 {
00118 if (rec.GetN() < 2) return;
00119 DS.DigitSelected(rec.GetItem(1));
00120 }
00121 }