Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveViewer.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007, 2018
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, 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 ROOT7_REveViewer
13#define ROOT7_REveViewer
14
15#include <ROOT/REveElement.hxx>
16#include <ROOT/REveCamera.hxx>
17
18namespace ROOT {
19namespace Experimental {
20
21class REveScene;
22
23////////////////////////////////////////////////////////////////////////////////
24/// REveViewer
25/// Reve representation of TGLViewer.
26////////////////////////////////////////////////////////////////////////////////
27
28class REveViewer : public REveElement
29{
30public:
31 // set alias instead
33
34 // backward compatibility
46
52
53 /// Point the camera looks at and orbits around after a camera reset.
55 kCameraCenterOrigin, ///< world origin, (0, 0, 0)
56 kCameraCenterBBox ///< center of the scene bounding box
57 };
58
59 /// Tone curve applied to the rendered buffer. Values match the shader.
60 // clang-format off
64 kToneLinear = 2, ///< no curve; exact colours, but anything over 1 clips
65 kToneKnee = 3 ///< identity below the knee, smooth roll-off above
66 };
67 // clang-format on
68
69private:
70 REveViewer(const REveViewer&) = delete;
71 REveViewer& operator=(const REveViewer&) = delete;
72
74
76
78
79 /// Let the client extrapolate streamed motion between updates. Off holds
80 /// each object where the last update put it, which shows the raw update rate.
82
83 /// Which axis points up: 0/1/2 for x/y/z, -1 (default) for none. When set,
84 /// the box axis draws the floor panel along it instead of the far face.
86
87 // clang-format off
88 Bool_t fHasAxesBBox{kFALSE}; ///< see SetAxesBBox()
89 Float_t fAxesBBox[6]{}; ///< xmin, ymin, zmin, xmax, ymax, zmax
90
91 Float_t fMotionMaxHz{60.f}; ///< see SetMotionMaxHz(); 0 freezes
92 Float_t fRenderMaxHz{0.f}; ///< see SetRenderMaxHz(); 0 is uncapped
93 bool fBlackBackground{false};
94
95 /// Distance attenuation of the 3D axis labels; see SetAxesAtten().
97
98 /// 3D axis label size, as a fraction of viewport height. Baked into the
99 /// glyph geometry, so a change costs a rebuild on the client.
101
102 /// Tooltip text size, same units as fAxesFontSize.
104
105 /// Opacity of the plate behind the tooltip and kept annotations, in [0, 1].
106 /// Unlike the font size this does reach annotations already placed.
108
109 /// Multiplier on the client's light intensities; see SetLightScale().
113 /// Bumped by AutoTuneLights(); the client re-measures when it changes.
115 // clang-format on
116
117 bool fMandatory{true};
118 std::string fPostStreamFlag;
119
120 std::vector<REveCamera*> fCameraList;
121
123
124 bool fSyncCamera{true};
125
126public:
127 REveViewer(const std::string &n="REveViewer", const std::string &t="");
128 ~REveViewer() override;
129
130 void Redraw(Bool_t resetCameras=kFALSE);
131
132 virtual void AddScene(REveScene* scene);
133 // XXX Missing RemoveScene() ????
134
135 // Camera setters
137 REveCamera* GetCamera() const { return fCamera;}
138 void SetCameraByElementId(ElementId_t cameraId); // set camera via ElementID
140
141 void SyncCamera(bool s) {fSyncCamera = s;}
142 bool GetSyncCamera() const {return fSyncCamera;}
143
144 // The getters return the value last sent to the clients, not what a client
145 // is showing.
146 EAxesType GetAxesType() const { return fAxesType; }
147 void SetAxesType(int);
148
150 void SetCameraCenter(ECameraCenter c);
151
152 // clang-format off
154 void SetExtrapolateMotion(bool);
155
156 Int_t GetAxesUpAxis() const { return fAxesUpAxis; }
157 void SetAxesUpAxis(int);
158
161 void ClearAxesBBox();
162 Bool_t HasAxesBBox() const { return fHasAxesBBox; }
163
164 /// Cap on how often this viewer applies streamed motion, in updates per
165 /// second, clamped to [0, 240]. Zero freezes motion; SetExtrapolateMotion()
166 /// only controls drawing between updates.
169
170 /// Cap on how often the animation loop redraws this viewer, in frames per
171 /// second, clamped to [0, 240]. Zero means uncapped, unlike SetMotionMaxHz().
174 // clang-format on
175
176 bool GetBlackBackground() const { return fBlackBackground; }
177 void SetBlackBackground(bool);
178
179 Float_t GetAxesAtten() const { return fAxesAtten; }
180 void SetAxesAtten(Float_t a);
181
183 void SetAxesFontSize(Float_t s);
184
187
190
192 void SetLightScale(Float_t s);
193
195 void SetToneMapMode(Int_t m);
196
198 void SetToneMapKnee(Float_t k);
199
200 void AutoTuneLights();
201
202 void DisconnectClient();
203 void ConnectClient();
204
205 void SetMandatory(bool x);
206 bool GetMandatory() { return fMandatory; }
207
208 void RemoveElementLocal(REveElement *el) override;
209 void RemoveElementsLocal() override;
210 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
211};
212
213
214////////////////////////////////////////////////////////////////////////////////
215/// REveViewerList
216/// List of Viewers providing common operations on REveViewer collections.
217////////////////////////////////////////////////////////////////////////////////
218
220{
221private:
224
225protected:
227
230
231public:
232 REveViewerList(const std::string &n="REveViewerList", const std::string &t="");
233 ~REveViewerList() override;
234
235 void AddElement(REveElement* el) override;
236 void RemoveElementLocal(REveElement* el) override;
237 void RemoveElementsLocal() override;
238
239 // --------------------------------
240
241 virtual void Connect();
242 virtual void Disconnect();
243
244 void RepaintChangedViewers(Bool_t resetCameras, Bool_t dropLogicals);
245 void RepaintAllViewers(Bool_t resetCameras, Bool_t dropLogicals);
246 void DeleteAnnotations();
247
248 void SceneDestructing(REveScene* scene);
249
250 // --------------------------------
251
254
257
259 void SwitchColorSet();
260 // Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
261};
262
263} // namespace Experimental
264} // namespace ROOT
265
266#endif
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:78
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
float xmin
float ymin
float xmax
float ymax
Eve representation of TGLScene.
REveViewerList List of Viewers providing common operations on REveViewer collections.
void RemoveElementsLocal() override
Decompoundofy children, call base-class version.
REveViewerList & operator=(const REveViewerList &)=delete
void AddElement(REveElement *el) override
Call base-class implementation.
~REveViewerList() override
Destructor.
void SceneDestructing(REveScene *scene)
Callback done from a REveScene destructor allowing proper removal of the scene from affected viewers.
void SetColorBrightness(Float_t b)
Set color brightness.
void RepaintAllViewers(Bool_t resetCameras, Bool_t dropLogicals)
Repaint all viewers.
virtual void Disconnect()
Disconnect from TGLViewer class-signals.
void RepaintChangedViewers(Bool_t resetCameras, Bool_t dropLogicals)
Repaint viewers that are tagged as changed.
void SwitchColorSet()
Switch background color.
REveViewerList(const REveViewerList &)=delete
virtual void Connect()
Connect to TGLViewer class-signals.
void DeleteAnnotations()
Delete annotations from all viewers.
void RemoveElementLocal(REveElement *el) override
Decompoundofy el, call base-class version.
REveViewer Reve representation of TGLViewer.
void SetCameraCenter(ECameraCenter c)
Set the point the camera looks at and orbits around, either the world origin or the center of the sce...
static constexpr ECameraType kCameraPerspXOY
static constexpr ECameraType kCameraOrthoZOX
static constexpr ECameraType kCameraPerspYOZ
void RemoveElementLocal(REveElement *el) override
Remove element 'el' from the list of children and also remove appropriate GLScene from GLViewer's lis...
void DisconnectClient()
Function called from MIR when user closes one of the viewer window.
void ConnectClient()
Function called from MIR when user wants to stream unsubscribed view.
Bool_t fExtrapolateMotion
Let the client extrapolate streamed motion between updates.
static constexpr ECameraType kCameraOrthoXOZ
~REveViewer() override
Destructor.
void SetCamera(ROOT::Experimental::REveCamera *cam)
Set camera reference.
static constexpr ECameraType kCameraOrthoZOY
std::vector< REveCamera * > fCameraList
void RemoveElementsLocal() override
Remove all children, forwarded to GLViewer.
Float_t fAxesAtten
Distance attenuation of the 3D axis labels; see SetAxesAtten().
ECameraCenter GetCameraCenter() const
void ClearAxesBBox()
Let the 3D axis follow the scene bounding box again.
void SetRenderMaxHz(Float_t)
Cap the redraw rate of this viewer, in frames per second; 0 is uncapped.
void SetCameraType(REveCamera::ECameraType type)
Set camera by type (backward compatibility with old API)
void SetTooltipAlpha(Float_t a)
Opacity of the plate behind the tooltip and kept annotations.
Float_t fAxesBBox[6]
xmin, ymin, zmin, xmax, ymax, zmax
void SetMotionMaxHz(Float_t)
Cap the rate at which this viewer applies streamed motion; 0 freezes it.
Float_t fLightScale
Multiplier on the client's light intensities; see SetLightScale().
Float_t fRenderMaxHz
see SetRenderMaxHz(); 0 is uncapped
Float_t fMotionMaxHz
see SetMotionMaxHz(); 0 freezes
void SetAxesFontSize(Float_t s)
Label size for the 3D axis, as a fraction of viewport height, clamped to [0.004, 0....
REveViewer(const REveViewer &)=delete
void SetExtrapolateMotion(bool)
Enable or disable client-side extrapolation of streamed motion.
EToneMapMode
Tone curve applied to the rendered buffer. Values match the shader.
@ kToneLinear
no curve; exact colours, but anything over 1 clips
@ kToneKnee
identity below the knee, smooth roll-off above
Float_t fTooltipFontSize
Tooltip text size, same units as fAxesFontSize.
Int_t fAutoTuneSerial
Bumped by AutoTuneLights(); the client re-measures when it changes.
REveViewer & operator=(const REveViewer &)=delete
void AutoTuneLights()
Ask the clients to pick a light scale that keeps the brightest channel just below white.
void SetAxesBBox(Float_t xmin, Float_t ymin, Float_t zmin, Float_t xmax, Float_t ymax, Float_t zmax)
Fix the volume the 3D axis spans, as {min, max} per coordinate, instead of following the scene conten...
Bool_t fHasAxesBBox
see SetAxesBBox()
static constexpr ECameraType kCameraOrthoXnOZ
static constexpr ECameraType kCameraOrthoXnOY
ECameraCenter
Point the camera looks at and orbits around after a camera reset.
@ kCameraCenterOrigin
world origin, (0, 0, 0)
@ kCameraCenterBBox
center of the scene bounding box
Int_t fAxesUpAxis
Which axis points up: 0/1/2 for x/y/z, -1 (default) for none.
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Stream Camera Info.
void SetCameraByElementId(ElementId_t cameraId)
Float_t fTooltipAlpha
Opacity of the plate behind the tooltip and kept annotations, in [0, 1].
void SetAxesAtten(Float_t a)
Distance attenuation of the 3D axis labels.
void SetLightScale(Float_t s)
Multiplier on the client's light intensities, clamped at zero from below.
void Redraw(Bool_t resetCameras=kFALSE)
Redraw viewer immediately.
virtual void AddScene(REveScene *scene)
Add 'scene' to the list of scenes.
void SetTooltipFontSize(Float_t s)
Label size for the hover tooltip, as a fraction of viewport height.
static constexpr ECameraType kCameraOrthoXOY
ROOT::Experimental::REveCamera * CreateCamera(ECameraType type)
static constexpr ECameraType kCameraPerspXOZ
void SetToneMapKnee(Float_t k)
Knee position for kToneKnee: colours below this pass through exactly, so raising it buys fidelity and...
static constexpr ECameraType kCameraOrthoZnOX
Float_t fAxesFontSize
3D axis label size, as a fraction of viewport height.
void SetAxesUpAxis(int)
Set the up axis, 0/1/2 for x/y/z; any other value means none.
void SetToneMapMode(Int_t m)
Tone curve, as EToneMapMode.
Float_t GetMotionMaxHz() const
Cap on how often this viewer applies streamed motion, in updates per second, clamped to [0,...
Float_t GetRenderMaxHz() const
Cap on how often the animation loop redraws this viewer, in frames per second, clamped to [0,...
REveCamera * GetCamera() const
static constexpr ECameraType kCameraOrthoZnOY
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
unsigned int ElementId_t
Definition REveTypes.hxx:28
TMarker m
Definition textangle.C:8