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%lx)->Paint()", (
ULong_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%lx)->Paint()", (
ULong_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,...)
void Error(const char *location, const char *msgfmt,...)
char * Form(const char *fmt,...)
std::vector< UInt_t > fTris
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.
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.
Bool_t InitGeometry()
Initializes meshes for 3d iso contours.
void DrawSectionYOZ() const
Draw YOZ parallel section.
void DrawPlot() const
Draw mesh.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
void AddOption(const TString &option)
No additional options for TGLIsoPainter.
TGLIsoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
void DeInitGL() const
Initialize OpenGL state variables.
void DrawMesh(const Mesh_t &mesh, Int_t level) const
Draw TF3 surface.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color scheme.
void InitGL() const
Initialize OpenGL state variables.
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 DrawSectionXOY() const
Draw XOY parallel section.
void DrawSectionXOZ() const
Draw XOZ parallel section.
void SetSurfaceColor(Int_t ind) const
Set color for surface.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
std::list< Mesh_t >::const_iterator ConstMeshIter_t
char * GetPlotInfo(Int_t px, Int_t py)
Return info for plot part under cursor.
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
virtual void Paint()
Draw lego/surf/whatever you can.
TGLPlotCoordinates * fCoord
void SaveProjectionMatrix() const
void SaveModelviewMatrix() const
void RestoreProjectionMatrix() const
Plot-painter for TF3 functions.
void InitGL() const
Initialize OpenGL state variables.
void DrawPlot() const
Draw mesh.
Rgl::Mc::TIsoMesh< Double_t > fMesh
void AddOption(const TString &stringOption)
No options for tf3.
TGLTF3Painter(TF3 *fun, TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
char * GetPlotInfo(Int_t px, Int_t py)
Coords for point on surface under cursor.
void DrawDefaultPlot() const
Surface with material properties and lighting.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color scheme.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
void DrawToSelectionBuffer() const
Draw triangles, no normals, no lighting.
void DeInitGL() const
Initialize OpenGL state variables.
void SetSurfaceColor() const
Set color for surface.
void DrawSectionXOY() const
Draw XOY parallel section.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
void DrawSectionYOZ() const
Draw YOZ parallel section.
void DrawMaplePlot() const
Colored surface, without lighting and material properties.
void DrawSectionXOZ() const
Draw XOZ parallel section.
Bool_t InitGeometry()
Create mesh.
Bool_t HasSections() const
Any section exists.
void DrawSlice(Double_t pos) const
Draw slice.
3 component (x/y/z) vertex class.
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 Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
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)
Short_t Min(Short_t a, Short_t b)