00001 // @(#)root/gl:$Id: TGLFaceSet.h 37192 2010-12-02 15:54:26Z matevz $ 00002 // Author: Timur Pocheptsov 03/08/2004 00003 // NOTE: This code moved from obsoleted TGLSceneObject.h / .cxx - see these 00004 // attic files for previous CVS history 00005 00006 /************************************************************************* 00007 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. * 00008 * All rights reserved. * 00009 * * 00010 * For the licensing terms see $ROOTSYS/LICENSE. * 00011 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00012 *************************************************************************/ 00013 00014 #ifndef ROOT_TGLFaceSet 00015 #define ROOT_TGLFaceSet 00016 00017 #ifndef ROOT_TGLLogicalShape 00018 #include "TGLLogicalShape.h" 00019 #endif 00020 #ifndef ROOT_CsgOps 00021 #include "CsgOps.h" 00022 #endif 00023 00024 /////////////////////////////////////////////////////////////////////// 00025 class TGLFaceSet : public TGLLogicalShape 00026 { 00027 private: 00028 std::vector<Double_t> fVertices; 00029 std::vector<Double_t> fNormals; 00030 std::vector<Int_t> fPolyDesc; 00031 UInt_t fNbPols; 00032 00033 static Bool_t fgEnforceTriangles; 00034 00035 public: 00036 TGLFaceSet(const TBuffer3D & buffer); 00037 00038 virtual void DirectDraw(TGLRnrCtx & rnrCtx) const; 00039 00040 void SetFromMesh(const RootCsg::TBaseMesh *m); 00041 void CalculateNormals(); 00042 void EnforceTriangles(); 00043 00044 std::vector<Double_t>& GetVertices() { return fVertices; } 00045 std::vector<Double_t>& GetNormals() { return fNormals; } 00046 std::vector<Int_t>& GetPolyDesc() { return fPolyDesc; } 00047 UInt_t GetNbPols() { return fNbPols; } 00048 00049 static Bool_t GetEnforceTriangles(); 00050 static void SetEnforceTriangles(Bool_t e); 00051 00052 private: 00053 void GLDrawPolys() const; 00054 Int_t CheckPoints(const Int_t *source, Int_t *dest) const; 00055 00056 static Bool_t Eq(const Double_t *p1, const Double_t *p2); 00057 00058 ClassDef(TGLFaceSet,0) // a faceset logical shape 00059 }; 00060 00061 #endif