13#include "TGLIncludes.h"
61#define GL_BGRA GL_BGRA_EXT
230 Int_t viewport[4] = {0};
232 SetViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
290 fPad->ReleaseViewer3D();
308 scenepad =
dynamic_cast<TGLScenePad*
>((*si)->GetScene());
309 if (scenepad && scenepad->
GetPad() == pad)
313 if (scenepad ==
nullptr)
375 if (!
box.IsEmpty()) {
410 glEnable(GL_LIGHTING);
411 glEnable(GL_DEPTH_TEST);
412 glEnable(GL_CULL_FACE);
414 glClearColor(0.f, 0.f, 0.f, 0.f);
416 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
417 glEnable(GL_COLOR_MATERIAL);
418 glMaterialf(GL_BACK, GL_SHININESS, 0.0);
419 glPolygonMode(GL_FRONT, GL_FILL);
422 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
423 Float_t lmodelAmb[] = {0.5f, 0.5f, 1.f, 1.f};
424 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodelAmb);
425 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
427 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
428 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
451 Info(
"TGLViewer::RequestDraw",
"viewer locked - requesting another draw.");
459 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%zx)->DoDraw()", (
size_t)
this));
495 if (
fSmoothPoints) glEnable(GL_POINT_SMOOTH);
else glDisable(GL_POINT_SMOOTH);
496 if (
fSmoothLines) glEnable(GL_LINE_SMOOTH);
else glDisable(GL_LINE_SMOOTH);
499 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
528 glClear(GL_DEPTH_BUFFER_BIT);
569 Info(
"TGLViewer::DoDraw()",
"zero surface area, draw skipped.");
575 Int_t viewport[4] = {};
577 SetViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
603 Info(
"TGLViewer::DoDraw()",
"Took %f msec", timer.
End());
661 Float_t gl_near, gl_far, zero_p_dist;
663 Float_t x_len_at_zero_parallax;
672 glDrawBuffer(GL_BACK_LEFT);
677 glEnable(GL_SCISSOR_TEST);
682 gl_near =
c.GetNearClip();
683 gl_far =
c.GetFarClip();
689 x_len_at_zero_parallax = 2.0f * w_half * zero_p_dist / gl_near;
695 abs_trans *=
c.RefCamTrans();
698 glTranslatef(stereo_offset*left_vec[0], stereo_offset*left_vec[1], stereo_offset*left_vec[2]);
700 glMatrixMode(GL_PROJECTION);
702 glFrustum(-w_half + frustum_asym, w_half + frustum_asym,
703 -h_half, h_half, gl_near, gl_far);
704 glMatrixMode(GL_MODELVIEW);
724 glDrawBuffer(GL_BACK_RIGHT);
737 glTranslatef(-stereo_offset*left_vec[0], -stereo_offset*left_vec[1], -stereo_offset*left_vec[2]);
739 glMatrixMode(GL_PROJECTION);
741 glFrustum(-w_half - frustum_asym, w_half - frustum_asym,
742 -h_half, h_half, gl_near, gl_far);
743 glMatrixMode(GL_MODELVIEW);
768 glDrawBuffer(GL_BACK);
772 glDisable(GL_SCISSOR_TEST);
814 if (GLAD_GL_EXT_framebuffer_object &&
gEnv->GetValue(
"OpenGL.SavePicturesViaFBO", 1))
835 static const TString eh(
"TGLViewer::SavePictureUsingBB");
840 Warning(eh,
"file %s cannot be saved with this extension.", fileName.
Data());
845 Error(eh,
"viewer locked - try later.");
855 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%zx)->DoDraw(kFALSE)", (
size_t)
this));
861 glReadBuffer(GL_BACK);
864 glPixelStorei(GL_PACK_ALIGNMENT, 1);
866 GL_BGRA, GL_UNSIGNED_BYTE, xx);
870 image->WriteImage(fileName);
893 static const TString eh(
"TGLViewer::SavePictureUsingFBO");
898 Warning(eh,
"file %s cannot be saved with this extension.", fileName.
Data());
903 Error(eh,
"viewer locked - try later.");
916 catch (std::runtime_error& exc)
918 Error(eh,
"%s",exc.what());
919 if (
gEnv->GetValue(
"OpenGL.SavePictureFallbackToBB", 1)) {
920 Info(eh,
"Falling back to saving image via back-buffer. Window must be fully visible.");
922 Warning(eh,
"Back-buffer does not support image scaling, window size will be used.");
933 if (pixel_object_scale != 0)
935 old_scale =
fRnrCtx->GetRenderScale();
936 fRnrCtx->SetRenderScale(old_scale * pixel_object_scale);
945 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%zx)->DoDraw(kFALSE)", (
size_t)
this));
956 glPixelStorei(GL_PACK_ALIGNMENT, 1);
958 GL_BGRA, GL_UNSIGNED_BYTE, xx);
962 image->WriteImage(fileName);
968 if (pixel_object_scale != 0)
970 fRnrCtx->SetRenderScale(old_scale);
986 static const TString eh(
"TGLViewer::GetPictureUsingBB");
989 Error(eh,
"viewer locked - try later.");
999 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%zx)->DoDraw(kFALSE)", (
size_t)
this));
1005 glReadBuffer(GL_BACK);
1008 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1010 GL_BGRA, GL_UNSIGNED_BYTE, xx);
1033 static const TString eh(
"TGLViewer::GetPictureUsingFBO");
1036 Error(eh,
"viewer locked - try later.");
1049 catch (std::runtime_error& exc)
1051 Error(eh,
"%s",exc.what());
1052 if (
gEnv->GetValue(
"OpenGL.GetPictureFallbackToBB", 1)) {
1053 Info(eh,
"Falling back to saving image via back-buffer. Window must be fully visible.");
1055 Warning(eh,
"Back-buffer does not support image scaling, window size will be used.");
1066 if (pixel_object_scale != 0)
1068 old_scale =
fRnrCtx->GetRenderScale();
1069 fRnrCtx->SetRenderScale(old_scale * pixel_object_scale);
1078 gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%zx)->DoDraw(kFALSE)", (
size_t)
this));
1089 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1091 GL_BGRA, GL_UNSIGNED_BYTE, xx);
1099 if (pixel_object_scale != 0)
1101 fRnrCtx->SetRenderScale(old_scale);
1116 Bool_t pixel_object_scale)
1130 Bool_t pixel_object_scale)
1144 Bool_t pixel_object_scale)
1160 glDisable(GL_DEPTH_TEST);
1166 glDisable(GL_DEPTH_TEST);
1168 const UChar_t rgba[4] = { 0, 255, 255, 255 };
1174 glEnable(GL_DEPTH_TEST);
1179 glDisable(GL_DEPTH_TEST);
1184 glEnable(GL_DEPTH_TEST);
1194 glDisable(GL_LIGHTING);
1198 glColor3d(0.0, 1.0, 0.0);
1202 glDisable(GL_DEPTH_TEST);
1207 glEnable(GL_DEPTH_TEST);
1209 glEnable(GL_LIGHTING);
1226 color->GetRGB(rgb[0], rgb[1], rgb[2]);
1228 rgb[0] = rgb[1] = rgb[2] = 0.0f;
1230 glClearColor(rgb[0], rgb[1], rgb[2], 0.0f);
1233 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
1253 static const Float_t z = -1.0f;
1255 glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity();
1256 glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity();
1261 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1264 glVertex3f(-1, -1, z); glVertex3f( 1, -1, z);
1265 glVertex3f( 1, 1, z); glVertex3f(-1, 1, z);
1269 glMatrixMode(GL_PROJECTION); glPopMatrix();
1270 glMatrixMode(GL_MODELVIEW); glPopMatrix();
1315 return Bool_t(
gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%zx)->DoSelect(%d, %d)", (
size_t)
this,
x,
y)));
1343 glRenderMode(GL_SELECT);
1349 Int_t nHits = glRenderMode(GL_RENDER);
1353 if (
gDebug > 0)
Info(
"TGLViewer::DoSelect",
"Primary select nHits=%d.", nHits);
1388 return Bool_t(
gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%zx)->DoSecondarySelect(%d, %d)", (
size_t)
this,
x,
y)));
1410 !
fSelRec.GetLogShape()->SupportsSecondarySelect())
1413 Info(
"TGLViewer::SecondarySelect",
"Skipping secondary selection "
1414 "(sinfo=0x%zx, pshape=0x%zx).\n",
1427 foo.push_back(sinfo);
1431 glRenderMode(GL_SELECT);
1438 glPushName(pshp->
ID());
1443 fRnrCtx->SetSceneInfo(
nullptr);
1446 Int_t nSecHits = glRenderMode(GL_RENDER);
1447 fRnrCtx->EndSelection(nSecHits);
1450 if (
gDebug > 0)
Info(
"TGLViewer::DoSelect",
"Secondary select nSecHits=%d.", nSecHits);
1498 return Bool_t(
gROOT->ProcessLineFast(
Form(
"((TGLViewer *)0x%zx)->DoOverlaySelect(%d, %d)", (
size_t)
this,
x,
y)));
1523 glRenderMode(GL_SELECT);
1529 Int_t nHits = glRenderMode(GL_RENDER);
1583 delete this;
return;
1598 "TGLFaderHelper",
this,
"MakeFadeStep()");
1636 Info(
"SwitchColorSet()",
"Global color-set is in use, switch not supported.");
1673 fRnrCtx->GetBaseColorSet()->Background().SetColor(col);
1745 Info(
"TGLViewer::SetViewport",
"updated - corner %d,%d dimensions %d,%d",
x,
y, width, height);
1766 switch(cameraType) {
1790 Error(
"TGLViewer::SetCurrentCamera",
"invalid camera type");
1857 Error(
"TGLViewer::SetCurrentCamera",
"invalid camera type");
1937 Error(
"TGLViewer::SetOrthoCamera",
"invalid camera type");
1985 Error(
"TGLViewer::SetPerspectiveCamera",
"invalid camera type");
2074 fReferencePos.Set(referencePos[0], referencePos[1], referencePos[2]);
2117 Emit(
"MouseOver(TGLPhysicalShape*,UInt_t)", args);
2128 Emit(
"MouseOver(TObject*,UInt_t)", args);
2139 Emit(
"ReMouseOver(TObject*,UInt_t)", args);
2151 Emit(
"UnMouseOver(TObject*,UInt_t)", args);
2171 Emit(
"Clicked(TObject*,UInt_t,UInt_t)", args);
2184 Emit(
"ReClicked(TObject*,UInt_t,UInt_t)", args);
2196 Emit(
"UnClicked(TObject*,UInt_t,UInt_t)", args);
2205 static UInt_t oldx = 0, oldy = 0;
2207 if (oldx != posx || oldy != posy) {
2211 Emit(
"MouseIdle(TGLPhysicalShape*,UInt_t,UInt_t)", args);
2228 gPad->SetSelected(
this);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Short_t
Signed Short integer 2 bytes (short).
double Double_t
Double 8 bytes.
short Color_t
Color number (short).
float Float_t
Float 4 bytes (float).
externTVirtualMutex * gROOTMutex
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
#define R__LOCKGUARD(mutex)
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
A GL overlay element which displays camera furstum.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
void DrawDebugAids() const
Draw out some debugging aids for the camera:
virtual void Setup(const TGLBoundingBox &box, Bool_t reset=kTRUE)=0
A collection of concrete TGLClip objects to be selected from.
Class encapsulating a set of colors used throughout standard rendering.
Identifier of a shared GL-context.
void Unbind()
Unbind the frame-buffer object.
void Init(int w, int h, int ms_samples=0)
Acquire GL resources for given width, height and number of multi-sampling samples.
void Bind()
Bind the frame-buffer object.
void MakeFadeStep()
Make one fading step and request redraw.
Encapsulates a set of lights for OpenGL.
Bool_t TakeLock(ELock lock) const
Lock the object in mode 'lock'.
ELock CurrentLock() const
Bool_t ReleaseLock(ELock lock) const
Release current lock, make sure it the same as the 'lock' argument.
static const char * LockName(ELock lock)
Return name-string for given lock-type.
Bool_t IsDrawOrSelectLock() const
Combine all available manipulators in a collection.
16 component (4x4) transform matrix - column MAJOR as per GL.
TGLVector3 GetBaseVec(Int_t b) const
TGLVector3 GetTranslation() const
Return the translation component of matrix.
void Set(const TGLVertex3 &origin, const TGLVector3 &zAxis, const TGLVector3 &xAxis=nullptr)
Set matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'.
Orthographic projection camera.
static Bool_t Capture(TGLViewer &viewer, EFormat format, const char *filePath=nullptr)
Capture viewer to file.
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered this element.
virtual Bool_t MouseStillInside(TGLOvlSelectRecord &selRec)
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
Perspective projection camera - with characteristic foreshortening.
Concrete physical shape - a GL drawable.
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw physical shape, using LOD flags, potential from display list cache.
Viewport (pixel base) 2D rectangle class.
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes:
virtual void PostRender(TGLRnrCtx &rnrCtx)
Perform post-render clean-up.
virtual void PreRender(TGLRnrCtx &rnrCtx)
Perform pre-render initialization - fill rnrCtx with values stored during PreDraw().
Base class for extended scene context.
TGLSceneBase * GetScene() const
Implements VirtualViewer3D interface and fills the base-class visualization structures from pad conte...
virtual void PadPaintFromViewer(TGLViewer *viewer)
Entry point for requesting update of scene's contents from gl-viewer.
TVirtualPad * GetPad() const
Standard selection record including information about containing scene and details ob out selected ob...
static Bool_t AreSameSelectionWise(const TGLSelectRecord &r1, const TGLSelectRecord &r2)
Check if the records imply the same selection result, that is, their secondary members are all equal.
Stopwatch object for timing GL work.
void Start()
Start timing.
Double_t End()
End timing, return total time since Start(), in milliseconds.
Wrapper class for various misc static functions - error checking, draw helpers etc.
static void DrawSphere(const TGLVertex3 &position, Double_t radius, const UChar_t rgba[4])
Draw sphere, centered on vertex 'position', with radius 'radius', color 'rgba'.
static const UChar_t fgWhite[4]
static void SetLineWidthScale(Float_t scale)
Set global line-width scale.
static void DrawReferenceMarker(const TGLCamera &camera, const TGLVertex3 &pos, Float_t radius=3, const UChar_t *rgba=nullptr)
Draw a sphere- marker on world-coordinate 'pos' with pixel radius 'radius'.
static Int_t CheckError(const char *loc)
Check current GL error state, outputting details via ROOT Error method if one.
static void ColorAlpha(const TGLColor &color, UChar_t alpha)
Set color from TGLColor and alpha value.
static Int_t GetPickingRadius()
Returns picking radius.
static void SetPointSizeScale(Float_t scale)
Set global point-size scale.
static const UChar_t fgGreen[4]
static void DrawSimpleAxes(const TGLCamera &camera, const TGLBoundingBox &bbox, Int_t axesType, Float_t labelScale=1)
Draw simple xyz-axes for given bounding-box.
static void PointToViewport(Int_t &x, Int_t &y)
Convert from point/screen coordinates to GL viewport coordinates.
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
virtual void PreRenderOverlaySelection()
Perform minimal initialization for overlay selection.
Bool_t FindClosestOpaqueRecord(TGLSelectRecord &rec, Int_t &recIdx)
Find next select record that can be resolved and whose result is not transparent, starting from posit...
virtual void ResetSceneInfos()
Force rebuild of view-dependent scene-info structures.
TGLSceneInfo * AddScene(TGLSceneBase *scene)
Add new scene, appropriate scene-info is created.
virtual void RemoveOverlayElement(TGLOverlayElement *el)
Remove overlay element.
virtual void RenderOverlay(Int_t state, Bool_t selection)
Render overlay objects.
virtual void Render()
Render all scenes.
virtual void PostRenderOverlaySelection()
Perform cleanup after overlay selection.
virtual void PreRender()
Initialize render-context, setup camera, GL, render-area.
virtual void PostRender()
Function called after rendering is finished.
Bool_t FindClosestOverlayRecord(TGLOvlSelectRecord &rec, Int_t &recIdx)
Find next overlay-select record that can be resolved, starting from position 'recIdx'.
virtual void MergeSceneBBoxes(TGLBoundingBox &bbox)
Merge bounding-boxes of all active registered scenes.
TGLBoundingBox fOverallBoundingBox
std::list< TGLSceneInfo * > SceneInfoList_t
virtual void RenderSelectedForHighlight()
Render selected objects from all scenes for highlight.
SceneInfoList_t::iterator SceneInfoList_i
virtual void AddOverlayElement(TGLOverlayElement *el)
Add overlay element.
Bool_t FindClosestRecord(TGLSelectRecord &rec, Int_t &recIdx)
Find next select record that can be resolved, starting from position 'recIdx'.
TGLRedrawTimer * fRedrawTimer
! timer for triggering redraws
virtual void MouseOver(TGLPhysicalShape *)
Emit MouseOver signal.
void SetDrawCameraCenter(Bool_t x)
Draw camera look at and rotation point.
TGLAutoRotator * fAutoRotator
!
Float_t fLineScale
! width scale for lines
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
!
TGLCameraOverlay * fCameraOverlay
! markup size of viewport in scene units
virtual void RefreshPadEditor(TObject *obj=nullptr)
Update GED editor if it is set.
Bool_t fAxesDepthTest
! remove guides hidden-lines
virtual void SetEventHandler(TGEventHandler *handler)
Set the event-handler.
TGLPerspectiveCamera fPerspectiveCameraYOZ
!
void PrintObjects() override
Pass viewer for print capture by TGLOutput.
TGLOrthoCamera fOrthoXOYCamera
!
TGLSelectRecord fSelRec
! select record from last select (should go to context)
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
!
static TGLColorSet & GetDefaultColorSet()
Returns reference to the default color-set.
void InitGL()
Initialise GL state.
void SetAutoRotator(TGLAutoRotator *ar)
Set the auto-rotator for this viewer. The old rotator is deleted.
virtual void Clicked(TObject *obj)
Emit Clicked signal.
void MakeCurrent() const
Make GL context current.
static TGLColorSet fgDefaultColorSet
! a shared, default color-set
void SetupClipObject() override
Setup clip-object. Protected virtual method.
TGEventHandler * fEventHandler
! event handler
TGLPerspectiveCamera fPerspectiveCameraXOY
!
TGLOrthoCamera fOrthoZnOYCamera
!
TGLRect fViewport
! viewport - drawn area
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,...
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 position
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,...
static Bool_t IsUsingDefaultColorSetForNewViewers()
Returns the value of the static flag that determines if new viewers should use the default color-set.
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
!
void SwitchColorSet()
Switch between dark and light colorsets.
TGLPShapeObj * fPShapeWrap
TGLSelectRecord fSecSelRec
! select record from last secondary select (should go to context)
~TGLViewer() override
Destroy viewer object.
void DrawDebugInfo()
If in debug mode draw camera aids and overall bounding box.
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
! reference marker on?
TGLCamera & CurrentCamera() const
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.
Bool_t fResetCamerasOnUpdate
Int_t fAxesType
! axes type
void SetStereo(Bool_t stereo, Bool_t quad_buf=kTRUE)
Enable stereo rendering.
TImage * GetPictureUsingBB()
Returns current image.
TGLCamera & RefCamera(ECameraType camera)
Return camera reference by type.
TContextMenu * fContextMenu
!
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
! position of zero-parallax plane: 0 - near clipping plane, 1 - far clipping plane
virtual void PostSceneBuildSetup(Bool_t resetCameras)
Perform post scene-build setup.
Float_t fStereoEyeOffsetFac
!
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
! fade the view (0 - no fade/default, 1 - full fade/no rendering done)
void UpdateScene(Bool_t redraw=kTRUE)
Force update of pad-scenes.
TGLOrthoCamera fOrthoZOXCamera
!
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).
friend class TGLAutoRotator
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
!
Bool_t GetClipAutoUpdate() const
virtual void OverlayDragFinished()
An overlay operation can result in change to an object.
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 UseDefaultColorSet(Bool_t x)
Set usage of the default color set.
Float_t fMaxSceneDrawTimeHQ
! max time for scene rendering at high LOD (in ms)
Bool_t RequestSecondarySelect(Int_t x, Int_t y)
Request secondary select.
TGedEditor * fGedEditor
! GED editor
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'.
Float_t fPointScale
! size scale for points
TGLColorSet fLightColorSet
! color-set with light background
Bool_t fStereo
! use stereo rendering
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
! external pad - remove replace with signal
virtual void ReClicked(TObject *obj, UInt_t button, UInt_t state)
Emit ReClicked signal with button id and modifier state.
Bool_t fResetCamerasOnNextUpdate
Bool_t fSmoothPoints
! smooth point edge rendering
TGLOrthoCamera fOrthoZnOXCamera
!
Float_t fMaxSceneDrawTimeLQ
! max time for scene rendering at high LOD (in ms)
Bool_t fSmoothLines
! smooth line edge rendering
TGLManipSet * fSelectedPShapeRef
!
TString fPictureFileName
! default file-name for SavePicture()
void ClearCurrentOvlElm()
Reset current overlay-element to zero, eventually notifying the old one that the mouse has left.
void ApplySelection()
Process result from last selection (in fSelRec) and extract a new current selection from it.
TGLColorSet fDarkColorSet
! color-set with dark background
void InitSecondaryObjects()
Common initialization.
Bool_t DoSecondarySelect(Int_t x, Int_t y)
Secondary selection.
void UseDarkColorSet()
Use the dark color-set.
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
! allow simple guide axes labels to be scaled relative to scene units
Bool_t DoOverlaySelect(Int_t x, Int_t y)
Perform GL selection, picking overlay objects only.
Bool_t fDrawCameraCenter
! reference marker on?
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.
Bool_t fIgnoreSizesOnUpdate
void PostDraw()
Perform GL work which must be done after each draw.
TGLAutoRotator * GetAutoRotator()
Get the auto-rotator for this viewer.
TGLPerspectiveCamera fPerspectiveCameraXOZ
!
void Render() override
Normal rendering, used by mono and stereo rendering.
const TGLPhysicalShape * GetSelected() const
Return selected physical shape.
Bool_t fSmartRefresh
! cache logicals during scene rebuilds
Float_t fStereoFrustumAsymFac
!
Bool_t fDebugMode
! debug mode (forced rebuild + draw scene/frustum/interest boxes)
TGLOrthoCamera fOrthoXnOYCamera
!
static Bool_t fgUseDefaultColorSetForNewViewers
! name says it all
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
! select record in use as selected
TGLViewer(const TGLViewer &)=delete
void DoDrawMono(Bool_t swap_buffers)
Draw out in monoscopic mode.
Bool_t fStereoQuadBuf
! draw quad buffer or left/right stereo in left/right half of window
TGLContextIdentity * fGLCtxId
!for embedded gl viewer
Int_t fGLDevice
!for embedded gl viewer
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.
TGLOvlSelectRecord fOvlSelRec
! select record from last overlay select
TGLOverlayElement * fCurrentOvlElm
! current overlay element
void SwapBuffers() const
Swap GL buffers.
void ResetCurrentCamera()
Resets position/rotation of current camera to default values.
An abstract interface to image processing library.
static TImage * Create()
Create an image.
virtual void FromGLBuffer(UChar_t *, UInt_t, UInt_t)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TObject()
TObject constructor.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.