Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:58

0001 // @(#)root/gl:$Id$
0002 // Author:  Timur Pocheptsov  03/08/2004
0003 // NOTE: This code moved from obsoleted TGLSceneObject.h / .cxx - see these
0004 // attic files for previous CVS history
0005 
0006 /*************************************************************************
0007  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
0008  * All rights reserved.                                                  *
0009  *                                                                       *
0010  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0011  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0012  *************************************************************************/
0013 
0014 #ifndef ROOT_TGLFaceSet
0015 #define ROOT_TGLFaceSet
0016 
0017 #include "TGLLogicalShape.h"
0018 #include "CsgOps.h"
0019 #include <vector>
0020 
0021 ///////////////////////////////////////////////////////////////////////
0022 class TGLFaceSet : public TGLLogicalShape
0023 {
0024 private:
0025    std::vector<Double_t> fVertices;
0026    std::vector<Double_t> fNormals;
0027    std::vector<Int_t>    fPolyDesc;
0028    UInt_t                fNbPols;
0029 
0030    static Bool_t fgEnforceTriangles;
0031 
0032 public:
0033    TGLFaceSet(const TBuffer3D & buffer);
0034 
0035    void DirectDraw(TGLRnrCtx & rnrCtx) const override;
0036 
0037    void SetFromMesh(const RootCsg::TBaseMesh *m);
0038    void CalculateNormals();
0039    void EnforceTriangles();
0040 
0041    std::vector<Double_t>& GetVertices() { return fVertices; }
0042    std::vector<Double_t>& GetNormals()  { return fNormals;  }
0043    std::vector<Int_t>&    GetPolyDesc() { return fPolyDesc; }
0044    UInt_t                 GetNbPols()   { return fNbPols;   }
0045 
0046    static Bool_t GetEnforceTriangles();
0047    static void   SetEnforceTriangles(Bool_t e);
0048 
0049 private:
0050    void  GLDrawPolys() const;
0051    Int_t CheckPoints(const Int_t *source, Int_t *dest) const;
0052 
0053    static Bool_t Eq(const Double_t *p1, const Double_t *p2);
0054 
0055    ClassDefOverride(TGLFaceSet,0) // a faceset logical shape
0056 };
0057 
0058 #endif