G4OpenGLSceneHandler.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // Andrew Walkden  27th March 1996
00031 // OpenGL scene handler - base for immediate mode and stored mode classes to
00032 //                        inherit from.
00033 
00034 #ifdef G4VIS_BUILD_OPENGL_DRIVER
00035 
00036 #ifndef G4OPENGLSCENEHANDLER_HH
00037 #define G4OPENGLSCENEHANDLER_HH
00038 
00039 #include "globals.hh"
00040 
00041 #include "G4VSceneHandler.hh"
00042 #include "G4OpenGL.hh"
00043 
00044 #include <map>
00045 
00046 class G4AttHolder;
00047 
00048 // Base class for various OpenGLSceneHandler classes.
00049 class G4OpenGLSceneHandler: public G4VSceneHandler {
00050 
00051   friend class G4OpenGLViewer;
00052 
00053 public:
00054   virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
00055   virtual void EndPrimitives ();
00056   virtual void BeginPrimitives2D (const G4Transform3D& objectTransformation);
00057   virtual void EndPrimitives2D ();
00058   void AddPrimitive (const G4Polyline&);
00059   void AddPrimitive (const G4Polymarker&);
00060   void AddPrimitive (const G4Text&);
00061   void AddPrimitive (const G4Circle&);
00062   void AddPrimitive (const G4Square&);
00063   void AddPrimitivesCircle (const std::vector <G4VMarker>&);
00064   void AddPrimitivesSquare (const std::vector <G4VMarker>&);
00065   void AddPrimitive (const G4Scale&);
00066   void AddPrimitive (const G4Polyhedron&);
00067   void AddPrimitive (const G4NURBS&);
00068 
00069   void PreAddSolid (const G4Transform3D& objectTransformation,
00070                     const G4VisAttributes&);
00071   void AddSolid (const G4Box&);
00072   void AddSolid (const G4Cons&);
00073   void AddSolid (const G4Tubs&);
00074   void AddSolid (const G4Trd&);
00075   void AddSolid (const G4Trap&);
00076   void AddSolid (const G4Sphere&);
00077   void AddSolid (const G4Para&);
00078   void AddSolid (const G4Torus&);
00079   void AddSolid (const G4Polycone&);
00080   void AddSolid (const G4Polyhedra&);
00081   void AddSolid (const G4VSolid&);
00082   void AddCompound (const G4VTrajectory&);
00083   void AddCompound (const G4VHit&);
00084   void AddCompound (const G4VDigi&);
00085   void AddCompound (const G4THitsMap<G4double>&);
00086 
00087   G4int GetEventsDrawInterval() {return fEventsDrawInterval;}
00088   void SetEventsDrawInterval(G4int interval) {fEventsDrawInterval = interval;}
00089 
00090 protected:
00091 
00092   G4OpenGLSceneHandler (G4VGraphicsSystem& system,
00093                         G4int id,
00094                         const G4String& name = "");
00095   virtual ~G4OpenGLSceneHandler ();
00096 
00097   void ProcessScene();
00098   G4VSolid* CreateSectionSolid ();
00099   G4VSolid* CreateCutawaySolid ();
00100 
00101   void ClearAndDestroyAtts();  // Destroys att holders and clears pick map.
00102 
00103   GLuint fPickName;
00104   std::map<GLuint, G4AttHolder*> fPickMap;  // For picking.
00105 
00106   // Shared code to wait until we make a single glFlush
00107   void ScaledFlush () ;
00108   // Number of events to wait until we make a single glFlush
00109   G4int fEventsDrawInterval;
00110   // Number of events waiting to be flushed
00111   G4int fEventsWaitingToBeFlushed;
00112   
00113   // True if caller of primitives is capable of processing three passes.
00114   G4bool fThreePassCapable;
00115 
00116   G4bool fSecondPassForTransparencyRequested;
00117   G4bool fSecondPassForTransparency;
00118   
00119   G4bool fThirdPassForNonHiddenMarkersRequested;
00120   G4bool fThirdPassForNonHiddenMarkers;
00121   
00122   static const GLubyte fStippleMaskHashed [128];
00123 };
00124 
00125 #include "G4OpenGLSceneHandler.icc"
00126 
00127 #endif
00128 
00129 #endif

Generated on Mon May 27 17:49:10 2013 for Geant4 by  doxygen 1.4.7