library: libRGL
#include "TGLScene.h"

TGLScene


class description - header file - source file
viewCVS header - viewCVS source

class TGLScene

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
TGLScene()
virtual~TGLScene()
voidActivateSecSelect()
voidAdoptLogical(TGLLogicalShape& shape)
voidAdoptPhysical(TGLPhysicalShape& shape)
voidApplySelection()
voidBeginSmartRefresh()
const TGLBoundingBox&BoundingBox() const
static TClass*Class()
voidClearClips()
TGLScene::ELockCurrentLock() const
Bool_tDestroyLogical(ULong_t ID)
UInt_tDestroyLogicals()
Bool_tDestroyPhysical(ULong_t ID)
UInt_tDestroyPhysicals(Bool_t incModified, const TGLCamera* camera = 0)
voidDraw(const TGLCamera& camera, TGLDrawFlags sceneFlags, Double_t timeout, Int_t axesType, const TGLVertex3* reference, Bool_t forSelect = kFALSE)
voidDump() const
voidEndSmartRefresh()
TGLLogicalShape*FindLogical(ULong_t ID) const
TGLLogicalShape*FindLogicalSmartRefresh(ULong_t ID) const
TGLPhysicalShape*FindPhysical(ULong_t ID) const
TGLCameraMarkupStyle*GetCameraMarkup() const
voidGetClipState(EClipType type, Double_t* data) const
voidGetCurrentClip(EClipType& type, Bool_t& edit) const
pair<UInt_t,UInt_t*>GetHitRecord(Int_t i) const
Int_tGetNPrimHits() const
Int_tGetNSecHits() const
TGLPhysicalShape*GetSelected() const
TGLPhysicalShape*GetSelectionResult() const
Bool_tGetTriedSecSelect() const
Bool_tGetTrySecSelect() const
Bool_tHandleButton(const Event_t& event, const TGLCamera& camera)
Bool_tHandleMotion(const Event_t& event, const TGLCamera& camera)
virtual TClass*IsA() const
Bool_tIsLocked() const
static const char*LockName(TGLScene::ELock lock)
static Bool_tLockValid(TGLScene::ELock lock)
voidPurgeNextLogical()
Bool_tReleaseLock(TGLScene::ELock lock) const
Bool_tSelect(const TGLCamera& camera, const TGLDrawFlags& sceneFlags)
voidSetCameraMarkup(TGLCameraMarkupStyle* m)
voidSetClipState(EClipType type, const Double_t* data)
Bool_tSetColorOnSelectedFamily(const Float_t* rgba)
voidSetCurrentClip(EClipType type, Bool_t edit)
voidSetCurrentManip(EManipType type)
Bool_tSetSelectedColor(const Float_t* rgba)
Bool_tSetSelectedGeom(const TGLVertex3& trans, const TGLVector3& scale)
voidSetupClips()
virtual voidShowMembers(TMemberInspector& insp, char* parent)
UInt_tSizeOf() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
Bool_tTakeLock(TGLScene::ELock lock) const
private:
TGLScene(const TGLScene&)
static Bool_tComparePhysicalVolumes(const TGLPhysicalShape* shape1, const TGLPhysicalShape* shape2)
voidDrawGuides(const TGLCamera& camera, Int_t axesType, const TGLVertex3* reference) const
voidDrawNumber(Double_t num, const TGLVertex3& center) const
voidDrawPass(const TGLCamera& camera, const TGLDrawFlags& sceneFlags, Double_t timeout, const vector<TGLPlane>* clipPlanes = 0)
voidDumpDrawStats()
TGLScene&operator=(const TGLScene&)
voidResetDrawStats(const TGLDrawFlags& flags)
voidSortDrawList()
voidUpdateDrawStats(const TGLPhysicalShape& shape, const TGLDrawFlags& flags)

Data Members

public:
enum ELock { kUnlocked
kDrawLock
kSelectLock
kModifyLock
};
private:
TGLScene::ELockfLock!
map<unsigned long,TGLLogicalShape*,less<unsigned long>,allocator<pair<const unsigned long,TGLLogicalShape*> > >fLogicalShapes!
map<unsigned long,TGLPhysicalShape*,less<unsigned long>,allocator<pair<const unsigned long,TGLPhysicalShape*> > >fPhysicalShapes!
vector<const TGLPhysicalShape*,allocator<const TGLPhysicalShape*> >fDrawList!
Bool_tfDrawListValid! (do we need this & fBoundingBoxValid)
Bool_tfInSmartRefresh!
map<unsigned long,TGLLogicalShape*,less<unsigned long>,allocator<pair<const unsigned long,TGLLogicalShape*> > >fSmartRefreshCache!
TGLBoundingBoxfBoundingBox! bounding box for scene (axis aligned) - lazy update - use BoundingBox() to access
Bool_tfBoundingBoxValid! bounding box valid?
TGLPhysicalShape*fSelectedPhysical! current selected physical shape
TGLPhysicalShape*fSelectionResult! physical shape found by last Select
Int_tfNPrimHits! number of primary selection hits
Int_tfNSecHits! number of secondary selection hits
Bool_tfTrySecSelect! flag controlling if secondary selection should be tried
Bool_tfTriedSecSelect! flag reporting if secondary selection was actually tried
vector<UInt_t>fSelectBuffer! buffer holding GL selection result
vector<std::pair<UInt_t,UInt_t*> >fSortedHits! depth-sorted selection result
TGLClipPlane*fClipPlane
TGLClipBox*fClipBox
TGLClip*fCurrentClip! the current clipping shape
TGLCameraMarkupStyle*fCameraMarkupoverlay GL text config
TGLTransManipfTransManip! translation manipulator
TGLScaleManipfScaleManip! scaling manipulator
TGLRotateManipfRotateManip! rotation manipulator
TGLManip*fCurrentManip! current manipulator
TGLScene::DrawStats_tfDrawStats

