]>
Commit | Line | Data |
---|---|---|
1383fb4a | 1 | // $Header$ |
2 | ||
3 | #include "StraightLineSet.h" | |
4 | ||
5 | #include <TBuffer3D.h> | |
6 | #include <TBuffer3DTypes.h> | |
7 | #include <TVirtualPad.h> | |
8 | #include <TVirtualViewer3D.h> | |
9 | ||
10 | #include <TRandom.h> | |
11 | ||
12 | using namespace Reve; | |
13 | ||
14 | //______________________________________________________________________ | |
15 | // StraightLineSet | |
16 | // | |
17 | ||
18 | ClassImp(StraightLineSet) | |
19 | ||
20 | StraightLineSet::StraightLineSet(const Text_t* n, const Text_t* t): | |
21 | RenderElement(fColor), | |
22 | TNamed(n, t), | |
23 | fLinePlex(sizeof(Line), 4), | |
24 | fMarkerPlex(sizeof(Marker), 8), | |
25 | fRnrMarkers(kTRUE), | |
26 | fRnrLines(kTRUE) | |
27 | { | |
28 | fColor = 4; | |
29 | fMarkerColor = 2; | |
30 | fMarkerStyle = 20; | |
31 | } | |
32 | ||
33 | /**************************************************************************/ | |
34 | ||
35 | void StraightLineSet::AddLine(Float_t x1, Float_t y1, Float_t z1, | |
1a19ee66 | 36 | Float_t x2, Float_t y2, Float_t z2) |
1383fb4a | 37 | { |
38 | fLastLine = new (fLinePlex.NewAtom()) Line(x1, y1, z1, x2, y2, z2); | |
39 | } | |
40 | ||
41 | /**************************************************************************/ | |
42 | ||
43 | void StraightLineSet::AddMarker(Int_t line, Float_t pos) | |
44 | { | |
45 | /*Marker* marker = */new (fMarkerPlex.NewAtom()) Marker(line, pos); | |
46 | } | |
47 | ||
48 | /**************************************************************************/ | |
49 | ||
50 | void StraightLineSet::ComputeBBox() | |
51 | { | |
52 | static const Exc_t eH("StraightLineSet::ComputeBBox "); | |
53 | if(fLinePlex.Size() == 0) { | |
54 | BBoxZero(); | |
55 | return; | |
56 | } | |
57 | ||
58 | BBoxInit(); | |
59 | ||
60 | VoidCPlex::iterator li(fLinePlex); | |
61 | while (li.next()) { | |
62 | BBoxCheckPoint(((Line*)li())->fV1); | |
63 | BBoxCheckPoint(((Line*)li())->fV2); | |
64 | } | |
65 | } | |
66 | ||
67 | /**************************************************************************/ | |
68 | ||
69 | void StraightLineSet::Paint(Option_t* /*option*/) | |
70 | { | |
71 | static const Exc_t eH("StraightLineSet::Paint "); | |
72 | ||
73 | TBuffer3D buff(TBuffer3DTypes::kGeneric); | |
74 | ||
75 | // Section kCore | |
76 | buff.fID = this; | |
77 | buff.fColor = fColor; | |
78 | buff.fTransparency = 0; | |
79 | buff.fLocalFrame = kFALSE; | |
80 | buff.SetSectionsValid(TBuffer3D::kCore); | |
81 | ||
82 | Int_t reqSections = gPad->GetViewer3D()->AddObject(buff); | |
83 | if (reqSections != TBuffer3D::kNone) | |
84 | Error(eH, "only direct GL rendering supported."); | |
85 | } |