#ifndef ROOT_TGLViewer
#define ROOT_TGLViewer
#ifndef ROOT_TVirtualViewer3D
#include "TVirtualViewer3D.h"
#endif
#ifndef ROOT_TGLScene
#include "TGLScene.h"
#endif
#ifndef ROOT_TGLPerspectiveCamera
#include "TGLPerspectiveCamera.h"
#endif
#ifndef ROOT_TGLOrthoCamera
#include "TGLOrthoCamera.h"
#endif
#ifndef ROOT_TGLDrawFlags
#include "TGLDrawFlags.h"
#endif
#ifndef ROOT_TTimer
#include "TTimer.h"
#endif
#ifndef ROOT_TPoint
#include "TPoint.h"
#endif
#ifndef ROOT_CsgOps
#include "CsgOps.h"
#endif
#ifndef ROOT_GuiTypes
#include "GuiTypes.h"
#endif
#ifndef ROOT_RQ_OBJECT
#include "RQ_OBJECT.h"
#endif
#include <vector>
class TGLFaceSet;
class TGLRedrawTimer;
class TGLViewerEditor;
class TGLWindow;
class TContextMenu;
class TGLCameraMarkupStyle;
class TGLViewer : public TVirtualViewer3D
{
RQ_OBJECT("TGLViewer")
friend class TGLOutput;
public:
enum ECameraType { kCameraPerspXOZ, kCameraPerspYOZ, kCameraPerspXOY,
kCameraOrthoXOY, kCameraOrthoXOZ, kCameraOrthoZOY };
enum ELight { kLightFront = 0x00000001,
kLightTop = 0x00000002,
kLightBottom = 0x00000004,
kLightLeft = 0x00000008,
kLightRight = 0x00000010,
kLightMask = 0x0000001f };
enum EAxesType { kAxesNone, kAxesEdge, kAxesOrigin };
private:
protected:
TVirtualPad * fPad;
TContextMenu * fContextMenu;
TGLPerspectiveCamera fPerspectiveCameraXOZ;
TGLPerspectiveCamera fPerspectiveCameraYOZ;
TGLPerspectiveCamera fPerspectiveCameraXOY;
TGLOrthoCamera fOrthoXOYCamera;
TGLOrthoCamera fOrthoXOZCamera;
TGLOrthoCamera fOrthoZOYCamera;
TGLCamera * fCurrentCamera;
Bool_t fInternalRebuild;
Bool_t fPostSceneBuildSetup;
Bool_t fAcceptedAllPhysicals;
Bool_t fForceAcceptAll;
Bool_t fInternalPIDs;
UInt_t fNextInternalPID;
typedef std::pair<UInt_t, RootCsg::TBaseMesh *> CSPart_t;
mutable TGLFaceSet *fComposite;
UInt_t fCSLevel;
std::vector<CSPart_t> fCSTokens;
enum ECameraAction { kCameraNone, kCameraRotate, kCameraTruck, kCameraDolly };
ECameraAction fAction;
TPoint fLastPos;
UInt_t fActiveButtonID;
TGLDrawFlags fDrawFlags;
TGLRedrawTimer * fRedrawTimer;
TGLScene fScene;
TGLRect fViewport;
Color_t fClearColor;
UInt_t fLightState;
EAxesType fAxesType;
Bool_t fReferenceOn;
TGLVertex3 fReferencePos;
Bool_t fInitGL;
Bool_t fSmartRefresh;
Bool_t fDebugMode;
UInt_t fAcceptedPhysicals;
UInt_t fRejectedPhysicals;
Bool_t fIsPrinting;
void InitGL();
void PreDraw();
void PostDraw();
void MakeCurrent() const;
void SwapBuffers() const;
Bool_t RebuildScene();
Int_t ValidateObjectBuffer(const TBuffer3D & buffer, Bool_t includeRaw) const;
TGLLogicalShape * CreateNewLogical(const TBuffer3D & buffer) const;
TGLPhysicalShape * CreateNewPhysical(UInt_t physicalID, const TBuffer3D & buffer,
const TGLLogicalShape & logical) const;
RootCsg::TBaseMesh *BuildComposite();
void SetViewport(Int_t x, Int_t y, UInt_t width, UInt_t height);
void SetupCameras(Bool_t reset);
void SetupLights();
TGLViewer(const TGLViewer &);
TGLViewer & operator=(const TGLViewer &);
protected:
TGLWindow *fGLWindow;
Int_t fGLDevice;
TGLViewerEditor *fPadEditor;
std::map<TClass*, TClass*> fDirectRendererMap;
TClass* FindDirectRendererClass(TClass* cls);
TGLLogicalShape* AttemptDirectRenderer(TObject* id);
Bool_t fIgnoreSizesOnUpdate;
Bool_t fResetCamerasOnUpdate;
Bool_t fResetCamerasOnNextUpdate;
Bool_t fResetCameraOnDoubleClick;
virtual void PostSceneBuildSetup(Bool_t resetCameras);
virtual void SelectionChanged();
virtual void ClipChanged();
public:
TGLViewer(TVirtualPad * pad, Int_t x, Int_t y, UInt_t width, UInt_t height);
TGLViewer(TVirtualPad * pad);
virtual ~TGLViewer();
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
virtual Bool_t PreferLocalFrame() const;
virtual void BeginScene();
virtual Bool_t BuildingScene() const { return fScene.CurrentLock() == TGLScene::kModifyLock; }
virtual void EndScene();
virtual Int_t AddObject(const TBuffer3D & buffer, Bool_t * addChildren = 0);
virtual Int_t AddObject(UInt_t physicalID, const TBuffer3D & buffer, Bool_t * addChildren = 0);
virtual Bool_t OpenComposite(const TBuffer3D & buffer, Bool_t * addChildren = 0);
virtual void CloseComposite();
virtual void AddCompositeOp(UInt_t operation);
virtual void PrintObjects();
virtual void ResetCameras() { SetupCameras(kTRUE); }
virtual void ResetCamerasAfterNextUpdate() { fResetCamerasOnNextUpdate = kTRUE; }
virtual void RefreshPadEditor(TObject* =0) {}
Int_t GetDev()const{return fGLDevice;}
Color_t GetClearColor() const { return fClearColor; }
void SetClearColor(Color_t col) { fClearColor = col; }
Bool_t GetSmartRefresh() const { return fSmartRefresh; }
void SetSmartRefresh(Bool_t smart_ref) { fSmartRefresh = smart_ref; }
void SetDrawStyle(TGLDrawFlags::EStyle style);
TGLCamera & CurrentCamera() const { return *fCurrentCamera; }
void SetCurrentCamera(ECameraType camera);
void SetOrthoCamera(ECameraType camera, Double_t left, Double_t right, Double_t top, Double_t bottom);
void SetPerspectiveCamera(ECameraType camera, Double_t fov, Double_t dolly,
Double_t center[3], Double_t hRotate, Double_t vRotate);
void ToggleLight(ELight light);
void SetLight(ELight light, Bool_t on);
UInt_t GetLightState(){return fLightState;}
void GetGuideState(EAxesType & axesType, Bool_t & referenceOn, Double_t referencePos[3]) const;
void SetGuideState(EAxesType axesType, Bool_t referenceOn, const Double_t referencePos[3]);
void GetClipState(EClipType type, Double_t data[6]) const;
void SetClipState(EClipType type, const Double_t data[6]);
void GetCurrentClip(EClipType & type, Bool_t & edit) const;
void SetCurrentClip(EClipType type, Bool_t edit);
TGLCameraMarkupStyle* GetCameraMarkup() const { return fScene.GetCameraMarkup(); }
void SetCameraMarkup(TGLCameraMarkupStyle* m) { fScene.SetCameraMarkup(m); }
void SetSelectedColor(const Float_t rgba[17]);
void SetColorOnSelectedFamily(const Float_t rgba[17]);
void SetSelectedGeom(const TGLVertex3 & trans, const TGLVector3 & scale);
const TGLPhysicalShape * GetSelected() const { return fScene.GetSelected(); }
void RequestDraw(Short_t LOD = TGLDrawFlags::kLODMed);
void DoDraw();
Bool_t RequestSelect(UInt_t x, UInt_t y);
Bool_t DoSelect(const TGLRect & rect);
void ApplySelection();
void UpdateScene();
Bool_t GetIgnoreSizesOnUpdate() const { return fIgnoreSizesOnUpdate; }
void SetIgnoreSizesOnUpdate(Bool_t v) { fIgnoreSizesOnUpdate = v; }
void ResetCurrentCamera();
Bool_t GetResetCamerasOnUpdate() const { return fResetCamerasOnUpdate; }
void SetResetCamerasOnUpdate(Bool_t v) { fResetCamerasOnUpdate = v; }
Bool_t GetResetCameraOnDoubleClick() const { return fResetCameraOnDoubleClick; }
void SetResetCameraOnDoubleClick(Bool_t v) { fResetCameraOnDoubleClick = v; }
Bool_t HandleEvent(Event_t *ev);
Bool_t HandleButton(Event_t *ev);
Bool_t HandleDoubleClick(Event_t *ev);
Bool_t HandleConfigureNotify(Event_t *ev);
Bool_t HandleKey(Event_t *ev);
Bool_t HandleMotion(Event_t *ev);
Bool_t HandleExpose(Event_t *ev);
void SetPadEditor(TGLViewerEditor *ed){fPadEditor = ed;}
ClassDef(TGLViewer,0)
};
inline void TGLViewer::GetClipState(EClipType type, Double_t data[6]) const
{
fScene.GetClipState(type, data);
}
inline void TGLViewer::SetClipState(EClipType type, const Double_t data[6])
{
fScene.SetClipState(type, data);
RequestDraw();
}
inline void TGLViewer::GetCurrentClip(EClipType & type, Bool_t & edit) const
{
fScene.GetCurrentClip(type, edit);
}
inline void TGLViewer::SetCurrentClip(EClipType type, Bool_t edit)
{
fScene.SetCurrentClip(type, edit);
RequestDraw();
}
class TGLRedrawTimer : public TTimer
{
private:
TGLViewer & fViewer;
Short_t fRedrawLOD;
public:
TGLRedrawTimer(TGLViewer & viewer) : fViewer(viewer), fRedrawLOD(TGLDrawFlags::kLODHigh) {};
~TGLRedrawTimer() {};
void RequestDraw(Int_t milliSec, Short_t redrawLOD) {
fRedrawLOD = redrawLOD;
TTimer::Start(milliSec, kTRUE);
}
Bool_t Notify() { TurnOff(); fViewer.RequestDraw(fRedrawLOD); return kTRUE; }
};
class TGLPShapeObj : public TObject
{
public:
TGLPhysicalShape *fPShape;
TGLViewer *fViewer;
TGLPShapeObj() : TObject(), fPShape(0), fViewer(0) {}
TGLPShapeObj(TGLPhysicalShape* sh,TGLViewer* v) :
TObject(), fPShape(sh), fViewer(v) { }
virtual ~TGLPShapeObj() {}
virtual const char* GetName() const { return "Selected"; }
private:
TGLPShapeObj(const TGLPShapeObj &);
TGLPShapeObj& operator=(const TGLPShapeObj &);
ClassDef(TGLPShapeObj, 0);
};
#endif // ROOT_TGLViewer
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.