21#include "TGLIncludes.h"
52 fScaleColor(-1), fScaleTransparency(0),
53 fScaleCoordX(0.85), fScaleCoordY(0.65),
54 fScaleW(0), fScaleH(0),
55 fCellX(-1), fCellY(-1),
57 fFrameColor(-1), fFrameLineTransp(70), fFrameBgTransp(90),
59 fMouseX(0), fMouseY(0),
64 fPlaneAxis(0), fAxisPlaneColor(
kGray),
74 fActiveID(-1), fActiveCol(
kRed-4)
113 switch (event->
fType)
154 switch (event->
fType)
265 glVertex2f(
x/vp.
Width(), 1);
273 glBitmap(0, 0, 0, 0,
x,
y, 0);
284 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
285 glEnable(GL_POINT_SMOOTH);
286 glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
287 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
288 glEnable(GL_POLYGON_OFFSET_FILL);
289 glPolygonOffset(0.1, 1);
290 glDisable(GL_CULL_FACE);
292 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
311 glVertex2f( bwt, bh);
312 glVertex2f(-bwt, bh);
319 glVertex2f(0, 0); glVertex2f(0, bh);
320 glVertex2f((bw+bwt)*0.5, bh*0.5); glVertex2f(-(bw+bwt)*0.5, bh*0.5);
327 glVertex2f( bwt, bh);
328 glVertex2f(-bwt, bh);
399 while(cellY > scaleStepY)
411 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
413 glDisable(GL_CULL_FACE);
414 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
415 glEnable(GL_POLYGON_OFFSET_FILL);
416 glPolygonOffset(0.1, 1);
428 for (
Int_t i=0; i < ne; ++i)
431 dx = 0.5* cellX * valFac;
432 dy = 0.5* cellY * valFac;
434 glVertex2f( - dx, pos - dy);
435 glVertex2f( - dx, pos + dy);
436 glVertex2f( + dx, pos + dy);
437 glVertex2f( + dx, pos - dy);
443 for (
Int_t i=0; i < ne; ++i)
444 glVertex2f(0, i* scaleStepY);
455 Float_t llx, lly, llz, urx, ury, urz;
456 fontB.
BBox(
"10", llx, lly, llz, urx, ury, urz);
463 glTranslatef(0.5*scaleStepX, 0, 0.1);
464 for (
Int_t i = 0; i < ne; ++i)
470 else if ( i == (maxe -1))
477 fontB.
BBox(
Form(
"%d", maxe-i), llx, lly, llz, urx, ury, urz);
478 if (expOff > urx/vp.
Width()) expOff = urx/vp.
Width();
485 if (expOff < 1) expX += expOff;
490 fScaleW = scaleStepX + expX+ frameOff*2;
491 fScaleH = scaleStepY * ne + frameOff*2;
502 glVertex3f(x0, y0, zf); glVertex3f(
x1, y0, zf);
503 glVertex3f(
x1, y1, zf); glVertex3f(x0, y1, zf);
508 glVertex2f(x0, y0); glVertex2f(
x1, y0);
509 glVertex2f(
x1, y1); glVertex2f(x0, y1);
523 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT);
525 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
526 glEnable(GL_POLYGON_OFFSET_FILL);
527 glPolygonOffset(0.1, 1);
570 for (TGLAxisPainter::LabVec_t::iterator it = labVec.begin(); it != labVec.end(); ++it)
573 glColor4ub(
c[0],
c[1],
c[2],
c[3]);
576 glVertex3f( -w,
y -
h, zf); glVertex3f( +w,
y -
h, zf);
577 glVertex3f( +w,
y +
h, zf); glVertex3f( -w,
y +
h, zf);
583 for (TGLAxisPainter::LabVec_t::iterator it = labVec.begin(); it != labVec.end(); ++it)
586 glVertex3f( -w,
y -
h, zf); glVertex3f( +w,
y -
h, zf);
587 glVertex3f( +w,
y +
h, zf); glVertex3f( -w,
y +
h, zf);
605 glGetFloatv(GL_DEPTH_RANGE, old_depth_range);
606 glDepthRange(0, 0.001);
608 glMatrixMode(GL_PROJECTION);
615 gluPickMatrix(rect.
X(), rect.
Y(), rect.
Width(), rect.
Height(),
618 glMatrixMode(GL_MODELVIEW);
622 glTranslatef(-1, -1, 0);
660 for (
Int_t i=1 ; i<=nb; i++)
662 if (sq >
a->GetBinWidth(i)) sq =
a->GetBinWidth(i);
667 for (
Int_t i=1 ; i<=nb; i++)
669 if (sq >
a->GetBinWidth(i)) sq =
a->GetBinWidth(i);
702 glMatrixMode(GL_PROJECTION);
704 glMatrixMode(GL_MODELVIEW);
706 glDepthRange(old_depth_range[0], old_depth_range[1]);
static const double x1[5]
char * Form(const char *fmt,...)
static struct mg_connection * fc(struct mg_context *ctx)
Manages histogram axis attributes.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Class to manage histogram axis.
virtual void SetLimits(Double_t xmin, Double_t xmax)
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates).
virtual void GetCellData(const CellId_t &id, CellData_t &data) const =0
virtual TAxis * GetEtaBins() const
virtual TAxis * GetPhiBins() const
OpenGL renderer class for TEveCaloLego.
GL-overlay control GUI for TEveCaloLego.
Bool_t fInDrag
last mouse position
void RenderPlaneInterface(TGLRnrCtx &rnrCtx)
Render menu for plane-value and the plane if marked.
virtual void Render(TGLRnrCtx &rnrCtx)
Display coordinates info of current frustum.
void RenderHeader(TGLRnrCtx &rnrCtx)
void SetScaleColorTransparency(Color_t colIdx, Char_t transp)
Set color and transparency of scales.
Char_t fScaleTransparency
TEveCaloLegoOverlay()
Constructor.
void RenderPaletteScales(TGLRnrCtx &rnrCtx)
virtual void MouseLeave()
Mouse has left overlay area.
Bool_t SetSliderVal(Event_t *event, TGLRnrCtx &rnrCtx)
void SetScalePosition(Double_t x, Double_t y)
Set scale coordinates in range [0,1].
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered overlay area.
void RenderLogaritmicScales(TGLRnrCtx &rnrCtx)
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
void SetFrameAttribs(Color_t frameCol, Char_t lineTransp, Char_t bgTransp)
Set frame attributes.
Color_t GetFontColor() const
void SetHPlaneVal(Float_t s)
TEveCaloData::vCellId_t fCellList
void SetDrawHPlane(Bool_t s)
Float_t GetEtaMin() const
TEveRGBAPalette * GetPalette() const
Float_t GetPhiRng() const
Float_t GetMaxVal() const
TEveCaloData * GetData() const
Float_t GetEtaMax() const
Float_t GetPhiMax() const
Float_t GetEtaRng() const
Float_t GetPhiMin() const
const UChar_t * ColorFromValue(Int_t val) const
void RnrLabels() const
Render label reading prepared list ov value-pos pairs.
void SetLabelFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set label font derived from TAttAxis.
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
std::vector< Lab_t > LabVec_t
void SetTextFormat(Double_t min, Double_t max, Double_t binWidth)
Construct print format from given primary bin width.
void SetAttAxis(TAttAxis *a)
void SetLabelPixelFontSize(Int_t fs)
std::pair< Float_t, Float_t > Lab_t
TGLVector3 & RefTMOff(Int_t i)
void PaintAxis(TGLRnrCtx &ctx, TAxis *ax)
GL render TAxis.
A GL overlay element which displays camera furstum.
TGLAxisPainter * fAxisPainter
void SetFrustum(TGLCamera &cam)
Set frustum values from given camera.
virtual void Render(TGLRnrCtx &rnrCtx)
Display coordinates info of current frustum.
TAttAxis * GetAttAxis()
Get axis attributes.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
virtual Bool_t IsPerspective() const
TGLVector3 WorldDeltaToViewport(const TGLVertex3 &worldRef, const TGLVector3 &worldDelta) const
Convert a 3D vector worldDelta (shift) about vertex worldRef to a viewport (screen) '3D' vector.
void WindowToViewport(Int_t &, Int_t &y) const
virtual Bool_t IsOrthographic() const
Color_t GetColorIndex() const
Returns color-index representing the color.
A wrapper class for FTFont.
void BBox(const char *txt, Float_t &llx, Float_t &lly, Float_t &llz, Float_t &urx, Float_t &ury, Float_t &urz) const
Get bounding box.
void Render(const char *txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
virtual void PostRender() const
Reset GL state after FTFont rendering.
virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE) const
Set-up GL state before FTFont rendering.
Selection record for overlay objects.
Viewport (pixel base) 2D rectangle class.
const Int_t * CArr() const
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
TGLRect * GetPickRectangle()
Return current pick rectangle.
void RegisterFontNoScale(Int_t size, Int_t file, Int_t mode, TGLFont &out)
Get font in the GL rendering context.
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
TGLViewerBase & RefViewer()
UInt_t GetItem(Int_t i) const
static void Color4f(Float_t r, Float_t g, Float_t b, Float_t a)
Wrapper for glColor4f.
static void ColorTransparency(Color_t color_index, Char_t transparency=0)
Set color from color_index and ROOT-style transparency (default 0).
static void Color(const TGLColor &color)
Set color from TGLColor.
static Float_t PointSize()
Get the point-size, taking the global scaling into account.
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
void Set(Double_t x, Double_t y, Double_t z)
TGLLogicalShape * FindLogicalInScenes(TObject *id)
Find logical-shape representing object id in the list of scenes.
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
Static function to compute reasonable axis limits.
const char * Data() const
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Max(Short_t a, Short_t b)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Int_t CeilNint(Double_t x)
Double_t Log10(Double_t x)
Cell data inner structure.