15#include "TGLIncludes.h"
59 p[0][0] = 0; p[0][1] = dy; p[0][2] = 0;
60 p[1][0] = dx; p[1][1] = dy; p[1][2] = 0;
61 p[2][0] = dx; p[2][1] = 0; p[2][2] = 0;
62 p[3][0] = 0; p[3][1] = 0; p[3][2] = 0;
64 p[4][0] = 0; p[4][1] = dy; p[4][2] = dz;
65 p[5][0] = dx; p[5][1] = dy; p[5][2] = dz;
66 p[6][0] = dx; p[6][1] = 0; p[6][2] = dz;
67 p[7][0] = 0; p[7][1] = 0; p[7][2] = dz;
78 glVertex3fv(p[0]); glVertex3fv(p[1]);
79 glVertex3fv(p[2]); glVertex3fv(p[3]);
82 glVertex3fv(p[7]); glVertex3fv(p[6]);
83 glVertex3fv(p[5]); glVertex3fv(p[4]);
86 glVertex3fv(p[0]); glVertex3fv(p[4]);
87 glVertex3fv(p[5]); glVertex3fv(p[1]);
90 glVertex3fv(p[3]); glVertex3fv(p[2]);
91 glVertex3fv(p[6]); glVertex3fv(p[7]);
94 glVertex3fv(p[0]); glVertex3fv(p[3]);
95 glVertex3fv(p[7]); glVertex3fv(p[4]);
98 glVertex3fv(p[1]); glVertex3fv(p[5]);
99 glVertex3fv(p[6]); glVertex3fv(p[2]);
111 Float_t d = sqrtf(o[0]*o[0] + o[1]*o[1] + o[2]*o[2]);
127 subtract_and_normalize(p[1], p[0],
e[0]);
128 subtract_and_normalize(p[3], p[0],
e[1]);
129 subtract_and_normalize(p[4], p[0],
e[2]);
130 subtract_and_normalize(p[5], p[6],
e[3]);
131 subtract_and_normalize(p[7], p[6],
e[4]);
132 subtract_and_normalize(p[2], p[6],
e[5]);
136 glVertex3fv(p[0]); glVertex3fv(p[1]);
137 glVertex3fv(p[2]); glVertex3fv(p[3]);
140 glVertex3fv(p[7]); glVertex3fv(p[6]);
141 glVertex3fv(p[5]); glVertex3fv(p[4]);
144 glVertex3fv(p[0]); glVertex3fv(p[4]);
145 glVertex3fv(p[5]); glVertex3fv(p[1]);
148 glVertex3fv(p[3]); glVertex3fv(p[2]);
149 glVertex3fv(p[6]); glVertex3fv(p[7]);
152 glVertex3fv(p[0]); glVertex3fv(p[3]);
153 glVertex3fv(p[7]); glVertex3fv(p[4]);
156 glVertex3fv(p[1]); glVertex3fv(p[5]);
157 glVertex3fv(p[6]); glVertex3fv(p[2]);
177 glNewList(
fBoxDL, GL_COMPILE);
194 gluCylinder(quad.
Get(), 0, 1, 1, nt, 1);
199 glTranslatef(0, 0, 1);
200 gluDisk(quad.
Get(), 0, 1, nt, 1);
208 gluCylinder(quad.
Get(), 1, 1, 1, nt, 1);
211 gluDisk(quad.
Get(), 0, 1, nt, 1);
215 glTranslatef(0, 0, 1);
216 gluDisk(quad.
Get(), 0, 1, nt, 1);
266 fM = SetModelDynCast<TEveBoxSet>(obj);
313 glBegin(primitiveType);
317 AntiFlick(0.5f*(
b.fVertices[0][0] +
b.fVertices[6][0]),
318 0.5f*(
b.fVertices[0][1] +
b.fVertices[6][1]),
319 0.5f*(
b.fVertices[0][2] +
b.fVertices[6][2]));
321 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
328 glEnable(GL_NORMALIZE);
336 glTranslatef(
b.fA,
b.fB,
b.fC);
337 glScalef (
b.fW,
b.fH,
b.fD);
340 AntiFlick(0.5f, 0.5f, 0.5f);
343 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
356 glTranslatef(
b.fA,
b.fB,
b.fC);
360 glTranslatef(-
b.fA, -
b.fB, -
b.fC);
362 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
369 using namespace TMath;
371 glEnable(GL_NORMALIZE);
380 phi = ATan2(
b.fDir.fY,
b.fDir.fX)*RadToDeg();
381 theta = ATan (
b.fDir.fZ / Sqrt(
b.fDir.fX*
b.fDir.fX +
b.fDir.fY*
b.fDir.fY))*RadToDeg();
383 glTranslatef(
b.fPos.fX,
b.fPos.fY,
b.fPos.fZ);
384 glRotatef(phi, 0, 0, 1);
385 glRotatef(90 - theta, 0, 1, 0);
386 glScalef (
b.fR,
b.fR,
h);
389 AntiFlick(0.0f, 0.0f, 0.5f);
392 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
399 using namespace TMath;
401 glEnable(GL_NORMALIZE);
410 phi = ATan2(
b.fDir.fY,
b.fDir.fX)*RadToDeg();
411 theta = ATan (
b.fDir.fZ / Sqrt(
b.fDir.fX*
b.fDir.fX +
b.fDir.fY*
b.fDir.fY))*RadToDeg();
413 glTranslatef(
b.fPos.fX,
b.fPos.fY,
b.fPos.fZ);
414 glRotatef(phi, 0, 0, 1);
415 glRotatef(90 - theta, 0, 1, 0);
416 glRotatef(
b.fAngle, 0, 0, 1);
417 glScalef (
b.fR,
b.fR2,
h);
420 AntiFlick(0.0f, 0.0f, 0.5f);
423 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
430 using namespace TMath;
432 glEnable(GL_NORMALIZE);
440 glTranslatef(
h.fPos.fX,
h.fPos.fY,
h.fPos.fZ);
441 glRotatef(
h.fAngle, 0, 0, 1);
442 glScalef (
h.fR,
h.fR,
h.fDepth);
445 AntiFlick(0.0f, 0.0f, 0.5f);
448 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
455 throw eH +
"unsupported box-type.";
481 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
486 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
488 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
494 glDisable(GL_CULL_FACE);
A GL rendering class for TEveBoxSet.
TEveBoxSetGL()
Default constructor.
virtual Bool_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const
Determines if display-list will be used for rendering.
virtual void DLCachePurge()
Called when display-lists need to be returned to the system.
void MakeDisplayList() const
Create a display-list for rendering a single box, based on the current box-type.
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
Set model object.
void RenderBoxAutoNorm(const Float_t p[8][3]) const
Render box, calculate normals on the fly from first three points.
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Actual rendering code.
virtual void Render(TGLRnrCtx &rnrCtx)
Interface for direct rendering from classes that include TEveBoxSet as a member.
void RenderBoxes(TGLRnrCtx &rnrCtx) const
GL rendering for all box-types.
Int_t PrimitiveType() const
Return GL primitive used to render the boxes, based on the render-mode specified in the model object.
void MakeOriginBox(Float_t p[8][3], Float_t dx, Float_t dy, Float_t dz) const
Fill array p to represent a box (0,0,0) - (dx,dy,dz).
virtual ~TEveBoxSetGL()
Destructor.
virtual void DLCacheDrop()
Called when display lists have been destroyed externally and the internal display-list data needs to ...
void RenderBoxStdNorm(const Float_t p[8][3]) const
Render a box specified by points in array p with standard axis-aligned normals.
Collection of 3D primitives (fixed-size boxes, boxes of different sizes, or arbitrary sexto-epipeds,...
OpenGL renderer class for TEveDigitSet.
const std::set< Int_t > * fHighlightSet
void DrawFrameIfNeeded(TGLRnrCtx &rnrCtx) const
Make a decision if the frame should be drawn.
Bool_t SetupColor(const TEveDigitSet::DigitBase_t &q) const
Set color for rendering of the specified digit.
TEveRGBAPalette * fPalette
TEveRGBAPalette * AssertPalette()
Make sure the TEveRGBAPalette pointer is not null.
ERenderMode_e fRenderMode
Exception class thrown by TEve classes and macros.
virtual void DLCachePurge()
Purge all entries for all LODs for this drawable from the display list cache, returning the reserved ...
virtual Bool_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const
Returns kTRUE if draws should be display list cached kFALSE otherwise.
virtual void DLCacheDrop()
Drop all entries for all LODs for this drawable from the display list cache, WITHOUT returning the re...
void PurgeDLRange(UInt_t base, Int_t size) const
External object is a fake.
Bool_t fDLCache
display-list validity bit-field
Wrapper class for GLU quadric shape drawing object.
GLUquadric * Get()
Get the internal raw GLU quadric object. Created on first call.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Bool_t SecSelection() const
Bool_t IsDrawPassOutlineLine() const
static Int_t CheckError(const char *loc)
Check current GL error state, outputting details via ROOT Error method if one.
Mother of all ROOT objects.
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
T * Cross(const T v1[3], const T v2[3], T out[3])
Calculate the Cross Product of two vectors: out = [v1 x v2].
Bool_t next()
Go to next atom.
const std::set< Int_t > * fSelection