3 #ifndef REVE_TriangleSet_H
4 #define REVE_TriangleSet_H
6 #include "RenderElement.h"
16 class TriangleSet : public RenderElement,
20 friend class TriangleSetEditor;
21 friend class TriangleSetGL;
27 Float_t* fVerts; //[3*fNVerts]
31 Int_t* fTrings; //[3*fNTrings]
32 Float_t* fTringNorms; //[3*fNTrings]
33 UChar_t* fTringCols; //[3*fNTrings]
35 // --------------------------------------------------------------
42 TriangleSet(Int_t nv, Int_t nt, Bool_t norms=false, Bool_t cols=false);
45 virtual Bool_t CanEditMainColor() { return kTRUE; }
47 Float_t* Vertex(Int_t i) { return &(fVerts[3*i]); }
48 Int_t* Triangle(Int_t i) { return &(fTrings[3*i]); }
49 Float_t* TriangleNormal(Int_t i) { return &(fTringNorms[3*i]); }
50 UChar_t* TriangleColor(Int_t i) { return &(fTringCols[3*i]); }
52 void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
53 { Float_t* v = Vertex(i); v[0] = x; v[1] = y; v[2] = z; }
54 void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
55 { Int_t* t = Triangle(i); t[0] = v0; t[1] = v1; t[2] = v2; }
56 void SetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
57 { UChar_t* c = TriangleColor(i); c[0] = r; c[1] = g; c[2] = b; c[3] = a; }
59 void GenerateTriangleNormals();
60 void GenerateRandomColors();
62 virtual void ComputeBBox();
63 virtual void Paint(Option_t* = "");
65 Color_t GetColor() const { return fColor; }
66 void SetColor(Color_t c) { fColor = c; }
68 ZTrans& RefHMTrans() { return fHMTrans; }
69 void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); }
70 void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); }
72 static TriangleSet* ReadTrivialFile(const char* file);
74 ClassDef(TriangleSet, 0)
75 }; // endclass TriangleSet