27#include "TGLIncludes.h"
53 static char mess[] = {
"fun3" };
124 py =
fCamera->GetHeight() - py;
167 Info(
"ProcessEvent",
"Cut box does not work in high color, please, switch to true color");
182 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%zx)->Paint()", (
size_t)
this));
193 glEnable(GL_LIGHTING);
195 glEnable(GL_DEPTH_TEST);
196 glDisable(GL_CULL_FACE);
197 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
205 glDisable(GL_LIGHTING);
206 glDisable(GL_LIGHT0);
207 glDisable(GL_DEPTH_TEST);
208 glDisable(GL_CULL_FACE);
209 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
232 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
233 glDepthMask(GL_FALSE);
246 glDepthMask(GL_TRUE);
260 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
261 glDepthMask(GL_FALSE);
265 glEnable(GL_POLYGON_OFFSET_FILL);
266 glPolygonOffset(1.f, 1.f);
268 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
277 glDisable(GL_POLYGON_OFFSET_FILL);
278 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
279 glColor4d(0., 0., 0., 0.25);
286 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
288 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
292 glDepthMask(GL_TRUE);
324 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.15f};
328 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
330 glMaterialfv(GL_BACK, GL_DIFFUSE, diffColor);
331 diffColor[0] /= 2, diffColor[1] /= 2, diffColor[2] /= 2;
332 glMaterialfv(GL_FRONT, GL_DIFFUSE, diffColor);
333 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
334 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
335 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 70.f);
396 Error(
"TGLIsoPainter::TGLIsoPainter",
"Wrong type of histogramm, must have 3 dimensions");
404 static char mess[] = {
"iso" };
413 if (
fHist->GetDimension() < 3) {
414 Error(
"TGLIsoPainter::TGLIsoPainter",
"Wrong type of histogramm, must have 3 dimensions");
442 for (
UInt_t i = 0; i < nContours; ++i)
447 for (
UInt_t i = 0; i < nContours; ++i)
461 for (
UInt_t i = 0; i < nContours; ++i) {
462 if (firstMesh !=
fCache.end()) {
477 fIsos.back().Swap(newMesh);
528 py =
fCamera->GetHeight() - py;
570 Info(
"ProcessEvent",
"Cut box does not work in high color, please, switch to true color");
585 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%zx)->Paint()", (
size_t)
this));
596 glEnable(GL_LIGHTING);
598 glEnable(GL_DEPTH_TEST);
599 glDisable(GL_CULL_FACE);
600 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
608 glDisable(GL_LIGHTING);
609 glDisable(GL_LIGHT0);
610 glDisable(GL_DEPTH_TEST);
611 glDisable(GL_CULL_FACE);
612 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
628 Error(
"TGLIsoPainter::DrawPlot",
"Non-equal number of levels and isos");
638 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
639 glDepthMask(GL_FALSE);
645 for (; iso !=
fIsos.end(); ++iso, ++colorInd)
650 glDepthMask(GL_TRUE);
701 Float_t diffColor[] = {0.8f, 0.8f, 0.8f, 0.25f};
706 c->GetRGB(diffColor[0], diffColor[1], diffColor[2]);
709 diffColor[0] = color[0] / 255.;
710 diffColor[1] = color[1] / 255.;
711 diffColor[2] = color[2] / 255.;
714 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffColor);
715 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
716 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
717 diffColor[0] /= 3.5, diffColor[1] /= 3.5, diffColor[2] /= 3.5;
718 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, diffColor);
719 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 30.f);
735 }
else if (
typeid(*
fHist) ==
typeid(
TH3S)) {
738 }
else if (
typeid(*
fHist) ==
typeid(
TH3I)) {
741 }
else if (
typeid(*
fHist) ==
typeid(
TH3F)) {
744 }
else if (
typeid(*
fHist) ==
typeid(
TH3D)) {
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
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.
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.
Rgl::Mc::TIsoMesh< Float_t > Mesh_t
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).
Camera for TGLPlotPainter and sub-classes.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
void DrawSections() const
Draw sections (if any).
TGLPlotPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord, Bool_t xoySelectable, Bool_t xozSelectable, Bool_t yozSelectable)
TGLPlotPainter's ctor.
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
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.
3 component (x/y/z) vertex class.
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t GetDimension() const
@ kUserContour
User specified contour levels.
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.
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.