library: libRGL
#include "TGLScene.h"

TGLScene


class description - source file - inheritance tree (.pdf)

class TGLScene

Inheritance Chart:
TGLScene
    private:
TGLScene(const TGLScene&) static Bool_t ComparePhysicalVolumes(const TGLPhysicalShape* shape1, const TGLPhysicalShape* shape2) void DrawGuides(const TGLCamera& camera, Int_t axesType, const TGLVertex3* reference) const void DrawNumber(Double_t num, const TGLVertex3& center) const void DrawPass(const TGLCamera& camera, const TGLDrawFlags& sceneFlags, Double_t timeout, const vector<TGLPlane>* clipPlanes = 0) void DumpDrawStats() TGLScene& operator=(const TGLScene&) void ResetDrawStats(const TGLDrawFlags& flags) void SortDrawList() void UpdateDrawStats(const TGLPhysicalShape& shape, const TGLDrawFlags& flags) public:
TGLScene() virtual ~TGLScene() void AdoptLogical(TGLLogicalShape& shape) void AdoptPhysical(TGLPhysicalShape& shape) const TGLBoundingBox& BoundingBox() const static TClass* Class() void ClearClips() TGLScene::ELock CurrentLock() const Bool_t DestroyLogical(ULong_t ID) UInt_t DestroyLogicals() Bool_t DestroyPhysical(ULong_t ID) UInt_t DestroyPhysicals(Bool_t incModified, const TGLCamera* camera = 0) void Draw(const TGLCamera& camera, TGLDrawFlags sceneFlags, Double_t timeout, Int_t axesType, const TGLVertex3* reference, Bool_t forSelect = kFALSE) void Dump() const TGLLogicalShape* FindLogical(ULong_t ID) const TGLPhysicalShape* FindPhysical(ULong_t ID) const void GetClipState(EClipType type, Double_t* data) const void GetCurrentClip(EClipType& type, Bool_t& edit) const const TGLPhysicalShape* GetSelected() const Bool_t HandleButton(const Event_t& event, const TGLCamera& camera) Bool_t HandleMotion(const Event_t& event, const TGLCamera& camera) virtual TClass* IsA() const Bool_t IsLocked() const static const char* LockName(TGLScene::ELock lock) const static Bool_t LockValid(TGLScene::ELock lock) void PurgeNextLogical() Bool_t ReleaseLock(TGLScene::ELock lock) const Bool_t Select(const TGLCamera& camera, const TGLDrawFlags& sceneFlags) void SetClipState(EClipType type, const Double_t* data) Bool_t SetColorOnSelectedFamily(const Float_t* rgba) void SetCurrentClip(EClipType type, Bool_t edit) void SetCurrentManip(EManipType type) Bool_t SetSelectedColor(const Float_t* rgba) Bool_t SetSelectedGeom(const TGLVertex3& trans, const TGLVector3& scale) void SetupClips() virtual void ShowMembers(TMemberInspector& insp, char* parent) UInt_t SizeOf() const virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) Bool_t TakeLock(TGLScene::ELock lock) const

Data Members

    private:
TGLScene::ELock fLock ! 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_t fDrawListValid ! (do we need this & fBoundingBoxValid) TGLBoundingBox fBoundingBox ! bounding box for scene (axis aligned) - lazy update - use BoundingBox() to access Bool_t fBoundingBoxValid ! bounding box valid? TGLPhysicalShape* fSelectedPhysical ! current selected physical shape TGLClipPlane* fClipPlane TGLClipBox* fClipBox TGLClip* fCurrentClip ! the current clipping shape TGLTransManip fTransManip ! translation manipulator TGLScaleManip fScaleManip ! scaling manipulator TGLRotateManip fRotateManip ! rotation manipulator TGLManip* fCurrentManip ! current manipulator TGLScene::DrawStats_t fDrawStats public:
static const TGLScene::ELock kUnlocked static const TGLScene::ELock kDrawLock static const TGLScene::ELock kSelectLock static const TGLScene::ELock kModifyLock

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() : fLock(kUnlocked), fDrawList(1000), fDrawListValid(kFALSE), fBoundingBox(), fBoundingBoxValid(kFALSE), fSelectedPhysical(0), fClipPlane(0), fClipBox(0), fCurrentClip(0), fTransManip(), fScaleManip(), fRotateManip()
 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) const
 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) const
 Find and return physical shape identified by unqiue 'ID'
 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) const
 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) const
 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 selection changed, kFALSE if not

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]) 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 GetCurrentClip(EClipType & type, Bool_t & edit) const
 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() const
 Update (if required) and return the scene bounding box
 Encapsulates all physical shapes bounding box with axes aligned box

void Dump() const
 Output simple scene stats to std::cout

UInt_t SizeOf() const
 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



Inline Functions


                      TGLScene& operator=(const TGLScene&)
                       TGLScene TGLScene()
                           void PurgeNextLogical()
        const TGLPhysicalShape* GetSelected() const
                         Bool_t HandleButton(const Event_t& event, const TGLCamera& camera)
                         Bool_t HandleMotion(const Event_t& event, const TGLCamera& camera)
                         Bool_t TakeLock(TGLScene::ELock lock) const
                         Bool_t ReleaseLock(TGLScene::ELock lock) const
                         Bool_t IsLocked() const
                TGLScene::ELock CurrentLock() const
                    const char* LockName(TGLScene::ELock lock) const
                         Bool_t LockValid(TGLScene::ELock lock)
                        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: TGLScene.cxx,v 1.38 2006/02/22 14:26:15 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.