Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGLScenePad.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gl:$Id$
0002 // Author:  Matevz Tadel, Jun 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGLScenePad
0013 #define ROOT_TGLScenePad
0014 
0015 #include "TGLScene.h"
0016 #include "TVirtualViewer3D.h"
0017 #include "CsgOps.h"
0018 #include <vector>
0019 #include <utility>
0020 
0021 class TGLViewer;
0022 class TGLFaceSet;
0023 class TList;
0024 
0025 
0026 class TGLScenePad : public TVirtualViewer3D,  public TGLScene {
0027 
0028 private:
0029    TGLScenePad(const TGLScenePad&) = delete;
0030    TGLScenePad& operator=(const TGLScenePad&) = delete;
0031 
0032 protected:
0033    TVirtualPad*       fPad;
0034 
0035    // For building via VV3D
0036    Bool_t             fInternalPIDs;          //! using internal physical IDs
0037    UInt_t             fNextInternalPID;       //! next internal physical ID (from 1 - 0 reserved)
0038    UInt_t             fLastPID;               //! last physical ID that was processed in AddObject()
0039    Int_t              fAcceptedPhysicals;
0040 
0041    Int_t              ValidateObjectBuffer(const TBuffer3D& buffer, Bool_t includeRaw) const;
0042    TGLLogicalShape*   CreateNewLogical(const TBuffer3D & buffer) const;
0043    TGLPhysicalShape*  CreateNewPhysical(UInt_t physicalID, const TBuffer3D& buffer,
0044                                         const TGLLogicalShape& logical) const;
0045 
0046    void               ComposePolymarker(const TList *padPrimitives);
0047    // Composite shape specific
0048    typedef std::pair<UInt_t, RootCsg::TBaseMesh*> CSPart_t;
0049    mutable TGLFaceSet     *fComposite; //! Paritally created composite
0050    UInt_t                  fCSLevel;
0051    std::vector<CSPart_t>   fCSTokens;
0052    RootCsg::TBaseMesh*     BuildComposite();
0053 
0054    TGLLogicalShape* AttemptDirectRenderer(TObject* id);
0055 
0056    Bool_t         fSmartRefresh;   //! cache logicals during scene rebuilds
0057 
0058 public:
0059    TGLScenePad(TVirtualPad* pad);
0060    ~TGLScenePad() override {}
0061 
0062    TVirtualPad* GetPad() const { return fPad; }
0063    void SetPad(TVirtualPad* p) { fPad = p; }
0064 
0065    // Histo import and Sub-pad traversal
0066    void AddHistoPhysical(TGLLogicalShape* log, const Float_t *histColor = nullptr);
0067    void SubPadPaint(TVirtualPad* pad);
0068 
0069    // PadPaint wrapper for calls from TGLViewer:
0070    virtual void   PadPaintFromViewer(TGLViewer* viewer);
0071 
0072    Bool_t  GetSmartRefresh() const           { return fSmartRefresh; }
0073    void    SetSmartRefresh(Bool_t smart_ref) { fSmartRefresh = smart_ref; }
0074 
0075 
0076    // TVirtualViewer3D interface
0077 
0078    Bool_t CanLoopOnPrimitives() const override { return kTRUE; }
0079    void   PadPaint(TVirtualPad* pad) override;
0080    void   ObjectPaint(TObject* obj, Option_t* opt="") override;
0081 
0082    // For now handled by viewer
0083    Int_t  DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/) override { return 9999; }
0084    void   ExecuteEvent(Int_t /*event*/, Int_t /*px*/, Int_t /*py*/) override {}
0085 
0086    Bool_t PreferLocalFrame() const override { return kTRUE; }
0087 
0088    void   BeginScene() override;
0089    Bool_t BuildingScene() const override { return CurrentLock() == kModifyLock; }
0090    void   EndScene() override;
0091 
0092    Int_t  AddObject(const TBuffer3D& buffer, Bool_t* addChildren = nullptr) override;
0093    Int_t  AddObject(UInt_t physicalID, const TBuffer3D& buffer, Bool_t* addChildren = nullptr) override;
0094    Bool_t OpenComposite(const TBuffer3D& buffer, Bool_t* addChildren = nullptr) override;
0095    void   CloseComposite() override;
0096    void   AddCompositeOp(UInt_t operation) override;
0097 
0098    ClassDefOverride(TGLScenePad, 0); // GL-scene filled via TPad-TVirtualViewer interface.
0099 };
0100 
0101 #endif