library: libRGL #include "TGLScene.h" |
TGLScene
class description - source file - inheritance tree (.pdf)
private:
TGLScene(const TGLScene&)
UInt_t CalcPhysicalLOD(const TGLPhysicalShape& shape, const TGLCamera& camera, UInt_t sceneLOD) const
static Bool_t ComparePhysicalVolumes(const TGLPhysicalShape* shape1, const TGLPhysicalShape* shape2)
void DrawNumber(Double_t num, const TGLVertex3& center) const
void DrawPass(const TGLCamera& camera, Int_t style, UInt_t LOD, Double_t timeout, const vector<TGLPlane>* clipPlanes = 0)
void DumpDrawStats()
TGLScene& operator=(const TGLScene&)
void ResetDrawStats()
void SortDrawList()
void UpdateDrawStats(const TGLPhysicalShape& shape)
public:
TGLScene()
virtual ~TGLScene()
void AdoptLogical(TGLLogicalShape& shape)
void AdoptPhysical(TGLPhysicalShape& shape)
const TGLBoundingBox& BoundingBox() const
static TClass* Class()
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, Int_t style, UInt_t LOD, Double_t timeout, const TGLClip* clip)
void DrawGuides(const TGLCamera& camera, Int_t axesType, const TGLVertex3* reference) const
void Dump() const
TGLLogicalShape* FindLogical(ULong_t ID) const
TGLPhysicalShape* FindPhysical(ULong_t ID) const
const TGLPhysicalShape* GetSelected() const
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, Int_t style, const TGLClip* clip)
Bool_t SetColorOnSelectedFamily(const Float_t* rgba)
Bool_t SetSelectedColor(const Float_t* rgba)
Bool_t SetSelectedGeom(const TGLVertex3& trans, const TGLVector3& scale)
Bool_t ShiftSelected(const TGLVector3& shift)
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
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?
UInt_t fLastDrawLOD ! last LOD for the scene draw
TGLPhysicalShape* fSelectedPhysical ! current selected physical shape
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
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),
fLastDrawLOD(kHigh), fSelectedPhysical(0)
Construct scene object
~TGLScene()
Destroy scene object
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, Int_t style, UInt_t LOD,
Double_t timeout, const TGLClip * clip)
Draw out scene into current GL context, using passed arguments:
'camera' - used for for object culling
'style' - draw style kFill (filled polygons) kOutline (polygons + outlines)
kWireFrame
'LOD' - base scene level of detail (quality), value 0 (low) to 100 (high)
combined with projection size LOD to produce overall draw LOD
for each physical shape
'timeout'- timeout for scene draw (in milliseconds) - if 0.0 unlimited
'clip' - optional clip object - if non-null used to clip away draw shapes
void DrawPass(const TGLCamera & camera, Int_t style, UInt_t LOD,
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'
UInt_t CalcPhysicalLOD(const TGLPhysicalShape & shape, const TGLCamera & camera,
UInt_t sceneLOD) const
Calculate a quality (level of detail) for passed 'shape', suitible for use
under projection defined by 'camera'. Factor in global 'sceneLOD', returning
UInt 0..100
Bool_t Select(const TGLCamera & camera, Int_t style, const TGLClip * clip)
Perform select draw using arguments:
'camera' - used for for object culling
'style' - draw style kFill (filled polygons) kOutline (polygons + outlines)
kWireFrame
'clip' - optional clip object - if non-null used to clip away draw shapes
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 ShiftSelected(const TGLVector3 & shift)
Shift selected physical shape by vector 'shift'
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
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()
Reset internal draw stats
void UpdateDrawStats(const TGLPhysicalShape & shape)
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 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.28 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.