source: trunk/source/geometry/solids/test/SBT/src/SBTVisManager.cc@ 1330

Last change on this file since 1330 was 1316, checked in by garnier, 15 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 5.7 KB
RevLine 
[1316]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// SBTVisManager
28//
29// Implementation of visualization manager for SBT
30//
31
32#include "SBTVisManager.hh"
33#include "G4ModelingParameters.hh"
34#include "G4BoundingSphereScene.hh"
35
36//
37// The following is borrowed from GEANT4's example "N02"
38//
39// Supported drivers...
40
41// Not needing external packages or libraries...
42#include "G4ASCIITree.hh"
43#include "G4DAWNFILE.hh"
44#include "G4HepRepFile.hh"
45#include "G4HepRep.hh"
46#include "G4RayTracer.hh"
47#include "G4VRML1File.hh"
48#include "G4VRML2File.hh"
49
50#ifdef G4VIS_USE_DAWN
51#include "G4FukuiRenderer.hh"
52#endif
53
54#ifdef G4VIS_USE_OPENGLX
55#include "G4OpenGLImmediateX.hh"
56#include "G4OpenGLStoredX.hh"
57#endif
58
59#ifdef G4VIS_USE_OPENGLWIN32
60#include "G4OpenGLImmediateWin32.hh"
61#include "G4OpenGLStoredWin32.hh"
62#endif
63
64#ifdef G4VIS_USE_OPENGLXM
65#include "G4OpenGLImmediateXm.hh"
66#include "G4OpenGLStoredXm.hh"
67#endif
68
69#ifdef G4VIS_USE_OIX
70#include "G4OpenInventorX.hh"
71#endif
72
73#ifdef G4VIS_USE_OIWIN32
74#include "G4OpenInventorWin32.hh"
75#endif
76
77
78#ifdef G4VIS_USE_VRML
79#include "G4VRML1.hh"
80#include "G4VRML2.hh"
81#endif
82
83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
84
85void SBTVisManager::RegisterGraphicsSystems () {
86
87 // Graphics Systems not needing external packages or libraries...
88 RegisterGraphicsSystem (new G4ASCIITree);
89 RegisterGraphicsSystem (new G4DAWNFILE);
90 RegisterGraphicsSystem (new G4HepRepFile);
91 RegisterGraphicsSystem (new G4HepRep);
92 RegisterGraphicsSystem (new G4RayTracer);
93 RegisterGraphicsSystem (new G4VRML1File);
94 RegisterGraphicsSystem (new G4VRML2File);
95
96#ifdef G4VIS_USE_DAWN
97 RegisterGraphicsSystem (new G4FukuiRenderer);
98#endif
99
100#ifdef G4VIS_USE_OPENGLX
101 RegisterGraphicsSystem (new G4OpenGLImmediateX);
102 RegisterGraphicsSystem (new G4OpenGLStoredX);
103#endif
104
105#ifdef G4VIS_USE_OPENGLWIN32
106 RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
107 RegisterGraphicsSystem (new G4OpenGLStoredWin32);
108#endif
109
110#ifdef G4VIS_USE_OPENGLXM
111 RegisterGraphicsSystem (new G4OpenGLImmediateXm);
112 RegisterGraphicsSystem (new G4OpenGLStoredXm);
113#endif
114
115#ifdef G4VIS_USE_OIX
116 RegisterGraphicsSystem (new G4OpenInventorX);
117#endif
118
119#ifdef G4VIS_USE_OIWIN32
120 RegisterGraphicsSystem (new G4OpenInventorWin32);
121#endif
122
123#ifdef G4VIS_USE_VRML
124 RegisterGraphicsSystem (new G4VRML1);
125 RegisterGraphicsSystem (new G4VRML2);
126#endif
127
128 if (fVerbose > 0) {
129 G4cout <<
130 "\nYou have successfully chosen to use the following graphics systems."
131 << G4endl;
132 PrintAvailableGraphicsSystems ();
133 }
134}
135
136
137
138//
139// BuildFakeWorld
140//
141// It is a little troubling how difficult it is to get visualization
142// working if one doesn't build geometry in the standard manner
143// (i.e. have a valid setting at
144// G4TransportationManager::GetTransportationManager ()
145// -> GetNavigatorForTracking () -> GetWorldVolume (); )
146//
147//
148// Why is this so? Why shouldn't one be able to use visualization
149// in cases like SBT?
150//
151G4int SBTVisManager::BuildFakeWorld() const
152{
153 //
154 // These are probably leaks...
155 //
156 G4ModelingParameters::DrawingStyle style = G4ModelingParameters::wf;
157 G4ModelingParameters *model = new G4ModelingParameters
158 (0, // No default vis attributes.
159 style, // Wireframe
160 true, // Global culling.
161 true, // Cull invisible volumes.
162 false, // Density culling.
163 0., // Density (not relevant if density culling false).
164 true, // Cull daughters of opaque mothers.
165 24); // No of sides (not relevant for this operation).
166 SBTFakeModel *fakeModel = new SBTFakeModel(model);
167
168 G4Scene *currentScene = GetCurrentScene();
169
170 if (!currentScene) {
171 G4cerr << "Please create a view first" << G4endl;
172 return 1;
173 }
174
175 currentScene->AddRunDurationModel( (G4VModel *)fakeModel );
176 return 0;
177}
Note: See TracBrowser for help on using the repository browser.