Logo ROOT   6.10/09
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:
53  TGLObject() : TGLLogicalShape(0), fMultiColor(kFALSE) {}
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
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:40
float xmin
Definition: THbookFile.cxx:93
float Float_t
Definition: RtypesCore.h:53
virtual void UpdateBoundingBox()
Update bounding box from external source.
Definition: TGLObject.cxx:60
const char Option_t
Definition: RtypesCore.h:62
float ymin
Definition: THbookFile.cxx:93
static TMap fgGLClassMap
Definition: TGLObject.h:24
TGLObject()
Definition: TGLObject.h:53
virtual ~TGLObject()
Definition: TGLObject.h:54
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
bool Bool_t
Definition: RtypesCore.h:59
TT * DynCast(TObject *obj)
Definition: TGLObject.h:45
#define ClassDef(name, id)
Definition: Rtypes.h:297
virtual Bool_t KeepDuringSmartRefresh() const
Definition: TGLObject.h:62
Base-class for direct OpenGL renderers.
Definition: TGLObject.h:21
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)=0
TObject * fExternalObj
first replica
Bool_t SetModelCheckClass(TObject *obj, TClass *cls)
Checks if obj is of proper class and sets the model.
Definition: TGLObject.cxx:71
float ymax
Definition: THbookFile.cxx:93
TT * SetModelDynCast(TObject *obj)
Definition: TGLObject.h:37
static TClass * GetGLRenderer(TClass *isa)
Return direct-rendering GL class for class isa.
Definition: TGLObject.cxx:135
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
float xmax
Definition: THbookFile.cxx:93
Abstract logical shape - a GL &#39;drawable&#39; - base for all shapes - faceset sphere etc.
const Bool_t kFALSE
Definition: RtypesCore.h:92
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
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
Bool_t fMultiColor
Definition: TGLObject.h:28
static TClass * SearchGLRenderer(TClass *cls)
Recursively search cls and its base classes for a GL-renderer class.
Definition: TGLObject.cxx:108
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void SetBBox()=0
const Bool_t kTRUE
Definition: RtypesCore.h:91