26 ClassImp(TEvePolygonSetProjectedGL);
31 TEvePolygonSetProjectedGL::TEvePolygonSetProjectedGL() : TGLObject()
40 Bool_t TEvePolygonSetProjectedGL::SetModel(TObject* obj,
const Option_t* )
42 fM = SetModelDynCast<TEvePolygonSetProjected>(obj);
49 void TEvePolygonSetProjectedGL::SetBBox()
51 SetAxisAlignedBBox(fM->AssertBBox());
58 void TEvePolygonSetProjectedGL::Draw(TGLRnrCtx& rnrCtx)
const
60 if (rnrCtx.IsDrawPassOutlineLine())
63 TGLObject::Draw(rnrCtx);
69 void TEvePolygonSetProjectedGL::DrawOutline()
const
71 if (fM->fPols.size() == 0)
return;
73 Bool_t done_p = kFALSE;
75 if (fM->GetMiniFrame())
77 std::map<Edge_t, Int_t> edges;
79 for (TEvePolygonSetProjected::vpPolygon_ci i = fM->fPols.begin();
80 i != fM->fPols.end(); ++i)
82 for(Int_t k = 0; k < i->fNPnts - 1; ++k)
84 ++edges[Edge_t(i->fPnts[k], i->fPnts[k+1])];
86 ++edges[Edge_t(i->fPnts[0], i->fPnts[i->fNPnts - 1])];
90 for (std::map<Edge_t, Int_t>::iterator i = edges.begin(); i != edges.end(); ++i)
94 glVertex3fv(fM->fPnts[i->first.fI].Arr());
95 glVertex3fv(fM->fPnts[i->first.fJ].Arr());
104 for (TEvePolygonSetProjected::vpPolygon_ci i = fM->fPols.begin();
105 i != fM->fPols.end(); ++i)
107 glBegin(GL_LINE_LOOP);
108 for(Int_t k = 0; k < i->fNPnts; ++k)
110 glVertex3fv(fM->fPnts[i->fPnts[k]].Arr());
120 void TEvePolygonSetProjectedGL::DirectDraw(TGLRnrCtx& )
const
122 if (fM->fPols.size() == 0)
return;
124 glPushAttrib(GL_ENABLE_BIT | GL_LINE_BIT | GL_POLYGON_BIT);
126 glDisable(GL_LIGHTING);
127 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
128 glEnable(GL_COLOR_MATERIAL);
129 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
130 glDisable(GL_CULL_FACE);
133 fMultiColor = fM->fDrawFrame;
136 glEnable(GL_POLYGON_OFFSET_FILL);
137 glPolygonOffset(1, 1);
138 GLUtesselator *tessObj = TGLUtil::GetDrawTesselator3fv();
140 TEveVector* pnts = fM->fPnts;
141 for (TEvePolygonSetProjected::vpPolygon_ci i = fM->fPols.begin();
142 i != fM->fPols.end(); ++i)
145 Int_t pntsN = (*i).fNPnts;
149 for (Int_t k = 0; k < pntsN; ++k)
152 glVertex3fv(pnts[vi].Arr());
158 gluBeginPolygon(tessObj);
159 gluNextContour(tessObj, (GLenum)GLU_UNKNOWN);
163 for (Int_t k = 0; k < pntsN; ++k)
166 coords[0] = pnts[vi].fX;
167 coords[1] = pnts[vi].fY;
168 gluTessVertex(tessObj, coords, pnts[vi].Arr());
170 gluEndPolygon(tessObj);
173 glDisable(GL_POLYGON_OFFSET_FILL);
178 TGLUtil::Color(fM->fLineColor);
179 glEnable(GL_LINE_SMOOTH);
180 TGLUtil::LineWidth(fM->fLineWidth);
190 void TEvePolygonSetProjectedGL::DrawHighlight(TGLRnrCtx& rnrCtx,
const TGLPhysicalShape* pshp, Int_t lvl)
const
192 if (lvl < 0) lvl = pshp->GetSelected();
194 glColor4ubv(rnrCtx.ColorSet().Selection(lvl).CArr());
195 TGLUtil::LockColor();
197 if (fM->GetHighlightFrame())
206 TGLUtil::UnlockColor();