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