35 #ifdef G4VIS_BUILD_VRML_DRIVER
50 G4VRML2Viewer::G4VRML2Viewer(G4VRML2SceneHandler& sceneHandler,
const G4String&
name) :
52 sceneHandler.IncrementViewCount(),
54 fSceneHandler(sceneHandler),
55 fDest(sceneHandler.fDest)
57 fViewHalfAngle = 0.5 * 0.785398 ;
58 fsin_VHA = std::sin ( fViewHalfAngle ) ;
61 G4VRML2Viewer::~G4VRML2Viewer()
64 void G4VRML2Viewer::SetView()
66 #if defined DEBUG_FR_VIEW
68 G4cout <<
"***** G4VRML2Viewer::SetView(): No effects" <<
G4endl;
77 void G4VRML2Viewer::DrawView()
79 #if defined DEBUG_FR_VIEW
83 fSceneHandler.VRMLBeginModeling() ;
94 void G4VRML2Viewer::ClearView(
void)
96 #if defined DEBUG_FR_VIEW
98 G4cout <<
"***** G4VRML2Viewer::ClearView(): No effects" <<
G4endl;
102 void G4VRML2Viewer::ShowView(
void)
104 #if defined DEBUG_FR_VIEW
108 fSceneHandler.VRMLEndModeling();
111 void G4VRML2Viewer::FinishView(
void)
113 #if defined DEBUG_FR_VIEW
115 G4cout <<
"***** G4VRML2Viewer::FinishView(): No effects" <<
G4endl;
119 void G4VRML2Viewer::SendViewParameters ()
125 #if defined DEBUG_FR_VIEW
127 G4cout <<
"***** G4VRML2Viewer::SendViewParameters()\n";
130 if ( fsin_VHA < 1.0
e-6 ) { return ; }
133 G4double extent_radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
134 G4double camera_distance = extent_radius / fsin_VHA ;
138 = fSceneHandler.GetScene()->GetStandardTargetPoint()
139 + fVP.GetCurrentTargetPoint();
140 G4double E_z = target_point.
z() + camera_distance;
145 fDest <<
"#---------- CAMERA" <<
"\n";
146 fDest <<
"Viewpoint {" <<
"\n";
147 fDest <<
"\t" <<
"position " ;
148 fDest << E.x() <<
" " ;
149 fDest << E.y() <<
" " ;
150 fDest << E.z() <<
"\n" ;
151 fDest <<
"}" <<
"\n";