23#include "TGLIncludes.h"
42 fNContours(kNContours)
68 Info(
"TGL5DPainter::AddSurface",
"Building the mesh ...");
79 Info(
"TGL5DPainter::AddSurface",
"Mesh has %d vertices",
Int_t(mesh.
fVerts.size() / 3));
86 fIsos.front().fMesh.Swap(mesh);
88 fIsos.front().fRange = range;
91 fIsos.front().fColor = ci;
119 if (surf ==
fIsos.end()) {
120 Error(
"TGL5DPainter::RemoveSurface",
"Invalid iterator, surface does not exist.");
132 static char mess[] = {
"gl5d"};
166 const Double_t min = isString ? v4R.first : mean - 3 * rms;
172 Info(
"InitGeometry",
"min = %g, mean = %g, rms = %g, dx = %g", min, mean, rms,
d);
176 Info(
"TGL5DPainter::InitGeometry",
"Iso-level %g, range is %g ...", isoLevel, range);
177 const Color_t color = j * 6 + 1;
178 AddSurface(isoLevel, color, 0.125, 0.05, range);
252 Info(
"ProcessEvent",
"Cut box does not work in high color, please, switch to true color");
262 gROOT->ProcessLineFast(
Form(
"((TGLPlotPainter *)0x%lx)->Paint()", (
ULong_t)
this));
280 Warning(
"SetAlpha",
"Alpha is not required for string data (your 4-th dimension is string).");
289 Warning(
"SetNContours",
"Bad number of contours: %d",
n);
317 Info(
"TGL5DPainter::ResetGeometryRanges",
"Building the mesh ...");
324 Mesh_t &mesh = surf->fMesh;
331 Info(
"TGL5DPainter::AddSurface",
"Mesh has %d vertices",
Int_t(mesh.
fVerts.size() / 3));
342 return fIsos.begin();
358 glEnable(GL_LIGHTING);
360 glEnable(GL_DEPTH_TEST);
361 glDisable(GL_CULL_FACE);
362 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_TRUE);
370 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,
GL_FALSE);
371 glDisable(GL_CULL_FACE);
372 glDisable(GL_DEPTH_TEST);
373 glDisable(GL_LIGHT0);
374 glDisable(GL_LIGHTING);
396 if (it->fAlpha != 100) {
397 needSecondPass =
kTRUE;
402 glEnable(GL_POLYGON_OFFSET_FILL);
403 glPolygonOffset(1.f, 1.f);
405 glDisable(GL_POLYGON_OFFSET_FILL);
410 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
411 glColor4d(1., 0.4, 0., 0.5);
416 if (needSecondPass) {
418 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
422 if (it->fAlpha == 100)
427 glEnable(GL_POLYGON_OFFSET_FILL);
428 glPolygonOffset(1.f, 1.f);
430 glDisable(GL_POLYGON_OFFSET_FILL);
434 glColor4d(1., 0.4, 0., it->fAlpha / 150.);
452 Float_t rgba[] = {0.f, 0.f, 0.f,
static_cast<Float_t>(it->fAlpha / 100.)};
455 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, rgba);
456 const Float_t specColor[] = {1.f, 1.f, 1.f, 1.f};
457 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
458 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.f);
469 glColor3d(0.4, 0., 1.);
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.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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.
void SelectPoints(Double_t v4Level, Double_t range)
"Select" sub-range from source data
UInt_t SelectedSize() const
Size of selected sub-range.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
void SetSurfaceColor(ConstSurfIter_t surf) const
Set the color for iso-surface.
void DrawMesh(ConstSurfIter_t surf) const
Draw one iso-surface.
void SetNContours(Int_t num)
Set the number of predefined contours.
void ResetGeometryRanges()
No need to create or delete meshes, number of meshes (iso-levels) are the same, but meshes must be re...
SurfList_t::iterator SurfIter_t
SurfIter_t SurfacesBegin()
std::list::begin.
void RemoveSurface(SurfIter_t surf)
Remove iso-surface.
Rgl::Mc::TMeshBuilder< TKDEFGT, Float_t > fMeshBuilder
SurfIter_t SurfacesEnd()
std::list::end.
char * GetPlotInfo(Int_t px, Int_t py)
Return info for plot part under cursor.
void DeInitGL() const
Return some gl states to original values.
void SetAlpha(Double_t newAlpha)
Set selection range parameter.
void DrawCloud() const
Draw full cloud of points.
SurfIter_t AddSurface(Double_t v4, Color_t ci, Double_t isoVal=1., Double_t sigma=1., Double_t range=1e-3, Int_t lowNumOfPoints=kNLowPts)
Try to add new iso-surface.
SurfList_t::const_iterator ConstSurfIter_t
void AddOption(const TString &option)
No additional options for TGL5DPainter.
void DrawSubCloud(Double_t v4, Double_t range, Color_t ci) const
Draw cloud for selected iso-surface.
void Pan(Int_t px, Int_t py)
Mouse events handler.
void DrawPlot() const
Draw a set of meshes.
TGL5DPainter(TGL5DDataSet *data, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
std::vector< Double_t >::size_type size_type
void ProcessEvent(Int_t event, Int_t px, Int_t py)
void InitGL() const
Initialize OpenGL state variables.
Bool_t InitGeometry()
Create mesh.
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.
void ResetBoxGeometry()
Set geometry using plot's back box.
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.
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,...
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
void BuildModel(const std::vector< Double_t > &sources, Double_t sigma=1., UInt_t dim=3, UInt_t p=8, UInt_t k=0)
Calculate coefficients for FGT.
void ExtractRGBA(Color_t colorIndex, Float_t *rgba)
void ObjectIDToColor(Int_t objectID, Bool_t highColor)
Object id encoded as rgb triplet.
std::pair< Double_t, Double_t > Range_t
void DrawMesh(const std::vector< Float_t > &vs, const std::vector< Float_t > &ns, const std::vector< UInt_t > &ts)
Call function-template.
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Return the weighted mean of an array a with length n.
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
Return the Standard Deviation of an array a with length n.