Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:47

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 //
0029 // Andrew Walkden  27th March 1996
0030 // OpenGL scene handler - base for immediate mode and stored mode classes to
0031 //                        inherit from.
0032 
0033 #ifndef G4OPENGLSCENEHANDLER_HH
0034 #define G4OPENGLSCENEHANDLER_HH
0035 
0036 #include "globals.hh"
0037 
0038 #include "G4VSceneHandler.hh"
0039 #include "G4OpenGL.hh"
0040 
0041 #include <map>
0042 
0043 class G4AttHolder;
0044 
0045 // Base class for various OpenGLSceneHandler classes.
0046 class G4OpenGLSceneHandler: public G4VSceneHandler {
0047   
0048   friend class G4OpenGLViewer;
0049   
0050 public:
0051   virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
0052   virtual void EndPrimitives ();
0053   virtual void BeginPrimitives2D (const G4Transform3D& objectTransformation);
0054   virtual void EndPrimitives2D ();
0055   using G4VSceneHandler::AddPrimitive;
0056   void AddPrimitive (const G4Polyline&);
0057   void AddPrimitive (const G4Polymarker&);
0058   void AddPrimitive (const G4Text&);
0059   void AddPrimitive (const G4Circle&);
0060   void AddPrimitive (const G4Square&);
0061   void AddPrimitivesCircle (const std::vector <G4VMarker>&);
0062   void AddPrimitivesSquare (const std::vector <G4VMarker>&);
0063   void AddPrimitive (const G4Polyhedron&);
0064   
0065   void PreAddSolid (const G4Transform3D& objectTransformation,
0066                     const G4VisAttributes&);
0067   void AddSolid (const G4Box&);
0068   void AddSolid (const G4Cons&);
0069   void AddSolid (const G4Tubs&);
0070   void AddSolid (const G4Trd&);
0071   void AddSolid (const G4Trap&);
0072   void AddSolid (const G4Sphere&);
0073   void AddSolid (const G4Para&);
0074   void AddSolid (const G4Torus&);
0075   void AddSolid (const G4Polycone&);
0076   void AddSolid (const G4Polyhedra&);
0077   void AddSolid (const G4Orb&);
0078   void AddSolid (const G4Ellipsoid&);
0079   void AddSolid (const G4TessellatedSolid&);
0080   void AddSolid (const G4VSolid&);
0081   void AddCompound (const G4VTrajectory&);
0082   void AddCompound (const G4VHit&);
0083   void AddCompound (const G4VDigi&);
0084   void AddCompound (const G4THitsMap<G4double>&);
0085   void AddCompound (const G4THitsMap<G4StatDouble>&);
0086   void AddCompound (const G4Mesh&);
0087 
0088   // enum for /vis/ogl/flushAt.
0089   enum FlushAction {
0090     endOfEvent,
0091     endOfRun,
0092     eachPrimitive,
0093     NthPrimitive,
0094     NthEvent,
0095     never
0096   };
0097   static G4int GetEntitiesFlushInterval()
0098   {return fEntitiesFlushInterval;}
0099   static FlushAction GetFlushAction()
0100   {return fFlushAction;}
0101   static void SetEntitiesFlushInterval(G4int interval)
0102   {fEntitiesFlushInterval = interval;}
0103   static void SetFlushAction(FlushAction action)
0104   {fFlushAction = action;}
0105 
0106 protected:
0107   
0108   G4OpenGLSceneHandler (G4VGraphicsSystem& system,
0109                         G4int id,
0110                         const G4String& name = "");
0111   virtual ~G4OpenGLSceneHandler ();
0112   
0113   void ProcessScene();
0114   G4DisplacedSolid* CreateSectionSolid ();
0115   G4DisplacedSolid* CreateCutawaySolid ();
0116   
0117   void ClearAndDestroyAtts();  // Destroys att holders and clears pick map.
0118   
0119   GLuint fPickName;
0120   std::map<GLuint, G4AttHolder*> fPickMap;  // For picking.
0121   
0122   // Shared code to wait until we make a single glFlush
0123   void ScaledFlush () ;
0124   // Static so that they apply to all OGL scene handlers...
0125   static FlushAction fFlushAction;
0126   // Number of entities between flushes
0127   static G4int fEntitiesFlushInterval;
0128 
0129   // True if caller of primitives is capable of processing three passes.
0130   G4bool fThreePassCapable;
0131   
0132   G4bool fSecondPassForTransparencyRequested;
0133   G4bool fSecondPassForTransparency;
0134   
0135   G4bool fThirdPassForNonHiddenMarkersRequested;
0136   G4bool fThirdPassForNonHiddenMarkers;
0137   
0138   static const GLubyte fStippleMaskHashed [128];
0139   bool fEdgeFlag;
0140 };
0141 
0142 #include "G4OpenGLSceneHandler.icc"
0143 
0144 #endif // G4OPENGLSCENEHANDLER_HH