Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
19class TClass;
20
22{
23private:
25 static TClass* SearchGLRenderer(TClass* cls);
26
27protected:
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
52public:
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
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
float xmin
float ymin
float xmax
float ymax
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
TObject * fExternalObj
first replica
Base-class for direct OpenGL renderers.
Definition TGLObject.h:22
Bool_t fMultiColor
Definition TGLObject.h:28
static TClass * SearchGLRenderer(TClass *cls)
Recursively search cls and its base classes for a GL-renderer class.
TT * DynCast(TObject *obj)
Definition TGLObject.h:45
virtual Bool_t KeepDuringSmartRefresh() const
Definition TGLObject.h:62
TT * SetModelDynCast(TObject *obj)
Definition TGLObject.h:37
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
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
static TMap fgGLClassMap
Definition TGLObject.h:24
virtual void SetBBox()=0
Bool_t SetModelCheckClass(TObject *obj, TClass *cls)
Checks if obj is of proper class and sets the model.
Definition TGLObject.cxx:71
virtual void UpdateBoundingBox()
Update bounding box from external source.
Definition TGLObject.cxx:60
virtual ~TGLObject()
Definition TGLObject.h:54
static TClass * GetGLRenderer(TClass *isa)
Return direct-rendering GL class for class isa.
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)=0
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition TGLRnrCtx.h:41
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition TMap.h:40
Mother of all ROOT objects.
Definition TObject.h:37