Class Description

                                                                      
 TGLScene                                                             
                                                                      
 A GL scene is the container for all the viewable objects (shapes)    
 loaded into the viewer. It consists of two main stl::maps containing 
 the TGLLogicalShape and TGLPhysicalShape collections, and interface  
 functions enabling viewers to manage objects in these. The physical  
 shapes defined the placement of copies of the logical shapes - see   
 TGLLogicalShape/TGLPhysicalShape for more information on relationship
                                                                      
 The scene can be drawn by owning viewer, passing camera, draw style  
 & quality (LOD), clipping etc - see Draw(). The scene can also be    
 drawn for selection in similar fashion - see Select(). The scene     
 keeps track of a single selected physical - which can be modified by 
 viewers.                                                             
                                                                      
 The scene maintains a lazy calculated bounding box for the total     
 scene extents, axis aligned round TGLPhysicalShape shapes.           
                                                                      
 Currently a scene is owned exclusively by one viewer - however it is 
 intended that it could easily be shared by multiple viewers - for    
 efficiency and syncronisation reasons. Hence viewer variant objects  
 camera, clips etc being owned by viewer and passed at draw/select    

TGLScene()
 Construct scene object
~TGLScene()
 Purge out the DL cache - when per drawable DL purging implemented
 this no longer really required. However should be faster....
void AdoptLogical(TGLLogicalShape & shape)
 Adopt dynamically created logical 'shape' - add to internal map and take
 responsibility for deleting
Bool_t DestroyLogical(ULong_t ID)
 Zero ID logical shapes are not unique - this simple means the external object
 does not exist - should never be asked to destroy these singularly
UInt_t DestroyLogicals()
 Destroy all logical shapes in scene
 Return count of number destroyed
TGLLogicalShape * FindLogical(ULong_t ID)
 Zero ID logical shapes are not unique - this simple means the external object
 does not exist - should never be asked to seach for this
void AdoptPhysical(TGLPhysicalShape & shape)
 Adopt dynamically created physical 'shape' - add to internal map and take
 responsibility for deleting
Bool_t DestroyPhysical(ULong_t ID)
 Destroy physical shape defined by unique 'ID'
 Returns kTRUE if found/destroyed - kFALSE otherwise
UInt_t DestroyPhysicals(Bool_t incModified, const TGLCamera * camera)
 Destroy all logical shapes in scene
 Return count of number destroyed
TGLPhysicalShape * FindPhysical(ULong_t ID)
 Find and return physical shape identified by unqiue 'ID'
 Returns 0 if not found
void BeginSmartRefresh()
 Moves logicals to refresh-cache.
void EndSmartRefresh()
 Wipes logicals in refresh-cache.
TGLLogicalShape * FindLogicalSmartRefresh(ULong_t ID)
 Find and return logical shape identified by unqiue 'ID' in refresh-cache.
 Returns 0 if not found.
void Draw(const TGLCamera & camera, TGLDrawFlags sceneFlags, Double_t timeout, Int_t axesType, const TGLVertex3 * reference, Bool_t forSelect)
 Draw out scene into current GL context, using passed arguments:

 'camera' - used for for object culling, manip scalling
 'sceneFlags'  - draw flags for scene - see TGLDrawFlags
 'timeout'- timeout for scene draw (in milliseconds) - if 0.0 unlimited
 'axesType' - axis style - one of TGLViewer::EAxesType
 'reference' - position of reference marker (or none if null)
 'forSelect' - is draw for select? If kTRUE clip and manip objects (which
            cannot be selected) are not drawn
void DrawPass(const TGLCamera & camera, const TGLDrawFlags & sceneFlags, Double_t timeout, const std::vector<TGLPlane> * clipPlanes)
 Perform a internal draw pass - multiple passes are required for some
 clip shapes
