]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/TriangleSet.h
Added method method GenerateZNormalColors() that uses Reve::RGBAPalette to set-up...
[u/mrichter/AliRoot.git] / EVE / Reve / TriangleSet.h
CommitLineData
6196c437 1// $Header$
2
3#ifndef REVE_TriangleSet_H
4#define REVE_TriangleSet_H
5
6#include "RenderElement.h"
7#include <TNamed.h>
8#include <TAttBBox.h>
64dae94d 9#include <TAtt3D.h>
6196c437 10
11#include "ZTrans.h"
12
13class TGeoMatrix;
14
15namespace Reve {
16
17class TriangleSet : public RenderElement,
64dae94d 18 public TNamed,
19 public TAttBBox,
20 public TAtt3D
6196c437 21{
22 friend class TriangleSetEditor;
23 friend class TriangleSetGL;
24
25protected:
26
27 // Vertex data
28 Int_t fNVerts;
29 Float_t* fVerts; //[3*fNVerts]
30
31 // Triangle data
32 Int_t fNTrings;
33 Int_t* fTrings; //[3*fNTrings]
34 Float_t* fTringNorms; //[3*fNTrings]
35 UChar_t* fTringCols; //[3*fNTrings]
36
37 // --------------------------------------------------------------
38
39 Color_t fColor;
40 ZTrans fHMTrans;
41
42public:
43
44 TriangleSet(Int_t nv, Int_t nt, Bool_t norms=false, Bool_t cols=false);
45 ~TriangleSet();
46
47 virtual Bool_t CanEditMainColor() { return kTRUE; }
48
49 Float_t* Vertex(Int_t i) { return &(fVerts[3*i]); }
50 Int_t* Triangle(Int_t i) { return &(fTrings[3*i]); }
51 Float_t* TriangleNormal(Int_t i) { return &(fTringNorms[3*i]); }
52 UChar_t* TriangleColor(Int_t i) { return &(fTringCols[3*i]); }
53
54 void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
55 { Float_t* v = Vertex(i); v[0] = x; v[1] = y; v[2] = z; }
56 void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
57 { Int_t* t = Triangle(i); t[0] = v0; t[1] = v1; t[2] = v2; }
58 void SetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
59 { UChar_t* c = TriangleColor(i); c[0] = r; c[1] = g; c[2] = b; c[3] = a; }
60
61 void GenerateTriangleNormals();
62 void GenerateRandomColors();
64dae94d 63 void GenerateZNormalColors(Float_t fac=20, Int_t min=-20, Int_t max=20,
64 Bool_t interp=kFALSE, Bool_t wrap=kFALSE);
6196c437 65
66 virtual void ComputeBBox();
67 virtual void Paint(Option_t* = "");
68
69 Color_t GetColor() const { return fColor; }
70 void SetColor(Color_t c) { fColor = c; }
71
72 ZTrans& RefHMTrans() { return fHMTrans; }
73 void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); }
74 void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); }
75
76 static TriangleSet* ReadTrivialFile(const char* file);
77
78 ClassDef(TriangleSet, 0)
79}; // endclass TriangleSet
80
81}
82
83#endif