Logo ROOT  
Reference Guide
TViewerX3D.cxx
Go to the documentation of this file.
1// @(#)root/x3d:$Id$
2// Author: Rene Brun 05/09/99
3/*************************************************************************
4 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
12// //
13// TViewerX3D //
14// //
15// C++ interface to the X3D viewer //
16// //
18
19#include "TViewerX3D.h"
20#include "X3DBuffer.h"
21#include "TVirtualPad.h"
22#include "TView.h"
23#include "TMath.h"
24#include "TROOT.h"
25#include "snprintf.h"
26
27#include "TRootHelpDialog.h"
28#include "TGClient.h"
29#include "TGCanvas.h"
30#include "TGMenu.h"
31#include "TGWidget.h"
32#include "TGMsgBox.h"
33#include "TVirtualX.h"
34
35#include "TBuffer3D.h"
36#include "TBuffer3DTypes.h"
37
38#include "HelpText.h"
39
40#include <cassert>
41
42const char gHelpX3DViewer[] = "\
43 PRESS \n\
44 \tw\t--- wireframe mode\n\
45 \te\t--- hidden line mode\n\
46 \tr\t--- hidden surface mode\n\
47 \tu\t--- move object down\n\
48 \ti\t--- move object up\n\
49 \to\t--- toggle controls style\n\
50 \ts\t--- toggle stereo display\n\
51 \td\t--- toggle blue stereo view\n\
52 \tf\t--- toggle double buffer\n\
53 \th\t--- move object right\n\
54 \tj\t--- move object forward\n\
55 \tk\t--- move object backward\n\
56 \tl\t--- move object left\n\
57 \tx a\t--- rotate about x\n\
58 \ty b\t--- rotate about y\n\
59 \tz c\t--- rotate about z\n\
60 \t1 2 3\t--- autorotate about x\n\
61 \t4 5 6\t--- autorotate about y\n\
62 \t7 8 9\t--- autorotate about z\n\
63 \t[ ] { }\t--- adjust focus\n\n\
64 HOLD the left mouse button and MOVE mouse to ROTATE object\n\n\
65";
66
67
68extern "C" {
69 Window_t x3d_main(Float_t *longitude, Float_t *latitude, Float_t *psi,
70 Option_t *option, Window_t parent);
71 void x3d_set_display(Display_t display);
73 void x3d_update();
74 void x3d_get_position(Float_t *longitude, Float_t *latitude, Float_t *psi);
75 int x3d_exec_command(int px, int py, char command);
76 void x3d_terminate();
77}
78
79
80// Canvas menu command ids
91
93
94
96// //
97// TX3DContainer //
98// //
99// Utility class used by TViewerX3D. The TX3DContainer is the frame //
100// embedded in the TGCanvas widget. The X3D graphics goes into this //
101// frame. This class is used to enable input events on this graphics //
102// frame and forward the events to X3D. //
103// //
105
107private:
108 TViewerX3D *fViewer; // pointer back to viewer imp
109public:
110 TX3DContainer(TViewerX3D *c, Window_t id, const TGWindow *parent);
111
113 { x3d_dispatch_event(gVirtualX->GetNativeEvent());
114 return fViewer->HandleContainerButton(ev); }
117 return x3d_dispatch_event(gVirtualX->GetNativeEvent()); }
119 { return x3d_dispatch_event(gVirtualX->GetNativeEvent()); }
121 { return x3d_dispatch_event(gVirtualX->GetNativeEvent()); }
123 { return x3d_dispatch_event(gVirtualX->GetNativeEvent()); }
125 { return x3d_dispatch_event(gVirtualX->GetNativeEvent()); }
126};
127
128
131
137
138
139
140
143
146 fCanvas(nullptr), fContainer(nullptr), fMenuBar(nullptr), fFileMenu(nullptr),
147 fHelpMenu(nullptr), fMenuBarLayout(nullptr), fMenuBarItemLayout(nullptr),
148 fMenuBarHelpLayout(nullptr), fCanvasLayout(nullptr),
150{
151 fMainFrame = new TX3DFrame(*this, gClient->GetRoot(), 800, 600);
152 fOption = "x3d";
153 fX3DWin = 0;
154 fWidth = 800;
155 fHeight = 600;
156 fXPos = 0;
157 fYPos = 0;
158 fTitle = "x3d";
159}
160
161
164
168 fCanvas(nullptr), fContainer(nullptr), fMenuBar(nullptr), fFileMenu(nullptr),
169 fHelpMenu(nullptr), fMenuBarLayout(nullptr), fMenuBarItemLayout(nullptr),
170 fMenuBarHelpLayout(nullptr), fCanvasLayout(nullptr),
172{
173 fMainFrame = new TX3DFrame(*this, gClient->GetRoot(), 800, 600);
174 fOption = option;
175 fX3DWin = 0;
176 fWidth = width;
177 fHeight = height;
178 fXPos = 0;
179 fYPos = 0;
180 fTitle = title;
181}
182
183
186
190 fCanvas(nullptr), fContainer(nullptr), fMenuBar(nullptr), fFileMenu(nullptr),
191 fHelpMenu(nullptr), fMenuBarLayout(nullptr), fMenuBarItemLayout(nullptr),
192 fMenuBarHelpLayout(nullptr), fCanvasLayout(nullptr),
194{
195 fMainFrame = new TX3DFrame(*this, gClient->GetRoot(), 800, 600);
196 fOption = option;
197 fX3DWin = 0;
198 fWidth = width;
199 fHeight = height;
200 fXPos = x;
201 fYPos = y;
202 fTitle = title;
203}
204
205
208
210{
211 if (!fPad) return;
212
213 if (fgCreated) {
215 }
216 delete fCanvasLayout;
217 delete fMenuBarHelpLayout;
218 delete fMenuBarItemLayout;
219 delete fMenuBarLayout;
220 delete fHelpMenu;
221 delete fFileMenu;
222 delete fMenuBar;
223 delete fContainer;
224 delete fCanvas;
225 delete fMainFrame;
227}
228
229
232
234{
235 assert(!fBuildingScene);
236 fPad->ReleaseViewer3D();
237 delete this;
238}
239
240
243
245{
246 // Create menus
247 fFileMenu = new TGPopupMenu(fMainFrame->GetClient()->GetRoot());
248 fFileMenu->AddEntry("&New Viewer", kFileNewViewer);
249 fFileMenu->AddSeparator();
250 fFileMenu->AddEntry("Save", kFileSave);
251 fFileMenu->AddEntry("Save As...", kFileSaveAs);
252 fFileMenu->AddSeparator();
253 fFileMenu->AddEntry("&Print...", kFilePrint);
254 fFileMenu->AddSeparator();
255 fFileMenu->AddEntry("&Close Viewer", kFileCloseViewer);
256
257 //fFileMenu->DefaultEntry(kFileNewViewer);
258 fFileMenu->DisableEntry(kFileNewViewer);
259 fFileMenu->DisableEntry(kFileSave);
260 fFileMenu->DisableEntry(kFileSaveAs);
261 fFileMenu->DisableEntry(kFilePrint);
262
263 fHelpMenu = new TGPopupMenu(fMainFrame->GetClient()->GetRoot());
264 fHelpMenu->AddEntry("&About ROOT...", kHelpAbout);
265 fHelpMenu->AddSeparator();
266 fHelpMenu->AddEntry("Help On X3D Viewer...", kHelpOnViewer);
267
268 // This main frame will process the menu commands
269 fFileMenu->Associate(fMainFrame);
270 fHelpMenu->Associate(fMainFrame);
271
272 // Create menubar layout hints
276
277 // Create menubar
279 fMenuBar->AddPopup("&File", fFileMenu, fMenuBarItemLayout);
280 fMenuBar->AddPopup("&Help", fHelpMenu, fMenuBarHelpLayout);
281
283
284 // Create canvas and canvas container that will host the ROOT graphics
285 fCanvas = new TGCanvas(fMainFrame, fMainFrame->GetWidth()+4, fMainFrame->GetHeight()+4,
288 if (!fX3DWin) {
289 fContainer = nullptr;
290 fCanvasLayout = nullptr;
291 return;
292 }
293 fContainer = new TX3DContainer(this, fX3DWin, fCanvas->GetViewPort());
294 fCanvas->SetContainer(fContainer);
296 fMainFrame->AddFrame(fCanvas, fCanvasLayout);
297
298 // Misc
299
300 fMainFrame->SetWindowName(name);
301 fMainFrame->SetIconName(name);
302 fMainFrame->SetClassHints("X3DViewer", "X3DViewer");
303
305
306 fMainFrame->MapSubwindows();
307
308 // we need to use GetDefaultSize() to initialize the layout algorithm...
309 fMainFrame->Resize(fMainFrame->GetDefaultSize());
310
311 fMainFrame->MoveResize(fXPos, fYPos, fWidth, fHeight);
312 fMainFrame->SetWMPosition(fXPos, fYPos);
314}
315
316
319
321{
322 TView *view = fPad->GetView();
323 if (!view) {
324 Error("InitX3DWindow", "view is not set");
325 return;
326 }
327
328 const Float_t kPI = Float_t (TMath::Pi());
329
330 Float_t longitude_rad = ( 90 + view->GetLongitude()) * kPI/180.0;
331 Float_t latitude_rad = (-90 + view->GetLatitude() ) * kPI/180.0;
332 Float_t psi_rad = ( view->GetPsi() ) * kPI/180.0;
333
334 // Call 'x3d' package
335 x3d_set_display(gVirtualX->GetDisplay());
336 fX3DWin = (Window_t) x3d_main(&longitude_rad, &latitude_rad, &psi_rad,
337 fOption.Data(), fCanvas->GetViewPort()->GetId());
338}
339
340
343
345{
346 if (fgCreated) {
347 return;
348 }
349
351
352 if (fPass == kSize) {
353 gSize3D.numPoints = 0;
354 gSize3D.numSegs = 0;
355 gSize3D.numPolys = 0;
356 }
357}
358
359
362
364{
365 if (fgCreated) {
366 return;
367 }
368
370
371 // Size pass done - and some points actually added
372 if (gSize3D.numPoints != 0) {
373 if (fPass == kSize) {
374 // Allocate the X3D viewer buffer with sizes if any
375 if (!AllocateX3DBuffer()) {
376 Error("InitX3DWindow", "x3d buffer allocation failure");
377 return;
378 }
379
380 // Enter draw pass and invoke another paint
381 fPass = kDraw;
382 fPad->Paint();
383 fPass = kSize;
385 Show();
386 }
387 } else {
388 Int_t retval;
389 new TGMsgBox(gClient->GetRoot(), gClient->GetRoot(),
390 "X3D Viewer", "Cannot display this content in the X3D viewer",
391 kMBIconExclamation, kMBOk, &retval);
392 Close();
393 }
394}
395
396
399
400Int_t TViewerX3D::AddObject(const TBuffer3D & buffer, Bool_t * addChildren)
401{
402 if (fgCreated) {
403 if (addChildren) {
404 *addChildren = kFALSE;
405 }
406 return TBuffer3D::kNone;
407 }
408 else if (addChildren) {
409 *addChildren = kTRUE;
410 }
411 // Ensure we have the required sections
413
414 // Sizing does not require actual raw tesselation information
415 if (fPass == kDraw) {
416 reqSections |= TBuffer3D::kRaw;
417 }
418
419 if (!buffer.SectionsValid(reqSections)) {
420 return reqSections;
421 }
422
423 if (buffer.Type() == TBuffer3DTypes::kMarker) {
424 PaintPolyMarker(buffer);
425 return TBuffer3D::kNone;
426 }
427
428 switch(fPass) {
429 case(kSize): {
430 gSize3D.numPoints += buffer.NbPnts();
431 gSize3D.numSegs += buffer.NbSegs();
432 gSize3D.numPolys += buffer.NbPols();
433 break;
434 }
435 case (kDraw): {
436 X3DBuffer *x3dBuff = new X3DBuffer;
437 x3dBuff->numPoints = buffer.NbPnts();
438 x3dBuff->numSegs = buffer.NbSegs();
439 x3dBuff->numPolys = buffer.NbPols();
440 x3dBuff->points = new Float_t[3*buffer.NbPnts()];
441 for (UInt_t i=0; i<3*buffer.NbPnts();i++)
442 x3dBuff->points[i] = (Float_t)buffer.fPnts[i];
443 x3dBuff->segs = buffer.fSegs;
444 x3dBuff->polys = buffer.fPols;
445 FillX3DBuffer(x3dBuff);
446 delete [] x3dBuff->points;
447 delete x3dBuff;
448 break;
449 }
450 default: {
451 assert(kFALSE);
452 break;
453 }
454 }
455
456 return TBuffer3D::kNone;
457}
458
459
462
463Int_t TViewerX3D::AddObject(UInt_t /* placedID */, const TBuffer3D & buffer, Bool_t * addChildren)
464{
465 return AddObject(buffer,addChildren);
466}
467
468
471
472void TViewerX3D::PaintPolyMarker(const TBuffer3D & buffer) const
473{
474 if (fgCreated) {
475 return;
476 }
477 UInt_t mode;
478
479 if (buffer.NbPnts() > 10000) mode = 1; // One line marker '-'
480 else if (buffer.NbPnts() > 3000) mode = 2; // Two lines marker '+'
481 else mode = 3; // Three lines marker '*'
482
483 switch(fPass) {
484 case(kSize): {
485 gSize3D.numPoints += 2*mode*buffer.NbPnts();
486 gSize3D.numSegs += mode*buffer.NbPnts();
487 break;
488 }
489 case (kDraw): {
490 X3DBuffer *x3dBuff = new X3DBuffer;
491 x3dBuff->numPoints = 2*mode*buffer.NbPnts();
492 x3dBuff->numSegs = mode*buffer.NbPnts();
493 x3dBuff->numPolys = 0;
494 x3dBuff->points = new Float_t[3*x3dBuff->numPoints];
495 x3dBuff->segs = new Int_t[3*x3dBuff->numSegs];
496 x3dBuff->polys = nullptr;
497
498 Double_t delta = 0.002;
499
500 for (UInt_t i = 0; i < buffer.NbPnts(); i++) {
501 for (UInt_t j = 0; j < mode; j++) {
502 for (UInt_t k = 0; k < 2; k++) {
503 delta *= -1;
504 for (UInt_t n = 0; n < 3; n++) {
505 x3dBuff->points[mode*6*i+6*j+3*k+n] =
506 buffer.fPnts[3*i+n] * (1 + (j == n ? delta : 0));
507 }
508 }
509 }
510 }
511
512 for (Int_t i=0; i<x3dBuff->numSegs; i++) {
513 x3dBuff->segs[3*i ] = buffer.fSegs[0];
514 x3dBuff->segs[3*i+1] = 2*i;
515 x3dBuff->segs[3*i+2] = 2*i+1;
516 }
517
518 FillX3DBuffer(x3dBuff);
519 delete [] x3dBuff->points;
520 delete [] x3dBuff->segs;
521 delete x3dBuff;
522 break;
523 }
524 }
525}
526
527
553
555{
556/*
557{
558 gSystem->Load("libX3d");
559 TCanvas *c1 = new TCanvas("c1");
560 TFile *f = new TFile("hsimple.root");
561 TTree *ntuple = (TTree*)f->Get("ntuple");
562 ntuple->SetMarkerColor(kYellow);
563 ntuple->Draw("px:py:pz");
564 TViewerX3D *x3d = new TViewerX3D(c1,"");
565 for (Int_t i=0;i<500;i++) {
566 Int_t px = i%500;
567 Int_t py = (2*i)%200;
568 x3d->ExecCommand(px,py,0); //rotate
569 if (i%20 >10) x3d->ExecCommand(px,py,'j'); //zoom
570 if (i%20 <10) x3d->ExecCommand(px,py,'k'); //unzoom
571 }
572}
573*/
574
575 return x3d_exec_command(px,py,command);
576}
577
578
581
582void TViewerX3D::GetPosition(Float_t &longitude, Float_t &latitude, Float_t &psi)
583{
584 x3d_get_position(&longitude, &latitude, &psi);
585}
586
589
594
595
598
600{
601 x3d_update();
602}
603
604
607
609{
610 TRootHelpDialog *hd;
611
612 switch (GET_MSG(msg)) {
613
614 case kC_COMMAND:
615
616 switch (GET_SUBMSG(msg)) {
617
618 case kCM_BUTTON:
619 case kCM_MENU:
620
621 switch (parm1) {
622 // Handle File menu items...
623 case kFileNewViewer:
624 if (fPad) fPad->GetViewer3D("x3d");
625 break;
626 case kFileSave:
627 case kFileSaveAs:
628 case kFilePrint:
629 break;
630 case kFileCloseViewer:
631 fMainFrame->SendCloseMessage();
632 break;
633
634 // Handle Help menu items...
635 case kHelpAbout:
636 {
637 char str[32];
638 snprintf(str,32, "About ROOT %s...", gROOT->GetVersion());
639 hd = new TRootHelpDialog(fMainFrame, str, 600, 400);
640 hd->SetText(gHelpAbout);
641 hd->Popup();
642 }
643 break;
644 case kHelpOnViewer:
645 hd = new TRootHelpDialog(fMainFrame, "Help on X3D Viewer...", 600, 400);
647 hd->Popup();
648 break;
649 }
650 default:
651 break;
652 }
653 default:
654 break;
655 }
656 return kTRUE;
657}
658
659
662
664{
665 // Currently disabled as only drawing into one view at a time
666 // Re-enalbe when multiple viewer implemented on pad
667 /*if (ev->fType == kButtonRelease) {
668 Float_t longitude_rad;
669 Float_t latitude_rad;
670 Float_t psi_rad;
671 const Float_t kPI = Float_t (TMath::Pi());
672
673 x3d_get_position(&longitude_rad, &latitude_rad, &psi_rad);
674
675 Int_t irep;
676
677 Float_t longitude_deg = longitude_rad * 180.0/kPI - 90;
678 Float_t latitude_deg = latitude_rad * 180.0/kPI + 90;
679 Float_t psi_deg = psi_rad * 180.0/kPI;
680
681 fPad->GetView()->SetView(longitude_deg, latitude_deg, psi_deg, irep);
682
683 fPad->SetPhi(-90 - longitude_deg);
684 fPad->SetTheta(90 - latitude_deg);
685
686 fPad->Modified(kTRUE);
687 fPad->Update();
688}*/
689 return kTRUE;
690}
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
Handle_t Display_t
Display handle.
Definition GuiTypes.h:27
@ kSunkenFrame
Definition GuiTypes.h:384
@ kDoubleBorder
Definition GuiTypes.h:386
@ kHorizontalFrame
Definition GuiTypes.h:383
ULongptr_t Handle_t
Generic resource handle.
Definition GuiTypes.h:26
R__EXTERN const char gHelpAbout[]
Definition HelpText.h:17
#define c(i)
Definition RSha256.hxx:101
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
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
constexpr Double_t kPI
Definition TEllipse.cxx:24
#define gClient
Definition TGClient.h:157
@ kMWMFuncAll
Definition TGFrame.h:49
@ kMWMDecorAll
Definition TGFrame.h:63
@ kMWMInputModeless
Definition TGFrame.h:57
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kMBOk
Definition TGMsgBox.h:33
@ kMBIconExclamation
Definition TGMsgBox.h:24
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t n
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:148
#define gROOT
Definition TROOT.h:417
void x3d_terminate()
Definition x3d.c:3318
const char gHelpX3DViewer[]
void x3d_set_display(Display_t display)
Definition x3d.c:3381
void x3d_update()
Definition x3d.c:3284
Window_t x3d_main(Float_t *longitude, Float_t *latitude, Float_t *psi, Option_t *option, Window_t parent)
EX3DViewerCommands
@ kFilePrint
@ kFileSaveAs
@ kHelpOnViewer
@ kFileCloseViewer
@ kFileNewViewer
@ kHelpAbout
@ kFileSave
int x3d_exec_command(int px, int py, char command)
Definition x3d.c:3386
void x3d_get_position(Float_t *longitude, Float_t *latitude, Float_t *psi)
Definition x3d.c:3308
int x3d_dispatch_event(Handle_t event)
Definition x3d.c:3294
#define gVirtualX
Definition TVirtualX.h:375
Int_t GET_MSG(Long_t val)
@ kCM_MENU
@ kC_COMMAND
@ kCM_BUTTON
Int_t GET_SUBMSG(Long_t val)
int AllocateX3DBuffer()
Definition X3DBuffer.c:27
struct _x3d_data_ X3DBuffer
#define gSize3D
Definition X3DBuffer.h:40
void FillX3DBuffer(X3DBuffer *buff)
Definition X3DBuffer.c:142
#define snprintf
Definition civetweb.c:1579
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Int_t Type() const
Definition TBuffer3D.h:94
Int_t * fPols
Definition TBuffer3D.h:124
UInt_t NbPols() const
Definition TBuffer3D.h:91
UInt_t NbPnts() const
Definition TBuffer3D.h:89
UInt_t NbSegs() const
Definition TBuffer3D.h:90
Bool_t SectionsValid(UInt_t mask) const
Definition TBuffer3D.h:76
Int_t * fSegs
Definition TBuffer3D.h:123
Double_t * fPnts
Definition TBuffer3D.h:122
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
TGCompositeFrame(const TGCompositeFrame &)=delete
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:435
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
This class creates a popup menu object.
Definition TGMenu.h:110
TGWindow(Window_t id)
Definition TGWindow.h:34
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1095
A TRootHelpDialog is used to display help text (or any text in a dialog window).
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
See TView3D.
Definition TView.h:25
Window_t fX3DWin
Definition TViewerX3D.h:43
Int_t fYPos
Definition TViewerX3D.h:56
TGCanvas * fCanvas
Definition TViewerX3D.h:44
void Update()
Update X3D viewer.
void Close()
Close X3D Viewer.
TGLayoutHints * fCanvasLayout
Definition TViewerX3D.h:52
TString fOption
Definition TViewerX3D.h:41
TGPopupMenu * fHelpMenu
Definition TViewerX3D.h:48
Int_t fXPos
Definition TViewerX3D.h:55
UInt_t fWidth
Definition TViewerX3D.h:53
friend class TX3DContainer
Definition TViewerX3D.h:37
TGPopupMenu * fFileMenu
Definition TViewerX3D.h:47
TString fTitle
Definition TViewerX3D.h:42
void InitX3DWindow()
Setup geometry and initialize X3D.
UInt_t fHeight
Definition TViewerX3D.h:54
TGMenuBar * fMenuBar
Definition TViewerX3D.h:46
TGLayoutHints * fMenuBarHelpLayout
Definition TViewerX3D.h:51
~TViewerX3D() override
Delete ROOT X3D viewer.
Bool_t HandleContainerButton(Event_t *ev)
After button release get current position and update associated pad.
TX3DContainer * fContainer
Definition TViewerX3D.h:45
static Bool_t fgCreated
Definition TViewerX3D.h:78
void GetPosition(Float_t &longitude, Float_t &latitude, Float_t &psi)
Get position.
TVirtualPad * fPad
Definition TViewerX3D.h:57
void CreateViewer(const char *name)
Create the actual canvas.
void EndScene() override
The x3d viewer cannot rebuild a scene once created.
EPass fPass
Definition TViewerX3D.h:70
Bool_t fBuildingScene
Definition TViewerX3D.h:58
void Show()
Definition TViewerX3D.h:91
void BeginScene() override
The x3d viewer cannot rebuild a scene once created.
TX3DFrame * fMainFrame
Definition TViewerX3D.h:40
void DeleteX3DWindow()
Close X3D window.
TGLayoutHints * fMenuBarItemLayout
Definition TViewerX3D.h:50
Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=nullptr) override
The x3d viewer cannot rebuild a scene once created.
Bool_t ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle menu and other command generated by the user.
TGLayoutHints * fMenuBarLayout
Definition TViewerX3D.h:49
TViewerX3D(TVirtualPad *pad)
Create ROOT X3D viewer.
Int_t ExecCommand(Int_t px, Int_t py, char command)
This function may be called from a script to animate an X3D picture px, py mouse position command = 0...
void PaintPolyMarker(const TBuffer3D &buffer) const
Paint 3D PolyMarker.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Abstract 3D shapes viewer.
Bool_t HandleExpose(Event_t *) override
TViewerX3D * fViewer
Bool_t HandleConfigureNotify(Event_t *ev) override
This event is generated when the frame is resized.
TX3DContainer(TViewerX3D *c, Window_t id, const TGWindow *parent)
Create a canvas container.
Bool_t HandleColormapChange(Event_t *) override
Bool_t HandleButton(Event_t *ev) override
Bool_t HandleMotion(Event_t *) override
Bool_t HandleKey(Event_t *) override
constexpr Double_t Pi()
Definition TMath.h:40
Event structure.
Definition GuiTypes.h:175
float * points
Definition X3DBuffer.h:19
int numSegs
Definition X3DBuffer.h:17
int numPolys
Definition X3DBuffer.h:18
int numPoints
Definition X3DBuffer.h:16
int * segs
Definition X3DBuffer.h:20
int * polys
Definition X3DBuffer.h:21
char title[80]
Definition x3d.c:915