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 fRenderMaxHz{0.f}; ///< see SetRenderMaxHz(); 0 is uncapped
92 bool fBlackBackground{false};
93
94 /// Distance attenuation of the 3D axis labels; see SetAxesAtten().
96
97 /// 3D axis label size, as a fraction of viewport height. Baked into the
98 /// glyph geometry, so a change costs a rebuild on the client.
100
101 /// Tooltip text size, same units as fAxesFontSize.
103
104 /// Opacity of the plate behind the tooltip and kept annotations, in [0, 1].
105 /// Unlike the font size this does reach annotations already placed.
107
108 /// Multiplier on the client's light intensities; see SetLightScale().
112 /// Bumped by AutoTuneLights(); the client re-measures when it changes.
114 // clang-format on
115
116 bool fMandatory{true};
117 std::string fPostStreamFlag;
118
119 std::vector<REveCamera*> fCameraList;
120
122
123 bool fSyncCamera{true};
124
125public:
126 REveViewer(const std::string &n="REveViewer", const std::string &t="");
127 ~REveViewer() override;
128
129 void Redraw(Bool_t resetCameras=kFALSE);
130
131 virtual void AddScene(REveScene* scene);
132 // XXX Missing RemoveScene() ????
133
134 // Camera setters
136 REveCamera* GetCamera() const { return fCamera;}
137 void SetCameraByElementId(ElementId_t cameraId); // set camera via ElementID
139
140 void SyncCamera(bool s) {fSyncCamera = s;}
141 bool GetSyncCamera() const {return fSyncCamera;}
142
143 // The getters return the value last sent to the clients, not what a client
144 // is showing.
145 EAxesType GetAxesType() const { return fAxesType; }
146 void SetAxesType(int);
147
149 void SetCameraCenter(ECameraCenter c);
150
151 // clang-format off
153 void SetExtrapolateMotion(bool);
154
155 Int_t GetAxesUpAxis() const { return fAxesUpAxis; }
156 void SetAxesUpAxis(int);
157
160 void ClearAxesBBox();
161 Bool_t HasAxesBBox() const { return fHasAxesBBox; }
162
163 /// Cap on how often the animation loop redraws this viewer, in frames per
164 /// second, clamped to [0, 240]. Zero means uncapped.
167 // clang-format on
168
169 bool GetBlackBackground() const { return fBlackBackground; }
170 void SetBlackBackground(bool);
171
172 Float_t GetAxesAtten() const { return fAxesAtten; }
173 void SetAxesAtten(Float_t a);
174
176 void SetAxesFontSize(Float_t s);
177
180
183
185 void SetLightScale(Float_t s);
186
188 void SetToneMapMode(Int_t m);
189
191 void SetToneMapKnee(Float_t k);
192
193 void AutoTuneLights();
194
195 void DisconnectClient();
196 void ConnectClient();
197
198 void SetMandatory(bool x);
199 bool GetMandatory() { return fMandatory; }
200
201 void RemoveElementLocal(REveElement *el) override;
202 void RemoveElementsLocal() override;
203 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
204};
205
206
207////////////////////////////////////////////////////////////////////////////////
208/// REveViewerList
209/// List of Viewers providing common operations on REveViewer collections.
210////////////////////////////////////////////////////////////////////////////////
211
213{
214private:
217
218protected:
220
223
224public:
225 REveViewerList(const std::string &n="REveViewerList", const std::string &t="");
226 ~REveViewerList() override;
227
228 void AddElement(REveElement* el) override;
229 void RemoveElementLocal(REveElement* el) override;
230 void RemoveElementsLocal() override;
231
232 // --------------------------------
233
234 virtual void Connect();
235 virtual void Disconnect();
236
237 void RepaintChangedViewers(Bool_t resetCameras, Bool_t dropLogicals);
238 void RepaintAllViewers(Bool_t resetCameras, Bool_t dropLogicals);
239 void DeleteAnnotations();
240
241 void SceneDestructing(REveScene* scene);
242
243 // --------------------------------
244
247
250
252 void SwitchColorSet();
253 // Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
254};
255
256} // namespace Experimental
257} // namespace ROOT
258
259#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
Float_t fLightScale
Multiplier on the client's light intensities; see SetLightScale().
Float_t fRenderMaxHz
see SetRenderMaxHz(); 0 is uncapped
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 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