TGLSurfacePainter.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id$
00002 // Author:  Timur Pocheptsov  31/08/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_TGLSurfacePainter
00013 #define ROOT_TGLSurfacePainter
00014 
00015 #include <vector>
00016 #include <list>
00017 
00018 #ifndef ROOT_TGLPlotPainter
00019 #include "TGLPlotPainter.h"
00020 #endif
00021 #ifndef ROOT_TString
00022 #include "TString.h"
00023 #endif
00024 #ifndef ROOT_TGLUtil
00025 #include "TGLUtil.h"
00026 #endif
00027 
00028 class TRandom;
00029 
00030 class TGLSurfacePainter : public TGLPlotPainter {
00031 private:
00032    enum ESurfaceType {
00033       kSurf,
00034       kSurf1,
00035       kSurf2,
00036       kSurf3,
00037       kSurf4,
00038       kSurf5
00039    };
00040 
00041    mutable ESurfaceType fType;
00042 
00043    TGL2DArray<TGLVertex3>                         fMesh;
00044    mutable TGL2DArray<Double_t>                   fTexMap;
00045    TGL2DArray<std::pair<TGLVector3, TGLVector3> > fFaceNormals;
00046    TGL2DArray<TGLVector3>                         fAverageNormals;
00047 
00048    mutable TString                 fObjectInfo;
00049 
00050    struct Projection_t {
00051       UChar_t fRGBA[4];
00052       std::vector<TGLVertex3> fVertices;
00053       void Swap(Projection_t &rhs);
00054    };
00055 
00056    mutable Projection_t            fProj;
00057 
00058    mutable std::list<Projection_t> fXOZProj;
00059    mutable std::list<Projection_t> fYOZProj;
00060    mutable std::list<Projection_t> fXOYProj;
00061 
00062    mutable TGLLevelPalette         fPalette;
00063    mutable std::vector<Double_t>   fColorLevels;
00064    Rgl::Range_t                    fMinMaxVal;
00065 
00066    Bool_t                          fSectionPass;
00067    mutable Bool_t                  fUpdateTexMap;
00068 
00069 public:
00070    TGLSurfacePainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
00071 
00072    //TGLPlotPainter's final-overriders.
00073    char  *GetPlotInfo(Int_t px, Int_t py);
00074    Bool_t InitGeometry();
00075    void   StartPan(Int_t px, Int_t py);
00076    void   Pan(Int_t px, Int_t py);
00077    void   AddOption(const TString &stringOption);
00078    void   ProcessEvent(Int_t event, Int_t px, Int_t py);
00079 
00080 private:
00081    void   InitGL()const;
00082    void   DeInitGL()const;
00083 
00084    void   DrawPlot()const;
00085 
00086    void   SetNormals();
00087    void   SetSurfaceColor()const;
00088 
00089    Bool_t InitGeometryCartesian();
00090    Bool_t InitGeometryPolar();
00091    Bool_t InitGeometryCylindrical();
00092    Bool_t InitGeometrySpherical();
00093 
00094    void   DrawProjections()const;
00095    void   DrawSectionXOZ()const;
00096    void   DrawSectionYOZ()const;
00097    void   DrawSectionXOY()const;
00098 
00099    void   ClampZ(Double_t &zVal)const;
00100 
00101    char  *WindowPointTo3DPoint(Int_t px, Int_t py)const;
00102 
00103    Bool_t PreparePalette()const;
00104    void   GenTexMap()const;
00105    void   DrawContoursProjection()const;
00106 
00107    Bool_t Textured()const;
00108    Bool_t HasSections()const;
00109    Bool_t HasProjections()const;
00110 
00111    void   DrawPalette()const;
00112    void   DrawPaletteAxis()const;
00113 
00114    static TRandom *fgRandom;
00115 
00116    ClassDef(TGLSurfacePainter, 0)//Surface painter.
00117 };
00118 
00119 #endif

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