112 Float_t rgba[4] = {1.f, 1.f, 1.f, 1.f};
114 rgba[0] = histoColor[0];
115 rgba[1] = histoColor[1];
116 rgba[2] = histoColor[2];
117 rgba[3] = histoColor[3];
144 if (
const TH3 *
th3 =
dynamic_cast<const TH3*
>(obj)) {
145 if(!
th3->GetEntries())
151 return gotMarker && gotEmptyTH3;
170 if (HasPolymarkerAndFrame(prims)) {
236 Error(
"TGLScenePad::PadPaint",
"Mismatch between pad argument and data-member!");
261 Info(
"TGLScenePad::BeginScene",
"entering.");
265 Error(
"TGLScenePad::BeginScene",
"could not take scene lock.");
269 UInt_t destroyedLogicals = 0;
270 UInt_t destroyedPhysicals = 0;
298 Info(
"TGLScenePad::BeginScene",
"destroyed %d physicals %d logicals in %f msec",
299 destroyedPhysicals, destroyedLogicals, stopwatch.
End());
356 if (physicalID == 0) {
357 Error(
"TGLScenePad::AddObject",
"0 physical ID reserved");
363 Error(
"TGLScenePad::AddObject",
"invalid next physical ID - mix of internal + external IDs?");
369 *addChildren =
kTRUE;
373 Error(
"TGLScenePad::AddObject",
"expected scene to be modify-locked.");
382 RootCsg::TBaseMesh *newMesh = RootCsg::ConvertToMesh(buffer);
410 Error(
"TGLScenePad::AddObject",
"cached physical with no associated cached logical");
422 Bool_t includeRaw = (logical ==
nullptr);
425 return extraSections;
431 Error(
"TGLScenePad::AddObject",
"internal physical ID tracking error?");
436 Error(
"TGLScenePad::AddObject",
"expecting to require physical");
445 Error(
"TGLScenePad::AddObject",
"failed to create logical");
466 Error(
"TGLScenePad::AddObject",
"failed to create physical");
484 Error(
"TGLScenePad::OpenComposite",
"composite already open");
489 Error(
"TGLScenePad::OpenComposite",
"expected top level composite to not require extra buffer sections");
529 fCSTokens.push_back(std::make_pair(operation, (RootCsg::TBaseMesh *)
nullptr));
546 Error(
"TGLScenePad::ValidateObjectBuffer",
"kCore section of buffer should be filled always");
579 Error(
"TGLScenePad::ValidateObjectBuffer",
"failed to cast buffer of type 'kSphere' to TBuffer3DSphere");
620 const_cast<TBuffer3D&
>(buffer).fColor = 42;
622 switch (buffer.
Type())
639 newLogical =
new TGLSphere(*sphereBuffer);
644 Error(
"TGLScenePad::CreateNewLogical",
"failed to cast buffer of type 'kSphere' to TBuffer3DSphere");
662 Error(
"TGLScenePad::CreateNewLogical",
"failed to cast buffer of type 'kTube/kTubeSeg/kCutTube' to TBuffer3DTube");
672 Error(
"TGLScenePad::CreateNewLogical",
"composite already open");
698 if (colorIndex < 0) colorIndex = 42;
718 }
else if (
TH3 *dTH3 =
dynamic_cast<TH3*
>(obj)) {
719 if(!
th3 && !dTH3->GetEntries())
732 Float_t rgba[4] = {0.f, 0.f, 0.f, 1.};
733 c->GetRGB(rgba[0], rgba[1], rgba[2]);
751 UInt_t opCode = currToken.first;
760 return RootCsg::BuildUnion(left, right);
762 return RootCsg::BuildIntersection(left, right);
764 return RootCsg::BuildDifference(left, right);
766 Error(
"BuildComposite",
"Wrong operation code %d\n", opCode);
790 catch (std::exception&)
796 Warning(
"TGLScenePad::AttemptDirectRenderer",
"failed initializing direct rendering.");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
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.
short Color_t
Color number (short).
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
virtual Color_t GetMarkerColor() const
Return the marker color.
Sphere description class - see TBuffer3DTypes for producer classes Supports hollow and cut spheres.
Bool_t IsSolidUncut() const
Test if buffer represents a solid uncut sphere.
Complete tube description class - see TBuffer3DTypes for producer classes.
Generic 3D primitive description class.
Bool_t SectionsValid(UInt_t mask) const
Double_t fLocalMaster[16]
TClass instances represent classes, structs and namespaces in the ROOT type system.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
Implements a native ROOT-GL cylinder that can be rendered at different levels of detail.
Implements a native ROOT-GL representation of an arbitrary set of polygons.
ELock CurrentLock() const
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
16 component (4x4) transform matrix - column MAJOR as per GL.
void Scale(const TGLVector3 &scale)
Set matrix axis scales to 'scale'.
void RotateLF(Int_t i1, Int_t i2, Double_t amount)
Rotate in local frame.
void Translate(const TGLVector3 &vect)
Shift matrix translation components by 'vect' in parent frame.
Base-class for direct OpenGL renderers.
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr)=0
static TClass * GetGLRenderer(TClass *isa)
Return direct-rendering GL class for class isa.
Concrete physical shape - a GL drawable.
Description of TGLPlot3D.
static TGLPlot3D * CreatePlot(TH3 *h, TPolyMarker3D *pm)
Create GL plot for specified TH3 and polymarker.
To draw a 3D polyline in a GL window.
To draw a 3D polymarker in a GL window.
TGLLogicalShape * CreateNewLogical(const TBuffer3D &buffer) const
Create and return a new TGLLogicalShape from the supplied buffer.
Bool_t fSmartRefresh
! cache logicals during scene rebuilds
std::vector< CSPart_t > fCSTokens
RootCsg::TBaseMesh * BuildComposite()
Build and return composite shape mesh.
void EndScene() override
End building of the scene.
void CloseComposite() override
Close composite container TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D....
Bool_t OpenComposite(const TBuffer3D &buffer, Bool_t *addChildren=nullptr) override
Open new composite container.
Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=nullptr) override
Add an object to the viewer, using internal physical IDs TVirtualViewer3D interface overload - see ba...
void PadPaint(TVirtualPad *pad) override
Entry point for updating scene contents via VirtualViewer3D interface.
Bool_t fInternalPIDs
! using internal physical IDs
TGLPhysicalShape * CreateNewPhysical(UInt_t physicalID, const TBuffer3D &buffer, const TGLLogicalShape &logical) const
Create and return a new TGLPhysicalShape with id 'ID', using 'buffer' placement information (translat...
void BeginScene() override
Start building of the scene.
TGLLogicalShape * AttemptDirectRenderer(TObject *id)
Try to construct an appropriate logical-shape sub-class based on id'class, following convention that ...
virtual void PadPaintFromViewer(TGLViewer *viewer)
Entry point for requesting update of scene's contents from gl-viewer.
void SubPadPaint(TVirtualPad *pad)
Iterate over pad-primitives and import them.
UInt_t fLastPID
! last physical ID that was processed in AddObject()
Int_t ValidateObjectBuffer(const TBuffer3D &buffer, Bool_t includeRaw) const
Validate if the passed 'buffer' contains all sections we require to add object.
void ComposePolymarker(const TList *padPrimitives)
void ObjectPaint(TObject *obj, Option_t *opt="") override
Override of virtual TVirtualViewer3D::ObjectPaint().
void AddCompositeOp(UInt_t operation) override
Add composite operation used to combine objects added via AddObject TVirtualViewer3D interface overlo...
TGLFaceSet * fComposite
! Paritally created composite
void AddHistoPhysical(TGLLogicalShape *log, const Float_t *histColor=nullptr)
Scale and rotate a histo object to mimic placement in canvas.
TGLScenePad(const TGLScenePad &)=delete
std::pair< UInt_t, RootCsg::TBaseMesh * > CSPart_t
UInt_t fNextInternalPID
! next internal physical ID (from 1 - 0 reserved)
virtual TGLPhysicalShape * FindPhysical(UInt_t phid) const
Find and return physical shape identified by unique 'ID'.
virtual Bool_t BeginUpdate()
Put scene in update mode, return true if lock acquired.
virtual void AdoptPhysical(TGLPhysicalShape &shape)
Adopt dynamically created physical 'shape' - add to internal map and take responsibility for deleting...
virtual void EndUpdate(Bool_t minorChange=kTRUE, Bool_t sceneChanged=kTRUE, Bool_t updateViewers=kTRUE)
Exit scene update mode.
virtual Int_t DestroyPhysicals()
Destroy physical shapes.
virtual void AdoptLogical(TGLLogicalShape &shape)
Adopt dynamically created logical 'shape' - add to internal map and take responsibility for deleting.
void EndSmartRefresh()
Wipes logicals in refresh-cache.
TGLScene(const TGLScene &)=delete
static void RGBAFromColorIdx(Float_t rgba[4], Color_t ci, Char_t transp=0)
Fill rgba color from ROOT color-index ci and transparency (0->100).
virtual Int_t DestroyLogicals()
Destroy all logical shapes in scene.
void DumpMapSizes() const
Print sizes of logical and physical-shape maps.
TGLLogicalShape * FindLogical(TObject *logid) const override
Find and return logical shape identified by unique logid.
UInt_t BeginSmartRefresh()
Moves logicals that support smart-refresh to intermediate cache.
Implements a native ROOT-GL sphere that can be rendered at different levels of detail.
Stopwatch object for timing GL work.
void Start()
Start timing.
Double_t End()
End timing, return total time since Start(), in milliseconds.
3 component (x/y/z) vector class.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Bool_t GetSmartRefresh() const
The 3-D histogram classes derived from the 1-D histogram classes.
virtual TObjLink * FirstLink() const
TObject * GetObject() const
Option_t * GetOption() const override
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
TObject()
TObject constructor.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TList * GetListOfPrimitives() const =0
virtual TVirtualViewer3D * GetViewer3D(Option_t *type="")=0
virtual void SetViewer3D(TVirtualViewer3D *)
Abstract 3D shapes viewer.
constexpr Double_t PiOver2()
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.