TPointSet3DGL.cxx

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TPointSet3DGL.cxx 33864 2010-06-14 09:47:19Z 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 #ifdef WIN32
00013 #include "Windows4root.h"
00014 #endif
00015 
00016 #include "TPointSet3DGL.h"
00017 #include "TPointSet3D.h"
00018 
00019 #include <TGLRnrCtx.h>
00020 #include <TGLSelectRecord.h>
00021 #include <TGLIncludes.h>
00022 
00023 //______________________________________________________________________
00024 //
00025 // Direct OpenGL renderer for TPointSet3D.
00026 
00027 ClassImp(TPointSet3DGL);
00028 
00029 //______________________________________________________________________________
00030 Bool_t TPointSet3DGL::SetModel(TObject* obj, const Option_t*)
00031 {
00032    // Set model.
00033 
00034    return SetModelCheckClass(obj, TPointSet3D::Class());
00035 }
00036 
00037 //______________________________________________________________________________
00038 void TPointSet3DGL::SetBBox()
00039 {
00040    // Set bounding-box.
00041 
00042    SetAxisAlignedBBox(((TPointSet3D*)fExternalObj)->AssertBBox());
00043 }
00044 
00045 //______________________________________________________________________________
00046 Bool_t TPointSet3DGL::ShouldDLCache(const TGLRnrCtx& rnrCtx) const
00047 {
00048    // Override from TGLLogicalShape.
00049    // To account for large point-sizes we modify the projection matrix
00050    // during selection and thus we need a direct draw.
00051 
00052    if (rnrCtx.Selection())
00053       return kFALSE;
00054    return TGLObject::ShouldDLCache(rnrCtx);
00055 }
00056 
00057 //______________________________________________________________________________
00058 void TPointSet3DGL::Draw(TGLRnrCtx& rnrCtx) const
00059 {
00060    // Draw function for TPointSet3D. Skips line-pass of outline mode.
00061 
00062    if (rnrCtx.IsDrawPassOutlineLine())
00063       return;
00064 
00065    TGLObject::Draw(rnrCtx);
00066 }
00067 
00068 //______________________________________________________________________________
00069 void TPointSet3DGL::DirectDraw(TGLRnrCtx& rnrCtx) const
00070 {
00071    // Direct GL rendering for TPointSet3D.
00072 
00073    //printf("TPointSet3DGL::DirectDraw Style %d, LOD %d\n", rnrCtx.Style(), rnrCtx.LOD());
00074    //printf("  sel=%d, secsel=%d\n", rnrCtx.Selection(), rnrCtx.SecSelection());
00075 
00076    TPointSet3D& q = * (TPointSet3D*) fExternalObj;
00077 
00078    TGLUtil::LockColor(); // Keep color from TGLPhysicalShape.
00079    TGLUtil::RenderPolyMarkers(q, 0, q.GetP(), q.Size(),
00080                               rnrCtx.GetPickRadius(),
00081                               rnrCtx.Selection(),
00082                               rnrCtx.SecSelection());
00083    TGLUtil::UnlockColor();
00084 }
00085 
00086 //______________________________________________________________________________
00087 void TPointSet3DGL::ProcessSelection(TGLRnrCtx& /*rnrCtx*/, TGLSelectRecord& rec)
00088 {
00089    // Processes secondary selection from TGLViewer.
00090    // Calls TPointSet3D::PointSelected(Int_t) with index of selected
00091    // point as an argument.
00092 
00093    if (rec.GetN() < 2) return;
00094    TPointSet3D& q = * (TPointSet3D*) fExternalObj;
00095    q.PointSelected(rec.GetItem(1));
00096 }

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