Logo ROOT  
Reference Guide
TGLScenePad.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel, Jun 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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 #ifndef ROOT_TGLScenePad
13 #define ROOT_TGLScenePad
14 
15 #include "TGLScene.h"
16 #include "TVirtualViewer3D.h"
17 #include "CsgOps.h"
18 #include <vector>
19 #include <utility>
20 
21 class TGLViewer;
22 class TGLFaceSet;
23 class TList;
24 
25 
26 class TGLScenePad : public TVirtualViewer3D, public TGLScene {
27 
28 private:
29  TGLScenePad(const TGLScenePad&) = delete;
30  TGLScenePad& operator=(const TGLScenePad&) = delete;
31 
32 protected:
34 
35  // For building via VV3D
36  Bool_t fInternalPIDs; //! using internal physical IDs
37  UInt_t fNextInternalPID; //! next internal physical ID (from 1 - 0 reserved)
38  UInt_t fLastPID; //! last physical ID that was processed in AddObject()
40 
41  Int_t ValidateObjectBuffer(const TBuffer3D& buffer, Bool_t includeRaw) const;
42  TGLLogicalShape* CreateNewLogical(const TBuffer3D & buffer) const;
43  TGLPhysicalShape* CreateNewPhysical(UInt_t physicalID, const TBuffer3D& buffer,
44  const TGLLogicalShape& logical) const;
45 
46  void ComposePolymarker(const TList *padPrimitives);
47  // Composite shape specific
48  typedef std::pair<UInt_t, RootCsg::TBaseMesh*> CSPart_t;
49  mutable TGLFaceSet *fComposite; //! Paritally created composite
51  std::vector<CSPart_t> fCSTokens;
52  RootCsg::TBaseMesh* BuildComposite();
53 
55 
56  Bool_t fSmartRefresh; //! cache logicals during scene rebuilds
57 
58 public:
60  virtual ~TGLScenePad() {}
61 
62  TVirtualPad* GetPad() const { return fPad; }
63  void SetPad(TVirtualPad* p) { fPad = p; }
64 
65  // Histo import and Sub-pad traversal
66  void AddHistoPhysical(TGLLogicalShape* log, const Float_t *histColor = 0);
67  void SubPadPaint(TVirtualPad* pad);
68 
69  // PadPaint wrapper for calls from TGLViewer:
70  virtual void PadPaintFromViewer(TGLViewer* viewer);
71 
72  Bool_t GetSmartRefresh() const { return fSmartRefresh; }
73  void SetSmartRefresh(Bool_t smart_ref) { fSmartRefresh = smart_ref; }
74 
75 
76  // TVirtualViewer3D interface
77 
78  virtual Bool_t CanLoopOnPrimitives() const { return kTRUE; }
79  virtual void PadPaint(TVirtualPad* pad);
80  virtual void ObjectPaint(TObject* obj, Option_t* opt="");
81 
82  // For now handled by viewer
83  virtual Int_t DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/) { return 9999; }
84  virtual void ExecuteEvent(Int_t /*event*/, Int_t /*px*/, Int_t /*py*/) {}
85 
86  virtual Bool_t PreferLocalFrame() const { return kTRUE; }
87 
88  virtual void BeginScene();
89  virtual Bool_t BuildingScene() const { return CurrentLock() == kModifyLock; }
90  virtual void EndScene();
91 
92  virtual Int_t AddObject(const TBuffer3D& buffer, Bool_t* addChildren = 0);
93  virtual Int_t AddObject(UInt_t physicalID, const TBuffer3D& buffer, Bool_t* addChildren = 0);
94  virtual Bool_t OpenComposite(const TBuffer3D& buffer, Bool_t* addChildren = 0);
95  virtual void CloseComposite();
96  virtual void AddCompositeOp(UInt_t operation);
97 
98  ClassDef(TGLScenePad, 0); // GL-scene filled via TPad-TVirtualViewer interface.
99 };
100 
101 #endif
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TGLScenePad::fSmartRefresh
Bool_t fSmartRefresh
Definition: TGLScenePad.h:56
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGLScenePad::AddCompositeOp
virtual void AddCompositeOp(UInt_t operation)
Add composite operation used to combine objects added via AddObject TVirtualViewer3D interface overlo...
Definition: TGLScenePad.cxx:528
TGLScenePad::AddHistoPhysical
void AddHistoPhysical(TGLLogicalShape *log, const Float_t *histColor=0)
Scale and rotate a histo object to mimic placement in canvas.
Definition: TGLScenePad.cxx:75
TGLScenePad::OpenComposite
virtual Bool_t OpenComposite(const TBuffer3D &buffer, Bool_t *addChildren=0)
Open new composite container.
Definition: TGLScenePad.cxx:482
TGLScenePad::GetSmartRefresh
Bool_t GetSmartRefresh() const
Definition: TGLScenePad.h:72
TGLScenePad::ComposePolymarker
void ComposePolymarker(const TList *padPrimitives)
Definition: TGLScenePad.cxx:704
TGLScenePad::~TGLScenePad
virtual ~TGLScenePad()
Definition: TGLScenePad.h:60
Float_t
float Float_t
Definition: RtypesCore.h:57
log
double log(double)
TGLScenePad::CreateNewLogical
TGLLogicalShape * CreateNewLogical(const TBuffer3D &buffer) const
Create and return a new TGLLogicalShape from the supplied buffer.
Definition: TGLScenePad.cxx:611
Int_t
int Int_t
Definition: RtypesCore.h:45
TGLScenePad::fAcceptedPhysicals
Int_t fAcceptedPhysicals
last physical ID that was processed in AddObject()
Definition: TGLScenePad.h:39
TGLScenePad::CanLoopOnPrimitives
virtual Bool_t CanLoopOnPrimitives() const
Definition: TGLScenePad.h:78
TGLScenePad
Implements VirtualViewer3D interface and fills the base-class visualization structures from pad conte...
Definition: TGLScenePad.h:26
TGLScenePad::fLastPID
UInt_t fLastPID
next internal physical ID (from 1 - 0 reserved)
Definition: TGLScenePad.h:38
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGLLockable::CurrentLock
ELock CurrentLock() const
Definition: TGLLockable.h:61
bool
TGLScene
TGLScene provides management and rendering of ROOT's default 3D /object representation as logical and...
Definition: TGLScene.h:29
TGLScenePad::AttemptDirectRenderer
TGLLogicalShape * AttemptDirectRenderer(TObject *id)
Try to construct an appropriate logical-shape sub-class based on id'class, following convention that ...
Definition: TGLScenePad.cxx:773
TGLScenePad::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t, Int_t)
Computes distance from point (px,py) to the object.
Definition: TGLScenePad.h:83
TBuffer3D
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
TGLScenePad::PreferLocalFrame
virtual Bool_t PreferLocalFrame() const
Definition: TGLScenePad.h:86
TGLViewer
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:55
TGLScenePad::GetPad
TVirtualPad * GetPad() const
Definition: TGLScenePad.h:62
TGLScenePad::operator=
TGLScenePad & operator=(const TGLScenePad &)=delete
TGLScenePad::PadPaintFromViewer
virtual void PadPaintFromViewer(TGLViewer *viewer)
Entry point for requesting update of scene's contents from gl-viewer.
Definition: TGLScenePad.cxx:217
TGLScenePad::CreateNewPhysical
TGLPhysicalShape * CreateNewPhysical(UInt_t physicalID, const TBuffer3D &buffer, const TGLLogicalShape &logical) const
Create and return a new TGLPhysicalShape with id 'ID', using 'buffer' placement information (translat...
Definition: TGLScenePad.cxx:688
TGLScenePad::ValidateObjectBuffer
Int_t ValidateObjectBuffer(const TBuffer3D &buffer, Bool_t includeRaw) const
Validate if the passed 'buffer' contains all sections we require to add object.
Definition: TGLScenePad.cxx:543
TVirtualViewer3D.h
TGLScenePad::fPad
TVirtualPad * fPad
Definition: TGLScenePad.h:33
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TGLScenePad::ExecuteEvent
virtual void ExecuteEvent(Int_t, Int_t, Int_t)
Execute action corresponding to an event at (px,py).
Definition: TGLScenePad.h:84
TGLScenePad::fNextInternalPID
UInt_t fNextInternalPID
using internal physical IDs
Definition: TGLScenePad.h:37
TGLScenePad::fCSLevel
UInt_t fCSLevel
Paritally created composite.
Definition: TGLScenePad.h:50
TGLScenePad::CloseComposite
virtual void CloseComposite()
Close composite container TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D....
Definition: TGLScenePad.cxx:507
unsigned int
TGLScenePad::fComposite
TGLFaceSet * fComposite
Definition: TGLScenePad.h:49
TGLScenePad::BeginScene
virtual void BeginScene()
Start building of the scene.
Definition: TGLScenePad.cxx:259
TGLScenePad::TGLScenePad
TGLScenePad(const TGLScenePad &)=delete
TGLScenePad::BuildComposite
RootCsg::TBaseMesh * BuildComposite()
Build and return composite shape mesh.
Definition: TGLScenePad.cxx:744
TVirtualPad
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:51
TGLFaceSet
Implements a native ROOT-GL representation of an arbitrary set of polygons.
Definition: TGLFaceSet.h:23
TGLScenePad::SetSmartRefresh
void SetSmartRefresh(Bool_t smart_ref)
Definition: TGLScenePad.h:73
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TVirtualViewer3D
Abstract 3D shapes viewer.
Definition: TVirtualViewer3D.h:34
TGLLogicalShape
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
Definition: TGLLogicalShape.h:30
TGLScene.h
TGLPhysicalShape
Concrete physical shape - a GL drawable.
Definition: TGLPhysicalShape.h:32
TGLScenePad::SubPadPaint
void SubPadPaint(TVirtualPad *pad)
Iterate over pad-primitives and import them.
Definition: TGLScenePad.cxx:162
TGLScenePad::fInternalPIDs
Bool_t fInternalPIDs
Definition: TGLScenePad.h:36
TGLScenePad::BuildingScene
virtual Bool_t BuildingScene() const
Definition: TGLScenePad.h:89
TGLScenePad::fCSTokens
std::vector< CSPart_t > fCSTokens
Definition: TGLScenePad.h:51
TGLScenePad::EndScene
virtual void EndScene()
End building of the scene.
Definition: TGLScenePad.cxx:310
TGLScenePad::CSPart_t
std::pair< UInt_t, RootCsg::TBaseMesh * > CSPart_t
Definition: TGLScenePad.h:48
TGLScenePad::PadPaint
virtual void PadPaint(TVirtualPad *pad)
Entry point for updating scene contents via VirtualViewer3D interface.
Definition: TGLScenePad.cxx:233
TGLScenePad::ObjectPaint
virtual void ObjectPaint(TObject *obj, Option_t *opt="")
Override of virtual TVirtualViewer3D::ObjectPaint().
Definition: TGLScenePad.cxx:189
TGLScenePad::SetPad
void SetPad(TVirtualPad *p)
Definition: TGLScenePad.h:63
TGLScenePad::AddObject
virtual Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=0)
Add an object to the viewer, using internal physical IDs TVirtualViewer3D interface overload - see ba...
Definition: TGLScenePad.cxx:329
TList
A doubly linked list.
Definition: TList.h:44
int
TGLLockable::kModifyLock
@ kModifyLock
Definition: TGLLockable.h:23