44 fXOZSlice("XOZ", (
TH3 *)hist, fun, coord, &fBackBox,
TGLTH3Slice::kXOZ),
45 fYOZSlice("YOZ", (
TH3 *)hist, fun, coord, &fBackBox,
TGLTH3Slice::kYOZ),
46 fXOYSlice("XOY", (
TH3 *)hist, fun, coord, &fBackBox,
TGLTH3Slice::kXOY)
55 static char mess[] = {
"fun3" };
169 Info(
"ProcessEvent",
"Cut box does not work in high color, please, switch to true color");
184 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%lx)->Paint()", (
ULong_t)
this));
195 glEnable(GL_LIGHTING);
197 glEnable(GL_DEPTH_TEST);
198 glDisable(GL_CULL_FACE);
199 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
207 glDisable(GL_LIGHTING);
208 glDisable(GL_LIGHT0);
209 glDisable(GL_DEPTH_TEST);
210 glDisable(GL_CULL_FACE);
211 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
234 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
235 glDepthMask(GL_FALSE);
248 glDepthMask(GL_TRUE);
262 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
263 glDepthMask(GL_FALSE);
267 glEnable(GL_POLYGON_OFFSET_FILL);
268 glPolygonOffset(1.
f, 1.
f);
270 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
279 glDisable(GL_POLYGON_OFFSET_FILL);
280 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
281 glColor4d(0., 0., 0., 0.25);
288 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
290 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
294 glDepthMask(GL_TRUE);
326 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.15f};
330 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
332 glMaterialfv(GL_BACK, GL_DIFFUSE, diffColor);
333 diffColor[0] /= 2, diffColor[1] /= 2, diffColor[2] /= 2;
334 glMaterialfv(GL_FRONT, GL_DIFFUSE, diffColor);
335 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
336 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
337 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.
f);
398 if (hist->GetDimension() < 3)
399 Error(
"TGLIsoPainter::TGLIsoPainter",
"Wrong type of histogramm, must have 3 dimensions");
407 static char mess[] = {
"iso" };
417 Error(
"TGLIsoPainter::TGLIsoPainter",
"Wrong type of histogramm, must have 3 dimensions");
435 fCache.splice(fCache.begin(), fIsos);
440 fColorLevels.resize(nContours);
445 for (
UInt_t i = 0; i < nContours; ++i)
449 const Double_t isoStep = (fMinMax.second - fMinMax.first) / nContours;
450 for (
UInt_t i = 0; i < nContours; ++i)
451 fColorLevels[i] = fMinMax.first + i * isoStep;
454 fPalette.GeneratePalette(nContours, fMinMax,
kFALSE);
457 fColorLevels.resize(nContours = 1);
464 for (
UInt_t i = 0; i < nContours; ++i) {
465 if (firstMesh != fCache.end()) {
467 SetMesh(*firstMesh, fColorLevels[i]);
470 fIsos.splice(fIsos.begin(), fCache, firstMesh);
478 SetMesh(newMesh, fColorLevels[i]);
479 fIsos.push_back(fDummyMesh);
480 fIsos.back().Swap(newMesh);
573 Info(
"ProcessEvent",
"Cut box does not work in high color, please, switch to true color");
588 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%lx)->Paint()", (
ULong_t)
this));
599 glEnable(GL_LIGHTING);
601 glEnable(GL_DEPTH_TEST);
602 glDisable(GL_CULL_FACE);
603 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
611 glDisable(GL_LIGHTING);
612 glDisable(GL_LIGHT0);
613 glDisable(GL_DEPTH_TEST);
614 glDisable(GL_CULL_FACE);
615 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
630 if (fIsos.size() != fColorLevels.size()) {
631 Error(
"TGLIsoPainter::DrawPlot",
"Non-equal number of levels and isos");
641 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
642 glDepthMask(GL_FALSE);
648 for (; iso != fIsos.end(); ++iso, ++colorInd)
653 glDepthMask(GL_TRUE);
704 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.25f};
706 if (fColorLevels.size() == 1) {
709 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
711 const UChar_t *color = fPalette.GetColour(ind);
712 diffColor[0] = color[0] / 255.;
713 diffColor[1] = color[1] / 255.;
714 diffColor[2] = color[2] / 255.;
717 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
718 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
719 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
720 diffColor[0] /= 3.5, diffColor[1] /= 3.5, diffColor[2] /= 3.5;
721 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, diffColor);
722 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 30.
f);
737 builder.
BuildMesh(static_cast<TH3C *>(
fHist), geom, &m, isoValue);
738 }
else if (
typeid(*
fHist) ==
typeid(
TH3S)) {
740 builder.
BuildMesh(static_cast<TH3S *>(
fHist), geom, &m, isoValue);
741 }
else if (
typeid(*
fHist) ==
typeid(
TH3I)) {
743 builder.
BuildMesh(static_cast<TH3I *>(
fHist), geom, &m, isoValue);
744 }
else if (
typeid(*
fHist) ==
typeid(
TH3F)) {
746 builder.
BuildMesh(static_cast<TH3F *>(
fHist), geom, &m, isoValue);
747 }
else if (
typeid(*
fHist) ==
typeid(
TH3D)) {
749 builder.
BuildMesh(static_cast<TH3D *>(
fHist), geom, &m, isoValue);
784 fMinMax.second = fMinMax.first;
790 fMinMax.first =
TMath::Min(binContent, fMinMax.first);
791 fMinMax.second =
TMath::Max(binContent, fMinMax.second);
std::vector< UInt_t > fTris
void DrawToSelectionBuffer() const
Draw triangles, no normals, no lighting.
void DrawBox(Bool_t selectionPass, Int_t selected) const
Draw cut as a semi-transparent box.
void FindMinMax()
Find max/min bin contents for TH3.
void RestoreModelviewMatrix() const
Camera for TGLPlotPainter and sub-classes.
Int_t GetFirst() const
Return first bin on the axis i.e.
void MoveBox(Int_t px, Int_t py, Int_t axisID)
Move box cut along selected direction.
tomato 3-D histogram with a float per channel (see TH1 documentation)}
Bool_t InitGeometry()
Create mesh.
Bool_t TestBit(UInt_t f) const
void DrawSections() const
Draw sections (if any).
void DrawPlot() const
Draw mesh.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
void DrawMesh(const Mesh_t &mesh, Int_t level) const
Draw TF3 surface.
void StartPan(Int_t px, Int_t py)
User clicks somewhere (px, py).
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
const TGLVertex3 * Get3DBox() const
Get 3D box.
virtual Int_t GetNbinsZ() const
Short_t Min(Short_t a, Short_t b)
void TurnOnOff()
Turn the box cut on/off.
Bool_t InitGeometry()
Initializes meshes for 3d iso contours.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
virtual Int_t GetDimension() const
virtual Int_t GetContour(Double_t *levels=0)
Return contour values into array levels if pointer levels is non zero.
void Apply(Double_t phi, Double_t theta) const
Applies rotations and translations before drawing.
char * GetPlotInfo(Int_t px, Int_t py)
Return info for plot part under cursor.
3 component (x/y/z) vertex class.
Plot-painter for TF3 functions.
void DeInitGL() const
Initialize OpenGL state variables.
void Info(const char *location, const char *msgfmt,...)
void SetCamera() const
Viewport and projection.
void SetSurfaceColor() const
Set color for surface.
void InitGL() const
Initialize OpenGL state variables.
void DeInitGL() const
Initialize OpenGL state variables.
user specified contour levels
void Error(const char *location, const char *msgfmt,...)
void SetViewVolume(const TGLVertex3 *box)
'box' is the TGLPlotPainter's back box's coordinates.
The 3-D histogram classes derived from the 1-D histogram classes.
tomato 3-D histogram with an int per channel (see TH1 documentation)}
void DrawSectionYOZ() const
Draw YOZ parallel section.
void AddOption(const TString &stringOption)
No options for tf3.
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
tomato 3-D histogram with a short per channel (see TH1 documentation)
const Rgl::Range_t & GetZRangeScaled() const
Scaled range.
void RestoreProjectionMatrix() const
void DrawSectionXOY() const
Draw XOY parallel section.
void InitGL() const
Initialize OpenGL state variables.
Int_t GetLast() const
Return last bin on the axis i.e.
tomato 3-D histogram with a double per channel (see TH1 documentation)}
void DrawSectionYOZ() const
Draw YOZ parallel section.
A 3-Dim function with parameters.
void SetMesh(Mesh_t &mesh, Double_t isoValue)
Grid geometry.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color scheme.
void DrawPlot() const
Draw mesh.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
void ResetModified()
Reset modified.
void Pan(Int_t px, Int_t py)
Pan camera.
void SetSurfaceColor(Int_t ind) const
Set color for surface.
char * Form(const char *fmt,...)
void DrawSlice(Double_t pos) const
Draw slice.
void AddOption(const TString &option)
No additional options for TGLIsoPainter.
virtual Double_t GetContourLevelPad(Int_t level) const
Return the value of contour number "level" in Pad coordinates.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
std::vector< Double_t > fZLevels
void DrawSectionXOZ() const
Draw XOZ parallel section.
void DrawBox(Int_t selectedPart, Bool_t selectionPass, const std::vector< Double_t > &zLevels, Bool_t highColor) const
Draw back box for a plot.
Double_t GetYScale() const
void DrawDefaultPlot() const
Surface with material properties and lighting.
Bool_t HasSections() const
Any section exists.
std::list< Mesh_t >::const_iterator ConstMeshIter_t
void SetCoordType(EGLCoordType type)
If coord type was changed, plot must reset sections (if any), set fModified.
Bool_t Modified() const
Modified.
Rgl::Mc::TIsoMesh< Double_t > fMesh
virtual Color_t GetFillColor() const
Return the fill area color.
void SaveProjectionMatrix() const
The color creation and management class.
tomato 3-D histogram with a byte per channel (see TH1 documentation)
Bool_t SetRanges(const TH1 *hist, Bool_t errors=kFALSE, Bool_t zBins=kFALSE)
Set bin ranges, ranges.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Change color scheme.
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.
Bool_t HasSections() const
Any section exists.
const Rgl::Range_t & GetYRangeScaled() const
Scaled range.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
void BuildMesh(const DataSource *src, const TGridGeometry< ValueType > &geom, MeshType_t *mesh, ValueType iso)
Build iso-mesh using marching cubes.
void StartMovement(Int_t px, Int_t py)
Start cut's movement.
Short_t Max(Short_t a, Short_t b)
void SetPlotBox(const Rgl::Range_t &xRange, const Rgl::Range_t &yRange, const Rgl::Range_t &zRange)
Set up a frame box.
const Rgl::Range_t & GetXRangeScaled() const
Scaled range.
void DrawSectionXOY() const
Draw XOY parallel section.
std::list< Mesh_t >::iterator MeshIter_t
virtual Int_t GetNbinsX() const
Int_t GetHeight() const
viewport[3]
void DrawMaplePlot() const
Colored surface, without lighting and material properties.
void SaveModelviewMatrix() const
TGLPlotCoordinates * fCoord
virtual void Paint()
Draw lego/surf/whatever you can.
char * GetPlotInfo(Int_t px, Int_t py)
Coords for point on surface under cursor.
Double_t GetZScale() const
void DrawMesh(const std::vector< Float_t > &vs, const std::vector< Float_t > &ns, const std::vector< UInt_t > &ts)
Call function-template.
void DrawSectionXOZ() const
Draw XOZ parallel section.
Double_t GetXScale() const
virtual Int_t GetNbinsY() const