16#include "TGLIncludes.h"
56 fPlotInfo.
Form(
"(binx = %d; biny = %d; binz = %d; binc = %f)", binI, binJ, binK,
59 fPlotInfo =
"Switch to true color mode to get correct info";
185 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%lx)->Paint()",
ULong_t(
this)));
190 Info(
"ProcessEvent",
"Switch to true color mode to use box cut");
203 glEnable(GL_DEPTH_TEST);
204 glEnable(GL_LIGHTING);
207 glEnable(GL_CULL_FACE);
210 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_TRUE);
218 glDisable(GL_DEPTH_TEST);
219 glDisable(GL_LIGHTING);
220 glDisable(GL_LIGHT0);
221 glDisable(GL_CULL_FACE);
222 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_FALSE);
242 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
255 const Int_t addI = frontPoint == 2 || frontPoint == 1 ? 1 : (iInit = nX - 1, irInit =
fCoord->
GetLastXBin(), -1);
256 const Int_t addJ = frontPoint == 2 || frontPoint == 3 ? 1 : (jInit = nY - 1, jrInit =
fCoord->
GetLastYBin(), -1);
280 for(
Int_t ir = irInit, i = iInit; addI > 0 ? i < nX : i >= 0; ir += addI, i += addI) {
281 for(
Int_t jr = jrInit, j = jInit; addJ > 0 ? j < nY : j >= 0; jr += addJ, j += addJ) {
282 for(
Int_t kr = krInit, k = kInit; addK > 0 ? k < nZ : k >= 0; kr += addK, k += addK) {
294 if (binContent < wmin)
continue;
295 if (binContent > wmax) binContent = wmax;
397 for (
UInt_t i = 0; i < trySize; ++i) {
399 if (level <= fMinMaxVal.first || level >=
fMinMaxVal.second)
409 paletteSize =
fLevels.size() - 1;
436 rgba[0] = tc[0] / 255.f;
437 rgba[1] = tc[1] / 255.f;
438 rgba[2] = tc[2] / 255.f;
447 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
448 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
449 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
450 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.f);
void Info(const char *location, const char *msgfmt,...)
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.
TGLVoxelPainter(const TGLVoxelPainter &)
void DrawPalette() const
Draw. Palette.
void AddOption(const TString &stringOption)
"z" draw palette or not.
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
@ 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)