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