15#include "TGLIncludes.h"
55 fPlotInfo.
Form(
"(binx = %d; biny = %d; binz = %d; binc = %f)", binI, binJ, binK,
58 fPlotInfo =
"Switch to true color mode to get correct info";
184 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%zx)->Paint()", (
size_t)
this));
189 Info(
"ProcessEvent",
"Switch to true color mode to use box cut");
202 glEnable(GL_DEPTH_TEST);
203 glEnable(GL_LIGHTING);
206 glEnable(GL_CULL_FACE);
209 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_TRUE);
217 glDisable(GL_DEPTH_TEST);
218 glDisable(GL_LIGHTING);
219 glDisable(GL_LIGHT0);
220 glDisable(GL_CULL_FACE);
221 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_FALSE);
241 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
254 const Int_t addI = frontPoint == 2 || frontPoint == 1 ? 1 : (iInit = nX - 1, irInit =
fCoord->
GetLastXBin(), -1);
255 const Int_t addJ = frontPoint == 2 || frontPoint == 3 ? 1 : (jInit = nY - 1, jrInit =
fCoord->
GetLastYBin(), -1);
279 for(
Int_t ir = irInit, i = iInit; addI > 0 ? i < nX : i >= 0; ir += addI, i += addI) {
280 for(
Int_t jr = jrInit, j = jInit; addJ > 0 ? j < nY : j >= 0; jr += addJ, j += addJ) {
281 for(
Int_t kr = krInit, k = kInit; addK > 0 ? k < nZ : k >= 0; kr += addK, k += addK) {
293 if (binContent < wmin)
continue;
294 if (binContent > wmax) binContent = wmax;
396 for (
UInt_t i = 0; i < trySize; ++i) {
398 if (level <= fMinMaxVal.first || level >=
fMinMaxVal.second)
408 paletteSize =
fLevels.size() - 1;
435 rgba[0] = tc[0] / 255.f;
436 rgba[1] = tc[1] / 255.f;
437 rgba[2] = tc[2] / 255.f;
446 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
447 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
448 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
449 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.f);
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
Class to manage histogram axis.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
Bool_t IsInCut(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax) const
Check, if box defined by xmin/xmax etc. is in cut.
void DrawBox(Bool_t selectionPass, Int_t selected) const
Draw cut as a semi-transparent box.
void TurnOnOff()
Turn the box cut on/off.
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
const UChar_t * GetColour(Double_t z) const
Get color.
Int_t GetPaletteSize() const
Get. Palette. Size.
void SetContours(const std::vector< Double_t > *contours)
Clear :)
Bool_t GeneratePalette(UInt_t paletteSize, const Rgl::Range_t &zRange, Bool_t checkSize=kTRUE)
Try to find colors for palette.
void SetPlotBox(const Rgl::Range_t &xRange, const Rgl::Range_t &yRange, const Rgl::Range_t &zRange)
Set up a frame box.
const TGLVertex3 * Get3DBox() const
Get 3D box.
const TGLVertex3 * Get2DBox() const
Get 2D box.
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
Int_t GetFrontPoint() const
The nearest point.
Camera for TGLPlotPainter and sub-classes.
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
void SetCamera() const
Viewport and projection.
void Pan(Int_t px, Int_t py)
Pan camera.
Int_t GetHeight() const
viewport[3]
void SetViewVolume(const TGLVertex3 *box)
'box' is the TGLPlotPainter's back box's coordinates.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
void SetXLog(Bool_t xLog)
If log changed, sections must be reset, set fModified.
Bool_t SetRanges(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges.
Double_t GetYScale() const
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
Int_t GetFirstXBin() const
Int_t GetFirstYBin() const
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
void ResetModified()
Reset modified.
Bool_t Modified() const
Modified.
Double_t GetXScale() const
Double_t GetZScale() const
Int_t GetLastZBin() const
Int_t GetNXBins() const
Number of X bins.
Int_t GetFirstZBin() const
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
void SetZLog(Bool_t zLog)
If log changed, sections must be reset, set fModified.
void SetYLog(Bool_t yLog)
If log changed, sections must be reset, set fModified.
Int_t GetLastYBin() const
Int_t GetNYBins() const
Number of Y bins.
Int_t GetLastXBin() const
Int_t GetNZBins() const
Number of Z bins.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
std::vector< Double_t > fZLevels
void RestoreModelviewMatrix() const
virtual void Paint()
Draw lego/surf/whatever you can.
TGLPlotCoordinates * fCoord
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
void MoveSection(Int_t px, Int_t py)
Create dynamic profile using selected plane.
void RestoreProjectionMatrix() const
Paint TH3 histograms as "voxels" - colored boxes, transparent if transfer function was specified.
void DrawPaletteAxis() const
Draw. Palette. Axis.
void DeInitGL() const
Return back some gl state variables.
void DrawSectionXOY() const
Noop.
void DrawSectionYOZ() const
Noop.
void SetVoxelColor(const Float_t *rgba) const
Set box color.
void InitGL() const
Initialize some gl state variables.
void PreparePalette() const
Generate palette.
void DrawPalette() const
Draw. Palette.
void AddOption(const TString &stringOption)
"z" draw palette or not.
TGLVoxelPainter(const TGLVoxelPainter &)=delete
void DrawSectionXOZ() const
Noop.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Remove sections, switch on/off box cut.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
Bool_t InitGeometry()
Set ranges, find min and max bin content.
void DrawPlot() const
Draw "voxels".
void FindVoxelColor(Double_t binContent, Float_t *rgba) const
Find box color.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
char * GetPlotInfo(Int_t px, Int_t py)
Show box info (i, j, k, binContent).
std::vector< Double_t > fLevels
TH1 is the base class of all histogram classes in ROOT.
@ kUserContour
User specified contour levels.
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
TList * GetListOfFunctions() const
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetContourLevel(Int_t level) const
Return value of contour number level.
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Int_t GetNumberContours() const
const Float_t gNullEmission[]
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
void DrawPalette(const TGLPlotCamera *camera, const TGLLevelPalette &palette)
Draw. Palette.
void DrawPaletteAxis(const TGLPlotCamera *camera, const Range_t &minMax, Bool_t logZ)
void DrawBoxFront(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Int_t fp)
Draws lego's bar as a 3d box.
const Float_t gOrangeEmission[]
Short_t Max(Short_t a, Short_t b)
Short_t Min(Short_t a, Short_t b)