Logo ROOT   6.10/09
Reference Guide
TEveArrowGL.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TEveArrowGL.h"
13 #include "TEveArrow.h"
14 
15 #include "TGLRnrCtx.h"
16 #include "TGLIncludes.h"
17 #include "TGLUtil.h"
18 #include "TGLQuadric.h"
19 
20 /** \class TEveArrowGL
21 \ingroup TEve
22 OpenGL renderer class for TEveArrow.
23 */
24 
26 
27 ////////////////////////////////////////////////////////////////////////////////
28 /// Constructor.
29 
31  TGLObject(), fM(0)
32 {
33 }
34 
35 /******************************************************************************/
36 
37 ////////////////////////////////////////////////////////////////////////////////
38 /// Set model object.
39 
41 {
42  fM = SetModelDynCast<TEveArrow>(obj);
43  return kTRUE;
44 }
45 
46 ////////////////////////////////////////////////////////////////////////////////
47 /// Set bounding box.
48 
50 {
51  // !! This ok if master sub-classed from TAttBBox
52  SetAxisAlignedBBox(((TEveArrow*)fExternalObj)->AssertBBox());
53 }
54 
55 /******************************************************************************/
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 /// Render with OpenGL.
59 
60 void TEveArrowGL::DirectDraw(TGLRnrCtx& /*rnrCtx*/) const
61 {
62  static TGLQuadric quad;
63 
64  glPushMatrix();
65 
68  TGLMatrix local(uo, uv);
69  glMultMatrixd(local.CArr());
70  Float_t size = fM->fVector.Mag();
71 
72  // Line (tube) component
73  Float_t r = size*fM->fTubeR;
74  Float_t h = size*fM->fConeL;
75  gluCylinder(quad.Get(), r, r, size - h, fM->fDrawQuality, 1);
76  gluQuadricOrientation(quad.Get(), (GLenum)GLU_INSIDE);
77  gluDisk(quad.Get(), 0.0, r, fM->fDrawQuality, 1);
78 
79  // Arrow cone
80  r = size*fM->fConeR;
81  glTranslated(0.0, 0.0, size - h);
82  gluDisk(quad.Get(), 0.0, r, fM->fDrawQuality, 1);
83  gluQuadricOrientation(quad.Get(), (GLenum)GLU_OUTSIDE);
84  gluCylinder(quad.Get(), r, 0., h , fM->fDrawQuality, 1);
85 
86  glPopMatrix();
87 }
virtual void SetBBox()
Set bounding box.
Definition: TEveArrowGL.cxx:49
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:40
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
16 component (4x4) transform matrix - column MAJOR as per GL.
Definition: TGLUtil.h:596
GLUquadric * Get()
Get the internal raw GLU quadric object. Created on first call.
Definition: TGLQuadric.cxx:44
Float_t fConeL
Definition: TEveArrow.h:38
TH1 * h
Definition: legend2.C:5
Class used for display of a thick arrow.
Definition: TEveArrow.h:21
void SetAxisAlignedBBox(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax)
Set axis-aligned bounding-box.
Definition: TGLObject.cxx:86
bool Bool_t
Definition: RtypesCore.h:59
Wrapper class for GLU quadric shape drawing object.
Definition: TGLQuadric.h:27
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
Set model object.
Definition: TEveArrowGL.cxx:40
3 component (x/y/z) vertex class.
Definition: TGLUtil.h:82
Base-class for direct OpenGL renderers.
Definition: TGLObject.h:21
3 component (x/y/z) vector class.
Definition: TGLUtil.h:246
TObject * fExternalObj
first replica
TEveArrow * fM
Definition: TEveArrowGL.h:28
TRandom2 r(17)
const Double_t * CArr() const
Definition: TGLUtil.h:663
Int_t fDrawQuality
Definition: TEveArrow.h:43
#define ClassImp(name)
Definition: Rtypes.h:336
TEveArrowGL()
Constructor.
Definition: TEveArrowGL.cxx:30
TEveVector fVector
Definition: TEveArrow.h:41
Mother of all ROOT objects.
Definition: TObject.h:37
Float_t fTubeR
Definition: TEveArrow.h:36
TEveVector fOrigin
Definition: TEveArrow.h:40
Float_t fConeR
Definition: TEveArrow.h:37
TT Mag() const
Definition: TEveVector.h:76
OpenGL renderer class for TEveArrow.
Definition: TEveArrowGL.h:21
const Bool_t kTRUE
Definition: RtypesCore.h:91
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Render with OpenGL.
Definition: TEveArrowGL.cxx:60