Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLViewer.h
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Richard Maunder 25/05/2005
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_TGLViewer
13#define ROOT_TGLViewer
14
15#include "TGLViewerBase.h"
16#include "TGLRnrCtx.h"
17#include "TGLSelectRecord.h"
18
19#include "TVirtualViewer3D.h"
20#include "TBuffer3D.h"
21
23#include "TGLOrthoCamera.h"
24#include "TGLClip.h"
25
26#include "TTimer.h"
27#include "TPoint.h"
28
29#include "TGEventHandler.h"
30
31#include "GuiTypes.h"
32#include "TQObject.h"
33
34class TGLSceneBase;
35class TGLRedrawTimer;
36class TGLViewerEditor;
37class TGLWidget;
38class TGLLightSet;
39class TGLClipSet;
40class TGLManipSet;
43class TGLAutoRotator;
44class TTimer;
45class TImage;
46
47class TContextMenu;
48class TGedEditor;
49class TGLPShapeObj;
50
52 public TGLViewerBase,
53 public TQObject
54
55{
56 friend class TGLOutput;
57 friend class TGLEventHandler;
58 friend class TGLAutoRotator;
59public:
60
64
65 enum ESecSelType { // When to do secondary-selection:
66 kOnRequest, // - on request - when Mod1 is pressed or logical-shape requests it;
67 kOnKeyMod1 // - only when Mod1 is pressed.
68 };
69
70private:
71 TGLViewer(const TGLViewer &) = delete;
72 TGLViewer & operator=(const TGLViewer &) = delete;
73
75
76protected:
77 // External handles
78 TVirtualPad *fPad; //! external pad - remove replace with signal
79
80 // GUI Handles
82
83 // Cameras
84 // TODO: Put in vector and allow external creation
98
99 // Stereo
100 Bool_t fStereo; //! use stereo rendering
101 Bool_t fStereoQuadBuf; //! draw quad buffer or left/right stereo in left/right half of window
102 Float_t fStereoZeroParallax; //! position of zero-parallax plane: 0 - near clipping plane, 1 - far clipping plane
105
106 // Lights
108 // Clipping
110 // Selected physical
111 TGLSelectRecord fCurrentSelRec; //! select record in use as selected
112 TGLSelectRecord fSelRec; //! select record from last select (should go to context)
113 TGLSelectRecord fSecSelRec; //! select record from last secondary select (should go to context)
115 // Overlay
116 TGLOverlayElement *fCurrentOvlElm; //! current overlay element
117 TGLOvlSelectRecord fOvlSelRec; //! select record from last overlay select
118
119 TGEventHandler *fEventHandler; //! event handler
120 TGedEditor *fGedEditor; //! GED editor
122
123 // Mouse ineraction
124public:
130protected:
133
134 // Redraw timer
135 TGLRedrawTimer *fRedrawTimer; //! timer for triggering redraws
136 Float_t fMaxSceneDrawTimeHQ; //! max time for scene rendering at high LOD (in ms)
137 Float_t fMaxSceneDrawTimeLQ; //! max time for scene rendering at high LOD (in ms)
138
139 TGLRect fViewport; //! viewport - drawn area
140 TGLColorSet fDarkColorSet; //! color-set with dark background
141 TGLColorSet fLightColorSet; //! color-set with light background
142 Float_t fPointScale; //! size scale for points
143 Float_t fLineScale; //! width scale for lines
144 Bool_t fSmoothPoints; //! smooth point edge rendering
145 Bool_t fSmoothLines; //! smooth line edge rendering
146 Int_t fAxesType; //! axes type
147 Bool_t fAxesDepthTest; //! remove guides hidden-lines
148 Bool_t fReferenceOn; //! reference marker on?
149 TGLVertex3 fReferencePos; //! reference position
150 Bool_t fDrawCameraCenter; //! reference marker on?
151 TGLCameraOverlay *fCameraOverlay; //! markup size of viewport in scene units
152
153 Bool_t fSmartRefresh; //! cache logicals during scene rebuilds
154
155 // Debug tracing (for scene rebuilds)
156 Bool_t fDebugMode; //! debug mode (forced rebuild + draw scene/frustum/interest boxes)
158 TString fPictureFileName; //! default file-name for SavePicture()
159 Float_t fFader; //! fade the view (0 - no fade/default, 1 - full fade/no rendering done)
160
161 static TGLColorSet fgDefaultColorSet; //! a shared, default color-set
162 static Bool_t fgUseDefaultColorSetForNewViewers; //! name says it all
163 static Float_t fgAxisLabelScale; //! allow simple guide axes labels to be scaled relative to scene units
164
165 ///////////////////////////////////////////////////////////////////////
166 // Methods
167 ///////////////////////////////////////////////////////////////////////
168
169 void SetupClipObject() override;
170
171 // Drawing - can tidy up/remove lots when TGLManager added
172 void InitGL();
173 void PreDraw();
174 void PostDraw();
175 void FadeView(Float_t alpha);
176 void MakeCurrent() const;
177 void SwapBuffers() const;
178
179 // Cameras
181 void SetViewport(const TGLRect& vp);
182 void SetupCameras(Bool_t reset);
183
184protected:
186 Int_t fGLDevice; //!for embedded gl viewer
187 TGLContextIdentity *fGLCtxId; //!for embedded gl viewer
188
189 // Updata/camera-reset behaviour
190 Bool_t fIgnoreSizesOnUpdate; // ignore sizes of bounding-boxes on update
191 Bool_t fResetCamerasOnUpdate; // reposition camera on each update
192 Bool_t fResetCamerasOnNextUpdate; // reposition camera on next update
193
194public:
197 ~TGLViewer() override;
198
199 // TVirtualViewer3D interface ... mostly a facade
200
201 // Forward to TGLScenePad
202 Bool_t CanLoopOnPrimitives() const override { return kTRUE; }
203 void PadPaint(TVirtualPad* pad) override;
204 // Actually used by GL-in-pad
205 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
206 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
207 // Only implemented because they're abstract ... should throw an
208 // exception or assert they are not called.
209 Bool_t PreferLocalFrame() const override { return kTRUE; }
210 void BeginScene() override {}
211 Bool_t BuildingScene() const override { return kFALSE; }
212 void EndScene() override {}
213 Int_t AddObject(const TBuffer3D&, Bool_t* = nullptr) override { return TBuffer3D::kNone; }
214 Int_t AddObject(UInt_t, const TBuffer3D&, Bool_t* = nullptr) override { return TBuffer3D::kNone; }
215 Bool_t OpenComposite(const TBuffer3D&, Bool_t* = nullptr) override { return kFALSE; }
216 void CloseComposite() override {}
217 void AddCompositeOp(UInt_t) override {}
218
219 void PrintObjects() override;
220 void ResetCameras() override { SetupCameras(kTRUE); }
222
224
225 virtual void CreateGLWidget() {}
226 virtual void DestroyGLWidget() {}
227
228 Int_t GetDev() const { return fGLDevice; }
230 void SetSmartRefresh(Bool_t smart_ref) { fSmartRefresh = smart_ref; }
231
235 void UseDarkColorSet();
236 void UseLightColorSet();
237 void SwitchColorSet();
238
241 Bool_t IsColorSetDark() const;
242
243 void SetClearColor(Color_t col);
244
248 static void SetAxisLabelScale(Float_t als);
249
250 const TGLRect& RefViewport() const { return fViewport; }
252
254 Float_t GetLineScale() const { return fLineScale; }
261
262 TGLLightSet* GetLightSet() const { return fLightSet; }
263 TGLClipSet * GetClipSet() const { return fClipSet; }
266
267 // External GUI component interface
270 void SetCurrentCamera(ECameraType camera);
271 void SetOrthoCamera(ECameraType camera, Double_t zoom, Double_t dolly,
272 Double_t center[3], Double_t hRotate, Double_t vRotate);
273 void SetPerspectiveCamera(ECameraType camera, Double_t fov, Double_t dolly,
274 Double_t center[3], Double_t hRotate, Double_t vRotate);
275 void ReinitializeCurrentCamera(const TGLVector3& hAxis, const TGLVector3& vAxis, Bool_t redraw=kTRUE);
276 void GetGuideState(Int_t & axesType, Bool_t & axesDepthTest, Bool_t & referenceOn, Double_t* referencePos) const;
277 void SetGuideState(Int_t axesType, Bool_t axesDepthTest, Bool_t referenceOn, const Double_t* referencePos);
286
287 // Stereo
288 Bool_t GetStereo() const { return fStereo; }
292
293 void SetStereo(Bool_t stereo, Bool_t quad_buf=kTRUE);
297
298 // Push / drag action
301
302 const TGLPhysicalShape * GetSelected() const;
303
304
305 // Draw and selection
306
307 // Scene rendering timeouts
312
313 // Request methods post cross thread request via TROOT::ProcessLineFast().
314 void RequestDraw(Short_t LOD = TGLRnrCtx::kLODMed); // Cross thread draw request
315 void PreRender() override;
316 void Render() override;
317 void PostRender() override;
318 void DoDraw(Bool_t swap_buffers=kTRUE);
319 void DoDrawMono(Bool_t swap_buffers);
320 void DoDrawStereo(Bool_t swap_buffers);
321
322 void DrawGuides();
323 void DrawDebugInfo();
324
325 Bool_t RequestSelect(Int_t x, Int_t y); // Cross thread select request
326 Bool_t DoSelect(Int_t x, Int_t y); // First level selecton (shapes/objects).
327 Bool_t RequestSecondarySelect(Int_t x, Int_t y); // Cross thread secondary select request
328 Bool_t DoSecondarySelect(Int_t x, Int_t y); // Second level selecton (inner structure).
329 void ApplySelection();
330
331 Bool_t RequestOverlaySelect(Int_t x, Int_t y); // Cross thread select request
332 Bool_t DoOverlaySelect(Int_t x, Int_t y); // Window coords origin top left
333
334 // Saving of screen image
336 Bool_t SavePicture(const TString &fileName);
337 Bool_t SavePictureUsingBB (const TString &fileName);
338 Bool_t SavePictureUsingFBO(const TString &fileName, Int_t w, Int_t h, Float_t pixel_object_scale=0);
339 Bool_t SavePictureWidth (const TString &fileName, Int_t width, Bool_t pixel_object_scale=kTRUE);
340 Bool_t SavePictureHeight(const TString &fileName, Int_t height, Bool_t pixel_object_scale=kTRUE);
341 Bool_t SavePictureScale (const TString &fileName, Float_t scale, Bool_t pixel_object_scale=kTRUE);
342
343 // Methods returning screen image
345 TImage* GetPictureUsingFBO(Int_t w, Int_t h,Float_t pixel_object_scale=0);
346
347 const char* GetPictureFileName() const { return fPictureFileName.Data(); }
349 Float_t GetFader() const { return fFader; }
350 void SetFader(Float_t x) { fFader = x; }
351 void AutoFade(Float_t fade, Float_t time=1, Int_t steps=10);
352
353 // Update/camera-reset
354 void UpdateScene(Bool_t redraw=kTRUE);
357 void ResetCurrentCamera();
360
361 virtual void PostSceneBuildSetup(Bool_t resetCameras);
362
363 virtual void Activated() { Emit("Activated()"); } // *SIGNAL*
364
365 virtual void MouseIdle(TGLPhysicalShape*,UInt_t,UInt_t); // *SIGNAL*
366 virtual void MouseOver(TGLPhysicalShape*); // *SIGNAL*
367 virtual void MouseOver(TGLPhysicalShape*, UInt_t state); // *SIGNAL*
368 virtual void MouseOver(TObject *obj, UInt_t state); // *SIGNAL*
369 virtual void ReMouseOver(TObject *obj, UInt_t state); // *SIGNAL*
370 virtual void UnMouseOver(TObject *obj, UInt_t state); // *SIGNAL*
371
372 virtual void Clicked(TObject *obj); //*SIGNAL*
373 virtual void Clicked(TObject *obj, UInt_t button, UInt_t state); //*SIGNAL*
374 virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state); //*SIGNAL*
375 virtual void UnClicked(TObject *obj, UInt_t button, UInt_t state); //*SIGNAL*
376 virtual void DoubleClicked() { Emit("DoubleClicked()"); } // *SIGNAL*
377
379 virtual void SetEventHandler(TGEventHandler *handler);
380
381 TGedEditor* GetGedEditor() const { return fGedEditor; }
382 virtual void SetGedEditor(TGedEditor* ed) { fGedEditor = ed; }
383
384 virtual void SelectionChanged();
385 virtual void OverlayDragFinished();
386 virtual void RefreshPadEditor(TObject* obj=nullptr);
387
388 void RemoveOverlayElement(TGLOverlayElement* el) override;
389
393 void ClearCurrentOvlElm();
394
395 ClassDefOverride(TGLViewer,0) // Standard ROOT GL viewer.
396};
397
398
399
400// TODO: Find a better place/way to do this
401class TGLRedrawTimer : public TTimer
402{
403private:
407public:
409 fViewer(viewer), fRedrawLOD(TGLRnrCtx::kLODHigh), fPending(kFALSE) {}
410 ~TGLRedrawTimer() override {}
411 void RequestDraw(Int_t milliSec, Short_t redrawLOD)
412 {
413 if (fPending) TurnOff(); else fPending = kTRUE;
414 if (redrawLOD < fRedrawLOD) fRedrawLOD = redrawLOD;
415 TTimer::Start(milliSec, kTRUE);
416 }
417 Bool_t IsPending() const { return fPending; }
418 void Stop() override
419 {
420 if (fPending) { TurnOff(); fPending = kFALSE; }
421 }
422 Bool_t Notify() override
423 {
424 TurnOff();
428 return kTRUE;
429 }
430};
431
433private:
436
437public:
442
444 fViewer(nullptr), fFadeTarget(0), fTime(0), fNSteps(0) {}
446 fViewer(v), fFadeTarget(fade), fTime(time), fNSteps(steps) {}
447 virtual ~TGLFaderHelper() {}
448
449 void MakeFadeStep();
450
452};
453
454#endif // ROOT_TGLViewer
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:92
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
short Short_t
Definition RtypesCore.h:39
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDef(name, id)
Definition Rtypes.h:337
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Generic 3D primitive description class.
Definition TBuffer3D.h:18
This class provides an interface to context sensitive popup menus.
Automatically rotates GL camera.
A GL overlay element which displays camera furstum.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition TGLCamera.h:44
A collection of concrete TGLClip objects to be selected from.
Definition TGLClip.h:140
void SetAutoUpdate(Bool_t aup)
Definition TGLClip.h:189
Bool_t GetAutoUpdate() const
Definition TGLClip.h:188
Class encapsulating a set of colors used throughout standard rendering.
Definition TGLUtil.h:836
Identifier of a shared GL-context.
Definition TGLContext.h:81
Base-class and default implementation of event-handler for TGLViewer.
TGLFaderHelper & operator=(const TGLFaderHelper &)=delete
TGLFaderHelper(TGLViewer *v, Float_t fade, Float_t time, Int_t steps)
Definition TGLViewer.h:445
void MakeFadeStep()
Make one fading step and request redraw.
Float_t fFadeTarget
Definition TGLViewer.h:439
Float_t fTime
Definition TGLViewer.h:440
virtual ~TGLFaderHelper()
Definition TGLViewer.h:447
TGLViewer * fViewer
Definition TGLViewer.h:438
TGLFaderHelper(const TGLFaderHelper &)=delete
Encapsulates a set of lights for OpenGL.
Definition TGLLightSet.h:22
Combine all available manipulators in a collection.
Definition TGLManipSet.h:22
Orthographic projection camera.
Wrapper class for GL capture & output routines.
Definition TGLOutput.h:26
An overlay element.
Definition TGLOverlay.h:23
Selection record for overlay objects.
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
Perspective projection camera - with characteristic foreshortening.
Concrete physical shape - a GL drawable.
Viewport (pixel base) 2D rectangle class.
Definition TGLUtil.h:422
Int_t Diagonal() const
Return the diagonal of the rectangle.
Definition TGLUtil.cxx:286
TGLRedrawTimer(TGLViewer &viewer)
Definition TGLViewer.h:408
Bool_t fPending
Definition TGLViewer.h:406
Short_t fRedrawLOD
Definition TGLViewer.h:405
~TGLRedrawTimer() override
Definition TGLViewer.h:410
void Stop() override
Definition TGLViewer.h:418
TGLViewer & fViewer
Definition TGLViewer.h:404
Bool_t IsPending() const
Definition TGLViewer.h:417
void RequestDraw(Int_t milliSec, Short_t redrawLOD)
Definition TGLViewer.h:411
Bool_t Notify() override
This method must be overridden to handle object notification (the base implementation is no-op).
Definition TGLViewer.h:422
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition TGLRnrCtx.h:41
TGLColorSet * GetBaseColorSet()
Returns the current base color-set.
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes:
Standard selection record including information about containing scene and details ob out selected ob...
3 component (x/y/z) vector class.
Definition TGLUtil.h:248
3 component (x/y/z) vertex class.
Definition TGLUtil.h:84
Base class for GL viewers.
TGLRnrCtx * fRnrCtx
Short_t LOD() const
GUI editor for TGLViewer.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
TGLRedrawTimer * fRedrawTimer
Definition TGLViewer.h:135
Bool_t CanLoopOnPrimitives() const override
Definition TGLViewer.h:202
virtual void MouseOver(TGLPhysicalShape *)
Emit MouseOver signal.
void SetDrawCameraCenter(Bool_t x)
Draw camera look at and rotation point.
TGLAutoRotator * fAutoRotator
Definition TGLViewer.h:97
Bool_t PreferLocalFrame() const override
Definition TGLViewer.h:209
EPushAction fPushAction
Definition TGLViewer.h:131
Float_t fLineScale
size scale for points
Definition TGLViewer.h:143
void FadeView(Float_t alpha)
Draw a rectangle (background color and given alpha) across the whole viewport.
Bool_t SavePictureScale(const TString &fileName, Float_t scale, Bool_t pixel_object_scale=kTRUE)
Save picture with given scale to current window size.
TGLCamera * fCurrentCamera
Definition TGLViewer.h:96
void SetMaxSceneDrawTimeLQ(Float_t t)
Definition TGLViewer.h:311
TGLCameraOverlay * fCameraOverlay
reference marker on?
Definition TGLViewer.h:151
Int_t AddObject(const TBuffer3D &, Bool_t *=nullptr) override
Definition TGLViewer.h:213
virtual void RefreshPadEditor(TObject *obj=nullptr)
Update GED editor if it is set.
void SetStereoFrustumAsymFac(Float_t f)
Definition TGLViewer.h:296
virtual void Activated()
Definition TGLViewer.h:363
TGLOvlSelectRecord & GetOvlSelRec()
Definition TGLViewer.h:391
Bool_t fAxesDepthTest
axes type
Definition TGLViewer.h:147
virtual void SetEventHandler(TGEventHandler *handler)
Set the event-handler.
Float_t GetStereoEyeOffsetFac() const
Definition TGLViewer.h:290
TGLPerspectiveCamera fPerspectiveCameraYOZ
Definition TGLViewer.h:86
EPushAction GetPushAction() const
Definition TGLViewer.h:299
void PrintObjects() override
Pass viewer for print capture by TGLOutput.
TGEventHandler * GetEventHandler() const
Definition TGLViewer.h:378
TGLOrthoCamera fOrthoXOYCamera
Definition TGLViewer.h:88
TGLSelectRecord fSelRec
select record in use as selected
Definition TGLViewer.h:112
Int_t AddObject(UInt_t, const TBuffer3D &, Bool_t *=nullptr) override
Definition TGLViewer.h:214
TGLColorSet & RefLightColorSet()
Definition TGLViewer.h:233
void SetFader(Float_t x)
Definition TGLViewer.h:350
Bool_t GetSmoothPoints() const
Definition TGLViewer.h:257
virtual void ReMouseOver(TObject *obj, UInt_t state)
Emit MouseOver signal.
TImage * GetPictureUsingFBO(Int_t w, Int_t h, Float_t pixel_object_scale=0)
Returns current image.
TGLOrthoCamera fOrthoXnOZCamera
Definition TGLViewer.h:93
static TGLColorSet & GetDefaultColorSet()
Returns reference to the default color-set.
void InitGL()
Initialise GL state.
TGLCameraOverlay * GetCameraOverlay() const
Definition TGLViewer.h:282
void SetAutoRotator(TGLAutoRotator *ar)
Set the auto-rotator for this viewer. The old rotator is deleted.
Bool_t GetSmoothLines() const
Definition TGLViewer.h:258
virtual void Clicked(TObject *obj)
Emit Clicked signal.
Int_t GetDev() const
Definition TGLViewer.h:228
void MakeCurrent() const
Make GL context current.
Bool_t fIsPrinting
debug mode (forced rebuild + draw scene/frustum/interest boxes)
Definition TGLViewer.h:157
static TGLColorSet fgDefaultColorSet
fade the view (0 - no fade/default, 1 - full fade/no rendering done)
Definition TGLViewer.h:161
Float_t GetStereoZeroParallax() const
Definition TGLViewer.h:289
void SetupClipObject() override
allow simple guide axes labels to be scaled relative to scene units
Float_t GetMaxSceneDrawTimeLQ() const
Definition TGLViewer.h:309
Bool_t OpenComposite(const TBuffer3D &, Bool_t *=nullptr) override
Definition TGLViewer.h:215
TGEventHandler * fEventHandler
select record from last overlay select
Definition TGLViewer.h:119
EDragAction GetDragAction() const
Definition TGLViewer.h:300
Bool_t GetDrawCameraCenter()
Definition TGLViewer.h:279
TGLPerspectiveCamera fPerspectiveCameraXOY
Definition TGLViewer.h:87
TGLOrthoCamera fOrthoZnOYCamera
Definition TGLViewer.h:94
@ kPushCamCenter
Definition TGLViewer.h:126
@ kPushAnnotate
Definition TGLViewer.h:126
TGLRect fViewport
max time for scene rendering at high LOD (in ms)
Definition TGLViewer.h:139
virtual void SelectionChanged()
Update GUI components for embedded viewer selection change.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Process event of type 'event' - one of EEventType types, occurring at window location px,...
void SetCameraOverlay(TGLCameraOverlay *m)
Definition TGLViewer.h:283
virtual void UnClicked(TObject *obj, UInt_t button, UInt_t state)
Emit UnClicked signal with button id and modifier state.
void SetPerspectiveCamera(ECameraType camera, Double_t fov, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Set a perspective camera to supplied configuration - note this does not need to be the current camera...
TGLVertex3 fReferencePos
reference marker on?
Definition TGLViewer.h:149
void PreRender() override
Initialize objects that influence rendering.
Bool_t RequestOverlaySelect(Int_t x, Int_t y)
Post request for secondary selection rendering of selected object around the window point (x,...
Float_t GetPointScale() const
Definition TGLViewer.h:253
static Bool_t IsUsingDefaultColorSetForNewViewers()
Returns the value of the static flag that determines if new viewers should use the default color-set.
Int_t ViewportDiagonal() const
Definition TGLViewer.h:251
virtual void MouseIdle(TGLPhysicalShape *, UInt_t, UInt_t)
Emit MouseIdle signal.
Bool_t SavePictureWidth(const TString &fileName, Int_t width, Bool_t pixel_object_scale=kTRUE)
Save picture with given width (height scaled proportionally).
void DoDrawStereo(Bool_t swap_buffers)
Draw out in stereoscopic mode.
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
void SetGuideState(Int_t axesType, Bool_t axesDepthTest, Bool_t referenceOn, const Double_t *referencePos)
Set the state of guides (axes & reference markers) from arguments.
void DoDraw(Bool_t swap_buffers=kTRUE)
Draw out the viewer.
TGLOrthoCamera fOrthoZOYCamera
Definition TGLViewer.h:90
virtual void CreateGLWidget()
Definition TGLViewer.h:225
void SwitchColorSet()
Switch between dark and light colorsets.
EDragAction fDragAction
Definition TGLViewer.h:132
TGLPShapeObj * fPShapeWrap
GED editor.
Definition TGLViewer.h:121
TGLSelectRecord fSecSelRec
select record from last select (should go to context)
Definition TGLViewer.h:113
~TGLViewer() override
Destroy viewer object.
TGLWidget * fGLWidget
Definition TGLViewer.h:185
TGLLightSet * GetLightSet() const
Definition TGLViewer.h:262
void DrawDebugInfo()
If in debug mode draw camera aids and overall bounding box.
void SetSmartRefresh(Bool_t smart_ref)
Definition TGLViewer.h:230
void SetIgnoreSizesOnUpdate(Bool_t v)
Definition TGLViewer.h:356
void AutoFade(Float_t fade, Float_t time=1, Int_t steps=10)
Animate fading from current value to fade over given time (sec) and number of steps.
Bool_t fReferenceOn
remove guides hidden-lines
Definition TGLViewer.h:148
TGLCamera & CurrentCamera() const
Definition TGLViewer.h:268
void SetCurrentCamera(ECameraType camera)
Set current active camera - 'cameraType' one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ,...
void SetupCameras(Bool_t reset)
Setup cameras for current bounding box.
Float_t GetStereoFrustumAsymFac() const
Definition TGLViewer.h:291
Bool_t fResetCamerasOnUpdate
Definition TGLViewer.h:191
void SetStereoEyeOffsetFac(Float_t f)
Definition TGLViewer.h:295
Int_t fAxesType
smooth line edge rendering
Definition TGLViewer.h:146
TGLClipSet * GetClipSet() const
Definition TGLViewer.h:263
void SetStereo(Bool_t stereo, Bool_t quad_buf=kTRUE)
Enable stereo rendering.
TImage * GetPictureUsingBB()
Returns current image.
TGLColorSet & RefDarkColorSet()
Definition TGLViewer.h:232
virtual void DestroyGLWidget()
Definition TGLViewer.h:226
TGLCamera & RefCamera(ECameraType camera)
Return camera reference by type.
TContextMenu * fContextMenu
external pad - remove replace with signal
Definition TGLViewer.h:81
void UseLightColorSet()
Use the light color-set.
Bool_t IsUsingDefaultColorSet() const
Check if the viewer is using the default color set.
Bool_t DoSelect(Int_t x, Int_t y)
Perform GL selection, picking objects overlapping WINDOW area described by 'rect'.
void PreDraw()
Perform GL work which must be done before each draw.
Float_t fStereoZeroParallax
draw quad buffer or left/right stereo in left/right half of window
Definition TGLViewer.h:102
virtual void PostSceneBuildSetup(Bool_t resetCameras)
Perform post scene-build setup.
TGedEditor * GetGedEditor() const
Definition TGLViewer.h:381
Float_t fStereoEyeOffsetFac
position of zero-parallax plane: 0 - near clipping plane, 1 - far clipping plane
Definition TGLViewer.h:103
Bool_t SavePictureUsingBB(const TString &fileName)
Save current image in various formats (gif, gif+, jpg, png).
Bool_t SavePicture()
Save current image using the default file name which can be set via SetPictureFileName() and defaults...
Float_t fFader
default file-name for SavePicture()
Definition TGLViewer.h:159
void SetSmoothPoints(Bool_t s)
Definition TGLViewer.h:259
@ kDragCameraTruck
Definition TGLViewer.h:128
@ kDragCameraRotate
Definition TGLViewer.h:128
@ kDragCameraDolly
Definition TGLViewer.h:128
void UpdateScene(Bool_t redraw=kTRUE)
Force update of pad-scenes.
void SetLineScale(Float_t s)
Definition TGLViewer.h:256
TGLOrthoCamera fOrthoZOXCamera
Definition TGLViewer.h:91
Bool_t GetStereo() const
Definition TGLViewer.h:288
Bool_t SavePictureUsingFBO(const TString &fileName, Int_t w, Int_t h, Float_t pixel_object_scale=0)
Save current image in various formats (gif, gif+, jpg, png).
static void SetAxisLabelScale(Float_t als)
Sets static scaling facor that allows simple guide axies to have label values scaled relative to actu...
TGLOrthoCamera fOrthoXOZCamera
Definition TGLViewer.h:89
Bool_t GetClipAutoUpdate() const
Definition TGLViewer.h:264
virtual void OverlayDragFinished()
An overlay operation can result in change to an object.
TGLOverlayElement * GetCurrentOvlElm() const
Definition TGLViewer.h:392
void SetMaxSceneDrawTimeHQ(Float_t t)
Definition TGLViewer.h:310
Bool_t SavePictureHeight(const TString &fileName, Int_t height, Bool_t pixel_object_scale=kTRUE)
Save picture with given height (width scaled proportionally).
void SetOrthoCamera(ECameraType camera, Double_t zoom, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Set an orthographic camera to supplied configuration - note this does not need to be the current came...
void DrawGuides()
Draw reference marker and coordinate axes.
void SetPointScale(Float_t s)
Definition TGLViewer.h:255
const TGLRect & RefViewport() const
Definition TGLViewer.h:250
void UseDefaultColorSet(Bool_t x)
Set usage of the default color set.
void SetStereoZeroParallax(Float_t f)
Definition TGLViewer.h:294
void AddCompositeOp(UInt_t) override
Definition TGLViewer.h:217
Float_t fMaxSceneDrawTimeHQ
timer for triggering redraws
Definition TGLViewer.h:136
void BeginScene() override
Definition TGLViewer.h:210
Bool_t RequestSecondarySelect(Int_t x, Int_t y)
Request secondary select.
TGedEditor * fGedEditor
event handler
Definition TGLViewer.h:120
TGLSelectRecord & GetSelRec()
Definition TGLViewer.h:390
void SetViewport(Int_t x, Int_t y, Int_t width, Int_t height)
Set viewer viewport (window area) with bottom/left at (x,y), with dimensions 'width'/'height'.
Bool_t GetSmartRefresh() const
Definition TGLViewer.h:229
Float_t fPointScale
color-set with light background
Definition TGLViewer.h:142
TGLColorSet fLightColorSet
color-set with dark background
Definition TGLViewer.h:141
TGLClipSet * fClipSet
Definition TGLViewer.h:109
void SetSmoothLines(Bool_t s)
Definition TGLViewer.h:260
Bool_t fStereo
Definition TGLViewer.h:100
virtual void UnMouseOver(TObject *obj, UInt_t state)
Emit UnMouseOver signal.
void PadPaint(TVirtualPad *pad) override
Entry point for updating viewer contents via VirtualViewer3D interface.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Calculate and return pixel distance to nearest viewer object from window location px,...
TVirtualPad * fPad
Definition TGLViewer.h:78
virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state)
Emit ReClicked signal with button id and modifier state.
Bool_t fResetCamerasOnNextUpdate
Definition TGLViewer.h:192
Float_t GetLineScale() const
Definition TGLViewer.h:254
void EndScene() override
Definition TGLViewer.h:212
Bool_t fSmoothPoints
width scale for lines
Definition TGLViewer.h:144
void SetClipAutoUpdate(Bool_t x)
Definition TGLViewer.h:265
TGLOrthoCamera fOrthoZnOXCamera
Definition TGLViewer.h:95
Float_t fMaxSceneDrawTimeLQ
max time for scene rendering at high LOD (in ms)
Definition TGLViewer.h:137
Bool_t fSmoothLines
smooth point edge rendering
Definition TGLViewer.h:145
TGLManipSet * fSelectedPShapeRef
select record from last secondary select (should go to context)
Definition TGLViewer.h:114
TString fPictureFileName
Definition TGLViewer.h:158
void ClearCurrentOvlElm()
Reset current overlay-element to zero, eventually notifying the old one that the mouse has left.
Bool_t GetIgnoreSizesOnUpdate() const
Definition TGLViewer.h:355
TGLColorSet & ColorSet()
Definition TGLViewer.h:234
void ApplySelection()
Process result from last selection (in fSelRec) and extract a new current selection from it.
TGLColorSet fDarkColorSet
viewport - drawn area
Definition TGLViewer.h:140
void InitSecondaryObjects()
Common initialization.
Bool_t DoSecondarySelect(Int_t x, Int_t y)
Secondary selection.
void UseDarkColorSet()
Use the dark color-set.
void ResetCameras() override
Definition TGLViewer.h:220
Float_t GetFader() const
Definition TGLViewer.h:349
TGLLightSet * fLightSet
Definition TGLViewer.h:107
virtual void SetGedEditor(TGedEditor *ed)
Definition TGLViewer.h:382
Bool_t RequestSelect(Int_t x, Int_t y)
Post request for selection render pass viewer, picking objects around the window point (x,...
void SetClearColor(Color_t col)
Set background method.
static Float_t fgAxisLabelScale
name says it all
Definition TGLViewer.h:163
Bool_t DoOverlaySelect(Int_t x, Int_t y)
Perform GL selection, picking overlay objects only.
Bool_t fDrawCameraCenter
reference position
Definition TGLViewer.h:150
void ReinitializeCurrentCamera(const TGLVector3 &hAxis, const TGLVector3 &vAxis, Bool_t redraw=kTRUE)
Change base-vectors defining the camera-base transformation of current camera.
Bool_t IsColorSetDark() const
Returns true if current color set is dark.
void CloseComposite() override
Definition TGLViewer.h:216
virtual void DoubleClicked()
Definition TGLViewer.h:376
Bool_t fIgnoreSizesOnUpdate
for embedded gl viewer
Definition TGLViewer.h:190
void PostDraw()
Perform GL work which must be done after each draw.
TGLAutoRotator * GetAutoRotator()
Get the auto-rotator for this viewer.
Bool_t GetResetCamerasOnUpdate() const
Definition TGLViewer.h:358
void PickCameraCenter()
Definition TGLViewer.h:280
TGLPerspectiveCamera fPerspectiveCameraXOZ
Definition TGLViewer.h:85
void Render() override
Normal rendering, used by mono and stereo rendering.
Bool_t BuildingScene() const override
Definition TGLViewer.h:211
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
Bool_t fSmartRefresh
markup size of viewport in scene units
Definition TGLViewer.h:153
Float_t fStereoFrustumAsymFac
Definition TGLViewer.h:104
Bool_t fDebugMode
cache logicals during scene rebuilds
Definition TGLViewer.h:156
TGLOrthoCamera fOrthoXnOYCamera
Definition TGLViewer.h:92
Float_t GetMaxSceneDrawTimeHQ() const
Definition TGLViewer.h:308
static Bool_t fgUseDefaultColorSetForNewViewers
a shared, default color-set
Definition TGLViewer.h:162
void GetGuideState(Int_t &axesType, Bool_t &axesDepthTest, Bool_t &referenceOn, Double_t *referencePos) const
Fetch the state of guides (axes & reference markers) into arguments.
void RemoveOverlayElement(TGLOverlayElement *el) override
Remove overlay element.
TGLSelectRecord fCurrentSelRec
Definition TGLViewer.h:111
void PickAnnotate()
Definition TGLViewer.h:281
TGLViewer & operator=(const TGLViewer &)=delete
TGLViewer(const TGLViewer &)=delete
void SetPictureFileName(const TString &f)
Definition TGLViewer.h:348
void ResetCamerasAfterNextUpdate() override
Definition TGLViewer.h:221
void DoDrawMono(Bool_t swap_buffers)
Draw out in monoscopic mode.
Bool_t fStereoQuadBuf
use stereo rendering
Definition TGLViewer.h:101
@ kCameraPerspXOY
Definition TGLViewer.h:61
@ kCameraPerspXOZ
Definition TGLViewer.h:61
@ kCameraOrthoXnOZ
Definition TGLViewer.h:63
@ kCameraPerspYOZ
Definition TGLViewer.h:61
@ kCameraOrthoZnOY
Definition TGLViewer.h:63
@ kCameraOrthoZOY
Definition TGLViewer.h:62
@ kCameraOrthoXOY
Definition TGLViewer.h:62
@ kCameraOrthoZOX
Definition TGLViewer.h:62
@ kCameraOrthoZnOX
Definition TGLViewer.h:63
@ kCameraOrthoXOZ
Definition TGLViewer.h:62
@ kCameraOrthoXnOY
Definition TGLViewer.h:63
TGLContextIdentity * fGLCtxId
for embedded gl viewer
Definition TGLViewer.h:187
Int_t fGLDevice
Definition TGLViewer.h:186
void PostRender() override
Restore state set in PreRender().
static void UseDefaultColorSetForNewViewers(Bool_t x)
Sets static flag that determines if new viewers should use the default color-set.
const char * GetPictureFileName() const
Definition TGLViewer.h:347
TGLOvlSelectRecord fOvlSelRec
current overlay element
Definition TGLViewer.h:117
TGLOverlayElement * fCurrentOvlElm
Definition TGLViewer.h:116
void SetResetCamerasOnUpdate(Bool_t v)
Definition TGLViewer.h:359
void SwapBuffers() const
Swap GL buffers.
void ResetCurrentCamera()
Resets position/rotation of current camera to default values.
TGLWidget * GetGLWidget()
Definition TGLViewer.h:223
GL window with context.
Definition TGLWidget.h:28
An abstract interface to image processing library.
Definition TImage.h:29
Mother of all ROOT objects.
Definition TObject.h:41
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition TQObject.h:48
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
virtual void TurnOff()
Remove timer from system timer list.
Definition TTimer.cxx:231
virtual void Start(Long_t milliSec=-1, Bool_t singleShot=kFALSE)
Starts the timer with a milliSec timeout.
Definition TTimer.cxx:213
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Abstract 3D shapes viewer.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TMarker m
Definition textangle.C:8