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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 //
 27 //
 28 //
 29 // Andrew Walkden  27th March 1996
 30 // OpenGL scene handler - base for immediate mode and stored mode classes to
 31 //                        inherit from.
 32 
 33 #ifndef G4OPENGLSCENEHANDLER_HH
 34 #define G4OPENGLSCENEHANDLER_HH
 35 
 36 #include "globals.hh"
 37 
 38 #include "G4VSceneHandler.hh"
 39 #include "G4OpenGL.hh"
 40 
 41 #include <map>
 42 
 43 class G4AttHolder;
 44 
 45 // Base class for various OpenGLSceneHandler classes.
 46 class G4OpenGLSceneHandler: public G4VSceneHandler {
 47   
 48   friend class G4OpenGLViewer;
 49   
 50 public:
 51   virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
 52   virtual void EndPrimitives ();
 53   virtual void BeginPrimitives2D (const G4Transform3D& objectTransformation);
 54   virtual void EndPrimitives2D ();
 55   using G4VSceneHandler::AddPrimitive;
 56   void AddPrimitive (const G4Polyline&);
 57   void AddPrimitive (const G4Polymarker&);
 58   void AddPrimitive (const G4Text&);
 59   void AddPrimitive (const G4Circle&);
 60   void AddPrimitive (const G4Square&);
 61   void AddPrimitivesCircle (const std::vector <G4VMarker>&);
 62   void AddPrimitivesSquare (const std::vector <G4VMarker>&);
 63   void AddPrimitive (const G4Polyhedron&);
 64   
 65   void PreAddSolid (const G4Transform3D& objectTransformation,
 66                     const G4VisAttributes&);
 67   void AddSolid (const G4Box&);
 68   void AddSolid (const G4Cons&);
 69   void AddSolid (const G4Tubs&);
 70   void AddSolid (const G4Trd&);
 71   void AddSolid (const G4Trap&);
 72   void AddSolid (const G4Sphere&);
 73   void AddSolid (const G4Para&);
 74   void AddSolid (const G4Torus&);
 75   void AddSolid (const G4Polycone&);
 76   void AddSolid (const G4Polyhedra&);
 77   void AddSolid (const G4Orb&);
 78   void AddSolid (const G4Ellipsoid&);
 79   void AddSolid (const G4TessellatedSolid&);
 80   void AddSolid (const G4VSolid&);
 81   void AddCompound (const G4VTrajectory&);
 82   void AddCompound (const G4VHit&);
 83   void AddCompound (const G4VDigi&);
 84   void AddCompound (const G4THitsMap<G4double>&);
 85   void AddCompound (const G4THitsMap<G4StatDouble>&);
 86   void AddCompound (const G4Mesh&);
 87 
 88   // enum for /vis/ogl/flushAt.
 89   enum FlushAction {
 90     endOfEvent,
 91     endOfRun,
 92     eachPrimitive,
 93     NthPrimitive,
 94     NthEvent,
 95     never
 96   };
 97   static G4int GetEntitiesFlushInterval()
 98   {return fEntitiesFlushInterval;}
 99   static FlushAction GetFlushAction()
100   {return fFlushAction;}
101   static void SetEntitiesFlushInterval(G4int interval)
102   {fEntitiesFlushInterval = interval;}
103   static void SetFlushAction(FlushAction action)
104   {fFlushAction = action;}
105 
106 protected:
107   
108   G4OpenGLSceneHandler (G4VGraphicsSystem& system,
109                         G4int id,
110                         const G4String& name = "");
111   virtual ~G4OpenGLSceneHandler ();
112   
113   void ProcessScene();
114   G4DisplacedSolid* CreateSectionSolid ();
115   G4DisplacedSolid* CreateCutawaySolid ();
116   
117   void ClearAndDestroyAtts();  // Destroys att holders and clears pick map.
118   
119   GLuint fPickName;
120   std::map<GLuint, G4AttHolder*> fPickMap;  // For picking.
121   
122   // Shared code to wait until we make a single glFlush
123   void ScaledFlush () ;
124   // Static so that they apply to all OGL scene handlers...
125   static FlushAction fFlushAction;
126   // Number of entities between flushes
127   static G4int fEntitiesFlushInterval;
128 
129   // True if caller of primitives is capable of processing three passes.
130   G4bool fThreePassCapable;
131   
132   G4bool fSecondPassForTransparencyRequested;
133   G4bool fSecondPassForTransparency;
134   
135   G4bool fThirdPassForNonHiddenMarkersRequested;
136   G4bool fThirdPassForNonHiddenMarkers;
137   
138   static const GLubyte fStippleMaskHashed [128];
139   bool fEdgeFlag;
140 };
141 
142 #include "G4OpenGLSceneHandler.icc"
143 
144 #endif // G4OPENGLSCENEHANDLER_HH
145