15#include "TGLIncludes.h"
58 p[0][0] = 0; p[0][1] = dy; p[0][2] = 0;
59 p[1][0] = dx; p[1][1] = dy; p[1][2] = 0;
60 p[2][0] = dx; p[2][1] = 0; p[2][2] = 0;
61 p[3][0] = 0; p[3][1] = 0; p[3][2] = 0;
63 p[4][0] = 0; p[4][1] = dy; p[4][2] = dz;
64 p[5][0] = dx; p[5][1] = dy; p[5][2] = dz;
65 p[6][0] = dx; p[6][1] = 0; p[6][2] = dz;
66 p[7][0] = 0; p[7][1] = 0; p[7][2] = dz;
77 glVertex3fv(p[0]); glVertex3fv(p[1]);
78 glVertex3fv(p[2]); glVertex3fv(p[3]);
81 glVertex3fv(p[7]); glVertex3fv(p[6]);
82 glVertex3fv(p[5]); glVertex3fv(p[4]);
85 glVertex3fv(p[0]); glVertex3fv(p[4]);
86 glVertex3fv(p[5]); glVertex3fv(p[1]);
89 glVertex3fv(p[3]); glVertex3fv(p[2]);
90 glVertex3fv(p[6]); glVertex3fv(p[7]);
93 glVertex3fv(p[0]); glVertex3fv(p[3]);
94 glVertex3fv(p[7]); glVertex3fv(p[4]);
97 glVertex3fv(p[1]); glVertex3fv(p[5]);
98 glVertex3fv(p[6]); glVertex3fv(p[2]);
110 Float_t d = sqrtf(o[0]*o[0] + o[1]*o[1] + o[2]*o[2]);
126 subtract_and_normalize(p[1], p[0],
e[0]);
127 subtract_and_normalize(p[3], p[0],
e[1]);
128 subtract_and_normalize(p[4], p[0],
e[2]);
129 subtract_and_normalize(p[5], p[6],
e[3]);
130 subtract_and_normalize(p[7], p[6],
e[4]);
131 subtract_and_normalize(p[2], p[6],
e[5]);
135 glVertex3fv(p[0]); glVertex3fv(p[1]);
136 glVertex3fv(p[2]); glVertex3fv(p[3]);
139 glVertex3fv(p[7]); glVertex3fv(p[6]);
140 glVertex3fv(p[5]); glVertex3fv(p[4]);
143 glVertex3fv(p[0]); glVertex3fv(p[4]);
144 glVertex3fv(p[5]); glVertex3fv(p[1]);
147 glVertex3fv(p[3]); glVertex3fv(p[2]);
148 glVertex3fv(p[6]); glVertex3fv(p[7]);
151 glVertex3fv(p[0]); glVertex3fv(p[3]);
152 glVertex3fv(p[7]); glVertex3fv(p[4]);
155 glVertex3fv(p[1]); glVertex3fv(p[5]);
156 glVertex3fv(p[6]); glVertex3fv(p[2]);
176 glNewList(
fBoxDL, GL_COMPILE);
193 gluCylinder(quad.
Get(), 0, 1, 1, nt, 1);
195 if (
fM->fDrawConeCap)
198 glTranslatef(0, 0, 1);
199 gluDisk(quad.
Get(), 0, 1, nt, 1);
207 gluCylinder(quad.
Get(), 1, 1, 1, nt, 1);
209 gluQuadricOrientation(quad.
Get(), GLU_INSIDE);
210 gluDisk(quad.
Get(), 0, 1, nt, 1);
211 gluQuadricOrientation(quad.
Get(), GLU_OUTSIDE);
214 glTranslatef(0, 0, 1);
215 gluDisk(quad.
Get(), 0, 1, nt, 1);
300 switch (
fM->fBoxType)
312 glBegin(primitiveType);
316 AntiFlick(0.5f*(
b.fVertices[0][0] +
b.fVertices[6][0]),
317 0.5f*(
b.fVertices[0][1] +
b.fVertices[6][1]),
318 0.5f*(
b.fVertices[0][2] +
b.fVertices[6][2]));
320 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
327 glEnable(GL_NORMALIZE);
335 glTranslatef(
b.fA,
b.fB,
b.fC);
336 glScalef (
b.fW,
b.fH,
b.fD);
339 AntiFlick(0.5f, 0.5f, 0.5f);
342 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
355 glTranslatef(
b.fA,
b.fB,
b.fC);
358 AntiFlick(0.5f*
fM->fDefWidth, 0.5f*
fM->fDefHeight, 0.5f*
fM->fDefDepth);
359 glTranslatef(-
b.fA, -
b.fB, -
b.fC);
361 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
368 using namespace TMath;
370 glEnable(GL_NORMALIZE);
382 glTranslatef(
b.fPos.fX,
b.fPos.fY,
b.fPos.fZ);
383 glRotatef(phi, 0, 0, 1);
384 glRotatef(90 - theta, 0, 1, 0);
385 glScalef (
b.fR,
b.fR,
h);
388 AntiFlick(0.0f, 0.0f, 0.5f);
391 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
398 using namespace TMath;
400 glEnable(GL_NORMALIZE);
412 glTranslatef(
b.fPos.fX,
b.fPos.fY,
b.fPos.fZ);
413 glRotatef(phi, 0, 0, 1);
414 glRotatef(90 - theta, 0, 1, 0);
415 glRotatef(
b.fAngle, 0, 0, 1);
416 glScalef (
b.fR,
b.fR2,
h);
419 AntiFlick(0.0f, 0.0f, 0.5f);
422 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
429 using namespace TMath;
431 glEnable(GL_NORMALIZE);
439 glTranslatef(
h.fPos.fX,
h.fPos.fY,
h.fPos.fZ);
440 glRotatef(
h.fAngle, 0, 0, 1);
441 glScalef (
h.fR,
h.fR,
h.fDepth);
444 AntiFlick(0.0f, 0.0f, 0.5f);
447 if (boxSkip) {
Int_t s = boxSkip;
while (s--) bi.
next(); }
454 throw eH +
"unsupported box-type.";
480 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
485 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
487 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
493 glDisable(GL_CULL_FACE);
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
TEveBoxSetGL()
Default constructor.
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override
Set model object.
void MakeDisplayList() const
Create a display-list for rendering a single box, based on the current box-type.
void DLCacheDrop() override
Called when display lists have been destroyed externally and the internal display-list data needs to ...
void RenderBoxAutoNorm(const Float_t p[8][3]) const
Render box, calculate normals on the fly from first three points.
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.
void DLCachePurge() override
Called when display-lists need to be returned to the system.
~TEveBoxSetGL() override
Destructor.
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).
Bool_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const override
Determines if display-list will be used for rendering.
void DirectDraw(TGLRnrCtx &rnrCtx) const override
Actual rendering code.
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,...
const std::set< Int_t > * fHighlightSet
TEveDigitSetGL(const TEveDigitSetGL &)
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
Purge given display-list range.
Bool_t fDLCache
! use display list caching
TT * SetModelDynCast(TObject *obj)
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.
Double_t ATan(Double_t)
Returns the principal value of the arc tangent of x, expressed in radians.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
T * Cross(const T v1[3], const T v2[3], T out[3])
Calculates the Cross Product of two vectors: out = [v1 x v2].
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Bool_t next()
Go to next atom.
const std::set< Int_t > * fSelection