Logo ROOT  
Reference Guide
TGLObject.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel 7/4/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGLObject
13 #define ROOT_TGLObject
14 
15 #include "TGLLogicalShape.h"
16 #include "TMap.h"
17 #include <stdexcept>
18 
19 class TClass;
20 
21 class TGLObject : public TGLLogicalShape
22 {
23 private:
25  static TClass* SearchGLRenderer(TClass* cls);
26 
27 protected:
28  mutable Bool_t fMultiColor; // Are multiple colors used for object rendering.
29 
31 
34  Float_t zmin, Float_t zmax);
35  void SetAxisAlignedBBox(const Float_t* p);
36 
37  template <class TT> TT* SetModelDynCast(TObject* obj)
38  {
39  TT *ret = dynamic_cast<TT*>(obj);
40  if (!ret) throw std::runtime_error("Object of wrong type passed.");
41  fExternalObj = obj;
42  return ret;
43  }
44 
45  template <class TT> TT* DynCast(TObject* obj)
46  {
47  TT *ret = dynamic_cast<TT*>(obj);
48  if (!ret) throw std::runtime_error("Object of wrong type passed.");
49  return ret;
50  }
51 
52 public:
54  virtual ~TGLObject() {}
55 
56  virtual Bool_t ShouldDLCache(const TGLRnrCtx& rnrCtx) const;
57 
58  // Kept from TGLLogicalShape
59  // virtual ELODAxes SupportedLODAxes() const { return kLODAxesNone; }
60 
61  // Changed from TGLLogicalShape
62  virtual Bool_t KeepDuringSmartRefresh() const { return kTRUE; }
63  virtual void UpdateBoundingBox();
64 
65  // TGLObject virtuals
66  virtual Bool_t SetModel(TObject* obj, const Option_t* opt=0) = 0;
67  virtual void SetBBox() = 0;
68  // Abstract method from TGLLogicalShape:
69  // virtual void DirectDraw(TGLRnrCtx & rnrCtx) const = 0;
70 
71  // Interface to class .vs. classGL map.
72  static TClass* GetGLRenderer(TClass* isa);
73 
74  ClassDef(TGLObject, 0); // Base-class for direct OpenGL renderers
75 };
76 
77 #endif
TGLObject::~TGLObject
virtual ~TGLObject()
Definition: TGLObject.h:54
TGLObject::SetModelDynCast
TT * SetModelDynCast(TObject *obj)
Definition: TGLObject.h:37
ymax
float ymax
Definition: THbookFile.cxx:95
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TGLObject::TGLObject
TGLObject()
Definition: TGLObject.h:53
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGLObject::SetModelCheckClass
Bool_t SetModelCheckClass(TObject *obj, TClass *cls)
Checks if obj is of proper class and sets the model.
Definition: TGLObject.cxx:71
TGLObject::SetModel
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)=0
TGLObject::ShouldDLCache
virtual Bool_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const
Decide if display-list should be used for this pass rendering, as determined by rnrCtx.
Definition: TGLObject.cxx:41
xmax
float xmax
Definition: THbookFile.cxx:95
TGLObject::UpdateBoundingBox
virtual void UpdateBoundingBox()
Update bounding box from external source.
Definition: TGLObject.cxx:60
TGLLogicalShape::fExternalObj
TObject * fExternalObj
first replica
Definition: TGLLogicalShape.h:49
Float_t
float Float_t
Definition: RtypesCore.h:57
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
bool
TGLObject::DynCast
TT * DynCast(TObject *obj)
Definition: TGLObject.h:45
TGLObject
Base-class for direct OpenGL renderers.
Definition: TGLObject.h:22
TGLObject::fgGLClassMap
static TMap fgGLClassMap
Definition: TGLObject.h:24
xmin
float xmin
Definition: THbookFile.cxx:95
TGLObject::SearchGLRenderer
static TClass * SearchGLRenderer(TClass *cls)
Recursively search cls and its base classes for a GL-renderer class.
Definition: TGLObject.cxx:108
TGLObject::SetBBox
virtual void SetBBox()=0
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TGLObject::GetGLRenderer
static TClass * GetGLRenderer(TClass *isa)
Return direct-rendering GL class for class isa.
Definition: TGLObject.cxx:135
ymin
float ymin
Definition: THbookFile.cxx:95
TGLObject::SetAxisAlignedBBox
void SetAxisAlignedBBox(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax)
Set axis-aligned bounding-box.
Definition: TGLObject.cxx:86
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TGLLogicalShape.h
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TGLObject::KeepDuringSmartRefresh
virtual Bool_t KeepDuringSmartRefresh() const
Definition: TGLObject.h:62
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TMap.h
TGLLogicalShape
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
Definition: TGLLogicalShape.h:30
TGLObject::fMultiColor
Bool_t fMultiColor
Definition: TGLObject.h:28
TGLRnrCtx
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:41
TMap
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40