00001 // @(#)root/base:$Id: TVirtualViewer3D.h 20877 2007-11-19 11:17:07Z rdm $ 00002 // Author: Olivier Couet 05/10/2004 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TVirtualViewer3D 00013 #define ROOT_TVirtualViewer3D 00014 00015 ////////////////////////////////////////////////////////////////////////// 00016 // // 00017 // TVirtualViewer3D // 00018 // // 00019 // Abstract 3D shapes viewer. The concrete implementations are: // 00020 // // 00021 // TViewerX3D : X3d viewer // 00022 // TViewerOpenGL: OpenGL viewer // 00023 // TViewerPad3D : visualise the 3D scene in the current Pad // 00024 // // 00025 ////////////////////////////////////////////////////////////////////////// 00026 00027 #ifndef ROOT_Rtypes 00028 #include "Rtypes.h" 00029 #endif 00030 00031 #ifndef ROOT_TObject 00032 #include "TObject.h" 00033 #endif 00034 00035 #ifndef ROOT_TAttFill 00036 #include "TAttFill.h" 00037 #endif 00038 00039 class TBuffer3D; 00040 class TVirtualPad; 00041 class TGLRect; 00042 00043 class TVirtualViewer3D : public TObject 00044 { 00045 public: 00046 virtual ~TVirtualViewer3D() {}; 00047 00048 // Viewers must always handle master (absolute) positions - and 00049 // buffer producers must be able to supply them. Some viewers may 00050 // prefer local frame & translation - and producers can optionally 00051 // supply them 00052 virtual Bool_t PreferLocalFrame() const = 0; 00053 00054 // Viewers can implement their own loop over pad's primitive list. 00055 virtual Bool_t CanLoopOnPrimitives() const { return kFALSE; } 00056 // When they can, TPad::Paint() and TPad::PaintModified() simply 00057 // call the following function: 00058 virtual void PadPaint(TVirtualPad*) {} 00059 virtual void ObjectPaint(TObject*, Option_t* = "") {} 00060 00061 // Addition/removal of objects must occur between Begin/EndUpdate calls 00062 virtual void BeginScene() = 0; 00063 virtual Bool_t BuildingScene() const = 0; 00064 virtual void EndScene() = 0; 00065 00066 // Simple object addition - buffer represents a unique single positioned object 00067 virtual Int_t AddObject(const TBuffer3D & buffer, Bool_t * addChildren = 0) = 0; 00068 00069 // Complex object addition - for adding physical objects which have common logical 00070 // shapes. In this case buffer describes template shape (aside from kCore). 00071 virtual Int_t AddObject(UInt_t physicalID, const TBuffer3D & buffer, Bool_t * addChildren = 0) = 0; 00072 00073 virtual Bool_t OpenComposite(const TBuffer3D & buffer, Bool_t * addChildren = 0) = 0; 00074 virtual void CloseComposite() = 0; 00075 virtual void AddCompositeOp(UInt_t operation) = 0; 00076 00077 virtual TObject *SelectObject(Int_t, Int_t){return 0;} 00078 virtual void DrawViewer(){} 00079 00080 virtual void PrintObjects(){} 00081 virtual void ResetCameras(){} 00082 virtual void ResetCamerasAfterNextUpdate(){} 00083 00084 static TVirtualViewer3D *Viewer3D(TVirtualPad *pad = 0, Option_t *type = ""); 00085 00086 ClassDef(TVirtualViewer3D,0) // Abstract interface to 3D viewers 00087 }; 00088 00089 #endif