3 #ifndef REVE_TriangleSet_H
4 #define REVE_TriangleSet_H
6 #include "RenderElement.h"
17 class TriangleSet : public RenderElement,
22 friend class TriangleSetEditor;
23 friend class TriangleSetGL;
25 TriangleSet(const TriangleSet&); // Not implemented
26 TriangleSet& operator=(const TriangleSet&); // Not implemented
32 Float_t* fVerts; //[3*fNVerts]
36 Int_t* fTrings; //[3*fNTrings]
37 Float_t* fTringNorms; //[3*fNTrings]
38 UChar_t* fTringCols; //[3*fNTrings]
40 // --------------------------------------------------------------
48 TriangleSet(Int_t nv, Int_t nt, Bool_t norms=false, Bool_t cols=false);
51 virtual Bool_t CanEditMainColor() { return kTRUE; }
53 Float_t* Vertex(Int_t i) { return &(fVerts[3*i]); }
54 Int_t* Triangle(Int_t i) { return &(fTrings[3*i]); }
55 Float_t* TriangleNormal(Int_t i) { return &(fTringNorms[3*i]); }
56 UChar_t* TriangleColor(Int_t i) { return &(fTringCols[3*i]); }
58 // void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
59 // { Float_t* v = Vertex(i); v[0] = x; v[1] = y; v[2] = z; }
60 void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
61 { fVerts[i] = x; fVerts[i+1] = y; fVerts[i+2] = z; }
62 // void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
63 // { Int_t* t = Triangle(i); t[0] = v0; t[1] = v1; t[2] = v2; }
64 void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
65 { fTrings[i] = v0; fTrings[i+1] = v1; fTrings[i+2] = v2; }
66 void SetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
67 { UChar_t* c = TriangleColor(i); c[0] = r; c[1] = g; c[2] = b; c[3] = a; }
69 void GenerateTriangleNormals();
70 void GenerateRandomColors();
71 void GenerateZNormalColors(Float_t fac=20, Int_t min=-20, Int_t max=20,
72 Bool_t interp=kFALSE, Bool_t wrap=kFALSE);
74 virtual void ComputeBBox();
75 virtual void Paint(Option_t* = "");
77 Color_t GetColor() const { return fColor; }
78 void SetColor(Color_t c) { fColor = c; }
80 UShort_t GetTransparency() const { return fTransp; }
81 void SetTransparency(UShort_t tr) { fTransp = tr; } // *MENU*
83 ZTrans& RefHMTrans() { return fHMTrans; }
84 void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); }
85 void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); }
87 static TriangleSet* ReadTrivialFile(const char* file);
89 ClassDef(TriangleSet, 0)
90 }; // endclass TriangleSet