TGLObject.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TGLObject.h 36384 2010-10-20 14:26:41Z matevz $
00002 // Author: Matevz Tadel  7/4/2006
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGLObject
00013 #define ROOT_TGLObject
00014 
00015 #include "TGLLogicalShape.h"
00016 #include "TMap.h"
00017 #include <stdexcept>
00018 
00019 class TClass;
00020 
00021 class TGLObject : public TGLLogicalShape
00022 {
00023 private:
00024    static TMap    fgGLClassMap;
00025    static TClass* SearchGLRenderer(TClass* cls);
00026 
00027 protected:
00028    mutable Bool_t fMultiColor; // Are multiple colors used for object rendering.
00029 
00030    Bool_t SetModelCheckClass(TObject* obj, TClass* cls);
00031 
00032    void   SetAxisAlignedBBox(Float_t xmin, Float_t xmax,
00033                              Float_t ymin, Float_t ymax,
00034                              Float_t zmin, Float_t zmax);
00035    void   SetAxisAlignedBBox(const Float_t* p);
00036 
00037    template <class TT> TT* SetModelDynCast(TObject* obj)
00038    {
00039       TT *ret = dynamic_cast<TT*>(obj);
00040       if (!ret) throw std::runtime_error("Object of wrong type passed.");
00041       fExternalObj = obj;
00042       return ret;
00043    }
00044 
00045    template <class TT> TT* DynCast(TObject* obj)
00046    {
00047       TT *ret = dynamic_cast<TT*>(obj);
00048       if (!ret) throw std::runtime_error("Object of wrong type passed.");
00049       return ret;
00050    }
00051 
00052 public:
00053    TGLObject() : TGLLogicalShape(0), fMultiColor(kFALSE) {}
00054    virtual ~TGLObject() {}
00055 
00056    virtual Bool_t ShouldDLCache(const TGLRnrCtx& rnrCtx) const;
00057 
00058    // Kept from TGLLogicalShape
00059    // virtual ELODAxes SupportedLODAxes() const { return kLODAxesNone; }
00060 
00061    // Changed from TGLLogicalShape
00062    virtual Bool_t KeepDuringSmartRefresh() const { return kTRUE; }
00063    virtual void   UpdateBoundingBox();
00064 
00065    // TGLObject virtuals
00066    virtual Bool_t SetModel(TObject* obj, const Option_t* opt=0) = 0;
00067    virtual void   SetBBox() = 0;
00068    // Abstract method from TGLLogicalShape:
00069    // virtual void DirectDraw(TGLRnrCtx & rnrCtx) const = 0;
00070 
00071    // Interface to class .vs. classGL map.
00072    static TClass* GetGLRenderer(TClass* isa);
00073 
00074    ClassDef(TGLObject, 0); // Base-class for direct OpenGL renderers
00075 };
00076 
00077 #endif

Generated on Tue Jul 5 14:16:47 2011 for ROOT_528-00b_version by  doxygen 1.5.1