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 ~TGLObject() override {}
55
56 Bool_t ShouldDLCache(const TGLRnrCtx& rnrCtx) const override;
57
58 // Kept from TGLLogicalShape
59 // virtual ELODAxes SupportedLODAxes() const { return kLODAxesNone; }
60
61 // Changed from TGLLogicalShape
62 Bool_t KeepDuringSmartRefresh() const override { return kTRUE; }
63 void UpdateBoundingBox() override;
64
65 // TGLObject virtuals
66 virtual Bool_t SetModel(TObject* obj, const Option_t *opt = nullptr) = 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 ClassDefOverride(TGLObject, 0); // Base-class for direct OpenGL renderers
75};
76
77#endif
bool Bool_t
Definition RtypesCore.h:63
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
winID h TVirtualViewer3D TVirtualGLPainter p
float xmin
float ymin
float xmax
float ymax
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
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
TT * SetModelDynCast(TObject *obj)
Definition TGLObject.h:37
void UpdateBoundingBox() override
Update bounding box from external source.
Definition TGLObject.cxx:60
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_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const override
Decide if display-list should be used for this pass rendering, as determined by rnrCtx.
Definition TGLObject.cxx:41
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 Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr)=0
static TClass * GetGLRenderer(TClass *isa)
Return direct-rendering GL class for class isa.
~TGLObject() override
Definition TGLObject.h:54
Bool_t KeepDuringSmartRefresh() const override
Definition TGLObject.h:62
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:41