TEveTriangleSet.h

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveTriangleSet.h 33864 2010-06-14 09:47:19Z matevz $
00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, 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_TEveTriangleSet
00013 #define ROOT_TEveTriangleSet
00014 
00015 #include "TEveElement.h"
00016 #include "TNamed.h"
00017 #include "TAttBBox.h"
00018 #include "TAtt3D.h"
00019 
00020 #include "TEveTrans.h"
00021 
00022 class TGeoMatrix;
00023 
00024 class TEveTriangleSet : public TEveElementList,
00025                         public TAtt3D,
00026                         public TAttBBox
00027 {
00028    friend class TEveTriangleSetEditor;
00029    friend class TEveTriangleSetGL;
00030 
00031    TEveTriangleSet(const TEveTriangleSet&);            // Not implemented
00032    TEveTriangleSet& operator=(const TEveTriangleSet&); // Not implemented
00033 
00034 protected:
00035    // Vertex data
00036    Int_t    fNVerts;
00037    Float_t* fVerts;        //[3*fNVerts]
00038 
00039    // Triangle data
00040    Int_t    fNTrings;
00041    Int_t*   fTrings;       //[3*fNTrings]
00042    Float_t* fTringNorms;   //[3*fNTrings]
00043    UChar_t* fTringCols;    //[3*fNTrings]
00044 
00045 public:
00046    TEveTriangleSet(Int_t nv, Int_t nt, Bool_t norms=kFALSE, Bool_t cols=kFALSE);
00047    ~TEveTriangleSet();
00048 
00049    virtual Bool_t CanEditMainTransparency() const { return kTRUE; }
00050 
00051    Int_t GetNVerts()  const { return fNVerts;  }
00052    Int_t GetNTrings() const { return fNTrings; }
00053 
00054    Float_t* Vertex(Int_t i)         { return &(fVerts[3*i]);      }
00055    Int_t*   Triangle(Int_t i)       { return &(fTrings[3*i]);     }
00056    Float_t* TriangleNormal(Int_t i) { return &(fTringNorms[3*i]); }
00057    UChar_t* TriangleColor(Int_t i)  { return &(fTringCols[3*i]);  }
00058 
00059    void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
00060    { Float_t* v = Vertex(i); v[0] = x; v[1] = y; v[2] = z; }
00061    void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
00062    { Int_t* t = Triangle(i); t[0] = v0; t[1] = v1; t[2] = v2; }
00063    void SetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
00064    { UChar_t* c = TriangleColor(i); c[0] = r; c[1] = g; c[2] = b; c[3] = a; }
00065 
00066    void GenerateTriangleNormals();
00067    void GenerateRandomColors();
00068    void GenerateZNormalColors(Float_t fac=20, Int_t min=-20, Int_t max=20,
00069                               Bool_t interp=kFALSE, Bool_t wrap=kFALSE);
00070 
00071    virtual void ComputeBBox();
00072    virtual void Paint(Option_t* option="");
00073 
00074    void SetTransparency(Char_t tr) { SetMainTransparency(tr); } // *MENU*
00075 
00076    static TEveTriangleSet* ReadTrivialFile(const char* file);
00077 
00078    ClassDef(TEveTriangleSet, 0); // Generic mesh or soup of triangles with per-triangle normals and colors.
00079 };
00080 
00081 #endif

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