Logo ROOT  
Reference Guide
TGLSceneInfo.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel, Feb 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_TGLSceneInfo_H
13 #define ROOT_TGLSceneInfo_H
14 
15 #include "Rtypes.h"
16 
17 #include "TGLBoundingBox.h"
18 #include "TGLUtil.h"
19 #include <vector>
20 
21 class TGLViewerBase;
22 class TGLSceneBase;
23 class TGLClip;
24 class TGLRenderContext;
25 class TGLCamera;
26 
28 {
29  friend class TGLSceneBase;
30 
31 public:
33 
34 private:
35  TGLSceneInfo(const TGLSceneInfo&) = delete;
36  TGLSceneInfo& operator=(const TGLSceneInfo&) = delete;
37 
38 protected:
41  Bool_t fActive; // Show fScene in fViewer
42 
43  Short_t fLOD; // Optional override of scene lod
44  Short_t fStyle; // Optional override of scene style
45  Float_t fWFLineW; // Optional override of scene wire-frame line-width
46  Float_t fOLLineW; // Optional override of scene outline line-width
47  TGLClip * fClip; // Optional override of clipping-plane
48 
49  Short_t fLastLOD; // Last combined viewer/scene lod (set in scene::lodify-scene-info).
50  Short_t fLastStyle; // Last combined viewer/scene style (set in scene::pre-draw).
51  Float_t fLastWFLineW; // Last combined viewer/scene wire-frame line-width (set in scene::pre-draw).
52  Float_t fLastOLLineW; // Last combined viewer/scene outline line-width (set in scene::pre-draw).
53  TGLClip * fLastClip; // Last combined viewer/scene clip (set in scene::update)
54  TGLCamera * fLastCamera; // Last camera used.
55 
56  UInt_t fSceneStamp; // Scene's time-stamp on last update.
57  UInt_t fClipStamp; // Clip's time-stamp on last update.
58  UInt_t fCameraStamp; // Camera's time-stamp on last update.
59  Bool_t fUpdateTimeouted; // Set if update was interrupted.
60 
61  // Eventually we will allow additional per-scene transforamtion.
62  // TGLMatrix fSceneTrans;
63  // Also needed:
64  // *) transformed clipping planes of the camera
65  // *) transformed bounding-box of the scene
67 
68  Bool_t fViewCheck; // Viewer side check if render is necessary.
69  Bool_t fInFrustum; // Is scene intersecting view-frustum.
70  Bool_t fInClip; // Is scene contained within clipping-volume.
71  Char_t fClipMode; // Clipping mode, can be disbled.
72  TGLPlaneSet_t fFrustumPlanes; // Clipping planes defined by frustum; only those intersecting the scene volume are kept.
73  TGLPlaneSet_t fClipPlanes; // Clipping planes from clip-object; which planes are kept depends on inside/outside mode.
74 
75  // Additional stuff (scene-class specific) can be added by sub-classing.
76  // For TGLScene these data include draw-lists after clipping.
77 
78 public:
79  TGLSceneInfo(TGLViewerBase* view=0, TGLSceneBase* scene=0);
80  virtual ~TGLSceneInfo() {}
81 
82  TGLViewerBase * GetViewer() const { return fViewer; }
83  TGLViewerBase & RefViewer() const { return *fViewer; }
84  TGLSceneBase * GetScene() const { return fScene; }
85  TGLSceneBase & RefScene() const { return *fScene; }
86 
87  Bool_t GetActive() const { return fActive; }
88  void SetActive(Bool_t a);
89 
91 
93 
94  virtual void SetSceneTrans(TGLMatrix&) { ResetSceneStamp(); }
95 
96  Bool_t ViewCheck() const { return fViewCheck; }
97  void ViewCheck(Bool_t c) { fViewCheck = c; }
98  Bool_t IsInFrustum() const { return fInFrustum; }
99  void InFrustum(Bool_t f) { fInFrustum = f; }
100  Bool_t IsInClip() const { return fInClip; }
101  void InClip(Bool_t c) { fInClip = c; }
102  Char_t ClipMode() const { return fClipMode; }
103  void ClipMode(Char_t m) { fClipMode = m; }
104 
105  Bool_t ShouldClip() const { return fClipMode != kClipNone; }
106  Bool_t IsVisible() const { return fInFrustum && fInClip; }
107 
108  std::vector<TGLPlane>& FrustumPlanes() { return fFrustumPlanes; }
109  std::vector<TGLPlane>& ClipPlanes() { return fClipPlanes; }
110 
111  Short_t LOD() const { return fLOD; }
112  void SetLOD(Short_t lod) { fLOD = lod; }
113 
114  Short_t Style() const { return fStyle; }
115  void SetStyle(Short_t st) { fStyle = st; }
116 
117  Float_t WFLineW() const { return fWFLineW; }
118  void SetWFLineW(Float_t w) { fWFLineW = w; }
119  Float_t OLLineW() const { return fOLLineW; }
120  void SetOLLineW(Float_t w) { fOLLineW = w; }
121 
122  TGLClip* Clip() const { return fClip; }
123  void SetClip(TGLClip *p) { fClip = p; }
124 
125  Short_t LastLOD() const { return fLastLOD; }
126  void SetLastLOD(Short_t ld) { fLastLOD = ld; }
127 
128  Short_t LastStyle() const { return fLastStyle; }
129  void SetLastStyle(Short_t st) { fLastStyle = st; }
130 
131  Float_t LastWFLineW() const { return fLastWFLineW; }
133  Float_t LastOLLineW() const { return fLastOLLineW; }
135 
136  TGLClip* LastClip() const { return fLastClip; }
137  void SetLastClip(TGLClip *p) { fLastClip = p; }
138 
139  TGLCamera* LastCamera() const { return fLastCamera; }
141 
142  UInt_t SceneStamp() const { return fSceneStamp; }
143  void SetSceneStamp(UInt_t ts) { fSceneStamp = ts; }
144  void ResetSceneStamp() { fSceneStamp = 0; }
145 
146  UInt_t ClipStamp() const { return fClipStamp; }
147  void SetClipStamp(UInt_t ts) { fClipStamp = ts; }
148  void ResetClipStamp() { fClipStamp = 0; }
149 
150  UInt_t CameraStamp() const { return fCameraStamp; }
151  void SetCameraStamp(UInt_t ts) { fCameraStamp = ts; }
153 
157 
158  ClassDef(TGLSceneInfo, 0) // Data about a scene within a viewer context.
159 }; // endclass TGLSceneInfo
160 
161 
162 #endif
TGLSceneInfo::ClipStamp
UInt_t ClipStamp() const
Definition: TGLSceneInfo.h:146
TGLSceneInfo::TGLSceneInfo
TGLSceneInfo(const TGLSceneInfo &)=delete
c
#define c(i)
Definition: RSha256.hxx:101
TGLSceneInfo::fCameraStamp
UInt_t fCameraStamp
Definition: TGLSceneInfo.h:58
TGLSceneInfo::GetActive
Bool_t GetActive() const
Definition: TGLSceneInfo.h:87
m
auto * m
Definition: textangle.C:8
TGLSceneInfo::ResetUpdateTimeouted
void ResetUpdateTimeouted()
Definition: TGLSceneInfo.h:156
TGLSceneInfo::SetCameraStamp
void SetCameraStamp(UInt_t ts)
Definition: TGLSceneInfo.h:151
TGLSceneInfo::ShouldClip
Bool_t ShouldClip() const
Definition: TGLSceneInfo.h:105
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGLSceneInfo::ResetClipStamp
void ResetClipStamp()
Definition: TGLSceneInfo.h:148
TGLSceneBase
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes:
Definition: TGLSceneBase.h:33
f
#define f(i)
Definition: RSha256.hxx:104
TGLSceneInfo::RefViewer
TGLViewerBase & RefViewer() const
Definition: TGLSceneInfo.h:83
TGLSceneInfo::SceneStamp
UInt_t SceneStamp() const
Definition: TGLSceneInfo.h:142
TGLSceneInfo::FrustumPlanes
std::vector< TGLPlane > & FrustumPlanes()
Definition: TGLSceneInfo.h:108
TGLSceneInfo::fInClip
Bool_t fInClip
Definition: TGLSceneInfo.h:70
TGLSceneInfo::fViewer
TGLViewerBase * fViewer
Definition: TGLSceneInfo.h:39
TGLSceneInfo::SetLastOLLineW
void SetLastOLLineW(Float_t w)
Definition: TGLSceneInfo.h:134
TGLSceneInfo::CameraStamp
UInt_t CameraStamp() const
Definition: TGLSceneInfo.h:150
TGLSceneInfo::fLastStyle
Short_t fLastStyle
Definition: TGLSceneInfo.h:50
TGLSceneInfo::SetLOD
void SetLOD(Short_t lod)
Definition: TGLSceneInfo.h:112
TGLCamera
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:44
TGLSceneInfo::SetClip
void SetClip(TGLClip *p)
Definition: TGLSceneInfo.h:123
TGLSceneInfo::fOLLineW
Float_t fOLLineW
Definition: TGLSceneInfo.h:46
Float_t
float Float_t
Definition: RtypesCore.h:57
TGLSceneInfo::fClipPlanes
TGLPlaneSet_t fClipPlanes
Definition: TGLSceneInfo.h:73
TGLSceneInfo::InClip
void InClip(Bool_t c)
Definition: TGLSceneInfo.h:101
TGLSceneInfo::SetLastCamera
void SetLastCamera(TGLCamera *p)
Definition: TGLSceneInfo.h:140
TGLSceneInfo::LastCamera
TGLCamera * LastCamera() const
Definition: TGLSceneInfo.h:139
TGLMatrix
16 component (4x4) transform matrix - column MAJOR as per GL.
Definition: TGLUtil.h:598
TGLSceneInfo::LastOLLineW
Float_t LastOLLineW() const
Definition: TGLSceneInfo.h:133
TGLSceneInfo::SetLastStyle
void SetLastStyle(Short_t st)
Definition: TGLSceneInfo.h:129
TGLBoundingBox.h
TGLSceneInfo::LastWFLineW
Float_t LastWFLineW() const
Definition: TGLSceneInfo.h:131
TGLSceneInfo::SetSceneTrans
virtual void SetSceneTrans(TGLMatrix &)
Definition: TGLSceneInfo.h:94
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGLBoundingBox
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
Definition: TGLBoundingBox.h:33
TGLSceneInfo::IsInFrustum
Bool_t IsInFrustum() const
Definition: TGLSceneInfo.h:98
TGLSceneInfo::GetScene
TGLSceneBase * GetScene() const
Definition: TGLSceneInfo.h:84
TGLSceneInfo::SetupTransformsAndBBox
void SetupTransformsAndBBox()
Combine information from scene, scene-info and camera (should be optional) into transformation matric...
Definition: TGLSceneInfo.cxx:85
bool
TGLSceneInfo::LastClip
TGLClip * LastClip() const
Definition: TGLSceneInfo.h:136
TGLSceneInfo::ResetCameraStamp
void ResetCameraStamp()
Definition: TGLSceneInfo.h:152
TGLSceneInfo::fInFrustum
Bool_t fInFrustum
Definition: TGLSceneInfo.h:69
TGLSceneInfo::fLastCamera
TGLCamera * fLastCamera
Definition: TGLSceneInfo.h:54
TGLViewerBase
Base class for GL viewers.
Definition: TGLViewerBase.h:37
TGLSceneInfo::fLastClip
TGLClip * fLastClip
Definition: TGLSceneInfo.h:53
TGLSceneInfo::fLastLOD
Short_t fLastLOD
Definition: TGLSceneInfo.h:49
TGLSceneInfo::fActive
Bool_t fActive
Definition: TGLSceneInfo.h:41
TGLSceneInfo::kClipOutside
@ kClipOutside
Definition: TGLSceneInfo.h:32
TGLSceneInfo::fViewCheck
Bool_t fViewCheck
Definition: TGLSceneInfo.h:68
TGLSceneInfo::operator=
TGLSceneInfo & operator=(const TGLSceneInfo &)=delete
TGLSceneInfo::fLastWFLineW
Float_t fLastWFLineW
Definition: TGLSceneInfo.h:51
TGLSceneInfo::fClipStamp
UInt_t fClipStamp
Definition: TGLSceneInfo.h:57
a
auto * a
Definition: textangle.C:12
TGLSceneInfo::SetLastLOD
void SetLastLOD(Short_t ld)
Definition: TGLSceneInfo.h:126
TGLSceneInfo::ClipPlanes
std::vector< TGLPlane > & ClipPlanes()
Definition: TGLSceneInfo.h:109
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGLSceneInfo::fSceneStamp
UInt_t fSceneStamp
Definition: TGLSceneInfo.h:56
TGLSceneInfo::GetViewer
TGLViewerBase * GetViewer() const
Definition: TGLSceneInfo.h:82
TGLSceneInfo::fFrustumPlanes
TGLPlaneSet_t fFrustumPlanes
Definition: TGLSceneInfo.h:72
TGLSceneInfo::~TGLSceneInfo
virtual ~TGLSceneInfo()
Definition: TGLSceneInfo.h:80
TGLSceneInfo::WFLineW
Float_t WFLineW() const
Definition: TGLSceneInfo.h:117
TGLSceneInfo::SetSceneStamp
void SetSceneStamp(UInt_t ts)
Definition: TGLSceneInfo.h:143
TGLSceneInfo::fStyle
Short_t fStyle
Definition: TGLSceneInfo.h:44
TGLSceneInfo::LOD
Short_t LOD() const
Definition: TGLSceneInfo.h:111
TGLSceneInfo::fClipMode
Char_t fClipMode
Definition: TGLSceneInfo.h:71
TGLSceneInfo::fClip
TGLClip * fClip
Definition: TGLSceneInfo.h:47
TGLSceneInfo::fTransformedBBox
TGLBoundingBox fTransformedBBox
Definition: TGLSceneInfo.h:66
Short_t
short Short_t
Definition: RtypesCore.h:39
TGLSceneInfo::UpdateTimeouted
void UpdateTimeouted()
Definition: TGLSceneInfo.h:155
TGLSceneInfo::SetWFLineW
void SetWFLineW(Float_t w)
Definition: TGLSceneInfo.h:118
TGLPlaneSet_t
std::vector< TGLPlane > TGLPlaneSet_t
Definition: TGLUtil.h:571
TGLSceneInfo::SetOLLineW
void SetOLLineW(Float_t w)
Definition: TGLSceneInfo.h:120
TGLSceneInfo::Style
Short_t Style() const
Definition: TGLSceneInfo.h:114
unsigned int
TGLSceneInfo::SetStyle
void SetStyle(Short_t st)
Definition: TGLSceneInfo.h:115
TGLSceneInfo::SetLastWFLineW
void SetLastWFLineW(Float_t w)
Definition: TGLSceneInfo.h:132
TGLSceneInfo::InFrustum
void InFrustum(Bool_t f)
Definition: TGLSceneInfo.h:99
TGLSceneInfo::fScene
TGLSceneBase * fScene
Definition: TGLSceneInfo.h:40
TGLClip
Abstract clipping shape - derives from TGLPhysicalShape Adds clip mode (inside/outside) and pure virt...
Definition: TGLClip.h:32
TGLSceneInfo::fLastOLLineW
Float_t fLastOLLineW
Definition: TGLSceneInfo.h:52
TGLSceneInfo::SetActive
void SetActive(Bool_t a)
Set active state of the scene, mark viewer as changed.
Definition: TGLSceneInfo.cxx:70
TGLSceneInfo::ViewCheck
Bool_t ViewCheck() const
Definition: TGLSceneInfo.h:96
TGLSceneInfo::ClipMode
void ClipMode(Char_t m)
Definition: TGLSceneInfo.h:103
TGLSceneInfo::EClipTest
EClipTest
Definition: TGLSceneInfo.h:32
TGLSceneInfo::GetTransformedBBox
const TGLBoundingBox & GetTransformedBBox()
Definition: TGLSceneInfo.h:92
TGLSceneInfo::SetClipStamp
void SetClipStamp(UInt_t ts)
Definition: TGLSceneInfo.h:147
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGLSceneInfo::kClipInside
@ kClipInside
Definition: TGLSceneInfo.h:32
TGLSceneInfo::ClipMode
Char_t ClipMode() const
Definition: TGLSceneInfo.h:102
TGLUtil.h
TGLSceneInfo::LastStyle
Short_t LastStyle() const
Definition: TGLSceneInfo.h:128
TGLSceneInfo::IsInClip
Bool_t IsInClip() const
Definition: TGLSceneInfo.h:100
TGLSceneInfo::RefScene
TGLSceneBase & RefScene() const
Definition: TGLSceneInfo.h:85
TGLSceneInfo
Base class for extended scene context.
Definition: TGLSceneInfo.h:28
TGLSceneInfo::ViewCheck
void ViewCheck(Bool_t c)
Definition: TGLSceneInfo.h:97
TGLSceneInfo::Clip
TGLClip * Clip() const
Definition: TGLSceneInfo.h:122
TGLSceneInfo::kClipNone
@ kClipNone
Definition: TGLSceneInfo.h:32
TGLSceneInfo::HasUpdateTimeouted
Bool_t HasUpdateTimeouted() const
Definition: TGLSceneInfo.h:154
Char_t
char Char_t
Definition: RtypesCore.h:33
TGLSceneInfo::fWFLineW
Float_t fWFLineW
Definition: TGLSceneInfo.h:45
Rtypes.h
TGLSceneInfo::IsVisible
Bool_t IsVisible() const
Definition: TGLSceneInfo.h:106
TGLSceneInfo::LastLOD
Short_t LastLOD() const
Definition: TGLSceneInfo.h:125
TGLSceneInfo::fLOD
Short_t fLOD
Definition: TGLSceneInfo.h:43
TGLSceneInfo::fUpdateTimeouted
Bool_t fUpdateTimeouted
Definition: TGLSceneInfo.h:59
TGLSceneInfo::SetLastClip
void SetLastClip(TGLClip *p)
Definition: TGLSceneInfo.h:137
TGLSceneInfo::ResetSceneStamp
void ResetSceneStamp()
Definition: TGLSceneInfo.h:144
TGLSceneInfo::OLLineW
Float_t OLLineW() const
Definition: TGLSceneInfo.h:119