Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // @(#)root/eve:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, 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_TEveTriangleSet
0013 #define ROOT_TEveTriangleSet
0014 
0015 #include "TEveElement.h"
0016 #include "TAttBBox.h"
0017 #include "TAtt3D.h"
0018 
0019 #include "TEveTrans.h"
0020 
0021 class TGeoMatrix;
0022 
0023 class TEveTriangleSet : public TEveElementList,
0024                         public TAtt3D,
0025                         public TAttBBox
0026 {
0027    friend class TEveTriangleSetEditor;
0028    friend class TEveTriangleSetGL;
0029 
0030    TEveTriangleSet(const TEveTriangleSet&);            // Not implemented
0031    TEveTriangleSet& operator=(const TEveTriangleSet&); // Not implemented
0032 
0033 protected:
0034    // Vertex data
0035    Int_t    fNVerts;
0036    Float_t* fVerts;        //[3*fNVerts]
0037 
0038    // Triangle data
0039    Int_t    fNTrings;
0040    Int_t*   fTrings;       //[3*fNTrings]
0041    Float_t* fTringNorms;   //[3*fNTrings]
0042    UChar_t* fTringCols;    //[3*fNTrings]
0043 
0044 public:
0045    TEveTriangleSet(Int_t nv, Int_t nt, Bool_t norms=kFALSE, Bool_t cols=kFALSE);
0046    ~TEveTriangleSet() override;
0047 
0048    Bool_t CanEditMainTransparency() const override { return kTRUE; }
0049 
0050    Int_t GetNVerts()  const { return fNVerts;  }
0051    Int_t GetNTrings() const { return fNTrings; }
0052 
0053    Float_t* Vertex(Int_t i)         { return &(fVerts[3*i]);      }
0054    Int_t*   Triangle(Int_t i)       { return &(fTrings[3*i]);     }
0055    Float_t* TriangleNormal(Int_t i) { return &(fTringNorms[3*i]); }
0056    UChar_t* TriangleColor(Int_t i)  { return &(fTringCols[3*i]);  }
0057 
0058    void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
0059    { Float_t* v = Vertex(i); v[0] = x; v[1] = y; v[2] = z; }
0060    void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
0061    { Int_t* t = Triangle(i); t[0] = v0; t[1] = v1; t[2] = v2; }
0062    void SetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
0063    { UChar_t* c = TriangleColor(i); c[0] = r; c[1] = g; c[2] = b; c[3] = a; }
0064 
0065    void GenerateTriangleNormals();
0066    void GenerateRandomColors();
0067    void GenerateZNormalColors(Float_t fac=20, Int_t min=-20, Int_t max=20,
0068                               Bool_t interp=kFALSE, Bool_t wrap=kFALSE);
0069 
0070    void ComputeBBox() override;
0071    void Paint(Option_t* option="") override;
0072 
0073    void SetTransparency(Char_t tr) { SetMainTransparency(tr); } // *MENU*
0074 
0075    static TEveTriangleSet* ReadTrivialFile(const char* file);
0076 
0077    ClassDefOverride(TEveTriangleSet, 0); // Generic mesh or soup of triangles with per-triangle normals and colors.
0078 };
0079 
0080 #endif