Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLFaceSet.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 03/08/2004
3 // NOTE: This code moved from obsoleted TGLSceneObject.h / .cxx - see these
4 // attic files for previous CVS history
5 
6 /*************************************************************************
7  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
8  * All rights reserved. *
9  * *
10  * For the licensing terms see $ROOTSYS/LICENSE. *
11  * For the list of contributors see $ROOTSYS/README/CREDITS. *
12  *************************************************************************/
13 
14 #ifndef ROOT_TGLFaceSet
15 #define ROOT_TGLFaceSet
16 
17 #include "TGLLogicalShape.h"
18 #include "CsgOps.h"
19 
20 ///////////////////////////////////////////////////////////////////////
21 class TGLFaceSet : public TGLLogicalShape
22 {
23 private:
24  std::vector<Double_t> fVertices;
25  std::vector<Double_t> fNormals;
26  std::vector<Int_t> fPolyDesc;
27  UInt_t fNbPols;
28 
29  static Bool_t fgEnforceTriangles;
30 
31 public:
32  TGLFaceSet(const TBuffer3D & buffer);
33 
34  virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
35 
36  void SetFromMesh(const RootCsg::TBaseMesh *m);
37  void CalculateNormals();
38  void EnforceTriangles();
39 
40  std::vector<Double_t>& GetVertices() { return fVertices; }
41  std::vector<Double_t>& GetNormals() { return fNormals; }
42  std::vector<Int_t>& GetPolyDesc() { return fPolyDesc; }
43  UInt_t GetNbPols() { return fNbPols; }
44 
45  static Bool_t GetEnforceTriangles();
46  static void SetEnforceTriangles(Bool_t e);
47 
48 private:
49  void GLDrawPolys() const;
50  Int_t CheckPoints(const Int_t *source, Int_t *dest) const;
51 
52  static Bool_t Eq(const Double_t *p1, const Double_t *p2);
53 
54  ClassDef(TGLFaceSet,0) // a faceset logical shape
55 };
56 
57 #endif