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
21class TGLViewerBase;
22class TGLSceneBase;
23class TGLClip;
24class TGLRenderContext;
25class TGLCamera;
26
28{
29 friend class TGLSceneBase;
30
31public:
33
34private:
35 TGLSceneInfo(const TGLSceneInfo&) = delete;
37
38protected:
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
78public:
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
95
96 Bool_t ViewCheck() const { return fViewCheck; }
98 Bool_t IsInFrustum() const { return fInFrustum; }
100 Bool_t IsInClip() const { return fInClip; }
101 void InClip(Bool_t c) { fInClip = c; }
102 Char_t ClipMode() const { return fClipMode; }
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; }
145
146 UInt_t ClipStamp() const { return fClipStamp; }
147 void SetClipStamp(UInt_t ts) { fClipStamp = ts; }
149
150 UInt_t CameraStamp() const { return fCameraStamp; }
153
157
158 ClassDef(TGLSceneInfo, 0) // Data about a scene within a viewer context.
159}; // endclass TGLSceneInfo
160
161
162#endif
#define f(i)
Definition: RSha256.hxx:104
#define c(i)
Definition: RSha256.hxx:101
char Char_t
Definition: RtypesCore.h:33
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
short Short_t
Definition: RtypesCore.h:39
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassDef(name, id)
Definition: Rtypes.h:325
std::vector< TGLPlane > TGLPlaneSet_t
Definition: TGLUtil.h:571
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:44
Abstract clipping shape - derives from TGLPhysicalShape Adds clip mode (inside/outside) and pure virt...
Definition: TGLClip.h:32
16 component (4x4) transform matrix - column MAJOR as per GL.
Definition: TGLUtil.h:598
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes:
Definition: TGLSceneBase.h:33
Base class for extended scene context.
Definition: TGLSceneInfo.h:28
UInt_t SceneStamp() const
Definition: TGLSceneInfo.h:142
Bool_t IsInClip() const
Definition: TGLSceneInfo.h:100
Short_t fLOD
Definition: TGLSceneInfo.h:43
UInt_t fCameraStamp
Definition: TGLSceneInfo.h:58
Short_t Style() const
Definition: TGLSceneInfo.h:114
Bool_t fViewCheck
Definition: TGLSceneInfo.h:68
UInt_t fClipStamp
Definition: TGLSceneInfo.h:57
void SetOLLineW(Float_t w)
Definition: TGLSceneInfo.h:120
TGLCamera * fLastCamera
Definition: TGLSceneInfo.h:54
TGLViewerBase * GetViewer() const
Definition: TGLSceneInfo.h:82
Bool_t ViewCheck() const
Definition: TGLSceneInfo.h:96
void SetClip(TGLClip *p)
Definition: TGLSceneInfo.h:123
TGLSceneBase & RefScene() const
Definition: TGLSceneInfo.h:85
void SetLastClip(TGLClip *p)
Definition: TGLSceneInfo.h:137
Float_t fLastWFLineW
Definition: TGLSceneInfo.h:51
Float_t fLastOLLineW
Definition: TGLSceneInfo.h:52
void ClipMode(Char_t m)
Definition: TGLSceneInfo.h:103
void ViewCheck(Bool_t c)
Definition: TGLSceneInfo.h:97
Short_t LastStyle() const
Definition: TGLSceneInfo.h:128
Bool_t fActive
Definition: TGLSceneInfo.h:41
void UpdateTimeouted()
Definition: TGLSceneInfo.h:155
Bool_t IsInFrustum() const
Definition: TGLSceneInfo.h:98
void SetLastWFLineW(Float_t w)
Definition: TGLSceneInfo.h:132
TGLSceneBase * fScene
Definition: TGLSceneInfo.h:40
void InClip(Bool_t c)
Definition: TGLSceneInfo.h:101
void ResetClipStamp()
Definition: TGLSceneInfo.h:148
Bool_t fInFrustum
Definition: TGLSceneInfo.h:69
Float_t WFLineW() const
Definition: TGLSceneInfo.h:117
void SetCameraStamp(UInt_t ts)
Definition: TGLSceneInfo.h:151
void SetStyle(Short_t st)
Definition: TGLSceneInfo.h:115
void SetupTransformsAndBBox()
Combine information from scene, scene-info and camera (should be optional) into transformation matric...
TGLPlaneSet_t fClipPlanes
Definition: TGLSceneInfo.h:73
Bool_t ShouldClip() const
Definition: TGLSceneInfo.h:105
TGLClip * LastClip() const
Definition: TGLSceneInfo.h:136
Float_t fOLLineW
Definition: TGLSceneInfo.h:46
TGLClip * fClip
Definition: TGLSceneInfo.h:47
Short_t fLastStyle
Definition: TGLSceneInfo.h:50
Bool_t fInClip
Definition: TGLSceneInfo.h:70
TGLSceneInfo & operator=(const TGLSceneInfo &)=delete
Bool_t GetActive() const
Definition: TGLSceneInfo.h:87
TGLViewerBase & RefViewer() const
Definition: TGLSceneInfo.h:83
void SetLOD(Short_t lod)
Definition: TGLSceneInfo.h:112
TGLClip * Clip() const
Definition: TGLSceneInfo.h:122
Char_t ClipMode() const
Definition: TGLSceneInfo.h:102
const TGLBoundingBox & GetTransformedBBox()
Definition: TGLSceneInfo.h:92
void SetLastLOD(Short_t ld)
Definition: TGLSceneInfo.h:126
virtual void SetSceneTrans(TGLMatrix &)
Definition: TGLSceneInfo.h:94
Short_t LastLOD() const
Definition: TGLSceneInfo.h:125
virtual ~TGLSceneInfo()
Definition: TGLSceneInfo.h:80
TGLBoundingBox fTransformedBBox
Definition: TGLSceneInfo.h:66
void SetActive(Bool_t a)
Set active state of the scene, mark viewer as changed.
UInt_t CameraStamp() const
Definition: TGLSceneInfo.h:150
void ResetCameraStamp()
Definition: TGLSceneInfo.h:152
void SetLastCamera(TGLCamera *p)
Definition: TGLSceneInfo.h:140
void InFrustum(Bool_t f)
Definition: TGLSceneInfo.h:99
TGLClip * fLastClip
Definition: TGLSceneInfo.h:53
Short_t fStyle
Definition: TGLSceneInfo.h:44
Bool_t IsVisible() const
Definition: TGLSceneInfo.h:106
Float_t OLLineW() const
Definition: TGLSceneInfo.h:119
void SetSceneStamp(UInt_t ts)
Definition: TGLSceneInfo.h:143
TGLCamera * LastCamera() const
Definition: TGLSceneInfo.h:139
TGLPlaneSet_t fFrustumPlanes
Definition: TGLSceneInfo.h:72
Char_t fClipMode
Definition: TGLSceneInfo.h:71
Float_t LastWFLineW() const
Definition: TGLSceneInfo.h:131
Bool_t HasUpdateTimeouted() const
Definition: TGLSceneInfo.h:154
TGLViewerBase * fViewer
Definition: TGLSceneInfo.h:39
Short_t LOD() const
Definition: TGLSceneInfo.h:111
std::vector< TGLPlane > & ClipPlanes()
Definition: TGLSceneInfo.h:109
void SetLastStyle(Short_t st)
Definition: TGLSceneInfo.h:129
UInt_t fSceneStamp
Definition: TGLSceneInfo.h:56
Float_t LastOLLineW() const
Definition: TGLSceneInfo.h:133
Bool_t fUpdateTimeouted
Definition: TGLSceneInfo.h:59
Float_t fWFLineW
Definition: TGLSceneInfo.h:45
void SetClipStamp(UInt_t ts)
Definition: TGLSceneInfo.h:147
std::vector< TGLPlane > & FrustumPlanes()
Definition: TGLSceneInfo.h:108
void SetWFLineW(Float_t w)
Definition: TGLSceneInfo.h:118
void ResetUpdateTimeouted()
Definition: TGLSceneInfo.h:156
UInt_t ClipStamp() const
Definition: TGLSceneInfo.h:146
TGLSceneBase * GetScene() const
Definition: TGLSceneInfo.h:84
void ResetSceneStamp()
Definition: TGLSceneInfo.h:144
void SetLastOLLineW(Float_t w)
Definition: TGLSceneInfo.h:134
Short_t fLastLOD
Definition: TGLSceneInfo.h:49
TGLSceneInfo(const TGLSceneInfo &)=delete
Base class for GL viewers.
Definition: TGLViewerBase.h:37
auto * m
Definition: textangle.C:8
auto * a
Definition: textangle.C:12