Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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=nullptr, TGLSceneBase* scene=nullptr);
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; }
119 Float_t OLLineW() const { return fOLLineW; }
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; }
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
#define a(i)
Definition RSha256.hxx:99
bool Bool_t
Definition RtypesCore.h:63
char Char_t
Definition RtypesCore.h:37
float Float_t
Definition RtypesCore.h:57
short Short_t
Definition RtypesCore.h:39
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassDef(name, id)
Definition Rtypes.h:342
std::vector< TGLPlane > TGLPlaneSet_t
Definition TGLUtil.h:571
winID h TVirtualViewer3D TVirtualGLPainter p
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:
Base class for extended scene context.
UInt_t SceneStamp() const
Bool_t IsInClip() const
UInt_t fCameraStamp
Short_t Style() const
Bool_t fViewCheck
UInt_t fClipStamp
void SetOLLineW(Float_t w)
TGLCamera * fLastCamera
TGLViewerBase * GetViewer() const
Bool_t ViewCheck() const
void SetClip(TGLClip *p)
TGLSceneBase & RefScene() const
void SetLastClip(TGLClip *p)
Float_t fLastWFLineW
Float_t fLastOLLineW
void ClipMode(Char_t m)
void ViewCheck(Bool_t c)
Short_t LastStyle() const
void UpdateTimeouted()
Bool_t IsInFrustum() const
void SetLastWFLineW(Float_t w)
TGLSceneBase * fScene
void InClip(Bool_t c)
void ResetClipStamp()
Bool_t fInFrustum
Float_t WFLineW() const
void SetCameraStamp(UInt_t ts)
void SetStyle(Short_t st)
void SetupTransformsAndBBox()
Combine information from scene, scene-info and camera (should be optional) into transformation matric...
TGLPlaneSet_t fClipPlanes
Bool_t ShouldClip() const
TGLClip * LastClip() const
Float_t fOLLineW
TGLClip * fClip
Short_t fLastStyle
TGLSceneInfo & operator=(const TGLSceneInfo &)=delete
Bool_t GetActive() const
TGLViewerBase & RefViewer() const
void SetLOD(Short_t lod)
TGLClip * Clip() const
Char_t ClipMode() const
const TGLBoundingBox & GetTransformedBBox()
void SetLastLOD(Short_t ld)
virtual void SetSceneTrans(TGLMatrix &)
Short_t LastLOD() const
virtual ~TGLSceneInfo()
TGLBoundingBox fTransformedBBox
void SetActive(Bool_t a)
Set active state of the scene, mark viewer as changed.
UInt_t CameraStamp() const
void ResetCameraStamp()
void SetLastCamera(TGLCamera *p)
void InFrustum(Bool_t f)
TGLClip * fLastClip
Short_t fStyle
Bool_t IsVisible() const
Float_t OLLineW() const
void SetSceneStamp(UInt_t ts)
TGLCamera * LastCamera() const
TGLPlaneSet_t fFrustumPlanes
Char_t fClipMode
Float_t LastWFLineW() const
Bool_t HasUpdateTimeouted() const
TGLViewerBase * fViewer
Short_t LOD() const
std::vector< TGLPlane > & ClipPlanes()
void SetLastStyle(Short_t st)
UInt_t fSceneStamp
Float_t LastOLLineW() const
Bool_t fUpdateTimeouted
Float_t fWFLineW
void SetClipStamp(UInt_t ts)
std::vector< TGLPlane > & FrustumPlanes()
void SetWFLineW(Float_t w)
void ResetUpdateTimeouted()
UInt_t ClipStamp() const
TGLSceneBase * GetScene() const
void ResetSceneStamp()
void SetLastOLLineW(Float_t w)
Short_t fLastLOD
TGLSceneInfo(const TGLSceneInfo &)=delete
Base class for GL viewers.
TMarker m
Definition textangle.C:8