]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/BoxSetGL.cxx
Remove Pos calib classes
[u/mrichter/AliRoot.git] / EVE / Reve / BoxSetGL.cxx
CommitLineData
915dabe1 1// $Header$
2
3#include "BoxSetGL.h"
4#include <Reve/BoxSet.h>
5
6#include <TGLDrawFlags.h>
7#ifdef WIN32
8#include "Windows4root.h"
9#endif
10#include <GL/gl.h>
11#include <GL/glu.h>
12
13using namespace Reve;
14
15//______________________________________________________________________
16// BoxSetGL
17//
18
2aef44c1 19ClassImp(BoxSetGL)
915dabe1 20
21BoxSetGL::BoxSetGL()
22{
23 // fCached = false; // Disable display list.
24}
25
26BoxSetGL::~BoxSetGL()
27{}
28
29/**************************************************************************/
30
31Bool_t BoxSetGL::SetModel(TObject* obj)
32{
606c4ed7 33#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
915dabe1 34 return set_model(obj, "Reve::BoxSet");
606c4ed7 35#else
36 return SetModelCheckClass(obj, "Reve::BoxSet");
37#endif
915dabe1 38}
39
40void BoxSetGL::SetBBox()
41{
606c4ed7 42#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
915dabe1 43 set_axis_aligned_bbox(((BoxSet*)fExternalObj)->AssertBBox());
606c4ed7 44#else
45 SetAxisAlignedBBox(((BoxSet*)fExternalObj)->AssertBBox());
46#endif
915dabe1 47}
48
49/**************************************************************************/
50
51void BoxSetGL::DirectDraw(const TGLDrawFlags& /*flags*/) const
52{
53 BoxSet& mB = * (BoxSet*) fExternalObj;
54 // printf("BoxSetGL::DirectDraw N boxes %d\n", mB.fBoxes.size());
55
56 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
57 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
58 glEnable(GL_COLOR_MATERIAL);
59 glDisable(GL_CULL_FACE);
60
61 Float_t c[4]; glGetFloatv(GL_CURRENT_COLOR, c);
62
63 glBegin(GL_QUADS);
64 for(std::vector<Box>::iterator q=mB.fBoxes.begin(); q!=mB.fBoxes.end(); ++q) {
65 UChar_t* c = (UChar_t*) &q->color;
66 glColor3ub(c[0], c[1], c[2]);
67
68 // bottom: 3210
69 glNormal3f(0, 0, -1);
70 glVertex3fv(q->vertices + 9); glVertex3fv(q->vertices + 6);
71 glVertex3fv(q->vertices + 3); glVertex3fv(q->vertices);
72 // top: 4567
73 glNormal3f(0, 0, 1);
74 glVertex3fv(q->vertices + 12); glVertex3fv(q->vertices + 15);
75 glVertex3fv(q->vertices + 18); glVertex3fv(q->vertices + 21);
76 // front: 0154
77 glNormal3f(0, -1, 0);
78 glVertex3fv(q->vertices); glVertex3fv(q->vertices + 3);
79 glVertex3fv(q->vertices + 15); glVertex3fv(q->vertices + 12);
80 // back: 7623
81 glNormal3f(0, 1, 0);
82 glVertex3fv(q->vertices + 21); glVertex3fv(q->vertices + 18);
83 glVertex3fv(q->vertices + 6); glVertex3fv(q->vertices + 9);
84 // left: 4730
85 glNormal3f(-1, 0, 0);
86 glVertex3fv(q->vertices + 12); glVertex3fv(q->vertices + 21);
87 glVertex3fv(q->vertices + 9); glVertex3fv(q->vertices);
88 // right: 5126
89 glNormal3f(1, 0, 0);
90 glVertex3fv(q->vertices + 15); glVertex3fv(q->vertices + 3);
91 glVertex3fv(q->vertices + 6); glVertex3fv(q->vertices + 18);
92 }
93 glEnd();
94
95 glPopAttrib();
96}