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