library: libRGL #include "TGLViewer.h" |
TGLViewer
class description - source file - inheritance tree (.pdf)
private:
TGLViewer(const TGLViewer&)
RootCsg::BaseMesh* BuildComposite()
void ClearClips()
TGLLogicalShape* CreateNewLogical(const TBuffer3D& buffer) const
TGLPhysicalShape* CreateNewPhysical(UInt_t physicalID, const TBuffer3D& buffer, const TGLLogicalShape& logical) const
TGLCamera& CurrentCamera() const
void InitGL()
void MakeCurrent() const
TGLViewer& operator=(const TGLViewer&)
void PostDraw()
void PreDraw()
Bool_t RebuildScene()
void SetupCameras()
void SetupClips()
void SetupLights()
void SetViewport(Int_t x, Int_t y, UInt_t width, UInt_t height)
void SwapBuffers() const
Int_t ValidateObjectBuffer(const TBuffer3D& buffer, Bool_t includeRaw) const
public:
TGLViewer(TVirtualPad* pad, Int_t x, Int_t y, UInt_t width, UInt_t height)
virtual ~TGLViewer()
virtual void AddCompositeOp(UInt_t operation)
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 void BeginScene()
virtual Bool_t BuildingScene() const
void ChangedBy(const char* method)
static TClass* Class()
virtual void ClipChanged()
virtual void CloseComposite()
Bool_t Connect(const char* sig, const char* cl, void* rcvr, const char* slt)
void Destroyed()
Bool_t Disconnect(const char* sig = "0", void* rcvr = 0, const char* slt = "0")
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
void DoDraw()
Bool_t DoSelect(const TGLRect& rect)
void DoSelectManip(const TGLRect& rect)
void Emit(const char* signal)
void Emit(const char* signal, const char* params)
void Emit(const char* signal, Long_t* paramArr)
void Emit(const char* signal, Double_t param)
void Emit(const char* signal, Long_t param)
void Emit(const char* signal, Long64_t param)
void Emit(const char* signal, ULong64_t param)
void Emit(const char* signal, Bool_t param)
void Emit(const char* signal, Char_t param)
void Emit(const char* signal, UChar_t param)
void Emit(const char* signal, Short_t param)
void Emit(const char* signal, UShort_t param)
void Emit(const char* signal, Int_t param)
void Emit(const char* signal, UInt_t param)
void Emit(const char* signal, ULong_t param)
void Emit(const char* signal, Float_t param)
void EmitVA(const char* signal, Int_t nargs)
virtual void EndScene()
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
void GetClipState(TGLViewer::EClipType type, Double_t* data) const
TGLViewer::EClipType GetCurrentClip() const
void GetGuideState(TGLViewer::EAxesType& axesType, Bool_t& referenceOn, Double_t* referencePos) const
TList* GetListOfSignals() const
const TGLPhysicalShape* GetSelected() const
Bool_t HandleButton(Event_t* ev)
Bool_t HandleConfigureNotify(Event_t* ev)
Bool_t HandleDoubleClick(Event_t* ev)
Bool_t HandleEvent(Event_t* ev)
Bool_t HandleExpose(Event_t* ev)
Bool_t HandleKey(Event_t* ev)
Bool_t HandleMotion(Event_t* ev)
void HighPriority(const char* signal_name, const char* slot_name = "0")
virtual TClass* IsA() const
void LowPriority(const char* signal_name, const char* slot_name = "0")
void Message(const char* msg)
virtual Bool_t OpenComposite(const TBuffer3D& buffer, Bool_t* addChildren = 0)
virtual void PostSceneBuildSetup()
virtual Bool_t PreferLocalFrame() const
void RequestDraw(UInt_t redrawLOD = kMed)
void RequestSelect(UInt_t x, UInt_t y)
void RequestSelectManip(const TGLRect& rect)
virtual void SelectionChanged()
void SetClipState(TGLViewer::EClipType type, const Double_t* data)
void SetColorOnSelectedFamily(const Float_t* rgba)
void SetCurrentCamera(TGLViewer::ECameraType camera)
void SetCurrentClip(TGLViewer::EClipType type, Bool_t edit)
void SetDrawStyle(TGLViewer::EDrawStyle drawStyle)
void SetGuideState(TGLViewer::EAxesType axesType, Bool_t referenceOn, const Double_t* referencePos)
void SetLight(TGLViewer::ELight light, Bool_t on)
void SetOrthoCamera(TGLViewer::ECameraType camera, Double_t left, Double_t right, Double_t top, Double_t bottom)
void SetPerspectiveCamera(TGLViewer::ECameraType camera, Double_t fov, Double_t dolly, Double_t* center, Double_t hRotate, Double_t vRotate)
void SetSelectedColor(const Float_t* rgba)
void SetSelectedGeom(const TGLVertex3& trans, const TGLVector3& scale)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
void ToggleLight(TGLViewer::ELight light)
private:
TQObjSender fQObject
TVirtualPad* fPad ! external pad - remove replace with signal
TContextMenu* fContextMenu !
TGLPerspectiveCamera fPerspectiveCameraXOZ !
TGLPerspectiveCamera fPerspectiveCameraYOZ !
TGLPerspectiveCamera fPerspectiveCameraXOY !
TGLOrthoCamera fOrthoXOYCamera !
TGLOrthoCamera fOrthoXOZCamera !
TGLOrthoCamera fOrthoZOYCamera !
TGLCamera* fCurrentCamera !
Bool_t fInternalRebuild ! scene rebuild triggered internally/externally?
Bool_t fPostSceneBuildSetup ! setup viewer after (re)build complete?
Bool_t fAcceptedAllPhysicals ! did we take all physicals offered in AddObject()
Bool_t fForceAcceptAll ! force taking of all logicals/physicals in AddObject()
Bool_t fInternalPIDs ! using internal physical IDs
UInt_t fNextInternalPID ! next internal physical ID (from 1 - 0 reserved)
TGLFaceSet* fComposite ! Paritally created composite
UInt_t fCSLevel
vector<CSPart_t> fCSTokens
TGLViewer::EAction fAction
TPoint fStartPos
TPoint fLastPos
UInt_t fActiveButtonID
TGLViewer::EDrawStyle fDrawStyle ! current draw style (Fill/Outline/WireFrame)
TGLRedrawTimer* fRedrawTimer !
UInt_t fNextSceneLOD !
TGLScene fScene ! the GL scene - owned by viewer at present
TGLRect fViewport ! viewport - drawn area
UInt_t fLightState ! light states (on/off) mask
TGLViewer::EAxesType fAxesType ! axes type
Bool_t fReferenceOn ! reference marker on?
TGLVertex3 fReferencePos ! reference position
Bool_t fInitGL ! has GL been initialised?
TGLClipPlane* fClipPlane
TGLClipBox* fClipBox
TGLClip* fCurrentClip ! the current clipping shape
Bool_t fClipEdit
TGLTransManip* fTransManip ! translation manipulator
TGLScaleManip* fScaleManip ! scaling manipulator
TGLRotateManip* fRotateManip ! rotation manipulator
TGLManip* fCurrentManip ! current manipulator
Bool_t fDebugMode ! debug mode (forced rebuild + draw scene/frustum/interest boxes)
UInt_t fAcceptedPhysicals ! number of physicals accepted in last rebuild
UInt_t fRejectedPhysicals ! number of physicals rejected in last rebuild
Bool_t fIsPrinting
protected:
TGLWindow* fGLWindow ! remove - replace with TGLManager
public:
static const TGLViewer::ECameraType kCameraPerspXOZ
static const TGLViewer::ECameraType kCameraPerspYOZ
static const TGLViewer::ECameraType kCameraPerspXOY
static const TGLViewer::ECameraType kCameraOrthoXOY
static const TGLViewer::ECameraType kCameraOrthoXOZ
static const TGLViewer::ECameraType kCameraOrthoZOY
static const TGLViewer::ELight kLightFront
static const TGLViewer::ELight kLightTop
static const TGLViewer::ELight kLightBottom
static const TGLViewer::ELight kLightLeft
static const TGLViewer::ELight kLightRight
static const TGLViewer::ELight kLightMask
static const TGLViewer::EDrawStyle kFill
static const TGLViewer::EDrawStyle kOutline
static const TGLViewer::EDrawStyle kWireFrame
static const TGLViewer::EClipType kClipNone
static const TGLViewer::EClipType kClipPlane
static const TGLViewer::EClipType kClipBox
static const TGLViewer::EAxesType kAxesNone
static const TGLViewer::EAxesType kAxesEdge
static const TGLViewer::EAxesType kAxesOrigin
static const TGLViewer::EAction kNone
static const TGLViewer::EAction kRotate
static const TGLViewer::EAction kTruck
static const TGLViewer::EAction kDolly
static const TGLViewer::EAction kDrag
TGLViewer
Base GL viewer object - used by both standalone and embedded (in pad)
GL. Contains core viewer objects :
GL scene (fScene) - collection of main drawn objects - see TGLScene
Cameras (fXXXXCamera) - ortho and perspective cameras - see TGLCamera
Clipping (fClipXXXX) - collection of clip objects - see TGLClip
Manipulators (fXXXXManip) - collection of manipulators - see TGLManip
It maintains the current active draw styles, clipping object,
manipulator, camera etc.
TGLViewer is 'GUI free' in that it does not derive from any ROOT GUI
TGFrame etc - see TGLSAViewer for this. However it contains GUI
GUI style methods HandleButton() etc to which GUI events can be
directed from standalone frame or embedding pad to perform
interaction.
For embedded (pad) GL this viewer is created directly by plugin
manager. For standalone the derived TGLSAViewer is.
~TGLViewer()
Destroy viewer object
Bool_t PreferLocalFrame() const
Indicate if viewer prefers to receive logical shape descriptions
in local (kTRUE) or world frame (kFALSE). For GL viewer is kTRUE always
TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
for description of viewer architecture
void BeginScene()
Start building of viewer scene
TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
for description of viewer architecture
void EndScene()
End building of viewer scene
TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
for description of viewer architecture
Bool_t RebuildScene()
If we accepted all offered physicals into the scene no point in
rebuilding it.
Int_t AddObject(const TBuffer3D & buffer, Bool_t * addChildren)
Add an object to the viewer, using internal physical IDs
TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
for description of viewer architecture
Int_t AddObject(UInt_t physicalID, const TBuffer3D & buffer, Bool_t * addChildren)
Add an object to the viewer, using an external physical ID
TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
for description of viewer architecture
Bool_t OpenComposite(const TBuffer3D & buffer, Bool_t * addChildren)
Open new composite container.
TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
for description of viewer architecture.
void CloseComposite()
Close composite container
TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
for description of viewer architecture
void AddCompositeOp(UInt_t operation)
Add composite operation used to combine objects added via AddObject
TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
for description of viewer architecture
Int_t ValidateObjectBuffer(const TBuffer3D & buffer, Bool_t includeRaw) const
Validate if the passed 'buffer' contains all sections we require to add object.
Returns Int_t combination of TBuffer::ESection flags still required - or
TBuffer3D::kNone if buffer is valid.
If 'includeRaw' is kTRUE check for kRaw/kRawSizes - skip otherwise.
See base/src/TVirtualViewer3D.cxx for description of viewer architecture
TGLLogicalShape* CreateNewLogical(const TBuffer3D & buffer) const
Create and return a new TGLLogicalShape from the supplied buffer
TGLPhysicalShape* CreateNewPhysical(UInt_t ID,
const TBuffer3D & buffer,
const TGLLogicalShape & logical) const
Create and return a new TGLPhysicalShape with id 'ID', using 'buffer' placement
information (translation etc), and bound to suppled 'logical'
RootCsg::BaseMesh* BuildComposite()
Build and return composite shape mesh
void InitGL()
Initialise GL state if not already done
void PostSceneBuildSetup()
Perform post scene (re)build setup
void SetupCameras()
Setup cameras for current scene bounding box
void SetupLights()
Setup lights for current scene bounding box
void SetupClips()
Setup clipping objects for current scene bounding box
void ClearClips()
Clear out exising clipping objects
void RequestDraw(UInt_t LOD)
Post request for redraw of viewer at level of detail 'LOD'
Request is directed via cross thread gVirtualGL object
void DoDraw()
Draw out the the current viewer/scene
void PreDraw()
Perform GL work which must be done before each draw of scene
void PostDraw()
Perform GL work which must be done after each draw of scene
void MakeCurrent() const
Make GL context current
void SwapBuffers() const
SWap GL buffers
void RequestSelect(UInt_t x, UInt_t y)
Post request for select draw of viewer, picking objects round the WINDOW
point (x,y).
Request is directed via cross thread gVirtualGL object
Bool_t DoSelect(const TGLRect & rect)
Perform GL selection, picking objects overlapping WINDOW
area described by 'rect'. Return kTRUE if selection
changed, kFALSE otherwise. Selection can be obtained
via fScene.GetSelected()
Select lock should already been taken in other thread in
TGLViewer::DoSelect()
void RequestSelectManip(const TGLRect & rect)
Post request for select draw of current manipulator , picking objects round
the WINDOW area described by 'rect'
void DoSelectManip(const TGLRect & rect)
Perform GL selection, picking objects overlapping WINDOW
area described by 'rect'
void SetViewport(Int_t x, Int_t y, UInt_t width, UInt_t height)
Set viewer viewport (window area) with bottom/left at (x,y), with
dimensions 'width'/'height'
void SetDrawStyle(EDrawStyle drawStyle)
Set the draw style - one of kFill, kWireframe, kOutline
void SetCurrentCamera(ECameraType cameraType)
Set current active camera - 'cameraType' one of:
kCameraPerspX, kCameraPerspY, kCameraPerspZ
kCameraOrthoXOY, kCameraOrthoXOZ, kCameraOrthoZOY
void SetOrthoCamera(ECameraType camera, Double_t left, Double_t right,
Double_t top, Double_t bottom)
Set an orthographic camera to supplied configuration - note this does not need
to be the current camera - though you will not see the effect if it is not.
'camera' defines the ortho camera - one of kCameraOrthoXOY, kCameraOrthoXOZ, kCameraOrthoZOY
'left' / 'right' / 'top' / 'bottom' define the WORLD coordinates which
corresepond with the left/right/top/bottom positions on the GL viewer viewport
E.g. for kCameraOrthoXOY camera left/right are X world coords,
top/bottom are Y world coords
As this is an orthographic camera the other axis (in eye direction) is
no relevant. The near/far clip planes are set automatically based in scene
contents
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 - though you will not see the effect if it is not.
'camera' defines the persp camera - one of kCameraPerspXOZ, kCameraPerspYOZ, kCameraPerspXOY
'fov' - field of view (lens angle) in degrees (clamped to 0.1 - 170.0)
'dolly' - distance from 'center'
'center' - world position from which dolly/hRotate/vRotate are measured
camera rotates round this, always facing in (in center of viewport)
'hRotate' - horizontal rotation from initial configuration in degrees
'hRotate' - vertical rotation from initial configuration in degrees
void ToggleLight(ELight light)
Toggle light on/off - 'light' one of kFront, kTop, kBottom, kLeft, kRight
void SetLight(ELight light, Bool_t on)
Set light on/off - 'light' one of kFront, kTop, kBottom, kLeft, kRight
void GetGuideState(EAxesType & axesType, Bool_t & referenceOn, Double_t referencePos[3]) const
Fetch the state of guides (axes & reference markers) into arguments
void SetGuideState(EAxesType axesType, Bool_t referenceOn, const Double_t referencePos[3])
Set the state of guides (axes & reference markers) from arguments
void GetClipState(EClipType type, Double_t data[6]) const
Get state of clip object 'type' into data vector:
'type' requested 'data' contents returned
kClipPlane 4 components - A,B,C,D - of plane eq : Ax+By+CZ+D = 0
kBoxPlane 6 components - Box Center X/Y/Z - Box Extents X/Y/Z
void SetClipState(EClipType type, const Double_t data[6])
Set state of clip object 'type' into data vector:
'type' specified 'data' contents interpretation
kClipNone ignored
kClipPlane 4 components - A,B,C,D - of plane eq : Ax+By+CZ+D = 0
kBoxPlane 6 components - Box Center X/Y/Z - Box Extents X/Y/Z
void SetCurrentClip(EClipType type, Bool_t edit)
Set current clip active in viewer - 'type' is one of kClipNone
kClipPlane or kClipBox. 'edit' indicates if clip object should
been shown/edited directly in viewer (current manipulator attached to it)
kTRUE if so (ignored for kClipNone), kFALSE otherwise
void SetSelectedColor(const Float_t color[17])
Set full color attributes on current selected physical shape:
0...3 - diffuse
4...7 - ambient
8...11 - specular
12..15 - emission
16 - shininess
see OpenGL documentation for details of materials
void SetColorOnSelectedFamily(const Float_t color[17])
Set full color attributes on all physical shapes sharing the same
logical shape as the selected physical
0...3 - diffuse
4...7 - ambient
8...11 - specular
12..15 - emission
16 - shininess
see OpenGL documentation for details of materials
void SetSelectedGeom(const TGLVertex3 & trans, const TGLVector3 & scale)
Update geometry of the selected physical. 'trans' and 'scale' specify the
translation and scaling components of the physical shapes translation matrix
See TGLMatrix for more details
void SelectionChanged()
Emit signal indicating selection has changed
void ClipChanged()
Emit signal indicating clip object has changed
Int_t DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/)
Calcaulate and return pxiel distance to nearest viewer object from
window location px, py
This is provided for use when embedding GL viewer into pad
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Process event of type 'event' - one of EEventType types,
occuring at window location px, py
This is provided for use when embedding GL viewer into pad
Bool_t HandleEvent(Event_t *event)
Handle generic Event_t type 'event' - provided to catch focus changes
and terminate any interaction in viewer
Bool_t HandleButton(Event_t *event)
Handle mouse button 'event'
Bool_t HandleDoubleClick(Event_t *event)
Handle mouse double click 'event'
Bool_t HandleConfigureNotify(Event_t *event)
Handle configure notify 'event' - a window resize/movement
Bool_t HandleKey(Event_t *event)
Handle keyboard 'event'
Bool_t HandleMotion(Event_t *event)
Handle mouse motion 'event'
Bool_t HandleExpose(Event_t *)
Handle window expose 'event' - show
Inline Functions
TList* GetListOfSignals() const
Bool_t Connect(const char* sig, const char* cl, void* rcvr, const char* slt)
Bool_t Disconnect(const char* sig = "0", void* rcvr = 0, const char* slt = "0")
void HighPriority(const char* signal_name, const char* slot_name = "0")
void LowPriority(const char* signal_name, const char* slot_name = "0")
void EmitVA(const char* signal, Int_t nargs)
void Emit(const char* signal)
void Emit(const char* signal, const char* params)
void Emit(const char* signal, Long_t* paramArr)
void Emit(const char* signal, Double_t param)
void Emit(const char* signal, Long_t param)
void Emit(const char* signal, Long64_t param)
void Emit(const char* signal, ULong64_t param)
void Emit(const char* signal, Bool_t param)
void Emit(const char* signal, Char_t param)
void Emit(const char* signal, UChar_t param)
void Emit(const char* signal, Short_t param)
void Emit(const char* signal, UShort_t param)
void Emit(const char* signal, Int_t param)
void Emit(const char* signal, UInt_t param)
void Emit(const char* signal, ULong_t param)
void Emit(const char* signal, Float_t param)
void Destroyed()
void ChangedBy(const char* method)
void Message(const char* msg)
TGLCamera& CurrentCamera() const
TGLViewer TGLViewer(const TGLViewer&)
TGLViewer& operator=(const TGLViewer&)
TGLViewer TGLViewer(TVirtualPad* pad, Int_t x, Int_t y, UInt_t width, UInt_t height)
Bool_t BuildingScene() const
TGLViewer::EClipType GetCurrentClip() const
const TGLPhysicalShape* GetSelected() const
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
Author: Richard Maunder 25/05/2005
Last update: root/gl:$Name: $:$Id: TGLViewer.cxx,v 1.31 2005/12/12 15:28:32 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
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.