Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TVirtualViewer3D.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Olivier Couet 05/10/2004
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 #ifndef ROOT_TVirtualViewer3D
13 #define ROOT_TVirtualViewer3D
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TVirtualViewer3D //
18 // //
19 // Abstract 3D shapes viewer. The concrete implementations are: //
20 // //
21 // TViewerX3D : X3d viewer //
22 // TViewerOpenGL: OpenGL viewer //
23 // TViewerPad3D : visualise the 3D scene in the current Pad //
24 // //
25 //////////////////////////////////////////////////////////////////////////
26 
27 #include "Rtypes.h"
28 
29 #include "TObject.h"
30 
31 #include "TAttFill.h"
32 
33 class TBuffer3D;
34 class TVirtualPad;
35 class TGLRect;
36 
37 class TVirtualViewer3D : public TObject
38 {
39 public:
40  virtual ~TVirtualViewer3D();
41 
42  // Viewers must always handle master (absolute) positions - and
43  // buffer producers must be able to supply them. Some viewers may
44  // prefer local frame & translation - and producers can optionally
45  // supply them
46  virtual Bool_t PreferLocalFrame() const = 0;
47 
48  // Viewers can implement their own loop over pad's primitive list.
49  virtual Bool_t CanLoopOnPrimitives() const { return kFALSE; }
50  // When they can, TPad::Paint() and TPad::PaintModified() simply
51  // call the following function:
52  virtual void PadPaint(TVirtualPad*) {}
53  virtual void ObjectPaint(TObject*, Option_t* = "") {}
54 
55  // Addition/removal of objects must occur between Begin/EndUpdate calls
56  virtual void BeginScene() = 0;
57  virtual Bool_t BuildingScene() const = 0;
58  virtual void EndScene() = 0;
59 
60  // Simple object addition - buffer represents a unique single positioned object
61  virtual Int_t AddObject(const TBuffer3D & buffer, Bool_t * addChildren = 0) = 0;
62 
63  // Complex object addition - for adding physical objects which have common logical
64  // shapes. In this case buffer describes template shape (aside from kCore).
65  virtual Int_t AddObject(UInt_t physicalID, const TBuffer3D & buffer, Bool_t * addChildren = 0) = 0;
66 
67  virtual Bool_t OpenComposite(const TBuffer3D & buffer, Bool_t * addChildren = 0) = 0;
68  virtual void CloseComposite() = 0;
69  virtual void AddCompositeOp(UInt_t operation) = 0;
70 
71  virtual TObject *SelectObject(Int_t, Int_t){return 0;}
72  virtual void DrawViewer(){}
73 
74  virtual void PrintObjects(){}
75  virtual void ResetCameras(){}
76  virtual void ResetCamerasAfterNextUpdate(){}
77 
78  static TVirtualViewer3D *Viewer3D(TVirtualPad *pad = 0, Option_t *type = "");
79 
80  ClassDef(TVirtualViewer3D,0) // Abstract interface to 3D viewers
81 };
82 
83 #endif