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