Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLScenePad.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Matevz Tadel, Jun 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TGLScenePad.h"
13
14#include "TGLViewer.h"
15#include "TGLLogicalShape.h"
16#include "TGLPhysicalShape.h"
17#include "TGLObject.h"
18#include "TGLStopwatch.h"
19#include "TBuffer3D.h"
20#include "TBuffer3DTypes.h"
21#include "TPolyMarker3D.h"
22#include "TColor.h"
23#include "TROOT.h"
24#include "TH3.h"
25
26#include "TGLFaceSet.h"
27#include "TGLPolyLine.h"
28#include "TGLPolyMarker.h"
29#include "TGLCylinder.h"
30#include "TGLSphere.h"
31
32#include "TVirtualPad.h"
33#include "TAtt3D.h"
34#include "TClass.h"
35#include "TList.h"
36#include "TMath.h"
37
38#include "TGLPlot3D.h"
39
40
41/** \class TGLScenePad
42\ingroup opengl
43Implements VirtualViewer3D interface and fills the base-class
44visualization structures from pad contents.
45*/
46
47
48////////////////////////////////////////////////////////////////////////////////
49
52 TGLScene(),
53
54 fPad (pad),
55 fInternalPIDs (kFALSE),
56 fNextInternalPID (1), // 0 reserved
57 fLastPID (0), // 0 reserved
58 fAcceptedPhysicals (0),
59 fComposite (nullptr),
60 fCSLevel (0),
61 fSmartRefresh (kFALSE)
62{
63 // Constructor.
64}
65
66
67/******************************************************************************/
68// Histo import and Sub-pad traversal
69/******************************************************************************/
70
71////////////////////////////////////////////////////////////////////////////////
72/// Scale and rotate a histo object to mimic placement in canvas.
73
75{
76 Double_t how = ((Double_t) gPad->GetWh()) / gPad->GetWw();
77
78 Double_t lw = gPad->GetAbsWNDC();
79 Double_t lh = gPad->GetAbsHNDC() * how;
81
82 const TGLBoundingBox& bb = log->BoundingBox();
83
84 // Timur always packs histos in a square: let's just take x-diff.
85 Double_t size = TMath::Sqrt(3) * (bb.XMax() - bb.XMin());
88
89 Double_t tx = gPad->GetAbsXlowNDC() + lw;
90 Double_t ty = gPad->GetAbsYlowNDC() * how + lh;
91 TGLVector3 transVec(0, ty, tx); // For viewer convention (starts looking along -x).
92
93 // XXXX plots no longer centered at 0. Or they never were?
94 // Impossible to translate and scale them as they should be, it
95 // seems. This requires further investigation, eventually.
96 //
97 // bb.Dump();
98 // printf("lm=%f, size=%f, scale=%f, tx=%f, ty=%f\n",
99 // lm, size, scale, tx, ty);
100 //
101 // TGLVector3 c(bb.Center().Arr());
102 // c.Negate();
103 // c.Dump();
104 // mat.Translate(c);
105
107 mat.Scale(scaleVec);
108 mat.Translate(transVec);
109 mat.RotateLF(3, 2, TMath::PiOver2());
110 mat.RotateLF(1, 3, TMath::DegToRad()*gPad->GetTheta());
111 mat.RotateLF(1, 2, TMath::DegToRad()*(gPad->GetPhi() - 90));
112 Float_t rgba[4] = {1.f, 1.f, 1.f, 1.f};
113 if (histoColor) {
114 rgba[0] = histoColor[0];
115 rgba[1] = histoColor[1];
116 rgba[2] = histoColor[2];
117 rgba[3] = histoColor[3];
118 }
121
122 // Part of XXXX above.
123 // phys->BoundingBox().Dump();
124}
125
126namespace {
127
128////////////////////////////////////////////////////////////////////////////////
129///TTree::Draw can create polymarker + empty TH3 (to draw as a frame around marker).
130///Unfortunately, this is not good for GL - this will be two unrelated
131///objects in two unrelated coordinate systems.
132///So, this function checks list contents, and if it founds empty TH3 and polymarker,
133///the must be combined as one object.
134///Later we'll reconsider the design.
135
137{
140
141 TObjOptLink *lnk = lst ? (TObjOptLink*)lst->FirstLink() : nullptr;
142 for (; lnk; lnk = (TObjOptLink*)lnk->Next()) {
143 const TObject *obj = lnk->GetObject();
144 if (const TH3 *th3 = dynamic_cast<const TH3*>(obj)) {
145 if(!th3->GetEntries())
147 } else if (dynamic_cast<const TPolyMarker3D *>(obj))
149 }
150
151 return gotMarker && gotEmptyTH3;
152}
153
154}
155
156
157
158////////////////////////////////////////////////////////////////////////////////
159/// Iterate over pad-primitives and import them.
160
162{
164 TVirtualViewer3D *vv3dsav = pad->GetViewer3D();
165 gPad = pad;
166 pad->SetViewer3D(this);
167
168 TList *prims = pad->GetListOfPrimitives();
169
172 } else {
173 TObjOptLink *lnk = (prims) ? (TObjOptLink*)prims->FirstLink() : nullptr;
174 for (; lnk; lnk = (TObjOptLink*)lnk->Next())
175 ObjectPaint(lnk->GetObject(), lnk->GetOption());
176 }
177
178 pad->SetViewer3D(vv3dsav);
179 gPad = padsav;
180}
181
182
183////////////////////////////////////////////////////////////////////////////////
184/// Override of virtual TVirtualViewer3D::ObjectPaint().
185/// Special handling of 2D/3D histograms to activate Timur's
186/// histo-painters.
187
189{
190 TGLPlot3D* log = TGLPlot3D::CreatePlot(obj, opt, gPad);
191 if (log)
192 {
193 AdoptLogical(*log);
194 AddHistoPhysical(log);
195 }
196 else if (obj->InheritsFrom(TAtt3D::Class()))
197 {
198 // Handle 3D primitives here.
199 obj->Paint(opt);
200 }
201 else if (obj->InheritsFrom(TVirtualPad::Class()))
202 {
203 SubPadPaint(dynamic_cast<TVirtualPad*>(obj));
204 }
205 else
206 {
207 // Handle 2D primitives here.
208 obj->Paint(opt);
209 }
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Entry point for requesting update of scene's contents from
214/// gl-viewer.
215
217{
219 fSmartRefresh = viewer->GetSmartRefresh();
220
221 PadPaint(fPad);
222
223 fSmartRefresh = sr;
224}
225
226////////////////////////////////////////////////////////////////////////////////
227/// Entry point for updating scene contents via VirtualViewer3D
228/// interface.
229/// For now this is handled by TGLViewer as it remains
230/// the 'Viewer3D' of given pad.
231
233{
234 if (pad != fPad)
235 {
236 Error("TGLScenePad::PadPaint", "Mismatch between pad argument and data-member!");
237 return;
238 }
239
240 BeginScene();
242 EndScene();
243}
244
245
246//==============================================================================
247// VV3D
248//==============================================================================
249
250////////////////////////////////////////////////////////////////////////////////
251/// Start building of the scene.
252/// Old contents is dropped, unless smart-refresh is in active. Then
253/// the object supporting it are kept in a cache and possibly reused.
254///
255/// TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
256/// for description of viewer architecture.
257
259{
260 if (gDebug>2) {
261 Info("TGLScenePad::BeginScene", "entering.");
262 }
263
264 if ( ! BeginUpdate()) {
265 Error("TGLScenePad::BeginScene", "could not take scene lock.");
266 return;
267 }
268
271
273 if (gDebug > 2) {
274 stopwatch.Start();
275 }
276
277 // Rebuilds can potentially invalidate all logical and
278 // physical shapes.
279 // Physicals must be removed first.
281 if (fSmartRefresh) {
283 } else {
285 }
286
287 // Potentially using external physical IDs
289
290 // Reset internal physical ID counter
292 fLastPID = 0;
293
294 // Reset tracing info
296
297 if (gDebug > 2) {
298 Info("TGLScenePad::BeginScene", "destroyed %d physicals %d logicals in %f msec",
300 DumpMapSizes();
301 }
302}
303
304////////////////////////////////////////////////////////////////////////////////
305/// End building of the scene.
306/// TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
307/// for description of viewer architecture
308
310{
311 if (fSmartRefresh) {
313 }
314
315 EndUpdate();
316
317 if (gDebug > 2) {
318 Info("TGLScenePad::EndScene", "Accepted %d physicals", fAcceptedPhysicals);
319 DumpMapSizes();
320 }
321}
322
323////////////////////////////////////////////////////////////////////////////////
324/// Add an object to the viewer, using internal physical IDs
325/// TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
326/// for description of viewer architecture
327
329{
330 // If this is called we are generating internal physical IDs
332 Int_t sections = AddObject(fNextInternalPID, buffer, addChildren);
333 return sections;
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Add an object to the scene, using an external physical ID
338/// TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
339/// for description of viewer architecture
340
342{
343 // TODO: Break this up and make easier to understand. This is
344 // pretty convoluted due to the large number of cases it has to
345 // deal with:
346 // i) existing physical and/or logical;
347 // ii) external provider may or may not supply bounding box;
348 // iii) local/global reference frame;
349 // iv) deferred filling of some sections of the buffer;
350 // v) internal or external physical IDs;
351 // vi) composite components as special case.
352 //
353 // The buffer filling means the function is re-entrant which adds
354 // to complication.
355
356 if (physicalID == 0) {
357 Error("TGLScenePad::AddObject", "0 physical ID reserved");
358 return TBuffer3D::kNone;
359 }
360
361 // Internal and external physical IDs cannot be mixed in a scene build
363 Error("TGLScenePad::AddObject", "invalid next physical ID - mix of internal + external IDs?");
364 return TBuffer3D::kNone;
365 }
366
367 // We always take all children ... interest is viewer dependent.
368 if (addChildren)
370
371 // Scene should be modify locked
372 if (CurrentLock() != kModifyLock) {
373 Error("TGLScenePad::AddObject", "expected scene to be modify-locked.");
374 return TBuffer3D::kNone;
375 }
376
377 // Note that 'object' here is really a physical/logical pair described
378 // in buffer + physical ID.
379
380 // If adding component to a current partial composite do this now
381 if (fComposite) {
382 RootCsg::TBaseMesh *newMesh = RootCsg::ConvertToMesh(buffer);
383 // Solaris CC can't create stl pair with enumerate type
384 fCSTokens.push_back(std::make_pair(static_cast<UInt_t>(TBuffer3D::kCSNoOp), newMesh));
385 return TBuffer3D::kNone;
386 }
387
388 // TODO: Could be a data member - save possible double lookup?
390 TGLLogicalShape *logical = nullptr;
391
392 // If we have a valid (non-zero) ID, see if the logical is already cached.
393 // If it is not, try to create a direct renderer object.
394 if (buffer.fID)
395 {
396 logical = FindLogical(buffer.fID);
397 if (!logical)
399 }
400
401 // First attempt to add this physical.
402 if (physicalID != fLastPID)
403 {
404 // Existing physical.
405 // MT comment: I don't think this should ever happen.
406 if (physical)
407 {
408 // If we have physical we should have logical cached, too.
409 if (!logical) {
410 Error("TGLScenePad::AddObject", "cached physical with no associated cached logical");
411 }
412
413 // Since we already have logical no need for further checks.
414 // Done ... prepare for next object.
415 if (fInternalPIDs)
417
418 return TBuffer3D::kNone;
419 }
420
421 // Need any extra sections in buffer?
422 Bool_t includeRaw = (logical == nullptr);
425 return extraSections;
426
428 }
429
430 if (fLastPID != physicalID) {
431 Error("TGLScenePad::AddObject", "internal physical ID tracking error?");
432 }
433
434 // Being here means we need to add a physical, maybe logical as well.
435 if (physical) {
436 Error("TGLScenePad::AddObject", "expecting to require physical");
437 return TBuffer3D::kNone;
438 }
439
440 // Create logical if required.
441 if (!logical)
442 {
443 logical = CreateNewLogical(buffer);
444 if (!logical) {
445 Error("TGLScenePad::AddObject", "failed to create logical");
446 return TBuffer3D::kNone;
447 }
448 // Add logical to scene
450 }
451
452 // Create the physical, bind it to the logical and add it to the scene.
454
455 if (physical)
456 {
458 buffer.fPhysicalID = physicalID;
460 if (gDebug>3 && fAcceptedPhysicals%1000 == 0) {
461 Info("TGLScenePad::AddObject", "added %d physicals", fAcceptedPhysicals);
462 }
463 }
464 else
465 {
466 Error("TGLScenePad::AddObject", "failed to create physical");
467 }
468
469 // Done ... prepare for next object.
470 if (fInternalPIDs)
472
473 return TBuffer3D::kNone;
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Open new composite container.
478/// TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
479/// for description of viewer architecture.
480
482{
483 if (fComposite) {
484 Error("TGLScenePad::OpenComposite", "composite already open");
485 return kFALSE;
486 }
489 Error("TGLScenePad::OpenComposite", "expected top level composite to not require extra buffer sections");
490 }
491
492 // If composite was created it is of interest - we want the rest of the
493 // child components
494 if (fComposite) {
495 return kTRUE;
496 } else {
497 return kFALSE;
498 }
499}
500
501////////////////////////////////////////////////////////////////////////////////
502/// Close composite container
503/// TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
504/// for description of viewer architecture
505
507{
508 // If we have a partially complete composite build it now
509 if (fComposite) {
510 // TODO: Why is this member and here - only used in BuildComposite()
511 fCSLevel = 0;
512
513 RootCsg::TBaseMesh *resultMesh = BuildComposite();
515 delete resultMesh;
516 for (UInt_t i = 0; i < fCSTokens.size(); ++i) delete fCSTokens[i].second;
517 fCSTokens.clear();
518 fComposite = nullptr;
519 }
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// Add composite operation used to combine objects added via AddObject
524/// TVirtualViewer3D interface overload - see base/src/TVirtualViewer3D.cxx
525/// for description of viewer architecture
526
528{
529 fCSTokens.push_back(std::make_pair(operation, (RootCsg::TBaseMesh *)nullptr));
530}
531
532
533// Protected methods
534
535////////////////////////////////////////////////////////////////////////////////
536/// Validate if the passed 'buffer' contains all sections we require to add object.
537/// Returns Int_t combination of TBuffer::ESection flags still required - or
538/// TBuffer3D::kNone if buffer is valid.
539/// If 'includeRaw' is kTRUE check for kRaw/kRawSizes - skip otherwise.
540/// See base/src/TVirtualViewer3D.cxx for description of viewer architecture
541
543{
544 // kCore: Should always be filled
545 if (!buffer.SectionsValid(TBuffer3D::kCore)) {
546 Error("TGLScenePad::ValidateObjectBuffer", "kCore section of buffer should be filled always");
547 return TBuffer3D::kNone;
548 }
549
550 // Need to check raw (kRaw/kRawSizes)?
551 if (!includeRaw) {
552 return TBuffer3D::kNone;
553 }
554
555 // kRawSizes / kRaw: These are on demand based on shape type
557
558 // We need raw tesselation in these cases:
559 //
560 // 1. Shape type is NOT kSphere / kTube / kTubeSeg / kCutTube / kComposite
561 if (buffer.Type() != TBuffer3DTypes::kSphere &&
562 buffer.Type() != TBuffer3DTypes::kTube &&
563 buffer.Type() != TBuffer3DTypes::kTubeSeg &&
564 buffer.Type() != TBuffer3DTypes::kCutTube &&
566 {
567 needRaw = kTRUE;
568 }
569 // 2. Sphere type is kSPHE, but the sphere is hollow and/or cut - we
570 // do not support native drawing of these currently
571 else if (buffer.Type() == TBuffer3DTypes::kSphere)
572 {
573 const TBuffer3DSphere * sphereBuffer = dynamic_cast<const TBuffer3DSphere *>(&buffer);
574 if (sphereBuffer) {
575 if (!sphereBuffer->IsSolidUncut()) {
576 needRaw = kTRUE;
577 }
578 } else {
579 Error("TGLScenePad::ValidateObjectBuffer", "failed to cast buffer of type 'kSphere' to TBuffer3DSphere");
580 return TBuffer3D::kNone;
581 }
582 }
583 // 3. kBoundingBox is not filled - we generate a bounding box from
584 else if (!buffer.SectionsValid(TBuffer3D::kBoundingBox))
585 {
586 needRaw = kTRUE;
587 }
588 // 4. kShapeSpecific is not filled - except in case of top level composite
589 else if (!buffer.SectionsValid(TBuffer3D::kShapeSpecific) &&
591 {
592 needRaw = kTRUE;
593 }
594 // 5. We are a component (not the top level) of a composite shape
595 else if (fComposite)
596 {
597 needRaw = kTRUE;
598 }
599 // 6. The shape is scaled
600 else if (buffer.fScaled)
601 {
602 needRaw = kTRUE;
603 }
604
607 } else {
608 return TBuffer3D::kNone;
609 }
610}
611
612////////////////////////////////////////////////////////////////////////////////
613/// Create and return a new TGLLogicalShape from the supplied buffer
614
616{
617 TGLLogicalShape * newLogical = nullptr;
618
619 if (buffer.fColor == 1) // black -> light-brown; std behaviour for geom
620 const_cast<TBuffer3D&>(buffer).fColor = 42;
621
622 switch (buffer.Type())
623 {
625 newLogical = new TGLPolyLine(buffer);
626 break;
628 newLogical = new TGLPolyMarker(buffer);
629 break;
631 {
632 const TBuffer3DSphere * sphereBuffer = dynamic_cast<const TBuffer3DSphere *>(&buffer);
633 if (sphereBuffer)
634 {
635 // We can only draw solid uncut spheres natively at present.
636 // If somebody already passed the raw buffer, they probably want us to use it.
637 if (sphereBuffer->IsSolidUncut() && !buffer.SectionsValid(TBuffer3D::kRawSizes|TBuffer3D::kRaw))
638 {
640 } else {
641 newLogical = new TGLFaceSet(buffer);
642 }
643 } else {
644 Error("TGLScenePad::CreateNewLogical", "failed to cast buffer of type 'kSphere' to TBuffer3DSphere");
645 }
646 break;
647 }
651 {
652 const TBuffer3DTube * tubeBuffer = dynamic_cast<const TBuffer3DTube *>(&buffer);
653 if (tubeBuffer)
654 {
655 // If somebody already passed the raw buffer, they probably want us to use it.
658 } else {
659 newLogical = new TGLFaceSet(buffer);
660 }
661 } else {
662 Error("TGLScenePad::CreateNewLogical", "failed to cast buffer of type 'kTube/kTubeSeg/kCutTube' to TBuffer3DTube");
663 }
664 break;
665 }
667 {
668 // Create empty faceset and record partial complete composite object
669 // Will be populated with mesh in CloseComposite()
670 if (fComposite)
671 {
672 Error("TGLScenePad::CreateNewLogical", "composite already open");
673 }
674 fComposite = new TGLFaceSet(buffer);
676 break;
677 }
678 default:
679 newLogical = new TGLFaceSet(buffer);
680 break;
681 }
682
683 return newLogical;
684}
685
686////////////////////////////////////////////////////////////////////////////////
687/// Create and return a new TGLPhysicalShape with id 'ID', using
688/// 'buffer' placement information (translation etc), and bound to
689/// suppled 'logical'
690
693 const TGLLogicalShape& logical) const
694{
695 // Extract indexed color from buffer
696 // TODO: Still required? Better use proper color triplet in buffer?
697 Int_t colorIndex = buffer.fColor;
698 if (colorIndex < 0) colorIndex = 42;
699 Float_t rgba[4];
701 return new TGLPhysicalShape(ID, logical, buffer.fLocalMaster,
702 buffer.fReflection, rgba);
703}
704
705
706////////////////////////////////////////////////////////////////////////////////
707
709{
710 TPolyMarker3D *pm = nullptr;
711 TH3 *th3 = nullptr;
712 TObjOptLink *lnk = (TObjOptLink*)lst->FirstLink();
713 for (; lnk; lnk = (TObjOptLink*)lnk->Next()) {
714 TObject *obj = lnk->GetObject();
715 if (TPolyMarker3D *dPm = dynamic_cast<TPolyMarker3D*>(obj)) {
716 if(!pm)
717 pm = dPm;
718 } else if (TH3 *dTH3 = dynamic_cast<TH3*>(obj)) {
719 if(!th3 && !dTH3->GetEntries())
720 th3 = dTH3;
721 } else
722 ObjectPaint(obj, lnk->GetOption());
723
724 if (pm && th3) {
725 //Create a new TH3 plot, containing polymarker.
727 AdoptLogical(*log);
728 //Try to extract polymarker's color and
729 //create a physical shape with correct color.
730 const Color_t cInd = pm->GetMarkerColor();
731 if (TColor *c = gROOT->GetColor(cInd)) {
732 Float_t rgba[4] = {0.f, 0.f, 0.f, 1.};
733 c->GetRGB(rgba[0], rgba[1], rgba[2]);
735 } else
736 AddHistoPhysical(log);
737
738 //Composition was added into gl-viewer.
739 pm = nullptr;
740 th3 = nullptr;
741 }
742 }
743}
744
745////////////////////////////////////////////////////////////////////////////////
746/// Build and return composite shape mesh
747
748RootCsg::TBaseMesh* TGLScenePad::BuildComposite()
749{
751 UInt_t opCode = currToken.first;
752
753 if (opCode != TBuffer3D::kCSNoOp) {
754 ++fCSLevel;
755 RootCsg::TBaseMesh *left = BuildComposite();
756 RootCsg::TBaseMesh *right = BuildComposite();
757 //RootCsg::TBaseMesh *result = 0;
758 switch (opCode) {
760 return RootCsg::BuildUnion(left, right);
762 return RootCsg::BuildIntersection(left, right);
764 return RootCsg::BuildDifference(left, right);
765 default:
766 Error("BuildComposite", "Wrong operation code %d\n", opCode);
767 return nullptr;
768 }
769 } else return fCSTokens[fCSLevel++].second;
770}
771
772////////////////////////////////////////////////////////////////////////////////
773/// Try to construct an appropriate logical-shape sub-class based
774/// on id'class, following convention that SomeClassGL is a suitable
775/// renderer for class SomeClass.
776
778{
779 TClass* cls = TGLObject::GetGLRenderer(id->IsA());
780 if (cls == nullptr)
781 return nullptr;
782
783 TGLObject* rnr = reinterpret_cast<TGLObject*>(cls->New());
784 if (rnr) {
785 Bool_t status;
786 try
787 {
788 status = rnr->SetModel(id);
789 }
790 catch (std::exception&)
791 {
792 status = kFALSE;
793 }
794 if (!status)
795 {
796 Warning("TGLScenePad::AttemptDirectRenderer", "failed initializing direct rendering.");
797 delete rnr;
798 return nullptr;
799 }
800 rnr->SetBBox();
802 }
803 return rnr;
804}
#define c(i)
Definition RSha256.hxx:101
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
short Color_t
Color number (short)
Definition RtypesCore.h:99
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
Definition TROOT.cxx:627
#define gROOT
Definition TROOT.h:411
#define gPad
static TClass * Class()
Sphere description class - see TBuffer3DTypes for producer classes Supports hollow and cut spheres.
Definition TBuffer3D.h:130
Complete tube description class - see TBuffer3DTypes for producer classes.
Definition TBuffer3D.h:157
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Int_t Type() const
Definition TBuffer3D.h:85
Bool_t SectionsValid(UInt_t mask) const
Definition TBuffer3D.h:67
@ kBoundingBox
Definition TBuffer3D.h:51
@ kShapeSpecific
Definition TBuffer3D.h:52
@ kCSDifference
Definition TBuffer3D.h:43
@ kCSIntersection
Definition TBuffer3D.h:43
Double_t fLocalMaster[16]
Definition TBuffer3D.h:93
Bool_t fScaled
Definition TBuffer3D.h:92
Int_t fColor
Definition TBuffer3D.h:88
UInt_t fPhysicalID
Definition TBuffer3D.h:119
Short_t fTransparency
Definition TBuffer3D.h:89
Bool_t fReflection
Definition TBuffer3D.h:91
TObject * fID
Definition TBuffer3D.h:87
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
The color creation and management class.
Definition TColor.h:22
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
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.
Definition TGLCylinder.h:22
Implements a native ROOT-GL representation of an arbitrary set of polygons.
Definition TGLFaceSet.h:23
void SetFromMesh(const RootCsg::TBaseMesh *m)
Should only be done on an empty faceset object.
ELock CurrentLock() const
Definition TGLLockable.h:61
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
16 component (4x4) transform matrix - column MAJOR as per GL.
Definition TGLUtil.h:598
Base-class for direct OpenGL renderers.
Definition TGLObject.h:22
static TClass * GetGLRenderer(TClass *isa)
Return direct-rendering GL class for class isa.
Concrete physical shape - a GL drawable.
Description of TGLPlot3D.
Definition TGLPlot3D.h:23
static TGLPlot3D * CreatePlot(TH3 *h, TPolyMarker3D *pm)
Create GL plot for specified TH3 and polymarker.
Definition TGLPlot3D.cxx:86
To draw a 3D polyline in a GL window.
Definition TGLPolyLine.h:24
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
Definition TGLScenePad.h:56
std::vector< CSPart_t > fCSTokens
Definition TGLScenePad.h:51
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
Definition TGLScenePad.h:36
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
next internal physical ID (from 1 - 0 reserved)
Definition TGLScenePad.h:38
Int_t ValidateObjectBuffer(const TBuffer3D &buffer, Bool_t includeRaw) const
Validate if the passed 'buffer' contains all sections we require to add object.
Int_t fAcceptedPhysicals
last physical ID that was processed in AddObject()
Definition TGLScenePad.h:39
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...
TVirtualPad * fPad
Definition TGLScenePad.h:33
TGLFaceSet * fComposite
Definition TGLScenePad.h:49
UInt_t fCSLevel
Paritally created composite.
Definition TGLScenePad.h:50
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
Definition TGLScenePad.h:48
UInt_t fNextInternalPID
using internal physical IDs
Definition TGLScenePad.h:37
TGLScene provides management and rendering of ROOT's default 3D /object representation as logical and...
Definition TGLScene.h:29
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.
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.
Definition TGLSphere.h:22
Stopwatch object for timing GL work.
3 component (x/y/z) vector class.
Definition TGLUtil.h:248
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
The 3-D histogram classes derived from the 1-D histogram classes.
Definition TH3.h:40
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1057
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
Definition TObject.cxx:625
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:1045
A 3D polymarker.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
static TClass * Class()
Abstract 3D shapes viewer.
constexpr Double_t PiOver2()
Definition TMath.h:54
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Definition TMath.h:82
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:199
auto * th3
Definition textalign.C:22