void SortDrawList()
 Sort the TGLPhysical draw list by shape bounding box volume, from
 large to small. This makes dropout of shapes with time limited
 Draw() calls must less noticable. As this does not use projected
 size it only needs to be done after a scene content change - not
 everytime scene drawn (potential camera/projection change).
Bool_t ComparePhysicalVolumes(const TGLPhysicalShape * shape1, const TGLPhysicalShape * shape2)
 Compare 'shape1' and 'shape2' bounding box volumes - return kTRUE if
 'shape1' bigger than 'shape2'
void DrawGuides(const TGLCamera & camera, Int_t axesType, const TGLVertex3 * reference)
 Draw out scene guides - axes and reference marker

 'camera'    - current active camera - required for calculating projection size
 'axesType'  - kAxesNone, kAxesOrigin (run through origin), kAxesEdge (at scene box edge)
 'reference' - if not null, draw orange reference sphere at vertex
void DrawNumber(Double_t num, const TGLVertex3 & center)
 Draw out number (as string) 'num', centered on vertex 'center'
Bool_t Select(const TGLCamera & camera, const TGLDrawFlags & sceneFlags)
 Perform select draw using arguments:

 'camera' - used for for object culling
 'style'  - draw style kFill (filled polygons) kOutline (polygons + outlines)
            kWireFrame

 Arguments are passed on to Draw(), with unlimted time

 Returns kTRUE if selected object is different then currently selected
 fSelectedPhysical. The result is stored in fSelectionResult member.
 One still has to call ApplySelection() to activate this change.

 If secondary-selection is activated (by calling
 ActivateSecSelect() prior requesting the selection another
 selection pass is done on selected object if it supports
 secondary selection. The secondary select records are then available in:
 fTriedSecSelect, fNSecHits, fSelectBuffer and fSortedHits.
void ApplySelection()
 Makes result of last selection (fSelectionResult) the currently
 selected object (fSelectedPhysical).
Bool_t 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
Bool_t 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
Bool_t 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 SetupClips()
 Setup clipping objects for current scene bounding box
void ClearClips()
 Clear out exising clipping objects
void GetClipState(EClipType type, Double_t data[6])
 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 GetCurrentClip(EClipType & type, Bool_t & edit)
 Get current type active in viewer - returns one of kClipNone
 kClipPlane or kClipBox
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 SetCurrentManip(EManipType type)
const TGLBoundingBox & BoundingBox()
 Update (if required) and return the scene bounding box
 Encapsulates all physical shapes bounding box with axes aligned box
void Dump()
 Output simple scene stats to std::cout
UInt_t SizeOf()
 Return memory cost of scene
 Warning: NOT CORRECT at present - doesn't correctly calculate size
 of logical shapes with dynamic internal contents
void ResetDrawStats(const TGLDrawFlags & flags)
 Reset internal draw stats
void UpdateDrawStats(const TGLPhysicalShape & shape, const TGLDrawFlags & flags)
 Update draw stats, for newly drawn 'shape'
void DumpDrawStats()
 Output draw stats to std::cout
Bool_t HandleButton(const Event_t & event, const TGLCamera & camera)
______________________________________________________________________________
Bool_t HandleMotion(const Event_t & event, const TGLCamera & camera)
______________________________________________________________________________
Bool_t TakeLock(ELock lock)
______________________________________________________________________________
Bool_t ReleaseLock(ELock lock)
______________________________________________________________________________
Bool_t IsLocked()
______________________________________________________________________________
const char * LockName(ELock lock)
______________________________________________________________________________
Bool_t LockValid(ELock lock)
______________________________________________________________________________
 Test if lock is a valid type to take/release
 kUnlocked is never valid in these cases
TGLScene(const TGLScene &)
 Non-copyable class
TGLScene & operator=(const TGLScene &)
void PurgeNextLogical()
{}
TGLPhysicalShape * GetSelected()
 Selected Object
{ return fSelectedPhysical; }
TGLPhysicalShape * GetSelectionResult()
{ return fSelectionResult; }
Int_t GetNPrimHits()
{ return fNPrimHits; }
Int_t GetNSecHits()
{ return fNSecHits; }
Bool_t GetTrySecSelect()
{ return fTrySecSelect; }
void ActivateSecSelect()
{ fTrySecSelect = kTRUE; }
Bool_t GetTriedSecSelect()
{ return fTriedSecSelect; }
std::pair<UInt_t, UInt_t*> GetHitRecord(Int_t i)
{ return fSortedHits[i]; }
TGLCameraMarkupStyle* GetCameraMarkup()
 Viewport/camera screen markup
{ return fCameraMarkup; }
void SetCameraMarkup(TGLCameraMarkupStyle* m)
{ fCameraMarkup = m; }
ELock CurrentLock()

Author: Richard Maunder 25/05/2005
Last update: root/gl:$Name: $:$Id: TGLScene.cxx,v 1.45 2006/12/09 23:05:17 rdm 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.