27#include "TGLIncludes.h"
43 fXOZSlice(
"XOZ", (
TH3 *)hist, fun, coord, &fBackBox,
TGLTH3Slice::kXOZ),
44 fYOZSlice(
"YOZ", (
TH3 *)hist, fun, coord, &fBackBox,
TGLTH3Slice::kYOZ),
45 fXOYSlice(
"XOY", (
TH3 *)hist, fun, coord, &fBackBox,
TGLTH3Slice::kXOY)
54 static char mess[] = {
"fun3" };
168 Info(
"ProcessEvent",
"Cut box does not work in high color, please, switch to true color");
183 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%zx)->Paint()", (
size_t)
this));
194 glEnable(GL_LIGHTING);
196 glEnable(GL_DEPTH_TEST);
197 glDisable(GL_CULL_FACE);
198 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_TRUE);
206 glDisable(GL_LIGHTING);
207 glDisable(GL_LIGHT0);
208 glDisable(GL_DEPTH_TEST);
209 glDisable(GL_CULL_FACE);
210 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_FALSE);
233 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
261 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
266 glEnable(GL_POLYGON_OFFSET_FILL);
267 glPolygonOffset(1.f, 1.f);
269 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
278 glDisable(GL_POLYGON_OFFSET_FILL);
279 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
280 glColor4d(0., 0., 0., 0.25);
287 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
289 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
325 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.15f};
329 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
331 glMaterialfv(GL_BACK, GL_DIFFUSE, diffColor);
332 diffColor[0] /= 2, diffColor[1] /= 2, diffColor[2] /= 2;
333 glMaterialfv(GL_FRONT, GL_DIFFUSE, diffColor);
334 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
335 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
336 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.f);
392 fXOZSlice(
"XOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOZ),
393 fYOZSlice(
"YOZ", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kYOZ),
394 fXOYSlice(
"XOY", (
TH3 *)hist, coord, &fBackBox,
TGLTH3Slice::kXOY),
398 Error(
"TGLIsoPainter::TGLIsoPainter",
"Wrong type of histogramm, must have 3 dimensions");
406 static char mess[] = {
"iso" };
416 Error(
"TGLIsoPainter::TGLIsoPainter",
"Wrong type of histogramm, must have 3 dimensions");
444 for (
UInt_t i = 0; i < nContours; ++i)
449 for (
UInt_t i = 0; i < nContours; ++i)
463 for (
UInt_t i = 0; i < nContours; ++i) {
464 if (firstMesh !=
fCache.end()) {
479 fIsos.back().Swap(newMesh);
572 Info(
"ProcessEvent",
"Cut box does not work in high color, please, switch to true color");
587 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%zx)->Paint()", (
size_t)
this));
598 glEnable(GL_LIGHTING);
600 glEnable(GL_DEPTH_TEST);
601 glDisable(GL_CULL_FACE);
602 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_TRUE);
610 glDisable(GL_LIGHTING);
611 glDisable(GL_LIGHT0);
612 glDisable(GL_DEPTH_TEST);
613 glDisable(GL_CULL_FACE);
614 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_FALSE);
630 Error(
"TGLIsoPainter::DrawPlot",
"Non-equal number of levels and isos");
640 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
647 for (; iso !=
fIsos.end(); ++iso, ++colorInd)
703 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.25f};
708 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
711 diffColor[0] = color[0] / 255.;
712 diffColor[1] = color[1] / 255.;
713 diffColor[2] = color[2] / 255.;
716 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
717 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
718 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
719 diffColor[0] /= 3.5, diffColor[1] /= 3.5, diffColor[2] /= 3.5;
720 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, diffColor);
721 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 30.f);
737 }
else if (
typeid(*
fHist) ==
typeid(
TH3S)) {
740 }
else if (
typeid(*
fHist) ==
typeid(
TH3I)) {
743 }
else if (
typeid(*
fHist) ==
typeid(
TH3F)) {
746 }
else if (
typeid(*
fHist) ==
typeid(
TH3D)) {
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void BuildMesh(const DataSource *src, const TGridGeometry< ValueType > &geom, MeshType_t *mesh, ValueType iso)
Build iso-mesh using marching cubes.
virtual Color_t GetFillColor() const
Return the fill area color.
Int_t GetLast() const
Return last bin on the axis i.e.
Int_t GetFirst() const
Return first bin on the axis i.e.
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
A 3-Dim function with parameters.
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
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.
Bool_t HasSections() const
Any section exists.
char * GetPlotInfo(Int_t px, Int_t py) override
Return info for plot part under cursor.
TGLIsoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
void DeInitGL() const override
Initialize OpenGL state variables.
Bool_t InitGeometry() override
Initializes meshes for 3d iso contours.
void DrawMesh(const Mesh_t &mesh, Int_t level) const
Draw TF3 surface.
void DrawSectionXOY() const override
Draw XOY parallel section.
void DrawSectionXOZ() const override
Draw XOZ parallel section.
void AddOption(const TString &option) override
No additional options for TGLIsoPainter.
std::list< Mesh_t >::iterator MeshIter_t
void FindMinMax()
Find max/min bin contents for TH3.
std::vector< Double_t > fColorLevels
void SetMesh(Mesh_t &mesh, Double_t isoValue)
Grid geometry.
void ProcessEvent(Int_t event, Int_t px, Int_t py) override
Change color scheme.
void InitGL() const override
Initialize OpenGL state variables.
void DrawSectionYOZ() const override
Draw YOZ parallel section.
void SetSurfaceColor(Int_t ind) const
Set color for surface.
void DrawPlot() const override
Draw mesh.
std::list< Mesh_t >::const_iterator ConstMeshIter_t
void StartPan(Int_t px, Int_t py) override
User clicks right mouse button (in a pad).
void Pan(Int_t px, Int_t py) override
User's moving mouse cursor, with middle mouse button pressed (for pad).
const UChar_t * GetColour(Double_t z) const
Get color.
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.
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
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...
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.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
void SetCoordType(EGLCoordType type)
If coord type was changed, plot must reset sections (if any), set fModified.
void ResetModified()
Reset modified.
Bool_t Modified() const
Modified.
Double_t GetXScale() const
Double_t GetZScale() const
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
void DrawSections() const
Draw sections (if any).
std::vector< Double_t > fZLevels
void RestoreModelviewMatrix() const
TGLPlotCoordinates * fCoord
void Paint() override
Draw lego/surf/whatever you can.
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
void RestoreProjectionMatrix() const
Plot-painter for TF3 functions.
Rgl::Mc::TIsoMesh< Double_t > fMesh
void DeInitGL() const override
Initialize OpenGL state variables.
void DrawSectionXOZ() const override
Draw XOZ parallel section.
Bool_t InitGeometry() override
Create mesh.
void DrawSectionYOZ() const override
Draw YOZ parallel section.
TGLTF3Painter(TF3 *fun, TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
void DrawDefaultPlot() const
Surface with material properties and lighting.
void AddOption(const TString &stringOption) override
No options for tf3.
void Pan(Int_t px, Int_t py) override
User's moving mouse cursor, with middle mouse button pressed (for pad).
void DrawPlot() const override
Draw mesh.
void InitGL() const override
Initialize OpenGL state variables.
char * GetPlotInfo(Int_t px, Int_t py) override
Coords for point on surface under cursor.
void DrawToSelectionBuffer() const
Draw triangles, no normals, no lighting.
void SetSurfaceColor() const
Set color for surface.
void ProcessEvent(Int_t event, Int_t px, Int_t py) override
Change color scheme.
void DrawSectionXOY() const override
Draw XOY parallel section.
void DrawMaplePlot() const
Colored surface, without lighting and material properties.
void StartPan(Int_t px, Int_t py) override
User clicks right mouse button (in a pad).
Bool_t HasSections() const
Any section exists.
void DrawSlice(Double_t pos) const
Draw slice.
3 component (x/y/z) vertex class.
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t GetNbinsY() const
virtual Int_t GetNbinsZ() const
virtual Double_t GetContourLevelPad(Int_t level) const
Return the value of contour number "level" in Pad coordinates.
virtual Int_t GetDimension() const
@ kUserContour
User specified contour levels.
virtual Int_t GetNbinsX() const
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Int_t GetContour(Double_t *levels=nullptr)
Return contour values into array levels if pointer levels is non zero.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
3-D histogram with a byte per channel (see TH1 documentation)
3-D histogram with a double per channel (see TH1 documentation)}
3-D histogram with a float per channel (see TH1 documentation)}
3-D histogram with an int per channel (see TH1 documentation)}
3-D histogram with a short per channel (see TH1 documentation)
The 3-D histogram classes derived from the 1-D histogram classes.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void DrawMapleMesh(const std::vector< Double_t > &vs, const std::vector< Double_t > &ns, const std::vector< UInt_t > &ts)
Colored mesh with lighting disabled.
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
void DrawMesh(const std::vector< Float_t > &vs, const std::vector< Float_t > &ns, const std::vector< UInt_t > &ts)
Call function-template.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.