Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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
22OpenGL renderer class for TEveArrow.
23*/
24
25
26////////////////////////////////////////////////////////////////////////////////
27/// Constructor.
28
30 TGLObject(), fM(nullptr)
31{
32}
33
34/******************************************************************************/
35
36////////////////////////////////////////////////////////////////////////////////
37/// Set model object.
38
40{
42 return kTRUE;
43}
44
45////////////////////////////////////////////////////////////////////////////////
46/// Set bounding box.
47
49{
50 // !! This ok if master sub-classed from TAttBBox
51 SetAxisAlignedBBox(((TEveArrow*)fExternalObj)->AssertBBox());
52}
53
54/******************************************************************************/
55
56////////////////////////////////////////////////////////////////////////////////
57/// Render with OpenGL.
58
59void TEveArrowGL::DirectDraw(TGLRnrCtx& /*rnrCtx*/) const
60{
61 static TGLQuadric quad;
62
63 glPushMatrix();
64
65 TGLVertex3 uo(fM->fOrigin.fX, fM->fOrigin.fY, fM->fOrigin.fZ);
66 TGLVector3 uv(fM->fVector.fX, fM->fVector.fY, fM->fVector.fZ);
67 TGLMatrix local(uo, uv);
68 glMultMatrixd(local.CArr());
69 Float_t size = fM->fVector.Mag();
70
71 // Line (tube) component
72 Float_t r = size*fM->fTubeR;
73 Float_t h = size*fM->fConeL;
74 gluCylinder(quad.Get(), r, r, size - h, fM->fDrawQuality, 1);
75 gluQuadricOrientation(quad.Get(), (GLenum)GLU_INSIDE);
76 gluDisk(quad.Get(), 0.0, r, fM->fDrawQuality, 1);
77
78 // Arrow cone
79 r = size*fM->fConeR;
80 glTranslated(0.0, 0.0, size - h);
81 gluDisk(quad.Get(), 0.0, r, fM->fDrawQuality, 1);
82 gluQuadricOrientation(quad.Get(), (GLenum)GLU_OUTSIDE);
83 gluCylinder(quad.Get(), r, 0., h , fM->fDrawQuality, 1);
84
85 glPopMatrix();
86}
ROOT::R::TRInterface & r
Definition Object.C:4
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
void DirectDraw(TGLRnrCtx &rnrCtx) const override
Render with OpenGL.
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override
Set model object.
void SetBBox() override
Set bounding box.
TEveArrow * fM
Definition TEveArrowGL.h:28
TEveArrowGL()
Constructor.
Class used for display of a thick arrow.
Definition TEveArrow.h:25
TObject * fExternalObj
! Also plays the role of ID.
16 component (4x4) transform matrix - column MAJOR as per GL.
Definition TGLUtil.h:598
const Double_t * CArr() const
Definition TGLUtil.h:664
TT * SetModelDynCast(TObject *obj)
Definition TGLObject.h:37
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:85
Wrapper class for GLU quadric shape drawing object.
Definition TGLQuadric.h:28
GLUquadric * Get()
Get the internal raw GLU quadric object. Created on first call.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition TGLRnrCtx.h:41
3 component (x/y/z) vector class.
Definition TGLUtil.h:248
3 component (x/y/z) vertex class.
Definition TGLUtil.h:84
Mother of all ROOT objects.
Definition TObject.h:42