34 #ifdef G4VIS_BUILD_DAWN_DRIVER
38 #define G4FukuiRenderer_STRUCTURE_PRIORITY 1.
62 G4FukuiRendererViewer::G4FukuiRendererViewer (G4FukuiRendererSceneHandler& sceneHandler,
65 sceneHandler.IncrementViewCount (),
67 fSceneHandler (sceneHandler)
71 G4FukuiRendererViewer::~G4FukuiRendererViewer ()
75 void G4FukuiRendererViewer::SetView ()
77 #if defined DEBUG_FR_VIEW
79 G4cout <<
"***** G4FukuiRendererViewer::SetView(): No effects" <<
G4endl;
87 G4FukuiRendererViewer::ClearView(
void )
89 #if defined DEBUG_FR_VIEW
91 G4cout <<
"***** G4FukuiRendererViewer::ClearView (): No effects " <<
G4endl;
98 void G4FukuiRendererViewer::DrawView ()
100 #if defined DEBUG_FR_VIEW
102 G4cout <<
"***** G4FukuiRendererViewer::DrawView () " <<
G4endl;
106 fSceneHandler.FRBeginModeling();
118 void G4FukuiRendererViewer::ShowView(
void )
120 #if defined DEBUG_FR_VIEW
122 G4cout <<
"***** G4FukuiRendererViewer::ShowView () " <<
G4endl;
125 if( fSceneHandler.FRIsInModeling() )
130 fSceneHandler.FREndModeling();
140 void G4FukuiRendererViewer::Wait()
142 #if defined DEBUG_FR_VIEW
144 G4cout <<
"***** G4FukuiRendererViewer::Wait () : Begin" <<
G4endl;
146 fSceneHandler.SendStr (
FR_WAIT );
147 fSceneHandler.GetPrimDest().WaitSendBack(
FR_WAIT );
148 #if defined DEBUG_FR_VIEW
150 G4cout <<
"***** G4FukuiRendererViewer::Wait () : end" <<
G4endl;
158 G4FukuiRendererViewer::SendDevice( FRDEV dev )
160 #if defined DEBUG_FR_VIEW
162 G4cout <<
"***** G4FukuiRendererViewer::SendDevice() " <<
G4endl;
167 if( dev >= FRDEV_PS || dev < FRDEV_DEVICE_END ) {
168 fSceneHandler.SendStrInt (
FR_DEVICE, dev );
174 void G4FukuiRendererViewer::SendDrawingStyle()
176 #if defined DEBUG_FR_VIEW
178 G4cout <<
"***** G4FukuiRendererViewer::SendDrawingStyle() " <<
G4endl;
181 G4int style = fVP.GetDrawingStyle();
204 void G4FukuiRendererViewer::SendViewParameters ()
210 #if defined DEBUG_FR_VIEW
212 G4cout <<
"***** G4FukuiRendererViewer::SendViewParameters()" <<
G4endl;
217 const G4double MIN_HALF_ANGLE = 0.01 ;
223 G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
225 G4double half_view_angle = std::fabs ( fVP.GetFieldHalfAngle () ) ;
226 if( half_view_angle > MAX_HALF_ANGLE ) {
227 half_view_angle = MAX_HALF_ANGLE ;
230 if( half_view_angle < MIN_HALF_ANGLE ) {
232 camera_distance = radius * HOW_FAR ;
235 camera_distance = radius / std::sin ( half_view_angle );
236 camera_distance -= fVP.GetDolly();
239 if ( camera_distance < radius ) {
241 G4cout <<
"WARNING from FukuiRenderer (DAWN) driver:" <<
G4endl;
242 G4cout <<
" Camera cannot enter inside objects" <<
G4endl;
244 camera_distance =
radius ;
249 = fVP.GetViewpointDirection().
unit();
251 const G4double h_angle = (180.0 /
pi) * camera_direction.phi () ;
261 = fSceneHandler.GetScene()->GetStandardTargetPoint()
262 + fVP.GetCurrentTargetPoint();
271 const G4double zoom_factor = fVP.GetZoomFactor();
274 if( half_view_angle < MIN_HALF_ANGLE ) {
277 = fSceneHandler.GetScene()->GetStandardTargetPoint();
281 std_target_point.x(),
282 std_target_point.y(),
283 std_target_point.z());
289 const G4double FR_HALF_SCREEN_SIZE = 0.5 ;
291 = FR_HALF_SCREEN_SIZE / std::tan( half_view_angle );
292 focal_distance *= zoom_factor ;
297 if( fSceneHandler.GetSystem().IsGUIMode() ) {
299 fSceneHandler.SendStr(
FR_GUI );
304 fSceneHandler.GetPrimDest().WaitSendBack(
FR_GUI );
309 #endif // G4VIS_BUILD_DAWN_DRIVER