TGLScenePad.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TGLScenePad.h 36884 2010-11-23 17:52:08Z matevz $
00002 // Author:  Matevz Tadel, Jun 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, 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_TGLScenePad
00013 #define ROOT_TGLScenePad
00014 
00015 #ifndef ROOT_TGLScene
00016 #include "TGLScene.h"
00017 #endif
00018 #ifndef ROOT_TVirtualViewer3D
00019 #include "TVirtualViewer3D.h"
00020 #endif
00021 #ifndef ROOT_CsgOps
00022 #include "CsgOps.h"
00023 #endif
00024 
00025 
00026 class TGLViewer;
00027 class TGLFaceSet;
00028 
00029 
00030 class TGLScenePad : public TVirtualViewer3D,  public TGLScene {
00031 
00032 private:
00033    TGLScenePad(const TGLScenePad&);            // Not implemented
00034    TGLScenePad& operator=(const TGLScenePad&); // Not implemented
00035 
00036 protected:
00037    TVirtualPad*       fPad;
00038 
00039    // For building via VV3D
00040    Bool_t             fInternalPIDs;          //! using internal physical IDs
00041    UInt_t             fNextInternalPID;       //! next internal physical ID (from 1 - 0 reserved)
00042    UInt_t             fLastPID;               //! last physical ID that was processed in AddObject()
00043    Int_t              fAcceptedPhysicals;
00044 
00045    Int_t              ValidateObjectBuffer(const TBuffer3D& buffer, Bool_t includeRaw) const;
00046    TGLLogicalShape*   CreateNewLogical(const TBuffer3D & buffer) const;
00047    TGLPhysicalShape*  CreateNewPhysical(UInt_t physicalID, const TBuffer3D& buffer,
00048                                         const TGLLogicalShape& logical) const;
00049 
00050    // Composite shape specific
00051    typedef std::pair<UInt_t, RootCsg::TBaseMesh*> CSPart_t;
00052    mutable TGLFaceSet     *fComposite; //! Paritally created composite
00053    UInt_t                  fCSLevel;
00054    std::vector<CSPart_t>   fCSTokens;
00055    RootCsg::TBaseMesh*     BuildComposite();
00056 
00057    TGLLogicalShape* AttemptDirectRenderer(TObject* id);
00058 
00059    Bool_t         fSmartRefresh;   //! cache logicals during scene rebuilds
00060 
00061 public:
00062    TGLScenePad(TVirtualPad* pad);
00063    virtual ~TGLScenePad() {}
00064 
00065    TVirtualPad* GetPad() const { return fPad; }
00066    // void SetPad(TVirtualPad* p) { fPad = p; /* also need to drop contents */ }
00067 
00068    // Histo import and Sub-pad traversal
00069    void AddHistoPhysical(TGLLogicalShape* log);
00070    void SubPadPaint(TVirtualPad* pad);
00071 
00072    // PadPaint wrapper for calls from TGLViewer:
00073    virtual void   PadPaintFromViewer(TGLViewer* viewer);
00074 
00075    Bool_t  GetSmartRefresh() const           { return fSmartRefresh; }
00076    void    SetSmartRefresh(Bool_t smart_ref) { fSmartRefresh = smart_ref; }
00077 
00078 
00079    // TVirtualViewer3D interface
00080 
00081    virtual Bool_t CanLoopOnPrimitives() const { return kTRUE; }
00082    virtual void   PadPaint(TVirtualPad* pad);
00083    virtual void   ObjectPaint(TObject* obj, Option_t* opt="");
00084 
00085    // For now handled by viewer
00086    virtual Int_t  DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/) { return 9999; }
00087    virtual void   ExecuteEvent(Int_t /*event*/, Int_t /*px*/, Int_t /*py*/) {}
00088 
00089    virtual Bool_t PreferLocalFrame() const { return kTRUE; }
00090 
00091    virtual void   BeginScene();
00092    virtual Bool_t BuildingScene() const { return CurrentLock() == kModifyLock; }
00093    virtual void   EndScene();
00094 
00095    virtual Int_t  AddObject(const TBuffer3D& buffer, Bool_t* addChildren = 0);
00096    virtual Int_t  AddObject(UInt_t physicalID, const TBuffer3D& buffer, Bool_t* addChildren = 0);
00097    virtual Bool_t OpenComposite(const TBuffer3D& buffer, Bool_t* addChildren = 0);
00098    virtual void   CloseComposite();
00099    virtual void   AddCompositeOp(UInt_t operation);
00100 
00101    ClassDef(TGLScenePad, 0); // GL-scene filled via TPad-TVirtualViewer interface.
00102 };
00103 
00104 #endif

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