2 // ********************************************************************
 
    3 // * License and Disclaimer                                           *
 
    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.                             *
 
   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.         *
 
   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 // ********************************************************************
 
   27 // $Id: G4VisExecutive.icc 75567 2013-11-04 11:35:11Z gcosmo $
 
   30 // John Allison 24th January 1998.
 
   32 #ifndef G4VISEXECUTIVE_ICC
 
   33 #define G4VISEXECUTIVE_ICC
 
   35 // Supported drivers...
 
   37 // Not needing external packages or libraries...
 
   38 #include "G4ASCIITree.hh"
 
   39 #include "G4DAWNFILE.hh"
 
   40 #include "G4HepRep.hh"
 
   41 #include "G4HepRepFile.hh"
 
   42 #include "G4RayTracer.hh"
 
   43 #include "G4HitFilterFactories.hh"
 
   44 #include "G4DigiFilterFactories.hh"
 
   45 #include "G4TrajectoryFilterFactories.hh"
 
   46 #include "G4TrajectoryModelFactories.hh"
 
   47 #include "G4VRML1File.hh"
 
   48 #include "G4VRML2File.hh"
 
   49 #include "G4GMocrenFile.hh"
 
   51 // FIXME : avoid mix with QT/WT driver (should be done by cmake??)
 
   52 #if defined(G4VIS_USE_OPENGLWT)
 
   53   // do not want GL2P2 in WT case
 
   54   #undef G4VIS_BUILD_OPENGL_GL2PS
 
   57 // Needing external packages or libraries...
 
   60 #include "G4FukuiRenderer.hh"
 
   63 #ifdef G4VIS_USE_OPENGLX
 
   64 #include "G4OpenGLImmediateX.hh"
 
   65 #include "G4OpenGLStoredX.hh"
 
   68 #ifdef G4VIS_USE_OPENGLWIN32
 
   69 #include "G4OpenGLImmediateWin32.hh"
 
   70 #include "G4OpenGLStoredWin32.hh"
 
   73 #ifdef G4VIS_USE_OPENGLXM
 
   74 #include "G4OpenGLImmediateXm.hh"
 
   75 #include "G4OpenGLStoredXm.hh"
 
   78 #ifdef G4VIS_USE_OPENGLQT
 
   79 #include "G4OpenGLImmediateQt.hh"
 
   80 #include "G4OpenGLStoredQt.hh"
 
   83 #ifdef G4VIS_USE_OPENGLWT
 
   84 #include "G4OpenGLImmediateWt.hh"
 
   88 #include "G4OpenInventorX.hh"
 
   89 #include "G4OpenInventorXtExtended.hh"
 
   92 #ifdef G4VIS_USE_OIWIN32
 
   93 #include "G4OpenInventorWin32.hh"
 
   96 #ifdef G4VIS_USE_RAYTRACERX
 
   97 #include "G4RayTracerX.hh"
 
  100 #ifdef G4VIS_USE_VRML
 
  101 #include "G4VRML1.hh"
 
  102 #include "G4VRML2.hh"
 
  106 G4VisExecutive::G4VisExecutive (const G4String& verbosityString):
 
  107   G4VisManager(verbosityString)    
 
  110 // The inline keyword prevents the compiler making an external
 
  111 // reference even though they cannot actually be inlined since they
 
  112 // are virtual functions.  This prevents a "multiple definition" error
 
  113 // if it is included in more than one file.  However, as explained in
 
  114 // the class description in G4VisExecutive.hh, it should never be
 
  115 // necessary to #include "G4VisExecutive.hh" in more than one file
 
  116 // since after instantiation the object can be treated as a
 
  119 G4VisExecutive::RegisterGraphicsSystems () {
 
  121   // Graphics Systems not needing external packages or libraries...
 
  122   RegisterGraphicsSystem (new G4ASCIITree);
 
  123   RegisterGraphicsSystem (new G4DAWNFILE);
 
  124   RegisterGraphicsSystem (new G4HepRep);
 
  125   RegisterGraphicsSystem (new G4HepRepFile);
 
  126   RegisterGraphicsSystem (new G4RayTracer);
 
  127   RegisterGraphicsSystem (new G4VRML1File);
 
  128   RegisterGraphicsSystem (new G4VRML2File);
 
  129   RegisterGraphicsSystem (new G4GMocrenFile);
 
  130   // Graphics systems needing external packages or libraries...
 
  132 #ifdef G4VIS_USE_DAWN
 
  133   RegisterGraphicsSystem (new G4FukuiRenderer);
 
  136 // Register OGL graphics system with generic nicknames.
 
  137 // Note: Any graphics system can be used with any UI session except
 
  138 // OPENGLQT - this must have a UI Qt session unless in batch mode.  This
 
  139 // is handled in /vis/sceneHandler/create but a potential fallback is
 
  141 #ifdef G4VIS_USE_OPENGL
 
  142   G4VGraphicsSystem* ogl  = 0;
 
  143   G4VGraphicsSystem* ogli = 0;
 
  144   G4VGraphicsSystem* ogls = 0;
 
  145   G4VGraphicsSystem* ogl_fallback = 0;
 
  146   G4VGraphicsSystem* ogli_fallback = 0;
 
  147   G4VGraphicsSystem* ogls_fallback = 0;
 
  148 #ifdef G4VIS_USE_OPENGLQT
 
  149   ogl  = new G4OpenGLStoredQt;
 
  150   ogli = new G4OpenGLImmediateQt;
 
  151   ogls = new G4OpenGLStoredQt;
 
  152 #if defined G4VIS_USE_OPENGLXM
 
  153   ogl_fallback  = new G4OpenGLStoredXm;
 
  154   ogli_fallback = new G4OpenGLImmediateXm;
 
  155   ogls_fallback = new G4OpenGLStoredXm;
 
  156 #elif defined G4VIS_USE_OPENGLX
 
  157   ogl_fallback  = new G4OpenGLStoredX;
 
  158   ogli_fallback = new G4OpenGLImmediateX;
 
  159   ogls_fallback = new G4OpenGLStoredX;
 
  160 #elif defined G4VIS_USE_OPENGLWIN32
 
  161   ogl_fallback  = new G4OpenGLStoredWin32;
 
  162   ogli_fallback = new G4OpenGLImmediateWin32;
 
  163   ogls_fallback = new G4OpenGLStoredWin32;
 
  165 #elif defined G4VIS_USE_OPENGLWT
 
  166   ogl  = new G4OpenGLImmediateWt;
 
  167   ogli = new G4OpenGLImmediateWt;
 
  168   ogls = new G4OpenGLImmediateWt;
 
  169 #elif defined G4VIS_USE_OPENGLXM
 
  170   ogl  = new G4OpenGLStoredXm;
 
  171   ogli = new G4OpenGLImmediateXm;
 
  172   ogls = new G4OpenGLStoredXm;
 
  173 #elif defined G4VIS_USE_OPENGLWIN32
 
  174   ogl  = new G4OpenGLStoredWin32;
 
  175   ogli = new G4OpenGLImmediateWin32;
 
  176   ogls = new G4OpenGLStoredWin32;
 
  177 #elif defined G4VIS_USE_OPENGLX
 
  178   ogl  = new G4OpenGLStoredX;
 
  179   ogli = new G4OpenGLImmediateX;
 
  180   ogls = new G4OpenGLStoredX;
 
  183     ogl->SetNickname("OGL");
 
  184     RegisterGraphicsSystem (ogl);
 
  187     ogli->SetNickname("OGLI");
 
  188     RegisterGraphicsSystem (ogli);
 
  191     ogls->SetNickname("OGLS");
 
  192     RegisterGraphicsSystem (ogls);
 
  195     ogl_fallback->SetNickname("OGL_FALLBACK");
 
  196     RegisterGraphicsSystem (ogl_fallback);
 
  199     ogli_fallback->SetNickname("OGLI_FALLBACK");
 
  200     RegisterGraphicsSystem (ogli_fallback);
 
  203     ogls_fallback->SetNickname("OGLS_FALLBACK");
 
  204     RegisterGraphicsSystem (ogls_fallback);
 
  208 #ifdef G4VIS_USE_OPENGLX
 
  209   RegisterGraphicsSystem (new G4OpenGLImmediateX);
 
  210   RegisterGraphicsSystem (new G4OpenGLStoredX);
 
  213 #ifdef G4VIS_USE_OPENGLWIN32
 
  214   RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
 
  215   RegisterGraphicsSystem (new G4OpenGLStoredWin32);
 
  218 #ifdef G4VIS_USE_OPENGLXM
 
  219   RegisterGraphicsSystem (new G4OpenGLImmediateXm);
 
  220   RegisterGraphicsSystem (new G4OpenGLStoredXm);
 
  223 #ifdef G4VIS_USE_OPENGLQT
 
  224   G4VGraphicsSystem* gsi = new G4OpenGLImmediateQt;
 
  225   G4VGraphicsSystem* gss = new G4OpenGLStoredQt;
 
  226   RegisterGraphicsSystem (gsi);
 
  227   RegisterGraphicsSystem (gss);
 
  228   G4VGraphicsSystem* gsi_fallback = 0;
 
  229   G4VGraphicsSystem* gss_fallback = 0;
 
  230 #if defined G4VIS_USE_OPENGLXM
 
  231   gsi_fallback = new G4OpenGLImmediateXm;
 
  232   gss_fallback = new G4OpenGLStoredXm;
 
  233 #elif defined G4VIS_USE_OPENGLX
 
  234   gsi_fallback = new G4OpenGLImmediateX;
 
  235   gss_fallback = new G4OpenGLStoredX;
 
  236 #elif defined G4VIS_USE_OPENGLWIN32
 
  237   gsi_fallback = new G4OpenGLImmediateWin32;
 
  238   gss_fallback = new G4OpenGLStoredWin32;
 
  241     gsi_fallback->SetNickname(gsi->GetNickname()+"_FALLBACK");
 
  242     RegisterGraphicsSystem (gsi_fallback);
 
  245     gss_fallback->SetNickname(gss->GetNickname()+"_FALLBACK");
 
  246     RegisterGraphicsSystem (gss_fallback);
 
  250 #ifdef G4VIS_USE_OPENGLWT
 
  251   RegisterGraphicsSystem (new G4OpenGLImmediateWt);
 
  254 // Register OI graphics system with generic nickname
 
  256   G4VGraphicsSystem* oi  = 0;
 
  258   oi = new G4OpenInventorX;
 
  260 #ifdef G4VIS_USE_OIWIN32
 
  261   oi = new G4OpenInventorWin32;
 
  264     oi->SetNickname("OI");
 
  265     RegisterGraphicsSystem (oi);
 
  270   RegisterGraphicsSystem (new G4OpenInventorX);
 
  271   RegisterGraphicsSystem (new G4OpenInventorXtExtended);
 
  274 #ifdef G4VIS_USE_OIWIN32
 
  275   RegisterGraphicsSystem (new G4OpenInventorWin32);
 
  278 #ifdef G4VIS_USE_RAYTRACERX
 
  279   RegisterGraphicsSystem (new G4RayTracerX);
 
  282 #ifdef G4VIS_USE_VRML
 
  283   RegisterGraphicsSystem (new G4VRML1);
 
  284   RegisterGraphicsSystem (new G4VRML2);
 
  289 // See comments about inlining above.
 
  291 G4VisExecutive::RegisterModelFactories()
 
  293    // Trajectory draw models
 
  294    RegisterModelFactory(new G4TrajectoryGenericDrawerFactory());       
 
  295    RegisterModelFactory(new G4TrajectoryDrawByChargeFactory());
 
  296    RegisterModelFactory(new G4TrajectoryDrawByParticleIDFactory());
 
  297    RegisterModelFactory(new G4TrajectoryDrawByOriginVolumeFactory());  
 
  298    RegisterModelFactory(new G4TrajectoryDrawByAttributeFactory());  
 
  300    // Trajectory filter models
 
  301    RegisterModelFactory(new G4TrajectoryChargeFilterFactory());
 
  302    RegisterModelFactory(new G4TrajectoryParticleFilterFactory());
 
  303    RegisterModelFactory(new G4TrajectoryOriginVolumeFilterFactory());
 
  304    RegisterModelFactory(new G4TrajectoryAttributeFilterFactory());
 
  307    RegisterModelFactory(new G4HitAttributeFilterFactory());
 
  309    // Digi filter models
 
  310    RegisterModelFactory(new G4DigiAttributeFilterFactory());