00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TH3GL.h"
00013 #include "TH3.h"
00014 #include "TVirtualPad.h"
00015 #include "TAxis.h"
00016 #include "TMath.h"
00017
00018 #include "TGLSurfacePainter.h"
00019 #include "TGLHistPainter.h"
00020 #include "TGLLegoPainter.h"
00021 #include "TGLBoxPainter.h"
00022 #include "TGLTF3Painter.h"
00023 #include "TGLAxisPainter.h"
00024 #include "TGLCamera.h"
00025
00026 #include "TGLRnrCtx.h"
00027 #include "TGLIncludes.h"
00028
00029
00030
00031
00032
00033 ClassImp(TH3GL);
00034
00035
00036 TH3GL::TH3GL() :
00037 TGLPlot3D(), fM(0)
00038 {
00039
00040 }
00041
00042
00043 TH3GL::~TH3GL()
00044 {
00045
00046 }
00047
00048
00049
00050
00051 Bool_t TH3GL::SetModel(TObject* obj, const Option_t* opt)
00052 {
00053
00054
00055 TString option(opt);
00056 option.ToLower();
00057
00058 fM = SetModelDynCast<TH3>(obj);
00059
00060 if (option.Index("iso") != kNPOS)
00061 SetPainter( new TGLIsoPainter(fM, 0, &fCoord) );
00062 else if (option.Index("box") != kNPOS)
00063 SetPainter( new TGLBoxPainter(fM, 0, &fCoord) );
00064 else {
00065 Warning("SetModel", "Option '%s' not supported, assuming 'box'.", option.Data());
00066 SetPainter( new TGLBoxPainter(fM, 0, &fCoord) );
00067 }
00068
00069 fPlotPainter->AddOption(option);
00070 fPlotPainter->InitGeometry();
00071
00072 return kTRUE;
00073 }
00074
00075
00076 void TH3GL::SetBBox()
00077 {
00078
00079
00080 fBoundingBox.Set(fPlotPainter->RefBackBox().Get3DBox());
00081 }
00082
00083
00084
00085
00086 void TH3GL::DirectDraw(TGLRnrCtx & rnrCtx) const
00087 {
00088
00089
00090 fPlotPainter->RefBackBox().FindFrontPoint();
00091
00092 glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT);
00093
00094 glEnable(GL_NORMALIZE);
00095 glDisable(GL_COLOR_MATERIAL);
00096
00097 fPlotPainter->InitGL();
00098 fPlotPainter->DrawPlot();
00099
00100 glDisable(GL_CULL_FACE);
00101 glPopAttrib();
00102
00103
00104 TGLAxisPainterBox axe_painter;
00105 axe_painter.SetUseAxisColors(kFALSE);
00106 axe_painter.SetFontMode(TGLFont::kPixmap);
00107 axe_painter.PlotStandard(rnrCtx, fM, fBoundingBox);
00108 }