Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# $Id: GNUmakefile,v 2.3 1998/07/07 17:11:18 allison Exp $
|
||||
|
||||
# lib name
|
||||
name := G4VRML
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
|
||||
CPPFLAGS += -I$(G4BASE)/graphics_reps/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/VRML/include
|
||||
|
||||
ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
CPPFLAGS += -DVRML
|
||||
endif
|
||||
|
||||
ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
CPPFLAGS += -DVRMLFILE
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -0,0 +1,68 @@
|
||||
VRML-00-03-07 Satoshi TANAKA Dec 07, 1998
|
||||
- An environmental variable "G4VRML_VIEWER" is renames to
|
||||
"G4VRMLFILE_VIEWER" for consistency.
|
||||
|
||||
VRML-00-03-06 Satoshi TANAKA Dec 04, 1998
|
||||
- Maximun number of generated g4.wrl files in the destination
|
||||
directory is customizable as: "setenv G4VRMLFILE_MAX_FILE_NUM N"
|
||||
(N is the integer greater than or equal to 1. The default value is 1.)
|
||||
|
||||
VRML-00-03-04 Satoshi TANAKA Dec 03, 1998
|
||||
- Bug fix of SetPVPickability();
|
||||
|
||||
VRML-00-03-03 Satoshi TANAKA Nov 30, 1998
|
||||
- Destination directiory of g4.wrl and g4_X.wrl is customizable
|
||||
with the environmental variable "G4VRMLFILE_DEST_DIR".
|
||||
|
||||
Unix:
|
||||
% setenv G4VRMLFILE_DEST_DIR directory_name/
|
||||
|
||||
For example,
|
||||
|
||||
% setenv G4VRMLFILE_DEST_DIR /tmp/
|
||||
|
||||
Do not forget to add "/" at the end of the directory name.
|
||||
|
||||
NT:
|
||||
DOS> set G4VRMLFILE_DEST_DIR directory_name\
|
||||
|
||||
Do not forget to add "\" at the end of the directory name.
|
||||
|
||||
- Minor change in policy of automatic incremation of output VRML file:
|
||||
|
||||
OLD way: g4.wrl, g4_2.wrl, ..... , g4_100.wrl
|
||||
NEW way: g4.wrl, g4_1.wrl, g4_2.wrl, ..... , g4_100.wrl
|
||||
|
||||
Maximal number of files in one directory is restricted in order to
|
||||
avoid explosion of your hard disk. The maximal number is hard-coded.
|
||||
You can revise is by editing enum's of G4VRML1FILEScene.hh and
|
||||
G4VRML2FILESchene.hh
|
||||
|
||||
Note that the incrementation is done as follows (pseudo codes)
|
||||
|
||||
filename = "g4.wrl" // initialization
|
||||
|
||||
while( filename already exists in the dest directory )
|
||||
{
|
||||
increment filename
|
||||
}
|
||||
|
||||
It means that if you delete file "g4.wrl" in the destination directory,
|
||||
the file name in the next generation is still g4.wrl.
|
||||
|
||||
The JAVA application VRML/g4vrmlview/g4vrmlview.java
|
||||
for network visualization is also updated.
|
||||
|
||||
|
||||
VRML-00-03-02 Satoshi TANAKA Nov 13, 1998
|
||||
- Code refinement of VRML 2.0 driver
|
||||
- Pickability of Physical volume is controllable with
|
||||
setenv G4VRML_PV_PICKABLE 1/0
|
||||
- Nickname of VRML drivers are renames:
|
||||
(Old names were, e.g., "VRML1File")
|
||||
|
||||
VRML1 file : VRML1FILE
|
||||
VRML1 network : VRML1
|
||||
|
||||
VRML2 file : VRML2FILE
|
||||
VRML1 network : VRML2
|
||||
@@ -0,0 +1,20 @@
|
||||
INSTALL_DIR = "/usr/local/javaclass"
|
||||
|
||||
JAVAC = javac
|
||||
|
||||
g4vrmlview.class: g4vrmlview.java
|
||||
$(JAVAC) g4vrmlview.java
|
||||
$(JAVAC) g4mini.java
|
||||
|
||||
install:
|
||||
@if [ ! -d $(INSTALL_DIR) ] ; then mkdir $(INSTALL_DIR) ;fi
|
||||
cp g4vrmlview.class $(INSTALL_DIR)
|
||||
cp g4vrmlviewThread.class $(INSTALL_DIR)
|
||||
|
||||
clean:
|
||||
rm -f *.class
|
||||
rm -f \#* *~ *.bak
|
||||
|
||||
wrlclean:
|
||||
rm -f g4.wrl g4_*.wrl
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: g4mini.java,v 2.0 1998/07/02 16:47:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
public class g4mini
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
try{
|
||||
|
||||
// port number
|
||||
final int DEFALUT_PORT_NO = 40801 ;
|
||||
int portNo = DEFALUT_PORT_NO ;
|
||||
|
||||
// argument checking
|
||||
if( args.length != 2 )
|
||||
{
|
||||
System.out.println( "Usage: java g4mini src_file server_hostname");
|
||||
return ;
|
||||
}
|
||||
String src = args[0];
|
||||
String server = args[1];
|
||||
|
||||
// open connection
|
||||
Socket socket = new Socket( server, portNo ) ;
|
||||
|
||||
// get input stream from file
|
||||
BufferedReader br
|
||||
= new BufferedReader ( new FileReader ( src ) ) ;
|
||||
|
||||
// get output stream to socket
|
||||
BufferedWriter bw
|
||||
= new BufferedWriter ( new OutputStreamWriter ( socket.getOutputStream() ) ) ;
|
||||
|
||||
// file ==> socket
|
||||
String line ;
|
||||
while ( (line = br.readLine()) != null )
|
||||
{
|
||||
bw.write( line );
|
||||
bw.newLine() ;
|
||||
bw.flush () ;
|
||||
}
|
||||
|
||||
// close streams
|
||||
br.close();
|
||||
bw.close();
|
||||
socket.close() ;
|
||||
}
|
||||
|
||||
catch( Exception e )
|
||||
{
|
||||
System.out.println( e.toString() );
|
||||
}
|
||||
} // main
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: g4vrmlview.java,v 2.1 1998/11/29 22:00:10 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
//------------------//
|
||||
// class g4vrmlview //
|
||||
// ( main() ) //
|
||||
//------------------//
|
||||
public class g4vrmlview
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
try{
|
||||
// CONST
|
||||
final String VERSION = "1.00" ;
|
||||
final String DATE = "August 19, 1997";
|
||||
|
||||
final int PORT_NO = 40801 ;
|
||||
final String OUTPUT_FILE_HEAD = "g4" ;
|
||||
final String OUTPUT_FILE_EXT = "wrl" ;
|
||||
final int MAX_TRIAL = 10 ;
|
||||
|
||||
// local
|
||||
int portNo = PORT_NO ;
|
||||
|
||||
// argument checking
|
||||
if( args.length != 1 && args.length != 2 )
|
||||
{
|
||||
System.out.println( "-------------------------------");
|
||||
System.out.println( " G4VRMLView version " + VERSION );
|
||||
System.out.println( " " + DATE );
|
||||
System.out.println( "-------------------------------");
|
||||
System.out.println( "Usage: java g4vrmlview browser_name [port_number]");
|
||||
System.out.println( " Browser_name: netscape, vrweb, etc, or NONE");
|
||||
return ;
|
||||
}
|
||||
|
||||
// VRML browser
|
||||
String browser = new String ( args[0] ) ;
|
||||
|
||||
// port number
|
||||
if( args.length == 2 )
|
||||
{
|
||||
portNo = Integer.parseInt( args[1] );
|
||||
}
|
||||
|
||||
// make a server socket
|
||||
ServerSocket ss = null ;
|
||||
for ( int i = 0 ; i < MAX_TRIAL ; i++ )
|
||||
{
|
||||
try
|
||||
{
|
||||
ss = new ServerSocket( portNo );
|
||||
System.out.println( "Waiting for requests at port " +portNo + " ...");
|
||||
break ;
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
portNo++ ;
|
||||
if( i >= MAX_TRIAL )
|
||||
{
|
||||
System.out.println( "Sockets are not available.");
|
||||
return ;
|
||||
}
|
||||
}
|
||||
} // for
|
||||
|
||||
|
||||
// open connection and invoke thread
|
||||
int nSpawn = 0 ;
|
||||
while( true )
|
||||
{
|
||||
Socket socket = ss.accept(); nSpawn++ ;
|
||||
|
||||
System.out.println( "Connection accepted by thread " + nSpawn );
|
||||
|
||||
( new g4vrmlviewThread( socket, OUTPUT_FILE_HEAD, OUTPUT_FILE_EXT , browser )).start() ;
|
||||
|
||||
} // while
|
||||
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
System.out.println( e.toString() );
|
||||
}
|
||||
} // main()
|
||||
|
||||
} // g4vrmlview
|
||||
|
||||
|
||||
//------------------------//
|
||||
// class g4vrmlviewThread //
|
||||
//------------------------//
|
||||
class g4vrmlviewThread extends Thread
|
||||
{
|
||||
private final String NONE = "NONE" ; // no browser
|
||||
private Socket m_socket ;
|
||||
private String m_outputFile ;
|
||||
private String m_browser ;
|
||||
|
||||
// constuctor
|
||||
public g4vrmlviewThread( Socket socket ,
|
||||
String outputFileHead ,
|
||||
String outputFileExt ,
|
||||
String browser )
|
||||
{
|
||||
m_socket = socket ;
|
||||
SetOutputFileName ( outputFileHead , outputFileExt );
|
||||
m_browser = new String ( browser );
|
||||
}
|
||||
|
||||
private void SetOutputFileName( String outputFileHead,
|
||||
String outputFileExt )
|
||||
{
|
||||
// temporary file name
|
||||
String outputFile_tmp
|
||||
= new String ( outputFileHead +
|
||||
"." +
|
||||
outputFileExt ) ;
|
||||
|
||||
// for modification of temporary filename
|
||||
int n = 1 ;
|
||||
|
||||
// make a non-existing filename
|
||||
while ( true )
|
||||
{
|
||||
File file = new File ( outputFile_tmp );
|
||||
|
||||
if ( !file.exists() )
|
||||
{
|
||||
break ;
|
||||
} else {
|
||||
|
||||
outputFile_tmp
|
||||
= new String ( outputFileHead +
|
||||
"_" +
|
||||
(n++) +
|
||||
"." +
|
||||
outputFileExt );
|
||||
}
|
||||
|
||||
} // while
|
||||
|
||||
// set decided filename to data field
|
||||
m_outputFile = new String ( outputFile_tmp );
|
||||
|
||||
} // g4vrmlviewThread::setOutputFileName()
|
||||
|
||||
|
||||
// run ()
|
||||
public void run ()
|
||||
{
|
||||
try{
|
||||
// get input stream from socket
|
||||
BufferedReader br
|
||||
= new BufferedReader ( new InputStreamReader ( m_socket.getInputStream() ) ) ;
|
||||
|
||||
// get output stream to file
|
||||
BufferedWriter bw
|
||||
= new BufferedWriter ( new FileWriter ( m_outputFile ) ) ;
|
||||
|
||||
// socket ==> file
|
||||
String line ;
|
||||
while ( (line = br.readLine()) != null )
|
||||
{
|
||||
bw.write( line );
|
||||
bw.newLine() ;
|
||||
bw.flush () ;
|
||||
}
|
||||
System.out.println( "VRML data is saved to file " +m_outputFile );
|
||||
|
||||
// close streams and socket
|
||||
br.close();
|
||||
bw.close();
|
||||
m_socket.close() ;
|
||||
|
||||
// invoke browser
|
||||
if( !m_browser.equals(NONE) )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File file = new File ( m_outputFile );
|
||||
|
||||
// visualize created VRML file with browser
|
||||
if ( file.exists() )
|
||||
{
|
||||
String outputFileAbs = new String ( file.getAbsolutePath() ) ;
|
||||
String[] command = { m_browser, outputFileAbs };
|
||||
System.out.println( "Command: " + command[0] + " " + command[1] );
|
||||
|
||||
Process exec_process = null ;
|
||||
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
exec_process = runtime.exec( command );
|
||||
exec_process.waitFor() ;
|
||||
} else {
|
||||
System.out.println( "Error: Failed to open file" + m_outputFile );
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
System.out.println( e.toString() );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println( "No browser was invoked" );
|
||||
}
|
||||
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
System.out.println( e.toString() );
|
||||
}
|
||||
} // run()
|
||||
|
||||
} // g4vrmlviewThread
|
||||
@@ -0,0 +1,700 @@
|
||||
#VRML V1.0 ascii
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
|
||||
}
|
||||
DEF box_WBox_10 Separator {
|
||||
Material {
|
||||
diffuseColor 1 1 1
|
||||
}
|
||||
Cube {
|
||||
width 12000
|
||||
height 24000
|
||||
depth 20000
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
|
||||
}
|
||||
DEF box_WSBox_11 Separator {
|
||||
Material {
|
||||
diffuseColor 1 0 0
|
||||
}
|
||||
Cube {
|
||||
width 3200
|
||||
height 1300
|
||||
depth 3200
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
|
||||
}
|
||||
DEF box_WSWBox_12 Separator {
|
||||
Material {
|
||||
diffuseColor 0 1 0
|
||||
}
|
||||
Cube {
|
||||
width 3180
|
||||
height 1280
|
||||
depth 3180
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 400 0 1
|
||||
}
|
||||
DEF box_WSSBox_13 Separator {
|
||||
Material {
|
||||
diffuseColor 0 0 1
|
||||
}
|
||||
Cube {
|
||||
width 3180
|
||||
height 2
|
||||
depth 3180
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 460 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 520 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 580 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 640 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 700 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 760 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 820 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 880 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 940 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1060 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1120 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1180 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1240 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1300 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1360 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1420 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1480 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1540 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1600 0 1
|
||||
}
|
||||
USE box_WSSBox_13
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -1220 1
|
||||
}
|
||||
DEF tubs_CUTubsR_14 Separator {
|
||||
ShapeHints {
|
||||
vertexOrdering COUNTERCLOCKWISE
|
||||
shapeType SOLID
|
||||
faceType CONVEX
|
||||
}
|
||||
Material {
|
||||
diffuseColor 1 1 1
|
||||
}
|
||||
Coordinate3 {
|
||||
point [
|
||||
1512.5 1512.5 305,
|
||||
1069.5 1852.43 305,
|
||||
553.614 2066.12 305,
|
||||
1.30972e-13 2139 305,
|
||||
1512.5 1512.5 -305,
|
||||
1069.5 1852.43 -305,
|
||||
553.614 2066.12 -305,
|
||||
1.30972e-13 2139 -305,
|
||||
1234.86 1234.86 305,
|
||||
873.18 1512.39 305,
|
||||
451.991 1686.85 305,
|
||||
1.0693e-13 1746.36 305,
|
||||
1234.86 1234.86 -305,
|
||||
873.18 1512.39 -305,
|
||||
451.991 1686.85 -305,
|
||||
1.0693e-13 1746.36 -305,
|
||||
]
|
||||
}
|
||||
IndexedFaceSet {
|
||||
coordIndex [
|
||||
0, 4, 5, 1, -1,
|
||||
1, 5, 6, 2, -1,
|
||||
2, 6, 7, 3, -1,
|
||||
12, 8, 9, 13, -1,
|
||||
13, 9, 10, 14, -1,
|
||||
14, 10, 11, 15, -1,
|
||||
8, 0, 1, 9, -1,
|
||||
9, 1, 2, 10, -1,
|
||||
10, 2, 3, 11, -1,
|
||||
4, 12, 13, 5, -1,
|
||||
5, 13, 14, 6, -1,
|
||||
6, 14, 15, 7, -1,
|
||||
0, 8, 12, 4, -1,
|
||||
7, 15, 11, 3, -1,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -1220 1
|
||||
}
|
||||
DEF tubs_CRTubsR_15 Separator {
|
||||
ShapeHints {
|
||||
vertexOrdering COUNTERCLOCKWISE
|
||||
shapeType SOLID
|
||||
faceType CONVEX
|
||||
}
|
||||
Material {
|
||||
diffuseColor 1 1 1
|
||||
}
|
||||
Coordinate3 {
|
||||
point [
|
||||
1505.43 1505.43 305,
|
||||
1064.5 1843.77 305,
|
||||
551.026 2056.46 305,
|
||||
1.30359e-13 2129 305,
|
||||
1505.43 1505.43 -305,
|
||||
1064.5 1843.77 -305,
|
||||
551.026 2056.46 -305,
|
||||
1.30359e-13 2129 -305,
|
||||
1234.86 1234.86 305,
|
||||
873.18 1512.39 305,
|
||||
451.991 1686.85 305,
|
||||
1.0693e-13 1746.36 305,
|
||||
1234.86 1234.86 -305,
|
||||
873.18 1512.39 -305,
|
||||
451.991 1686.85 -305,
|
||||
1.0693e-13 1746.36 -305,
|
||||
]
|
||||
}
|
||||
IndexedFaceSet {
|
||||
coordIndex [
|
||||
0, 4, 5, 1, -1,
|
||||
1, 5, 6, 2, -1,
|
||||
2, 6, 7, 3, -1,
|
||||
12, 8, 9, 13, -1,
|
||||
13, 9, 10, 14, -1,
|
||||
14, 10, 11, 15, -1,
|
||||
8, 0, 1, 9, -1,
|
||||
9, 1, 2, 10, -1,
|
||||
10, 2, 3, 11, -1,
|
||||
4, 12, 13, 5, -1,
|
||||
5, 13, 14, 6, -1,
|
||||
6, 14, 15, 7, -1,
|
||||
0, 8, 12, 4, -1,
|
||||
7, 15, 11, 3, -1,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -1220 1
|
||||
}
|
||||
DEF tubs_CUTubsL_16 Separator {
|
||||
ShapeHints {
|
||||
vertexOrdering COUNTERCLOCKWISE
|
||||
shapeType SOLID
|
||||
faceType CONVEX
|
||||
}
|
||||
Material {
|
||||
diffuseColor 1 1 1
|
||||
}
|
||||
Coordinate3 {
|
||||
point [
|
||||
1.30972e-13 2139 305,
|
||||
-553.614 2066.12 305,
|
||||
-1069.5 1852.43 305,
|
||||
-1512.5 1512.5 305,
|
||||
1.30972e-13 2139 -305,
|
||||
-553.614 2066.12 -305,
|
||||
-1069.5 1852.43 -305,
|
||||
-1512.5 1512.5 -305,
|
||||
1.0693e-13 1746.36 305,
|
||||
-451.991 1686.85 305,
|
||||
-873.18 1512.39 305,
|
||||
-1234.86 1234.86 305,
|
||||
1.0693e-13 1746.36 -305,
|
||||
-451.991 1686.85 -305,
|
||||
-873.18 1512.39 -305,
|
||||
-1234.86 1234.86 -305,
|
||||
]
|
||||
}
|
||||
IndexedFaceSet {
|
||||
coordIndex [
|
||||
0, 4, 5, 1, -1,
|
||||
1, 5, 6, 2, -1,
|
||||
2, 6, 7, 3, -1,
|
||||
12, 8, 9, 13, -1,
|
||||
13, 9, 10, 14, -1,
|
||||
14, 10, 11, 15, -1,
|
||||
8, 0, 1, 9, -1,
|
||||
9, 1, 2, 10, -1,
|
||||
10, 2, 3, 11, -1,
|
||||
4, 12, 13, 5, -1,
|
||||
5, 13, 14, 6, -1,
|
||||
6, 14, 15, 7, -1,
|
||||
0, 8, 12, 4, -1,
|
||||
7, 15, 11, 3, -1,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -1220 1
|
||||
}
|
||||
DEF tubs_CRTubsL_17 Separator {
|
||||
ShapeHints {
|
||||
vertexOrdering COUNTERCLOCKWISE
|
||||
shapeType SOLID
|
||||
faceType CONVEX
|
||||
}
|
||||
Material {
|
||||
diffuseColor 1 1 1
|
||||
}
|
||||
Coordinate3 {
|
||||
point [
|
||||
1.30359e-13 2129 305,
|
||||
-551.026 2056.46 305,
|
||||
-1064.5 1843.77 305,
|
||||
-1505.43 1505.43 305,
|
||||
1.30359e-13 2129 -305,
|
||||
-551.026 2056.46 -305,
|
||||
-1064.5 1843.77 -305,
|
||||
-1505.43 1505.43 -305,
|
||||
1.0693e-13 1746.36 305,
|
||||
-451.991 1686.85 305,
|
||||
-873.18 1512.39 305,
|
||||
-1234.86 1234.86 305,
|
||||
1.0693e-13 1746.36 -305,
|
||||
-451.991 1686.85 -305,
|
||||
-873.18 1512.39 -305,
|
||||
-1234.86 1234.86 -305,
|
||||
]
|
||||
}
|
||||
IndexedFaceSet {
|
||||
coordIndex [
|
||||
0, 4, 5, 1, -1,
|
||||
1, 5, 6, 2, -1,
|
||||
2, 6, 7, 3, -1,
|
||||
12, 8, 9, 13, -1,
|
||||
13, 9, 10, 14, -1,
|
||||
14, 10, 11, 15, -1,
|
||||
8, 0, 1, 9, -1,
|
||||
9, 1, 2, 10, -1,
|
||||
10, 2, 3, 11, -1,
|
||||
4, 12, 13, 5, -1,
|
||||
5, 13, 14, 6, -1,
|
||||
6, 14, 15, 7, -1,
|
||||
0, 8, 12, 4, -1,
|
||||
7, 15, 11, 3, -1,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -610 1
|
||||
}
|
||||
USE tubs_CUTubsR_14
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -610 1
|
||||
}
|
||||
USE tubs_CRTubsR_15
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -610 1
|
||||
}
|
||||
USE tubs_CUTubsL_16
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 -610 1
|
||||
}
|
||||
USE tubs_CRTubsL_17
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
|
||||
}
|
||||
USE tubs_CUTubsR_14
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
|
||||
}
|
||||
USE tubs_CRTubsR_15
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
|
||||
}
|
||||
USE tubs_CUTubsL_16
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 0 1
|
||||
}
|
||||
USE tubs_CRTubsL_17
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 610 1
|
||||
}
|
||||
USE tubs_CUTubsR_14
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 610 1
|
||||
}
|
||||
USE tubs_CRTubsR_15
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 610 1
|
||||
}
|
||||
USE tubs_CUTubsL_16
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 610 1
|
||||
}
|
||||
USE tubs_CRTubsL_17
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 1220 1
|
||||
}
|
||||
USE tubs_CUTubsR_14
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 1220 1
|
||||
}
|
||||
USE tubs_CRTubsR_15
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 1220 1
|
||||
}
|
||||
USE tubs_CUTubsL_16
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 1000 1220 1
|
||||
}
|
||||
USE tubs_CRTubsL_17
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4100 0 1
|
||||
}
|
||||
DEF box_muCh_18 Separator {
|
||||
Material {
|
||||
diffuseColor 1 1 1
|
||||
}
|
||||
Cube {
|
||||
width 8000
|
||||
height 200
|
||||
depth 8000
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4250 0 1
|
||||
}
|
||||
DEF box_muFe_19 Separator {
|
||||
Material {
|
||||
diffuseColor 1 1 1
|
||||
}
|
||||
Cube {
|
||||
width 8000
|
||||
height 100
|
||||
depth 8000
|
||||
}
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4400 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4550 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4700 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 4850 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5000 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5150 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5300 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5450 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5550 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5700 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5850 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 5950 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6100 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6250 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6350 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6500 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6650 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6750 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 6900 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7050 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7150 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7300 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7450 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7550 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7700 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7850 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 7950 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 8100 0 1
|
||||
}
|
||||
USE box_muCh_18
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 8250 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
Separator {
|
||||
MatrixTransform {
|
||||
matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 8350 0 1
|
||||
}
|
||||
USE box_muFe_19
|
||||
}
|
||||
#End of file.
|
||||
@@ -0,0 +1,40 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: FRClient.h,v 2.0 1998/07/02 16:48:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// FRClient.h
|
||||
// FukuiRenderer Client
|
||||
// Yasuhide Sawada & Satoshi Tanaka
|
||||
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
|
||||
#ifndef FR_CLIENT_H
|
||||
#define FR_CLIENT_H
|
||||
|
||||
#define FRSendLength 256
|
||||
|
||||
class FRClient {
|
||||
public:
|
||||
FRClient();
|
||||
virtual ~FRClient();
|
||||
|
||||
int create();
|
||||
int connect(const char *hostname, int port);
|
||||
|
||||
int send(const char *sendbuf);
|
||||
int receive(char *recvbuf);
|
||||
|
||||
int close();
|
||||
protected:
|
||||
int fd;
|
||||
int port;
|
||||
};
|
||||
|
||||
#endif //FR_CLIENT_H
|
||||
#endif //G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,51 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FRClient.hh,v 2.0 1998/07/02 16:47:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4FRClient.hh
|
||||
// Yasuhide Sawada and Satoshi Tanaka
|
||||
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
|
||||
#ifndef G4_FR_CLIENT_HH
|
||||
#define G4_FR_CLIENT_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class FRClient;
|
||||
|
||||
class G4FRClient {
|
||||
// G4FRClient can SEND only!
|
||||
public:
|
||||
G4FRClient();
|
||||
virtual ~G4FRClient();
|
||||
|
||||
G4bool connect(const char *hostname, G4int port);
|
||||
void close();
|
||||
|
||||
G4int getPort() const;
|
||||
|
||||
G4bool isConnected() const { return connected; }
|
||||
G4bool is_open () const { return connected; }
|
||||
|
||||
G4FRClient& operator << (G4int);
|
||||
G4FRClient& operator << (G4double);
|
||||
G4FRClient& operator << (const char *);
|
||||
G4FRClient& operator << (G4FRClient& (*)(G4FRClient&));
|
||||
private:
|
||||
FRClient *fFRClient;
|
||||
G4bool connected;
|
||||
G4int fPort;
|
||||
};
|
||||
|
||||
//manipulator
|
||||
G4FRClient& endl(G4FRClient&);
|
||||
|
||||
#endif //G4_FR_CLIENT_HH
|
||||
#endif //G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,48 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1.hh,v 2.3 1998/11/09 19:30:45 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1.hh
|
||||
// Yasuhide Sawada and Satoshi Tanaka
|
||||
|
||||
#if defined (G4VIS_BUILD_VRML_DRIVER) || (G4VIS_USE_VRML)
|
||||
|
||||
#ifndef G4VRML1_HH
|
||||
#define G4VRML1_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
#include "FRClient.h"
|
||||
|
||||
class G4VScene;
|
||||
|
||||
//#define FR_VRML_DEFAULT_PORT 40801
|
||||
//#define FR_VRML_PORT_ENV "FR_VRML_PORT"
|
||||
//#define FR_VRML_HOST_NAME_ENV "FR_VRML_HOST_NAME"
|
||||
|
||||
#include "G4VRMLNetConfig.hh"
|
||||
|
||||
class G4VRML1: public G4VGraphicsSystem {
|
||||
public:
|
||||
G4VRML1();
|
||||
~G4VRML1();
|
||||
G4VScene* CreateScene(const G4String& name = "");
|
||||
G4VView* CreateView(G4VScene&, const G4String& name = "");
|
||||
|
||||
public:
|
||||
const G4String& getHostName() { return fHostName; }
|
||||
G4int getPort() { return fPort; }
|
||||
|
||||
private:
|
||||
G4String fHostName;
|
||||
G4int fPort;
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML1_HH
|
||||
#endif //G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,34 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1File.hh,v 2.3 1998/11/09 19:32:48 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1File.hh
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
#if defined (G4VIS_BUILD_VRMLFILE_DRIVER) || (G4VIS_USE_VRMLFILE)
|
||||
|
||||
#ifndef G4VRML1FILE_HH
|
||||
#define G4VRML1FILE_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
class G4VScene;
|
||||
|
||||
class G4VRML1File: public G4VGraphicsSystem {
|
||||
public:
|
||||
G4VRML1File();
|
||||
~G4VRML1File();
|
||||
G4VScene* CreateScene(const G4String& name = "");
|
||||
G4VView* CreateView(G4VScene&, const G4String& name = "");
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML1File_HH
|
||||
#endif //G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1FileScene.hh,v 2.6 1998/12/04 09:10:54 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1FileScene.hh
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
|
||||
#ifndef G4VRML1FILE_SCENE_HH
|
||||
#define G4VRML1FILE_SCENE_HH
|
||||
|
||||
#include <rw/tvhdict.h>
|
||||
#include <fstream.h>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VScene.hh"
|
||||
|
||||
|
||||
class G4VRML1File;
|
||||
class G4VisAttributes;
|
||||
|
||||
class G4VRML1FileScene: public G4VScene {
|
||||
|
||||
|
||||
// methods (public)
|
||||
public:
|
||||
G4VRML1FileScene(G4VRML1File& system, const G4String& name = "");
|
||||
~G4VRML1FileScene();
|
||||
void AddThis(const G4Box&);
|
||||
void AddThis(const G4Cons&);
|
||||
void AddThis(const G4Tubs&);
|
||||
void AddThis(const G4Trd&);
|
||||
void AddThis(const G4Trap&);
|
||||
void AddThis(const G4Sphere&);
|
||||
void AddThis(const G4Para&);
|
||||
void AddThis(const G4Torus&);
|
||||
void AddThis(const G4VSolid&);
|
||||
|
||||
void BeginPrimitives(const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives();
|
||||
|
||||
void AddPrimitive(const G4Polyline&);
|
||||
void AddPrimitive(const G4Polyhedron&);
|
||||
void AddPrimitive(const G4NURBS&);
|
||||
void AddPrimitive(const G4Text&);
|
||||
void AddPrimitive(const G4Circle&);
|
||||
void AddPrimitive(const G4Square&);
|
||||
void AddPrimitive (const G4Polymarker& polymarker)
|
||||
{ G4VScene::AddPrimitive (polymarker); }
|
||||
|
||||
void ClearStore();
|
||||
|
||||
void BeginModeling();
|
||||
void EndModeling();
|
||||
|
||||
void beginSending();
|
||||
void endSending();
|
||||
|
||||
static G4int GetSceneCount() { return fSceneCount; }
|
||||
|
||||
void connectPort();
|
||||
void closePort();
|
||||
|
||||
// methods (private)
|
||||
private:
|
||||
|
||||
void SendMaterialNode( const G4VisAttributes* pAV ); // NEW NEW NEW
|
||||
void SendMaterialNode();
|
||||
void SendMatrixTransformNode(const G4Transform3D *);
|
||||
void SendCubeNode(G4double, G4double, G4double);
|
||||
void SendCylinderNode(G4double, G4double);
|
||||
void SendSphereNode(G4double);
|
||||
|
||||
void SendMarkerColor ( const G4VMarker& mark ) ;
|
||||
void SendMarkerWorldPosition ( const G4VMarker& mark ) ;
|
||||
G4double GetMarkerHalfSize ( const G4VMarker& mark ) ;
|
||||
|
||||
G4bool isConnected () { return fFlagDestOpen ; }
|
||||
|
||||
// data
|
||||
private:
|
||||
char fVRMLFileDestDir[256] ;
|
||||
char fVRMLFileName[256] ;
|
||||
|
||||
G4String fCurrentDEF;
|
||||
|
||||
G4VRML1File& fSystem; // Graphics system for this scene.
|
||||
ofstream fDest ;
|
||||
G4bool fFlagDestOpen ;
|
||||
|
||||
G4int fMaxFileNum ;
|
||||
|
||||
static G4int fSceneIdCount;
|
||||
static G4int fSceneCount; // No. of existing scenes.
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML1File_SCENE_HH
|
||||
#endif //G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
@@ -0,0 +1,40 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1FileView.hh,v 2.3 1998/11/09 19:32:52 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1FileView.hh
|
||||
// Satoshi Tanaka and Yasuhide Sawada
|
||||
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
|
||||
#ifndef G4VRML1FILE_VIEW_HH
|
||||
#define G4VRML1FILE_VIEW_HH
|
||||
|
||||
#include "G4VView.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VRML1FileScene;
|
||||
|
||||
class G4VRML1FileView: public G4VView {
|
||||
public:
|
||||
G4VRML1FileView(G4VRML1FileScene& scene, const G4String& name = "");
|
||||
~G4VRML1FileView();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
void ShowView();
|
||||
void FinishView();
|
||||
private:
|
||||
void SetView();
|
||||
|
||||
private:
|
||||
G4VRML1FileScene& fScene; // Reference to Graphics Scene for this view.
|
||||
};
|
||||
|
||||
#endif //G4VRML1File_VIEW_HH
|
||||
#endif //G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
@@ -0,0 +1,99 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1Scene.hh,v 2.4 1998/11/09 19:32:58 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1Scene.hh
|
||||
// Yasuhide Sawada & Satoshi Tanaka
|
||||
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
|
||||
#ifndef G4VRML1_SCENE_HH
|
||||
#define G4VRML1_SCENE_HH
|
||||
|
||||
#include <rw/tvhdict.h>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VScene.hh"
|
||||
|
||||
#include "G4FRClient.hh"
|
||||
|
||||
class G4VRML1;
|
||||
class G4VisAttributes;
|
||||
|
||||
class G4VRML1Scene: public G4VScene {
|
||||
|
||||
enum { MAX_CONNECTION_TRIAL = 10 } ;
|
||||
|
||||
// methods (public)
|
||||
public:
|
||||
G4VRML1Scene(G4VRML1& system, const G4String& name = "");
|
||||
~G4VRML1Scene();
|
||||
void AddThis(const G4Box&);
|
||||
void AddThis(const G4Cons&);
|
||||
void AddThis(const G4Tubs&);
|
||||
void AddThis(const G4Trd&);
|
||||
void AddThis(const G4Trap&);
|
||||
void AddThis(const G4Sphere&);
|
||||
void AddThis(const G4Para&);
|
||||
void AddThis(const G4Torus&);
|
||||
void AddThis(const G4VSolid&);
|
||||
|
||||
void BeginPrimitives(const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives();
|
||||
|
||||
void AddPrimitive(const G4Polyline&);
|
||||
void AddPrimitive(const G4Polyhedron&);
|
||||
void AddPrimitive(const G4NURBS&);
|
||||
void AddPrimitive(const G4Text&);
|
||||
void AddPrimitive(const G4Circle&);
|
||||
void AddPrimitive(const G4Square&);
|
||||
void AddPrimitive (const G4Polymarker& polymarker)
|
||||
{ G4VScene::AddPrimitive (polymarker); }
|
||||
|
||||
void ClearStore();
|
||||
|
||||
void BeginModeling();
|
||||
void EndModeling();
|
||||
|
||||
void beginSending();
|
||||
void endSending();
|
||||
|
||||
static G4int GetSceneCount() { return fSceneCount; }
|
||||
|
||||
void connectPort(int max_trial = MAX_CONNECTION_TRIAL );
|
||||
void closePort();
|
||||
|
||||
// methods (private)
|
||||
private:
|
||||
void SendMaterialNode( const G4VisAttributes* pAV );
|
||||
void SendMaterialNode();
|
||||
void SendMatrixTransformNode(const G4Transform3D *);
|
||||
void SendCubeNode(G4double, G4double, G4double);
|
||||
void SendCylinderNode(G4double, G4double);
|
||||
void SendSphereNode(G4double);
|
||||
|
||||
void SendMarkerColor ( const G4VMarker& mark ) ;
|
||||
void SendMarkerWorldPosition ( const G4VMarker& mark ) ;
|
||||
G4double GetMarkerHalfSize ( const G4VMarker& mark ) ;
|
||||
|
||||
// data
|
||||
private:
|
||||
G4String fCurrentDEF;
|
||||
|
||||
G4VRML1& fSystem; // Graphics system for this scene.
|
||||
G4FRClient fDest ;
|
||||
|
||||
static G4int fSceneIdCount;
|
||||
static G4int fSceneCount; // No. of existing scenes.
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML1_SCENE_HH
|
||||
#endif //G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,40 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1View.hh,v 2.3 1998/11/09 19:32:59 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1View.hh
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
|
||||
#ifndef G4VRML1_VIEW_HH
|
||||
#define G4VRML1_VIEW_HH
|
||||
|
||||
#include "G4VView.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VRML1Scene;
|
||||
|
||||
class G4VRML1View: public G4VView {
|
||||
public:
|
||||
G4VRML1View(G4VRML1Scene& scene, const G4String& name = "");
|
||||
~G4VRML1View();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
void ShowView();
|
||||
void FinishView();
|
||||
private:
|
||||
void SetView();
|
||||
|
||||
private:
|
||||
G4VRML1Scene& fScene; // Reference to Graphics Scene for this view.
|
||||
};
|
||||
|
||||
#endif //G4VRML1_VIEW_HH
|
||||
#endif //G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,47 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2.hh,v 2.2 1998/11/09 19:33:01 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2.hh
|
||||
// Satoshi Tanaka and Yasuhide Sawada
|
||||
|
||||
#if defined (G4VIS_BUILD_VRML_DRIVER) || (G4VIS_USE_VRML)
|
||||
|
||||
#ifndef G4VRML2_HH
|
||||
#define G4VRML2_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
#include "FRClient.h"
|
||||
|
||||
class G4VScene;
|
||||
|
||||
#include "G4VRMLNetConfig.hh"
|
||||
//#define FR_VRML_DEFAULT_PORT 40801
|
||||
//#define FR_VRML_PORT_ENV "FR_VRML_PORT"
|
||||
//#define FR_VRML_HOST_NAME_ENV "FR_VRML_HOST_NAME"
|
||||
|
||||
class G4VRML2: public G4VGraphicsSystem {
|
||||
public:
|
||||
G4VRML2();
|
||||
~G4VRML2();
|
||||
G4VScene* CreateScene(const G4String& name = "");
|
||||
G4VView* CreateView(G4VScene&, const G4String& name = "");
|
||||
|
||||
public:
|
||||
const G4String& getHostName() { return fHostName; }
|
||||
G4int getPort() { return fPort; }
|
||||
|
||||
private:
|
||||
G4String fHostName;
|
||||
G4int fPort;
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML2_HH
|
||||
#endif //G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,34 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2File.hh,v 2.2 1998/11/09 19:33:02 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2File.hh
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
#if defined (G4VIS_BUILD_VRMLFILE_DRIVER) || (G4VIS_USE_VRMLFILE)
|
||||
|
||||
#ifndef G4VRML2FILE_HH
|
||||
#define G4VRML2FILE_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
class G4VScene;
|
||||
|
||||
class G4VRML2File: public G4VGraphicsSystem {
|
||||
public:
|
||||
G4VRML2File();
|
||||
~G4VRML2File();
|
||||
G4VScene* CreateScene(const G4String& name = "");
|
||||
G4VView* CreateView(G4VScene&, const G4String& name = "");
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML2File_HH
|
||||
#endif //G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2FileScene.hh,v 2.6 1998/12/04 09:10:54 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2FileScene.hh
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
|
||||
#ifndef G4VRML2FILE_SCENE_HH
|
||||
#define G4VRML2FILE_SCENE_HH
|
||||
|
||||
#include <fstream.h>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VScene.hh"
|
||||
|
||||
|
||||
class G4VRML2File;
|
||||
class G4VisAttributes;
|
||||
|
||||
class G4VRML2FileScene: public G4VScene {
|
||||
|
||||
|
||||
// methods (public)
|
||||
public:
|
||||
G4VRML2FileScene(G4VRML2File& system, const G4String& name = "");
|
||||
~G4VRML2FileScene();
|
||||
void AddThis(const G4Box&);
|
||||
void AddThis(const G4Cons&);
|
||||
void AddThis(const G4Tubs&);
|
||||
void AddThis(const G4Trd&);
|
||||
void AddThis(const G4Trap&);
|
||||
void AddThis(const G4Sphere&);
|
||||
void AddThis(const G4Para&);
|
||||
void AddThis(const G4Torus&);
|
||||
void AddThis(const G4VSolid&);
|
||||
|
||||
void BeginPrimitives(const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives();
|
||||
|
||||
void AddPrimitive(const G4Polyline&);
|
||||
void AddPrimitive(const G4Polyhedron&);
|
||||
void AddPrimitive(const G4NURBS&);
|
||||
void AddPrimitive(const G4Text&);
|
||||
void AddPrimitive(const G4Circle&);
|
||||
void AddPrimitive(const G4Square&);
|
||||
void AddPrimitive (const G4Polymarker& polymarker)
|
||||
{ G4VScene::AddPrimitive (polymarker); }
|
||||
|
||||
void ClearStore();
|
||||
|
||||
void BeginModeling();
|
||||
void EndModeling();
|
||||
|
||||
static G4int GetSceneCount() { return fSceneCount; }
|
||||
|
||||
// IO
|
||||
void beginSending();
|
||||
void endSending();
|
||||
|
||||
void connectPort();
|
||||
void closePort();
|
||||
|
||||
// methods (private)
|
||||
private:
|
||||
|
||||
void SendMaterialNode ( const G4VisAttributes* pAV );
|
||||
void SendMaterialNode ();
|
||||
|
||||
void SendLineColor ( const G4VisAttributes* pAV );
|
||||
void SendMarkerColor ( const G4VMarker& mark ) ;
|
||||
void SendMarkerWorldPosition ( const G4VMarker& mark ) ;
|
||||
|
||||
G4double GetMarkerHalfSize ( const G4VMarker& mark ) ;
|
||||
void GetMarkerWorldPosition ( const G4VMarker& mark ,
|
||||
double* pX ,
|
||||
double* pY ,
|
||||
double* pZ ) ;
|
||||
|
||||
G4bool isConnected () { return fFlagDestOpen ; }
|
||||
|
||||
G4bool IsPVPickable () { return fPVPickable ;}
|
||||
void SetPVPickability ( G4bool on_off ) { fPVPickable = on_off ;}
|
||||
G4double SetPVTransparency () ;
|
||||
G4double GetPVTransparency () { return fPVTransparency ; }
|
||||
|
||||
// data
|
||||
private:
|
||||
char fVRMLFileDestDir[256] ;
|
||||
char fVRMLFileName[256] ;
|
||||
|
||||
G4VRML2File& fSystem; // Graphics system for this scene.
|
||||
G4bool fFlagDestOpen ;
|
||||
|
||||
G4int fMaxFileNum ;
|
||||
|
||||
G4bool fPVPickable ;
|
||||
G4double fPVTransparency ;
|
||||
|
||||
static G4int fSceneIdCount;
|
||||
static G4int fSceneCount; // No. of existing scenes.
|
||||
|
||||
public:
|
||||
ofstream fDest ;
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML2File_SCENE_HH
|
||||
#endif //G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
@@ -0,0 +1,47 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2FileView.hh,v 2.2 1998/11/09 19:33:06 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2FileView.hh
|
||||
// Satoshi Tanaka and Yasuhide Sawada
|
||||
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
|
||||
#ifndef G4VRML2FILE_VIEW_HH
|
||||
#define G4VRML2FILE_VIEW_HH
|
||||
|
||||
#include <fstream.h>
|
||||
#include "G4VView.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VRML2FileScene;
|
||||
|
||||
class G4VRML2FileView: public G4VView {
|
||||
public:
|
||||
G4VRML2FileView(G4VRML2FileScene& scene, const G4String& name = "");
|
||||
~G4VRML2FileView();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
void ShowView();
|
||||
void FinishView();
|
||||
private:
|
||||
void SetView(); // Do nothing. SendViewParameters will do its job.
|
||||
void SendViewParameters () ;
|
||||
|
||||
private:
|
||||
G4VRML2FileScene& fScene; // Reference to Graphics Scene for this view.
|
||||
ofstream& fDest ;
|
||||
|
||||
G4double fViewHalfAngle ;
|
||||
G4double fsin_VHA ;
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML2File_VIEW_HH
|
||||
#endif //G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
@@ -0,0 +1,109 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2Scene.hh,v 2.5 1998/12/03 09:28:24 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2Scene.hh
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
|
||||
#ifndef G4VRML2_SCENE_HH
|
||||
#define G4VRML2_SCENE_HH
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VScene.hh"
|
||||
|
||||
#include "G4FRClient.hh"
|
||||
|
||||
class G4VRML2;
|
||||
class G4VisAttributes;
|
||||
|
||||
class G4VRML2Scene: public G4VScene {
|
||||
|
||||
enum { MAX_CONNECTION_TRIAL = 10 } ;
|
||||
|
||||
// methods (public)
|
||||
public:
|
||||
G4VRML2Scene(G4VRML2& system, const G4String& name = "");
|
||||
~G4VRML2Scene();
|
||||
void AddThis(const G4Box&);
|
||||
void AddThis(const G4Cons&);
|
||||
void AddThis(const G4Tubs&);
|
||||
void AddThis(const G4Trd&);
|
||||
void AddThis(const G4Trap&);
|
||||
void AddThis(const G4Sphere&);
|
||||
void AddThis(const G4Para&);
|
||||
void AddThis(const G4Torus&);
|
||||
void AddThis(const G4VSolid&);
|
||||
|
||||
void BeginPrimitives(const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives();
|
||||
|
||||
void AddPrimitive(const G4Polyline&);
|
||||
void AddPrimitive(const G4Polyhedron&);
|
||||
void AddPrimitive(const G4NURBS&);
|
||||
void AddPrimitive(const G4Text&);
|
||||
void AddPrimitive(const G4Circle&);
|
||||
void AddPrimitive(const G4Square&);
|
||||
void AddPrimitive (const G4Polymarker& polymarker)
|
||||
{ G4VScene::AddPrimitive (polymarker); }
|
||||
|
||||
void ClearStore();
|
||||
|
||||
void BeginModeling();
|
||||
void EndModeling();
|
||||
|
||||
static G4int GetSceneCount() { return fSceneCount; }
|
||||
|
||||
// IO
|
||||
void beginSending();
|
||||
void endSending();
|
||||
|
||||
void connectPort(int max_trial = MAX_CONNECTION_TRIAL );
|
||||
void closePort();
|
||||
|
||||
// methods (private)
|
||||
private:
|
||||
void SendMaterialNode ( const G4VisAttributes* pAV );
|
||||
void SendMaterialNode ();
|
||||
|
||||
void SendLineColor ( const G4VisAttributes* pAV );
|
||||
void SendMarkerColor ( const G4VMarker& mark ) ;
|
||||
void SendMarkerWorldPosition ( const G4VMarker& mark ) ;
|
||||
|
||||
G4double GetMarkerHalfSize ( const G4VMarker& mark ) ;
|
||||
void GetMarkerWorldPosition ( const G4VMarker& mark ,
|
||||
double* pX ,
|
||||
double* pY ,
|
||||
double* pZ ) ;
|
||||
|
||||
G4bool IsPVPickable () { return fPVPickable ;}
|
||||
void SetPVPickability ( G4bool on_off ) { fPVPickable = on_off ;}
|
||||
G4double SetPVTransparency () ;
|
||||
G4double GetPVTransparency () { return fPVTransparency ; }
|
||||
|
||||
// data
|
||||
private:
|
||||
|
||||
G4VRML2& fSystem; // Graphics system for this scene.
|
||||
|
||||
G4bool fPVPickable ;
|
||||
G4double fPVTransparency ;
|
||||
|
||||
static G4int fSceneIdCount;
|
||||
static G4int fSceneCount; // No. of existing scenes.
|
||||
|
||||
public:
|
||||
G4FRClient fDest ;
|
||||
|
||||
};
|
||||
|
||||
#endif //G4VRML2_SCENE_HH
|
||||
#endif //G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,47 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2View.hh,v 2.2 1998/11/09 19:33:10 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2View.hh
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
|
||||
#ifndef G4VRML2_VIEW_HH
|
||||
#define G4VRML2_VIEW_HH
|
||||
|
||||
#include "G4VView.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4FRClient.hh"
|
||||
|
||||
class G4VRML2Scene;
|
||||
|
||||
class G4VRML2View: public G4VView {
|
||||
public:
|
||||
G4VRML2View(G4VRML2Scene& scene, const G4String& name = "");
|
||||
~G4VRML2View();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
void ShowView();
|
||||
void FinishView();
|
||||
private:
|
||||
void SetView(); // Do nothing. SendViewParameters will do its job.
|
||||
void SendViewParameters () ;
|
||||
|
||||
private:
|
||||
G4VRML2Scene& fScene; // Reference to Graphics Scene for this view.
|
||||
G4FRClient& fDest ;
|
||||
|
||||
G4double fViewHalfAngle ;
|
||||
G4double fsin_VHA ;
|
||||
};
|
||||
|
||||
#endif //G4VRML2_VIEW_HH
|
||||
#endif //G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,24 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRMLNetConfig.hh,v 2.0 1998/07/02 16:48:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRMLNetConfig.hh
|
||||
// Satoshi Tanaka
|
||||
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
|
||||
#ifndef G4VRML_NET_CONFIG_HH
|
||||
#define G4VRML_NET_CONFIG_HH
|
||||
|
||||
const int FR_VRML_DEFAULT_PORT = 40801 ;
|
||||
const char FR_VRML_PORT_ENV [] = "G4VRML_PORT" ;
|
||||
const char FR_VRML_HOST_NAME_ENV[] = "G4VRML_HOST_NAME" ;
|
||||
|
||||
#endif // G4VRML_NET_CONFIG_HH
|
||||
#endif // G4VIS_BUILD_VRML_DRIVER
|
||||
@@ -0,0 +1,131 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: FRClient.cc,v 2.2 1998/07/13 17:12:04 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// FRClient.cc
|
||||
// FukuiRenderer Client
|
||||
// Yasuhide Sawada & Satoshi Tanaka
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "FRClient.h"
|
||||
|
||||
FRClient::FRClient()
|
||||
{
|
||||
fd = -1;
|
||||
create();
|
||||
}
|
||||
|
||||
FRClient::~FRClient()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
int FRClient::create()
|
||||
{
|
||||
/* stream socket */
|
||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (fd < 0)
|
||||
fputs("error: socket.\n", stderr);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int FRClient::connect(const char *hostname, int port_)
|
||||
{
|
||||
// local variables
|
||||
struct sockaddr_in sa;
|
||||
struct hostent *hp;
|
||||
|
||||
// set port ( sa.sin_family, sa.sin_port )
|
||||
port = port_; // Store port number to data member
|
||||
memset( (char *)&sa, '\0', sizeof(sa)) ;
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(port);
|
||||
|
||||
// set server host ( sa.sin_addr )
|
||||
if (hostname == NULL) {
|
||||
hostname = "localhost";
|
||||
// reset arg
|
||||
}
|
||||
hp = gethostbyname(hostname) ;
|
||||
if ( !hp ) {
|
||||
G4cerr << "ERROR: gethostbyname() failed" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy( (char * )&sa.sin_addr, (char * )hp->h_addr, hp->h_length );
|
||||
|
||||
// make connection to server
|
||||
if (::connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
|
||||
fputs("error: connect\n", stderr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// return file descripter (data member)
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int FRClient::send(const char *sendbuf)
|
||||
{
|
||||
int len = strlen(sendbuf);
|
||||
|
||||
if (::send(fd, sendbuf, len, 0) < 0) {
|
||||
fputs("error: Send()\n", stderr);
|
||||
len = -1;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
int FRClient::receive(char *recvbuf)
|
||||
{
|
||||
int len;
|
||||
|
||||
memset(recvbuf, '\0', FRSendLength + 1);
|
||||
len = ::recv(fd, recvbuf, FRSendLength, 0);
|
||||
if(len < 0) {
|
||||
fputs("error: Receive()\n", stderr);
|
||||
len = -1;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
int FRClient::close()
|
||||
{
|
||||
/*
|
||||
shutdown :argument '2' means shutdown both send and receive.
|
||||
*/
|
||||
if (::shutdown(fd, 2) < 0) {
|
||||
fputs("error: shutdown\n", stderr);
|
||||
return -1;
|
||||
}
|
||||
::close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,95 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FRClient.cc,v 2.0 1998/07/02 16:48:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4FRClient.cc
|
||||
// Yasuhide Sawada & Satoshi Tanaka
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "G4FRClient.hh"
|
||||
#include "FRClient.h"
|
||||
|
||||
G4FRClient::G4FRClient()
|
||||
{
|
||||
fFRClient = NULL;
|
||||
fPort = -1;
|
||||
connected = false;
|
||||
}
|
||||
|
||||
G4FRClient::~G4FRClient()
|
||||
{
|
||||
if (connected)
|
||||
this->close();
|
||||
}
|
||||
|
||||
G4bool G4FRClient::connect(const char *hostname, G4int port)
|
||||
{
|
||||
if (connected)
|
||||
return false;
|
||||
|
||||
delete fFRClient;
|
||||
fFRClient = new FRClient();
|
||||
|
||||
fPort = port;
|
||||
connected = (fFRClient->connect(hostname, port) < 0) ? false : true ;
|
||||
|
||||
return connected;
|
||||
}
|
||||
|
||||
void G4FRClient::close()
|
||||
{
|
||||
delete fFRClient;
|
||||
fFRClient = NULL;
|
||||
connected = false;
|
||||
}
|
||||
|
||||
G4int G4FRClient::getPort() const
|
||||
{
|
||||
return fPort;
|
||||
}
|
||||
|
||||
G4FRClient& G4FRClient::operator << (G4int val)
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "%d", val);
|
||||
fFRClient->send(buf);
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4FRClient& G4FRClient::operator << (G4double val)
|
||||
{
|
||||
char buf[64];
|
||||
sprintf(buf, "%g", val);
|
||||
fFRClient->send(buf);
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4FRClient& G4FRClient::operator << (const char *pval)
|
||||
{
|
||||
fFRClient->send(pval);
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4FRClient& G4FRClient::operator << (G4FRClient& (*func)(G4FRClient&))
|
||||
{
|
||||
return func(*this);
|
||||
}
|
||||
|
||||
//manipulator
|
||||
G4FRClient& endl(G4FRClient& c)
|
||||
{
|
||||
return c << "\n";
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1.cc,v 2.4 1998/11/09 19:33:17 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1.cc
|
||||
// Yasuhide Sawada & Satoshi Tanaka
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#include <stdio.h> // sscanf
|
||||
#include <stdlib.h> // getenv
|
||||
|
||||
#include "G4VScene.hh"
|
||||
|
||||
#include "G4VRML1.hh"
|
||||
#include "G4VRML1Scene.hh"
|
||||
#include "G4VRML1View.hh"
|
||||
|
||||
#include "G4FRClient.hh"
|
||||
|
||||
|
||||
G4VRML1::G4VRML1() :
|
||||
G4VGraphicsSystem("VRML1", "VRML1", G4VGraphicsSystem::threeD)
|
||||
{
|
||||
// port number
|
||||
fPort = FR_VRML_DEFAULT_PORT;
|
||||
char *pport = getenv(FR_VRML_PORT_ENV);
|
||||
if (pport) {
|
||||
sscanf(pport, "%d", &fPort);
|
||||
}
|
||||
|
||||
// host name
|
||||
fHostName = "localhost" ; // G4String::operator = ( const char* cs )
|
||||
char *phostname = getenv(FR_VRML_HOST_NAME_ENV);
|
||||
if (phostname) {
|
||||
fHostName = phostname;
|
||||
}
|
||||
}
|
||||
|
||||
G4VRML1::~G4VRML1()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
G4VScene* G4VRML1::CreateScene(const G4String& name)
|
||||
{
|
||||
G4VScene *p = NULL;
|
||||
|
||||
p = new G4VRML1Scene(*this, name);
|
||||
|
||||
G4cout << G4VRML1Scene::GetSceneCount()
|
||||
<< " " << fName << " scenes extanct." << endl;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
G4VView* G4VRML1::CreateView(G4VScene& scene, const G4String& name)
|
||||
{
|
||||
G4VView* pView = NULL;
|
||||
|
||||
G4VRML1Scene* pScene = (G4VRML1Scene*)&scene;
|
||||
pView = new G4VRML1View(*pScene, name);
|
||||
|
||||
return pView;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1File.cc,v 2.4 1998/11/09 19:33:18 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1File.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#include <stdio.h> // sscanf
|
||||
#include <stdlib.h> // getenv
|
||||
|
||||
#include "G4VScene.hh"
|
||||
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML1FileScene.hh"
|
||||
#include "G4VRML1FileView.hh"
|
||||
|
||||
#include "G4FRClient.hh"
|
||||
|
||||
|
||||
G4VRML1File::G4VRML1File() :
|
||||
G4VGraphicsSystem("VRML1FILE", "VRML1FILE", G4VGraphicsSystem::threeD)
|
||||
{
|
||||
}
|
||||
|
||||
G4VRML1File::~G4VRML1File()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
G4VScene* G4VRML1File::CreateScene(const G4String& name)
|
||||
{
|
||||
G4VScene *p = NULL;
|
||||
|
||||
p = new G4VRML1FileScene(*this, name);
|
||||
|
||||
G4cout << G4VRML1FileScene::GetSceneCount()
|
||||
<< " " << fName << " scenes extanct." << endl;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
G4VView* G4VRML1File::CreateView(G4VScene& scene, const G4String& name)
|
||||
{
|
||||
G4VView* pView = NULL;
|
||||
|
||||
G4VRML1FileScene* pScene = (G4VRML1FileScene*)&scene;
|
||||
pView = new G4VRML1FileView(*pScene, name);
|
||||
|
||||
return pView;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,189 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1FileScene.cc,v 2.7 1998/12/07 06:40:18 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1FileScene.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_SCENE
|
||||
|
||||
#include <fstream.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Transform.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
|
||||
#include "G4VRML1FileScene.hh"
|
||||
#include "G4VRML1FileView.hh"
|
||||
#include "G4VRML1File.hh"
|
||||
|
||||
// CONST
|
||||
|
||||
const char WRL_FILE_HEADER [] = "g4_";
|
||||
const char DEFAULT_WRL_FILE_NAME[] = "g4.wrl";
|
||||
const char ENV_VRML_VIEWER [] = "G4VRMLFILE_VIEWER";
|
||||
const char NO_VRML_VIEWER [] = "NONE";
|
||||
const char VRMLFILE_DEST_DIR [] = "G4VRMLFILE_DEST_DIR";
|
||||
|
||||
|
||||
G4VRML1FileScene::G4VRML1FileScene(G4VRML1File& system, const G4String& name) :
|
||||
G4VScene(system, fSceneIdCount++, name),
|
||||
fSystem(system),
|
||||
fDest() ,
|
||||
fFlagDestOpen( false )
|
||||
{
|
||||
fSceneCount++;
|
||||
fCurrentDEF = "";
|
||||
strcpy(fVRMLFileName, "");
|
||||
|
||||
if ( getenv( VRMLFILE_DEST_DIR ) == NULL ) {
|
||||
strcpy( fVRMLFileDestDir, "" );
|
||||
} else {
|
||||
strcpy( fVRMLFileDestDir, getenv( VRMLFILE_DEST_DIR ) );
|
||||
}
|
||||
|
||||
// maximum number of g4.prim files in the dest directory
|
||||
fMaxFileNum = 1 ; // initialization
|
||||
if ( getenv( "G4VRMLFILE_MAX_FILE_NUM" ) != NULL ) {
|
||||
|
||||
sscanf( getenv("G4VRMLFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ;
|
||||
|
||||
} else {
|
||||
fMaxFileNum = 1 ;
|
||||
}
|
||||
if( fMaxFileNum < 1 ) { fMaxFileNum = 1 ; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
G4VRML1FileScene::~G4VRML1FileScene()
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
G4cerr << "***** ~G4VRML1FileScene" << endl;
|
||||
#endif
|
||||
fSceneCount--;
|
||||
}
|
||||
|
||||
|
||||
#define G4VRML1SCENE G4VRML1FileScene
|
||||
#define IS_CONNECTED this->isConnected()
|
||||
#include "G4VRML1SceneFunc.icc"
|
||||
#undef IS_CONNECTED
|
||||
#undef G4VRML1SCENE
|
||||
|
||||
|
||||
void G4VRML1FileScene::connectPort()
|
||||
{
|
||||
// g4.wrl, g4_1.wrl, ..., g4_MAX_FILE_INDEX.wrl
|
||||
const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
|
||||
|
||||
// dest directory (null if no environmental variables is set)
|
||||
strcpy ( fVRMLFileName, fVRMLFileDestDir) ;
|
||||
|
||||
// create full path name (default)
|
||||
strcat ( fVRMLFileName, DEFAULT_WRL_FILE_NAME );
|
||||
|
||||
// Determine VRML file name
|
||||
for( int i = 0 ; i < fMaxFileNum ; i++) {
|
||||
|
||||
// Message
|
||||
if( fMaxFileNum > 1 && i == MAX_FILE_INDEX ) {
|
||||
G4cerr << "===========================================" << endl;
|
||||
G4cerr << "WARNING MESSAGE from VRML1FILE driver: " << endl;
|
||||
G4cerr << " This file name is the final one in the " << endl;
|
||||
G4cerr << " automatic updation of the output file name." << endl;
|
||||
G4cerr << " You may overwrite an existing file of " << endl;
|
||||
G4cerr << " the same name. " << endl;
|
||||
G4cerr << "===========================================" << endl;
|
||||
}
|
||||
|
||||
// re-determine file to G4VRMLFILE_DEST_DIR/g4_i.wrl for i>0
|
||||
if( i > 0 ) {
|
||||
sprintf( fVRMLFileName, "%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, i );
|
||||
}
|
||||
|
||||
// check validity of the file name
|
||||
ifstream fin ;
|
||||
fin.open(fVRMLFileName) ;
|
||||
if(!fin) {
|
||||
// new file
|
||||
fin.close(); // error recovery
|
||||
break;
|
||||
} else {
|
||||
// already exists (try next)
|
||||
fin.close();
|
||||
}
|
||||
|
||||
} // for
|
||||
|
||||
// open a VRML 1.0 file with determined file name
|
||||
G4cerr << "===========================================" << endl;
|
||||
G4cerr << "Output VRML 1.0 file: " << fVRMLFileName << endl;
|
||||
G4cerr << "Muximal number of file in the destination directory: " << fMaxFileNum << endl;
|
||||
G4cerr << " (Customizable as: setenv G4VRMLFILE_MAX_FILE_NUM number) " << endl;
|
||||
G4cerr << "===========================================" << endl;
|
||||
|
||||
fDest.open(fVRMLFileName) ; fFlagDestOpen = true ;
|
||||
}
|
||||
|
||||
|
||||
void G4VRML1FileScene::closePort()
|
||||
{
|
||||
char command[256] ;
|
||||
char viewer [256] ;
|
||||
strcpy( viewer, NO_VRML_VIEWER ); // initialization
|
||||
if( getenv( ENV_VRML_VIEWER ) ) {
|
||||
strcpy( viewer, getenv( ENV_VRML_VIEWER ) ) ;
|
||||
}
|
||||
|
||||
// close VRML file
|
||||
fDest.close(); fFlagDestOpen = false ;
|
||||
G4cerr << "*** VRML 1.0 File " << fVRMLFileName << " is generated." << endl;
|
||||
|
||||
|
||||
// Invoke viewer
|
||||
|
||||
if ( !strcmp(viewer, NO_VRML_VIEWER )) {
|
||||
G4cerr << "MESSAGE from VRML1FILE driver:" << endl;
|
||||
G4cerr << " Set an environmental variable " ;
|
||||
G4cerr << ENV_VRML_VIEWER << endl;
|
||||
G4cerr << " if you want to visualize the generated VRML file" << endl;
|
||||
G4cerr << " automatically. For example, " << endl;
|
||||
G4cerr << " setenv " << ENV_VRML_VIEWER << " vrweb " << endl;
|
||||
} else {
|
||||
sprintf( command, "%s %s", viewer, fVRMLFileName );
|
||||
system( command );
|
||||
}
|
||||
}
|
||||
|
||||
G4int G4VRML1FileScene::fSceneIdCount = 0;
|
||||
G4int G4VRML1FileScene::fSceneCount = 0;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1FileView.cc,v 2.4 1998/11/09 19:33:22 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRMLView.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_VIEW
|
||||
|
||||
#include "G4SceneData.hh"
|
||||
#include "G4VRML1FileView.hh"
|
||||
#include "G4VRML1FileScene.hh"
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4VRML1FileView::G4VRML1FileView(G4VRML1FileScene& scene,
|
||||
const G4String& name) :
|
||||
G4VView(scene, scene.IncrementViewCount(), name), fScene(scene)
|
||||
{}
|
||||
|
||||
G4VRML1FileView::~G4VRML1FileView()
|
||||
{}
|
||||
|
||||
void G4VRML1FileView::SetView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1FileView::SetView()" << endl;
|
||||
G4cerr << "G4VRML1FileView::SetView(); not imlemented. " << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML1FileView::DrawView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1FileView::DrawView()" << endl;
|
||||
#endif
|
||||
// Here is a minimal DrawView() function.
|
||||
NeedKernelVisit();
|
||||
ProcessView();
|
||||
FinishView();
|
||||
}
|
||||
|
||||
void G4VRML1FileView::ClearView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1File1View::ClearView()" << endl;
|
||||
G4cerr << "G4VRML1FileView::ClearView(); not implemented. " << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML1FileView::ShowView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1FileView::ShowView()" << endl;
|
||||
#endif
|
||||
fScene.endSending();
|
||||
}
|
||||
|
||||
void G4VRML1FileView::FinishView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1FileView::FinishView()" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1Scene.cc,v 2.4 1998/11/09 19:33:24 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1Scene.cc
|
||||
// Yasuhide Sawada and Satoshi Tanaka
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_SCENE
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fstream.h>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Transform.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
|
||||
#include "G4VRML1Scene.hh"
|
||||
#include "G4VRML1View.hh"
|
||||
#include "G4VRML1.hh"
|
||||
|
||||
|
||||
|
||||
G4VRML1Scene::G4VRML1Scene(G4VRML1& system, const G4String& name) :
|
||||
G4VScene(system, fSceneIdCount++, name),
|
||||
fSystem(system),
|
||||
fDest()
|
||||
{
|
||||
fSceneCount++;
|
||||
fCurrentDEF = "";
|
||||
}
|
||||
|
||||
|
||||
G4VRML1Scene::~G4VRML1Scene()
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
G4cerr << "***** ~G4VRML1Scene" << endl;
|
||||
#endif
|
||||
fSceneCount--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define G4VRML1SCENE G4VRML1Scene
|
||||
#define IS_CONNECTED fDest.isConnected()
|
||||
#include "G4VRML1SceneFunc.icc"
|
||||
#undef IS_CONNECTED
|
||||
#undef G4VRML1SCENE
|
||||
|
||||
|
||||
void G4VRML1Scene::connectPort(G4int max_trial)
|
||||
{
|
||||
G4int trial = 0 ;
|
||||
int port = fSystem.getPort();
|
||||
for (trial = 0; !fDest.isConnected()&& trial < max_trial; trial++, port++ ) {
|
||||
if (fDest.connect( (const char * )fSystem.getHostName(), port)) {
|
||||
// INET domain connection is established
|
||||
G4cerr << "*** GEANT4 is connected to port ";
|
||||
G4cerr << fDest.getPort();
|
||||
G4cerr << " of server " << fSystem.getHostName() << endl;
|
||||
break;
|
||||
} else {
|
||||
// Connection failed. Try the next port.
|
||||
G4cerr << "*** GEANT4 incremented targeting port to ";
|
||||
G4cerr << port << endl;
|
||||
}
|
||||
|
||||
sleep (1);
|
||||
|
||||
} // for
|
||||
|
||||
if (!fDest.isConnected()) {
|
||||
G4cerr << "*** INET Connection failed. " << endl;
|
||||
G4cerr << " Maybe, you have not invoked viewer g4vrmlview yet, " << endl;
|
||||
G4cerr << " or too many viewers are already running in the " << endl;
|
||||
G4cerr << " server host(" << fSystem.getHostName() << "). " << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4VRML1Scene::closePort()
|
||||
{
|
||||
fDest.close();
|
||||
G4cerr << "*** INET Connection closed. " << endl;
|
||||
}
|
||||
|
||||
|
||||
G4int G4VRML1Scene::fSceneIdCount = 0;
|
||||
G4int G4VRML1Scene::fSceneCount = 0;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,619 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1SceneFunc.icc,v 2.3 1998/11/09 03:09:45 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML1SceneFunc.icc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//#define DEBUG_SCENE_FUNC
|
||||
|
||||
// MACRO
|
||||
#define ADDTHIS_WITH_NAME(Solid) \
|
||||
fCurrentDEF = #Solid "_" + Solid.GetName(); \
|
||||
RequestPrimitives(Solid); \
|
||||
fCurrentDEF = "";
|
||||
|
||||
// End of MACRO
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4Trd& trd)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis trd\n";
|
||||
#endif
|
||||
ADDTHIS_WITH_NAME(trd)
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4Trap& trap)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis trap\n";
|
||||
#endif
|
||||
ADDTHIS_WITH_NAME(trap)
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4Para& para)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis para\n";
|
||||
#endif
|
||||
ADDTHIS_WITH_NAME(para)
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4Torus& torus )
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis torus\n";
|
||||
#endif
|
||||
ADDTHIS_WITH_NAME(torus)
|
||||
}
|
||||
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4VSolid& vsolid)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis vsolid\n";
|
||||
#endif
|
||||
ADDTHIS_WITH_NAME(vsolid)
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4Tubs& tubs)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis tubs\n";
|
||||
#endif
|
||||
// set current name
|
||||
fCurrentDEF = "tubs_" + tubs.GetName();
|
||||
|
||||
// Get data
|
||||
const G4double R = tubs.GetRMax(); // outside radius
|
||||
const G4double r = tubs.GetRMin(); // inside radius
|
||||
const G4double dz = tubs.GetDz(); // half length in z
|
||||
const G4double dp = tubs.GetDPhi(); // angle interval
|
||||
|
||||
// Send data
|
||||
if ( r == 0.0 && dp >= 360. * deg ) {
|
||||
// Send a built-in VRML node (Cylinder)
|
||||
fDest << "Separator {" << endl;
|
||||
SendMatrixTransformNode( fpObjectTransformation );
|
||||
|
||||
fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << endl;
|
||||
SendMaterialNode();
|
||||
SendCylinderNode(R, dz * 2);
|
||||
fDest << "\t" << "}" << endl; // DEF Separator
|
||||
fDest << "}" << endl; // Separator
|
||||
} else {
|
||||
// call AddPrimitives(Polyhedron)
|
||||
RequestPrimitives(tubs);
|
||||
}
|
||||
|
||||
// reset current name to null
|
||||
fCurrentDEF = "";
|
||||
}
|
||||
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4Cons& cons)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis cons\n";
|
||||
#endif
|
||||
// set current name
|
||||
fCurrentDEF = "cons_" + cons.GetName();
|
||||
|
||||
// Get data
|
||||
const G4double r1 = cons.GetRmin1(); // inside radius at -dz
|
||||
const G4double R1 = cons.GetRmax1(); // outside radius at -dz
|
||||
const G4double r2 = cons.GetRmin2(); // inside radius at +dz
|
||||
const G4double R2 = cons.GetRmax2(); // outside radius at +dz
|
||||
const G4double dz = cons.GetDz(); // half length in z
|
||||
//const G4double sp = cons.GetSPhi(); // starting angle
|
||||
const G4double dp = cons.GetDPhi(); // angle width
|
||||
|
||||
// Send data
|
||||
if ( r1 == 0.0 && r2 == 0.0 && R1 == R2 && dp >= 360. * deg) {
|
||||
// Send a built-in VRML node (Cylinder)
|
||||
fDest << "Separator {" << endl;
|
||||
SendMatrixTransformNode( fpObjectTransformation );
|
||||
|
||||
fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << endl;
|
||||
SendMaterialNode();
|
||||
SendCylinderNode(R1, dz * 2);
|
||||
fDest << "\t" << "}" << endl; // DEF Separator
|
||||
fDest << "}" << endl; // Separator
|
||||
} else {
|
||||
// call AddPrimitives(Polyhedron)
|
||||
RequestPrimitives(cons);
|
||||
}
|
||||
|
||||
// reset current name to null
|
||||
fCurrentDEF = "";
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4Box& box)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis box\n";
|
||||
#endif
|
||||
// set current name
|
||||
fCurrentDEF = "box_" + box.GetName();
|
||||
|
||||
// Send a built-in VRML node (Cube)
|
||||
fDest << "Separator {" << endl;
|
||||
|
||||
//fDest << "\t" << "renderCulling ON" << endl;
|
||||
SendMatrixTransformNode( fpObjectTransformation );
|
||||
|
||||
fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << endl;
|
||||
SendMaterialNode();
|
||||
SendCubeNode(box.GetXHalfLength() * 2, box.GetYHalfLength() * 2, box.GetZHalfLength() * 2);
|
||||
fDest << "\t" << "}" << endl; // DEF Separator
|
||||
|
||||
fDest << "}" << endl; // Separator
|
||||
|
||||
// reset current name to null
|
||||
fCurrentDEF = "";
|
||||
}
|
||||
|
||||
|
||||
void G4VRML1SCENE::AddThis(const G4Sphere& sphere)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis sphere\n";
|
||||
#endif
|
||||
// set current name
|
||||
fCurrentDEF = "sphere_" + sphere.GetName();
|
||||
|
||||
// Get data
|
||||
G4double dphi = sphere.GetDPhi () ;
|
||||
G4double dtheta = sphere.GetDTheta() ;
|
||||
G4double rmax = sphere.GetRmax () ;
|
||||
G4double rmin = sphere.GetRmin () ;
|
||||
|
||||
// Send data
|
||||
if ( (dphi >= 360. * deg) && (dtheta >= 180. * deg) && (rmin == 0.0) ) {
|
||||
// Send a built-in VRML node (Sphere)
|
||||
fDest << "Separator {" << endl;
|
||||
SendMatrixTransformNode( fpObjectTransformation );
|
||||
|
||||
fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << endl;
|
||||
SendMaterialNode();
|
||||
SendSphereNode( rmax );
|
||||
fDest << "\t" << "}" << endl; // DEF Separator
|
||||
fDest << "}" << endl; // Separator
|
||||
} else {
|
||||
// call AddPrimitives(Polyhedron)
|
||||
RequestPrimitives( sphere );
|
||||
}
|
||||
|
||||
// reset current name to null
|
||||
fCurrentDEF = "";
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddPrimitive(const G4Polyline& polyline)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrimitive polyline\n";
|
||||
#endif
|
||||
|
||||
fDest << "Separator {" << endl;
|
||||
|
||||
SendMatrixTransformNode (fpObjectTransformation );
|
||||
|
||||
SendMaterialNode( polyline.GetVisAttributes() );
|
||||
|
||||
fDest << "\t" << "Coordinate3 {" << endl;
|
||||
fDest << "\t\t" << "point [" << endl;
|
||||
G4int e, i;
|
||||
for (i = 0, e = polyline.entries(); e; i++, e--) {
|
||||
fDest << "\t\t\t";
|
||||
fDest << polyline(i).x() << " ";
|
||||
fDest << polyline(i).y() << " ";
|
||||
fDest << polyline(i).z() << "," << endl;
|
||||
}
|
||||
fDest << "\t\t" << "]" << endl;
|
||||
fDest << "\t" << "}" << endl; // Coordinate3
|
||||
|
||||
fDest << "\t" << "IndexedLineSet {" << endl;
|
||||
fDest << "\t\t" << "coordIndex [";
|
||||
for (i = 0, e = polyline.entries(); e; i++, e--) {
|
||||
if (i % 10 == 0)
|
||||
fDest << endl << "\t\t\t";
|
||||
fDest << i << ", ";
|
||||
}
|
||||
fDest << "-1" << endl;
|
||||
fDest << "\t\t" << "]" << endl;
|
||||
fDest << "\t" << "}" << endl; // IndexedLineSet
|
||||
|
||||
fDest << "}" << endl; // Separator
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrimitive(G4Polyhedron)" << endl;
|
||||
#endif
|
||||
|
||||
fDest << "Separator {" << endl;
|
||||
|
||||
SendMatrixTransformNode( fpObjectTransformation );
|
||||
|
||||
fDest << "\t";
|
||||
if (fCurrentDEF != "")
|
||||
fDest << "DEF " << fCurrentDEF << " ";
|
||||
|
||||
fDest << "Separator {" << endl;
|
||||
|
||||
//fDest << "\t\t" << "renderCulling ON" << endl;
|
||||
|
||||
fDest << "\t\t" << "ShapeHints {" << endl;
|
||||
fDest << "\t\t\t" << "vertexOrdering COUNTERCLOCKWISE" << endl;
|
||||
fDest << "\t\t\t" << "shapeType SOLID" << endl;
|
||||
fDest << "\t\t\t" << "faceType CONVEX" << endl;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
|
||||
SendMaterialNode();
|
||||
|
||||
fDest << "\t\t" << "Coordinate3 {" << endl;
|
||||
fDest << "\t\t\t" << "point [" << endl;
|
||||
G4int i, j;
|
||||
for (i = 1, j = polyhedron.GetNoVertices(); j; j--, i++) {
|
||||
G4Point3D point = polyhedron.GetVertex(i);
|
||||
fDest << "\t\t\t\t";
|
||||
fDest << point.x() << " ";
|
||||
fDest << point.y() << " ";
|
||||
fDest << point.z() << "," << endl;
|
||||
}
|
||||
fDest << "\t\t\t" << "]" << endl;
|
||||
fDest << "\t\t" << "}" << endl; // Coordinate3
|
||||
|
||||
fDest << "\t\t" << "IndexedFaceSet {" << endl;
|
||||
fDest << "\t\t\t" << "coordIndex [" << endl;
|
||||
|
||||
// facet loop
|
||||
G4int f;
|
||||
for (f = polyhedron.GetNoFacets(); f; f--) {
|
||||
|
||||
// edge loop
|
||||
G4bool notLastEdge;
|
||||
G4int index = -1, edgeFlag = 1;
|
||||
fDest << "\t\t\t\t";
|
||||
do {
|
||||
notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag);
|
||||
fDest << index - 1 << ", ";
|
||||
} while (notLastEdge);
|
||||
fDest << "-1," << endl;
|
||||
}
|
||||
fDest << "\t\t\t" << "]" << endl;
|
||||
fDest << "\t\t" << "}" << endl; // IndexFaceSet
|
||||
|
||||
fDest << "\t" << "}" << endl; // (DEF) Separator
|
||||
fDest << "}" << endl; // Separator
|
||||
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** end of AddPrimitive(G4Polyhedron)\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddPrimitive(const G4NURBS& nurb)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrimitive nurbs\n";
|
||||
#endif
|
||||
G4cerr << "G4VRML1File::AddPrimitive(G4NURBS&): not implemented. \n";
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddPrimitive( const G4Text& text )
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrim mark text\n";
|
||||
#endif
|
||||
G4cerr <<
|
||||
"***** void G4VRML1SCENE::AddPrimitive( const G4Text& text )"
|
||||
" not implemented yet."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddPrimitive( const G4Circle& circle )
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrim mark circle\n";
|
||||
#endif
|
||||
|
||||
// begin sending a mark
|
||||
fDest << "Separator {" << endl;
|
||||
|
||||
// send color
|
||||
SendMarkerColor ( circle ) ;
|
||||
|
||||
// position
|
||||
SendMarkerWorldPosition ( circle ) ;
|
||||
|
||||
// Calc size
|
||||
G4double size = GetMarkerHalfSize ( circle );
|
||||
|
||||
// send shape with size
|
||||
fDest << "\t" << "Sphere {" << endl;
|
||||
fDest << "\t\t" << "radius " << size << endl;
|
||||
fDest << "\t" << "}" << endl;
|
||||
|
||||
// end sending a mark
|
||||
fDest << "}" << endl; // Separator
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::AddPrimitive(const G4Square& Square) // mark Square
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrim mark Square\n";
|
||||
#endif
|
||||
|
||||
// begin sending a mark
|
||||
fDest << "Separator {" << endl;
|
||||
|
||||
// send color
|
||||
SendMarkerColor ( Square );
|
||||
|
||||
// position
|
||||
SendMarkerWorldPosition ( Square );
|
||||
|
||||
// Calc size
|
||||
G4double size = GetMarkerHalfSize ( Square );
|
||||
size *= 2.;
|
||||
|
||||
// send shape with size
|
||||
fDest << "\t" << "Cube {" << endl;
|
||||
fDest << "\t\t" << "width " << size << endl;
|
||||
fDest << "\t\t" << "height " << size << endl;
|
||||
fDest << "\t\t" << "depth " << size << endl;
|
||||
fDest << "\t" << "}" << endl;
|
||||
|
||||
// end sending a mark
|
||||
fDest << "}" << endl; // Separator
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::ClearStore()
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** ClearStore()\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::BeginModeling()
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** BeginModeling\n";
|
||||
#endif
|
||||
G4VScene::BeginModeling();
|
||||
beginSending();
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::EndModeling()
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** EndModeling \n";
|
||||
#endif
|
||||
G4VScene::EndModeling();
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::BeginPrimitives(const G4Transform3D& objectTransformation)
|
||||
{
|
||||
G4VScene::BeginPrimitives (objectTransformation);
|
||||
fpObjectTransformation = &objectTransformation;
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** BeginPrimitives \n";
|
||||
#endif
|
||||
beginSending();
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::EndPrimitives()
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** EndPrimitives \n";
|
||||
#endif
|
||||
G4VScene::EndPrimitives();
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::SendMaterialNode( const G4VisAttributes* pVA )
|
||||
{
|
||||
// const double TRANSPARENCY = 0.9 ;
|
||||
const double TRANSPARENCY = 0.5 ;
|
||||
|
||||
if (!pVA)
|
||||
return;
|
||||
|
||||
const G4Color& color = pVA->GetColor();
|
||||
|
||||
fDest << "\t\t" << "Material {" << endl;
|
||||
|
||||
if (pVA->IsForceDrawingStyle() &&
|
||||
(pVA->GetForcedDrawingStyle() == G4VisAttributes::wireframe)) {
|
||||
fDest << "\t\t\t" << "transparency " << TRANSPARENCY << endl;
|
||||
}
|
||||
|
||||
fDest << "\t\t\t" << "diffuseColor";
|
||||
fDest << " " << color.GetRed();
|
||||
fDest << " " << color.GetGreen();
|
||||
fDest << " " << color.GetBlue();
|
||||
fDest << endl;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
}
|
||||
|
||||
|
||||
void G4VRML1SCENE::SendMaterialNode()
|
||||
{
|
||||
SendMaterialNode
|
||||
( fpView->GetApplicableVisAttributes (fpVisAttribs) );
|
||||
}
|
||||
|
||||
|
||||
void G4VRML1SCENE::SendMatrixTransformNode(const G4Transform3D *trans)
|
||||
{
|
||||
G4Point3D B (0.0, 0.0, 0.0);
|
||||
|
||||
G4Point3D x1 (1.0, 0.0, 0.0);
|
||||
G4Point3D y1 (0.0, 1.0, 0.0);
|
||||
|
||||
G4Vector3D e1 (1.0, 0.0, 0.0);
|
||||
G4Vector3D e2 (0.0, 1.0, 0.0);
|
||||
G4Vector3D e3 (0.0, 0.0, 1.0);
|
||||
|
||||
//----- transformed origin of body coord
|
||||
B.transform(*trans);
|
||||
|
||||
//----- transformed base vectors of body coord
|
||||
x1.transform(*trans);
|
||||
e1 = x1 - B;
|
||||
|
||||
y1.transform(*trans);
|
||||
e2 = y1 - B;
|
||||
|
||||
e3 = e1.cross(e2);
|
||||
|
||||
e1 = e1.unit(); // normalize again for accuracy
|
||||
e2 = e2.unit(); //
|
||||
e3 = e3.unit(); //
|
||||
|
||||
fDest << "\t" << "MatrixTransform {" << endl;
|
||||
fDest << "\t\t" << "matrix ";
|
||||
fDest << e1.x() << " " << e1.y() << " " << e1.z() << " 0 ";
|
||||
fDest << e2.x() << " " << e2.y() << " " << e2.z() << " 0 ";
|
||||
fDest << e3.x() << " " << e3.y() << " " << e3.z() << " 0 ";
|
||||
fDest << B.x() << " " << B.y() << " " << B.z() << " 1" << endl;
|
||||
fDest << "\t" << "}" << endl;
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::SendCubeNode(G4double w, G4double h, G4double d)
|
||||
{
|
||||
fDest << "\t\t" << "Cube {" << endl;
|
||||
fDest << "\t\t\t" << "width " << w << endl;
|
||||
fDest << "\t\t\t" << "height " << h << endl;
|
||||
fDest << "\t\t\t" << "depth " << d << endl;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::SendCylinderNode(G4double R, G4double h)
|
||||
{
|
||||
fDest << "\t\t" << "Transform {" << endl;
|
||||
fDest << "\t\t\t" << "rotation 1 0 0 " << (90. * deg) << endl;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
|
||||
fDest << "\t\t" << "Cylinder {" << endl;
|
||||
fDest << "\t\t\t" << "radius " << R << endl;
|
||||
fDest << "\t\t\t" << "height " << h << endl;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::SendSphereNode(G4double R)
|
||||
{
|
||||
fDest << "\t\t" << "Sphere {" << endl;
|
||||
fDest << "\t\t\t" << "radius " << R << endl;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::beginSending()
|
||||
{
|
||||
if (!IS_CONNECTED ) {
|
||||
this->connectPort();
|
||||
fDest << "#VRML V1.0 ascii" << endl;
|
||||
fDest << "# Generated by VRML driver of GEANT4\n" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::endSending()
|
||||
{
|
||||
if ( IS_CONNECTED ) {
|
||||
fDest << "#End of file." << endl;
|
||||
this->closePort();
|
||||
}
|
||||
}
|
||||
|
||||
void G4VRML1SCENE::SendMarkerColor ( const G4VMarker& mark )
|
||||
{
|
||||
const G4Color& color = GetColor( mark );
|
||||
|
||||
fDest << "\t" << "Material {" << endl;
|
||||
fDest << "\t\t";
|
||||
fDest << "ambientColor [] ";
|
||||
fDest << "specularColor [] ";
|
||||
fDest << "\t\t" << "diffuseColor";
|
||||
fDest << " " << color.GetRed();
|
||||
fDest << " " << color.GetGreen();
|
||||
fDest << " " << color.GetBlue();
|
||||
fDest << endl;
|
||||
fDest << "\t\t" << "emissiveColor";
|
||||
fDest << " " << color.GetRed();
|
||||
fDest << " " << color.GetGreen();
|
||||
fDest << " " << color.GetBlue();
|
||||
fDest << endl;
|
||||
fDest << "\t" << "}" << endl;
|
||||
}
|
||||
|
||||
void
|
||||
G4VRML1SCENE::SendMarkerWorldPosition ( const G4VMarker& mark )
|
||||
{
|
||||
G4Point3D point = mark.GetPosition();
|
||||
|
||||
SendMatrixTransformNode( fpObjectTransformation );
|
||||
|
||||
fDest << "\t\t" << "Transform {" << endl;
|
||||
fDest << "\t\t\t" << "translation ";
|
||||
fDest << point.x() << " " << point.y() << " " << point.z() << endl;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
}
|
||||
|
||||
|
||||
G4double G4VRML1SCENE::GetMarkerHalfSize ( const G4VMarker& mark )
|
||||
{
|
||||
//----- return value ( marker radius in 3d units)
|
||||
G4double size = 1.0 ; // initialization
|
||||
|
||||
//----- parameters to calculate 3d size from 2d size
|
||||
const double HALF_SCREEN_SIZE_2D = 300.0 ; // pixels
|
||||
double zoom_factor = fpView->GetViewParameters().GetZoomFactor() ;
|
||||
if ( zoom_factor <= 0.0 ) { zoom_factor = 1.0 ; }
|
||||
double extent_radius_3d = GetSceneData().GetExtent().GetExtentRadius() ;
|
||||
if ( extent_radius_3d <= 0.0 ) { extent_radius_3d = 1.0 ; }
|
||||
|
||||
//----- get marker radius in 3D units
|
||||
if ( size = mark.GetWorldSize() ) {
|
||||
|
||||
// get mark radius in 3D units
|
||||
size = 0.5 * mark.GetWorldSize() ;
|
||||
|
||||
} else if ( size = mark.GetScreenSize() ) {
|
||||
|
||||
// local
|
||||
double mark_radius_2d = 0.5 * mark.GetScreenSize() ;
|
||||
|
||||
// get mark radius in 3D units
|
||||
size \
|
||||
= extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
|
||||
size *= zoom_factor ;
|
||||
|
||||
} else {
|
||||
// local
|
||||
double mark_radius_2d \
|
||||
= fpView->GetViewParameters().GetDefaultMarker().GetScreenSize();
|
||||
|
||||
// get mark radius in 3D units
|
||||
size \
|
||||
= extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
|
||||
size *= zoom_factor ;
|
||||
}
|
||||
|
||||
//----- global rescaling
|
||||
size *= fpView->GetViewParameters().GetGlobalMarkerScale();
|
||||
|
||||
//----- return size
|
||||
return size ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// #undef ADDTHIS_WITH_NAME(Solid)
|
||||
// #undef MAKE_NAME(Solid)
|
||||
// End of file.
|
||||
@@ -0,0 +1,78 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML1View.cc,v 2.4 1998/11/09 19:33:29 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRMLView.cc
|
||||
// Yasuhide Sawada & Satoshi Tanaka
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_VIEW
|
||||
|
||||
#include "G4SceneData.hh"
|
||||
#include "G4VRML1View.hh"
|
||||
#include "G4VRML1Scene.hh"
|
||||
#include "G4VRML1.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4VRML1View::G4VRML1View(G4VRML1Scene& scene, const G4String& name) :
|
||||
G4VView(scene, scene.IncrementViewCount(), name), fScene(scene)
|
||||
{}
|
||||
|
||||
G4VRML1View::~G4VRML1View()
|
||||
{}
|
||||
|
||||
void G4VRML1View::SetView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1View::SetView()" << endl;
|
||||
G4cerr << "G4VRML1View::SetView(); not imlemented. " << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML1View::DrawView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1View::DrawView()" << endl;
|
||||
#endif
|
||||
// Here is a minimal DrawView() function.
|
||||
NeedKernelVisit();
|
||||
ProcessView();
|
||||
FinishView();
|
||||
}
|
||||
|
||||
void G4VRML1View::ClearView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1View::ClearView()" << endl;
|
||||
G4cerr << "G4VRML1View::ClearView(); not implemented. " << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML1View::ShowView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1View::ShowView()" << endl;
|
||||
#endif
|
||||
fScene.endSending();
|
||||
}
|
||||
|
||||
void G4VRML1View::FinishView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML1View::FinishView()" << endl;
|
||||
//G4cerr << "G4VRML1View::FinishView(); not implemented. " << endl;
|
||||
#endif
|
||||
//fScene.endSending();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2.cc,v 2.2 1998/11/09 19:33:31 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#include <stdio.h> // sscanf
|
||||
#include <stdlib.h> // getenv
|
||||
|
||||
#include "G4VScene.hh"
|
||||
|
||||
#include "G4VRML2.hh"
|
||||
#include "G4VRML2Scene.hh"
|
||||
#include "G4VRML2View.hh"
|
||||
|
||||
#include "G4FRClient.hh"
|
||||
|
||||
|
||||
G4VRML2::G4VRML2() :
|
||||
G4VGraphicsSystem("VRML2", "VRML2", G4VGraphicsSystem::threeD)
|
||||
{
|
||||
// port number
|
||||
fPort = FR_VRML_DEFAULT_PORT;
|
||||
char *pport = getenv(FR_VRML_PORT_ENV);
|
||||
if (pport) {
|
||||
sscanf(pport, "%d", &fPort);
|
||||
}
|
||||
|
||||
// host name
|
||||
fHostName = "localhost" ; // G4String::operator = ( const char* cs )
|
||||
char *phostname = getenv(FR_VRML_HOST_NAME_ENV);
|
||||
if (phostname) {
|
||||
fHostName = phostname;
|
||||
}
|
||||
}
|
||||
|
||||
G4VRML2::~G4VRML2()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
G4VScene* G4VRML2::CreateScene(const G4String& name)
|
||||
{
|
||||
G4VScene *p = NULL;
|
||||
|
||||
p = new G4VRML2Scene(*this, name);
|
||||
|
||||
G4cout << G4VRML2Scene::GetSceneCount()
|
||||
<< " " << fName << " scenes extanct." << endl;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
G4VView* G4VRML2::CreateView(G4VScene& scene, const G4String& name)
|
||||
{
|
||||
G4VView* pView = NULL;
|
||||
|
||||
G4VRML2Scene* pScene = (G4VRML2Scene*)&scene;
|
||||
pView = new G4VRML2View(*pScene, name);
|
||||
|
||||
return pView;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2File.cc,v 2.2 1998/11/09 19:33:33 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2File.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#include <stdio.h> // sscanf
|
||||
#include <stdlib.h> // getenv
|
||||
|
||||
#include "G4VScene.hh"
|
||||
|
||||
#include "G4VRML2File.hh"
|
||||
#include "G4VRML2FileScene.hh"
|
||||
#include "G4VRML2FileView.hh"
|
||||
|
||||
#include "G4FRClient.hh"
|
||||
|
||||
|
||||
G4VRML2File::G4VRML2File() :
|
||||
G4VGraphicsSystem("VRML2FILE", "VRML2FILE", G4VGraphicsSystem::threeD)
|
||||
{
|
||||
}
|
||||
|
||||
G4VRML2File::~G4VRML2File()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
G4VScene* G4VRML2File::CreateScene(const G4String& name)
|
||||
{
|
||||
G4VScene *p = NULL;
|
||||
|
||||
p = new G4VRML2FileScene(*this, name);
|
||||
|
||||
G4cout << G4VRML2FileScene::GetSceneCount()
|
||||
<< " " << fName << " scenes extanct." << endl;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
G4VView* G4VRML2File::CreateView(G4VScene& scene, const G4String& name)
|
||||
{
|
||||
G4VView* pView = NULL;
|
||||
|
||||
G4VRML2FileScene* pScene = (G4VRML2FileScene*)&scene;
|
||||
pView = new G4VRML2FileView(*pScene, name);
|
||||
|
||||
return pView;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,206 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2FileScene.cc,v 2.6 1998/12/07 06:40:19 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2FileScene.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_SCENE
|
||||
|
||||
#include <fstream.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Transform.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
|
||||
#include "G4VRML2FileScene.hh"
|
||||
#include "G4VRML2FileView.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
|
||||
// CONST
|
||||
|
||||
const char WRL_FILE_HEADER [] = "g4_";
|
||||
const char DEFAULT_WRL_FILE_NAME[] = "g4.wrl";
|
||||
const char ENV_VRML_VIEWER [] = "G4VRMLFILE_VIEWER";
|
||||
const char NO_VRML_VIEWER [] = "NONE";
|
||||
const char VRMLFILE_DEST_DIR [] = "G4VRMLFILE_DEST_DIR";
|
||||
|
||||
|
||||
G4VRML2FileScene::G4VRML2FileScene(G4VRML2File& system, const G4String& name) :
|
||||
G4VScene(system, fSceneIdCount++, name),
|
||||
fSystem(system),
|
||||
fDest() ,
|
||||
fFlagDestOpen( false ),
|
||||
fPVPickable ( false )
|
||||
{
|
||||
fSceneCount++;
|
||||
|
||||
// output file name
|
||||
strcpy(fVRMLFileName, "");
|
||||
|
||||
// destination directory
|
||||
if ( getenv( VRMLFILE_DEST_DIR ) == NULL ) {
|
||||
strcpy( fVRMLFileDestDir, "" );
|
||||
} else {
|
||||
strcpy( fVRMLFileDestDir, getenv( VRMLFILE_DEST_DIR ) );
|
||||
}
|
||||
|
||||
|
||||
// maximum number of g4.prim files in the dest directory
|
||||
fMaxFileNum = 1 ; // initialization
|
||||
if ( getenv( "G4VRMLFILE_MAX_FILE_NUM" ) != NULL ) {
|
||||
|
||||
sscanf( getenv("G4VRMLFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ;
|
||||
|
||||
} else {
|
||||
fMaxFileNum = 1 ;
|
||||
}
|
||||
if( fMaxFileNum < 1 ) { fMaxFileNum = 1 ; }
|
||||
|
||||
|
||||
// PV name pickability
|
||||
if( getenv( "G4VRML_PV_PICKABLE" ) != NULL ) {
|
||||
|
||||
int is_pickable ;
|
||||
sscanf( getenv("G4VRML_PV_PICKABLE"), "%d", &is_pickable ) ;
|
||||
|
||||
if ( is_pickable ) { SetPVPickability ( true ) ; }
|
||||
}
|
||||
|
||||
// PV Transparency
|
||||
SetPVTransparency ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
G4VRML2FileScene::~G4VRML2FileScene()
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
G4cerr << "***** ~G4VRML2FileScene" << endl;
|
||||
#endif
|
||||
fSceneCount--;
|
||||
}
|
||||
|
||||
|
||||
#define G4VRML2SCENE G4VRML2FileScene
|
||||
#define IS_CONNECTED this->isConnected()
|
||||
#include "G4VRML2SceneFunc.icc"
|
||||
#undef IS_CONNECTED
|
||||
#undef G4VRML2SCENE
|
||||
|
||||
|
||||
void G4VRML2FileScene::connectPort()
|
||||
{
|
||||
// g4.wrl, g4_1.wrl, ..., g4_MAX_FILE_INDEX.wrl
|
||||
const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
|
||||
|
||||
// dest directory (null if no environmental variables is set)
|
||||
strcpy ( fVRMLFileName, fVRMLFileDestDir) ;
|
||||
|
||||
// create full path name (default)
|
||||
strcat ( fVRMLFileName, DEFAULT_WRL_FILE_NAME );
|
||||
|
||||
// Determine VRML file name
|
||||
for( int i = 0 ; i < fMaxFileNum ; i++) {
|
||||
|
||||
// Message
|
||||
if( fMaxFileNum > 1 && i == MAX_FILE_INDEX ) {
|
||||
G4cerr << "===========================================" << endl;
|
||||
G4cerr << "WARNING MESSAGE from VRML2FILE driver: " << endl;
|
||||
G4cerr << " This file name is the final one in the " << endl;
|
||||
G4cerr << " automatic updation of the output file name." << endl;
|
||||
G4cerr << " You may overwrite an existing file of " << endl;
|
||||
G4cerr << " the same name. " << endl;
|
||||
G4cerr << "===========================================" << endl;
|
||||
}
|
||||
|
||||
// re-determine file to G4VRMLFILE_DEST_DIR/g4_i.wrl for i>0
|
||||
if( i > 0 ) {
|
||||
sprintf( fVRMLFileName, "%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, i );
|
||||
}
|
||||
|
||||
// check validity of the file name
|
||||
ifstream fin ;
|
||||
fin.open(fVRMLFileName) ;
|
||||
if(!fin) {
|
||||
// new file
|
||||
fin.close(); // error recovery
|
||||
break;
|
||||
} else {
|
||||
// already exists (try next)
|
||||
fin.close();
|
||||
}
|
||||
|
||||
} // for
|
||||
|
||||
// open a VRML 2.0 file with determined file name
|
||||
G4cerr << "===========================================" << endl;
|
||||
G4cerr << "Output VRML 2.0 file: " << fVRMLFileName << endl;
|
||||
G4cerr << "Muximal number of file in the destination directory: " << fMaxFileNum << endl;
|
||||
G4cerr << " (Customizable as: setenv G4VRMLFILE_MAX_FILE_NUM number) " << endl;
|
||||
G4cerr << "===========================================" << endl;
|
||||
|
||||
fDest.open(fVRMLFileName) ; fFlagDestOpen = true ;
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2FileScene::closePort()
|
||||
{
|
||||
char command[256] ;
|
||||
char viewer [256] ;
|
||||
strcpy( viewer, NO_VRML_VIEWER ); // initialization
|
||||
if( getenv( ENV_VRML_VIEWER ) ) {
|
||||
strcpy( viewer, getenv( ENV_VRML_VIEWER ) ) ;
|
||||
}
|
||||
|
||||
// close VRML file
|
||||
fDest.close(); fFlagDestOpen = false ;
|
||||
G4cerr << "*** VRML 2.0 File " << fVRMLFileName << " is generated." << endl;
|
||||
|
||||
|
||||
// Invoke viewer
|
||||
|
||||
if ( !strcmp(viewer, NO_VRML_VIEWER )) {
|
||||
G4cerr << "MESSAGE from VRML2FILE driver:" << endl;
|
||||
G4cerr << " Set an environmental variable " ;
|
||||
G4cerr << ENV_VRML_VIEWER << endl;
|
||||
G4cerr << " if you want to visualize the generated VRML file" << endl;
|
||||
G4cerr << " automatically. For example, " << endl;
|
||||
G4cerr << " setenv " << ENV_VRML_VIEWER << " vrwave " << endl;
|
||||
} else {
|
||||
sprintf( command, "%s %s", viewer, fVRMLFileName );
|
||||
system( command );
|
||||
}
|
||||
}
|
||||
|
||||
G4int G4VRML2FileScene::fSceneIdCount = 0;
|
||||
G4int G4VRML2FileScene::fSceneCount = 0;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,130 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2FileView.cc,v 2.2 1998/11/09 19:33:36 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2FileView.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_VIEW
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "G4SceneData.hh"
|
||||
#include "G4VRML2FileView.hh"
|
||||
#include "G4VRML2FileScene.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4VRML2FileView::G4VRML2FileView(G4VRML2FileScene& scene,
|
||||
const G4String& name) :
|
||||
G4VView(scene, scene.IncrementViewCount(), name),
|
||||
fScene(scene),
|
||||
fDest(scene.fDest)
|
||||
{
|
||||
fViewHalfAngle = 0.5 * 0.785398 ; // 0.5 * 45*deg
|
||||
fsin_VHA = sin ( fViewHalfAngle ) ;
|
||||
}
|
||||
|
||||
G4VRML2FileView::~G4VRML2FileView()
|
||||
{}
|
||||
|
||||
void G4VRML2FileView::SetView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2FileView::SetView()" << endl;
|
||||
G4cerr << "G4VRML2FileView::SetView(); not imlemented. " << endl;
|
||||
#endif
|
||||
|
||||
// Do nothing, since VRML a browser is running as a different process.
|
||||
// SendViewParameters () will do this job instead.
|
||||
|
||||
}
|
||||
|
||||
void G4VRML2FileView::DrawView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2FileView::DrawView()" << endl;
|
||||
#endif
|
||||
|
||||
// Open VRML2 file and output header comments
|
||||
fScene.beginSending() ;
|
||||
|
||||
// Viewpoint node
|
||||
SendViewParameters();
|
||||
|
||||
// Here is a minimal DrawView() function.
|
||||
NeedKernelVisit();
|
||||
ProcessView();
|
||||
FinishView();
|
||||
}
|
||||
|
||||
void G4VRML2FileView::ClearView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2File1View::ClearView()" << endl;
|
||||
G4cerr << "G4VRML2FileView::ClearView(); not implemented. " << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML2FileView::ShowView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2FileView::ShowView()" << endl;
|
||||
#endif
|
||||
fScene.endSending();
|
||||
}
|
||||
|
||||
void G4VRML2FileView::FinishView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2FileView::FinishView()" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML2FileView::SendViewParameters ()
|
||||
{
|
||||
// Calculates view representation based on extent of object being
|
||||
// viewed and (initial) direction of camera. (Note: it can change
|
||||
// later due to user interaction via visualization system's GUI.)
|
||||
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2FileView::SendViewParameters()\n";
|
||||
#endif
|
||||
|
||||
// error recovery
|
||||
if ( fsin_VHA < 1.0e-6 ) { return ; }
|
||||
|
||||
// camera distance
|
||||
G4double extent_radius = fScene.GetSceneData().GetExtent().GetExtentRadius();
|
||||
G4double camera_distance = extent_radius / fsin_VHA ;
|
||||
|
||||
// camera position on Z axis
|
||||
const G4Point3D& target_point = fVP.GetCurrentTargetPoint();
|
||||
G4double E_z = target_point.z() + camera_distance;
|
||||
G4Point3D E(0.0, 0.0, E_z );
|
||||
|
||||
// VRML codes are generated below
|
||||
fDest << endl;
|
||||
fDest << "#---------- CAMERA" << endl;
|
||||
fDest << "Viewpoint {" << endl;
|
||||
fDest << "\t" << "position " ;
|
||||
fDest << E.x() << " " ;
|
||||
fDest << E.y() << " " ;
|
||||
fDest << E.z() << endl ;
|
||||
fDest << "}" << endl;
|
||||
fDest << endl;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,127 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2Scene.cc,v 2.4 1998/11/29 22:00:34 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2Scene.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_SCENE
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fstream.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Transform.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
|
||||
#include "G4VRML2Scene.hh"
|
||||
#include "G4VRML2View.hh"
|
||||
#include "G4VRML2.hh"
|
||||
|
||||
|
||||
|
||||
G4VRML2Scene::G4VRML2Scene(G4VRML2& system, const G4String& name) :
|
||||
G4VScene(system, fSceneIdCount++, name),
|
||||
fSystem(system),
|
||||
fDest(),
|
||||
fPVPickable ( false )
|
||||
{
|
||||
fSceneCount++;
|
||||
|
||||
|
||||
// PV name pickability
|
||||
if( getenv( "G4VRML_PV_PICKABLE" ) != NULL ) {
|
||||
|
||||
int is_pickable ;
|
||||
sscanf( getenv("G4VRML_PV_PICKABLE"), "%d", &is_pickable ) ;
|
||||
|
||||
if ( is_pickable ) { SetPVPickability ( true ) ; }
|
||||
}
|
||||
|
||||
// PV Transparency
|
||||
SetPVTransparency ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
G4VRML2Scene::~G4VRML2Scene()
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
G4cerr << "***** ~G4VRML2Scene" << endl;
|
||||
#endif
|
||||
fSceneCount--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define G4VRML2SCENE G4VRML2Scene
|
||||
#define IS_CONNECTED fDest.isConnected()
|
||||
#include "G4VRML2SceneFunc.icc"
|
||||
#undef IS_CONNECTED
|
||||
#undef G4VRML2SCENE
|
||||
|
||||
|
||||
void G4VRML2Scene::connectPort(G4int max_trial)
|
||||
{
|
||||
G4int trial = 0 ;
|
||||
int port = fSystem.getPort();
|
||||
for (trial = 0; !fDest.isConnected()&& trial < max_trial; trial++, port++ ) {
|
||||
if (fDest.connect( (const char * )fSystem.getHostName(), port)) {
|
||||
// INET domain connection is established
|
||||
G4cerr << "*** GEANT4 is connected to port ";
|
||||
G4cerr << fDest.getPort();
|
||||
G4cerr << " of server " << fSystem.getHostName() << endl;
|
||||
break;
|
||||
} else {
|
||||
// Connection failed. Try the next port.
|
||||
G4cerr << "*** GEANT4 incremented targeting port to ";
|
||||
G4cerr << port << endl;
|
||||
}
|
||||
|
||||
sleep (1);
|
||||
|
||||
} // for
|
||||
|
||||
if (!fDest.isConnected()) {
|
||||
G4cerr << "*** INET Connection failed. " << endl;
|
||||
G4cerr << " Maybe, you have not invoked viewer g4vrmlview yet, " << endl;
|
||||
G4cerr << " or too many viewers are already running in the " << endl;
|
||||
G4cerr << " server host(" << fSystem.getHostName() << "). " << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4VRML2Scene::closePort()
|
||||
{
|
||||
fDest.close();
|
||||
G4cerr << "*** INET Connection closed. " << endl;
|
||||
}
|
||||
|
||||
|
||||
G4int G4VRML2Scene::fSceneIdCount = 0;
|
||||
G4int G4VRML2Scene::fSceneCount = 0;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,618 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2SceneFunc.icc,v 2.3 1998/11/29 22:00:34 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2SceneFunc.icc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//#define DEBUG_SCENE_FUNC
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4Trd& trd)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis trd\n";
|
||||
#endif
|
||||
G4VScene::AddThis(trd);
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4Trap& trap)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis trap\n";
|
||||
#endif
|
||||
G4VScene::AddThis(trap);
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4Para& para)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis para\n";
|
||||
#endif
|
||||
G4VScene::AddThis(para);
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4Torus& torus )
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis torus\n";
|
||||
#endif
|
||||
G4VScene::AddThis(torus);
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4VSolid& vsolid)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis vsolid\n";
|
||||
#endif
|
||||
G4VScene::AddThis(vsolid);
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4Tubs& tubs)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis tubs\n";
|
||||
#endif
|
||||
G4VScene::AddThis(tubs) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4Cons& cons)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis cons\n";
|
||||
#endif
|
||||
G4VScene::AddThis(cons) ;
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4Box& box)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis box\n";
|
||||
#endif
|
||||
G4VScene::AddThis(box) ;
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2SCENE::AddThis(const G4Sphere& sphere)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddThis sphere\n";
|
||||
#endif
|
||||
G4VScene::AddThis(sphere) ;
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddPrimitive(const G4Polyline& polyline)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrimitive polyline\n";
|
||||
#endif
|
||||
|
||||
// VRML codes are generated below
|
||||
|
||||
fDest << "#---------- POLYLINE" << endl;
|
||||
fDest << "Shape {" << endl;
|
||||
|
||||
SendLineColor ( polyline.GetVisAttributes() );
|
||||
|
||||
fDest << "\t" << "geometry IndexedLineSet {" << endl;
|
||||
|
||||
fDest << "\t\t" << "coord Coordinate {" << endl;
|
||||
fDest << "\t\t\t" << "point [" << endl;
|
||||
G4int e, i;
|
||||
for (i = 0, e = polyline.entries(); e; i++, e--) {
|
||||
|
||||
G4Point3D point = polyline(i);
|
||||
point.transform( *fpObjectTransformation );
|
||||
|
||||
fDest << "\t\t\t\t";
|
||||
fDest << point.x() << " ";
|
||||
fDest << point.y() << " ";
|
||||
fDest << point.z() << "," << endl;
|
||||
|
||||
} // for
|
||||
|
||||
fDest << "\t\t\t" << "]" << endl; // point
|
||||
fDest << "\t\t" << "}" << endl; // coord
|
||||
|
||||
fDest << "\t\t" << "coordIndex [";
|
||||
for (i = 0, e = polyline.entries(); e; i++, e--) {
|
||||
if (i % 10 == 0)
|
||||
fDest << endl << "\t\t\t";
|
||||
fDest << i << ", ";
|
||||
}
|
||||
fDest << "-1" << endl;
|
||||
fDest << "\t\t" << "]" << endl; // coordIndex
|
||||
fDest << "\t" << "}" << endl; // geometry IndexedLineSet
|
||||
|
||||
fDest << "}" << endl; // Shape
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2SCENE::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
cerr << "***** AddPrimitive(G4Polyhedron)" << endl;
|
||||
#endif
|
||||
|
||||
// Transparency checking: If completely transparent, skip drawing
|
||||
if ( GetPVTransparency() > 0.99 ) { return ; }
|
||||
|
||||
// Current Model
|
||||
const G4VModel* pv_model = GetModel();
|
||||
const char* pv_name = pv_model->GetCurrentTag() ;
|
||||
|
||||
// VRML codes are generated below
|
||||
|
||||
fDest << "#---------- SOLID: " << pv_name << endl;
|
||||
|
||||
if ( IsPVPickable() ) {
|
||||
|
||||
fDest << "Anchor {" << endl;
|
||||
fDest << " description " << "\"" << pv_name << "\"" << endl;
|
||||
fDest << " url \"\" " << endl;
|
||||
fDest << " children [" << endl;
|
||||
}
|
||||
|
||||
fDest << "\t"; fDest << "Shape {" << endl;
|
||||
|
||||
SendMaterialNode();
|
||||
|
||||
fDest << "\t\t" << "geometry IndexedFaceSet {" << endl;
|
||||
|
||||
fDest << "\t\t\t" << "coord Coordinate {" << endl;
|
||||
fDest << "\t\t\t\t" << "point [" << endl;
|
||||
G4int i, j;
|
||||
for (i = 1, j = polyhedron.GetNoVertices(); j; j--, i++) {
|
||||
G4Point3D point = polyhedron.GetVertex(i);
|
||||
|
||||
point.transform( *fpObjectTransformation );
|
||||
|
||||
fDest << "\t\t\t\t\t";
|
||||
fDest << point.x() << " ";
|
||||
fDest << point.y() << " ";
|
||||
fDest << point.z() << "," << endl;
|
||||
}
|
||||
fDest << "\t\t\t\t" << "]" << endl; // point
|
||||
fDest << "\t\t\t" << "}" << endl; // coord
|
||||
|
||||
fDest << "\t\t\t" << "coordIndex [" << endl;
|
||||
|
||||
// facet loop
|
||||
G4int f;
|
||||
for (f = polyhedron.GetNoFacets(); f; f--) {
|
||||
|
||||
// edge loop
|
||||
G4bool notLastEdge;
|
||||
G4int index = -1, edgeFlag = 1;
|
||||
fDest << "\t\t\t\t";
|
||||
do {
|
||||
notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag);
|
||||
fDest << index - 1 << ", ";
|
||||
} while (notLastEdge);
|
||||
fDest << "-1," << endl;
|
||||
}
|
||||
fDest << "\t\t\t" << "]" << endl; // coordIndex
|
||||
|
||||
fDest << "\t\t\t" << "solid FALSE" << endl; // draw backfaces
|
||||
|
||||
fDest << "\t\t" << "}" << endl; // IndexFaceSet
|
||||
fDest << "\t" << "}" << endl; // Shape
|
||||
|
||||
if ( IsPVPickable() ) {
|
||||
fDest << " ]" << endl; // children
|
||||
fDest << "}" << endl; // Anchor
|
||||
}
|
||||
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
cerr << "***** end of AddPrimitive(G4Polyhedron)\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2SCENE::AddPrimitive(const G4NURBS& nurb)
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrimitive nurbs\n";
|
||||
#endif
|
||||
G4cerr << "G4VRML2File::AddPrimitive(G4NURBS&): not implemented. \n";
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddPrimitive( const G4Text& text )
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrim mark text\n";
|
||||
#endif
|
||||
G4cerr <<
|
||||
"***** void G4VRML2SCENE::AddPrimitive( const G4Text& text )"
|
||||
" not implemented yet."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddPrimitive( const G4Circle& circle )
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrim mark circle\n";
|
||||
#endif
|
||||
// Information
|
||||
// const char* info = NULL ;
|
||||
const char* info = circle.GetInfo() ;
|
||||
|
||||
// Position and half size of circle
|
||||
G4double X, Y, Z ; GetMarkerWorldPosition( circle, &X, &Y, &Z ) ;
|
||||
G4double radius = GetMarkerHalfSize ( circle );
|
||||
|
||||
// VRML codes are generated below
|
||||
fDest << "#---------- 3D MARKER (Circle)" << endl;
|
||||
fDest << "Anchor {" << endl;
|
||||
|
||||
if( circle.GetInfo().isNull() ) {
|
||||
fDest << " description " << "\"(" << X << " " ;
|
||||
fDest << Y << " " ;
|
||||
fDest << Z << ")\"" << endl;
|
||||
} else {
|
||||
fDest << " description " << "\"" << info << "\"" << endl;
|
||||
}
|
||||
|
||||
|
||||
fDest << " url \"\" " << endl;
|
||||
|
||||
fDest << " children [" << endl;
|
||||
|
||||
fDest << " Transform {" << endl;
|
||||
|
||||
fDest << " translation ";
|
||||
fDest << X << " " << Y << " " << Z << endl;
|
||||
|
||||
fDest << " children [" << endl;
|
||||
|
||||
fDest << "\t" << "Shape {" << endl;
|
||||
|
||||
SendMarkerColor( circle );
|
||||
|
||||
// send shape with size
|
||||
fDest << "\t\t" << "geometry Sphere {" << endl;
|
||||
fDest << "\t\t\t" << "radius " << radius << endl;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
|
||||
fDest << "\t" << "}" << endl; // Shape
|
||||
|
||||
fDest << " ]" << endl; // children
|
||||
fDest << " }" << endl; // Transform
|
||||
|
||||
fDest << " ]" << endl; // children
|
||||
fDest << "}" << endl; // Anchor
|
||||
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::AddPrimitive(const G4Square& square) // mark Square
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** AddPrim mark Square\n";
|
||||
#endif
|
||||
|
||||
// Information
|
||||
// const char* info = NULL ;
|
||||
const char* info = square.GetInfo() ;
|
||||
|
||||
// Position and size of square
|
||||
G4double X, Y, Z ; GetMarkerWorldPosition ( square, &X, &Y, &Z ) ;
|
||||
G4double radius = GetMarkerHalfSize ( square );
|
||||
G4double diameter = 2.0 * radius ;
|
||||
|
||||
// VRML codes are generated below
|
||||
fDest << "#---------- 3D MARKER (Square)" << endl;
|
||||
fDest << "Anchor {" << endl;
|
||||
|
||||
if( square.GetInfo().isNull() ) {
|
||||
fDest << " description " << "\"(" << X << " " ;
|
||||
fDest << Y << " " ;
|
||||
fDest << Z << ")\"" << endl;
|
||||
} else {
|
||||
fDest << " description " << "\"" << info << "\"" << endl;
|
||||
}
|
||||
|
||||
fDest << " url \"\" " << endl;
|
||||
|
||||
fDest << " children [" << endl;
|
||||
|
||||
fDest << " Transform {" << endl;
|
||||
|
||||
fDest << " translation ";
|
||||
fDest << X << " " << Y << " " << Z << endl;
|
||||
|
||||
fDest << " children [" << endl;
|
||||
|
||||
fDest << "\t" << "Shape {" << endl;
|
||||
|
||||
SendMarkerColor( square );
|
||||
|
||||
// send shape with size
|
||||
fDest << "\t\t" << "geometry Box {" << endl;
|
||||
fDest << "\t\t\t" << "size " << diameter << " " ;
|
||||
fDest << diameter << " " ;
|
||||
fDest << diameter << endl ;
|
||||
fDest << "\t\t" << "}" << endl;
|
||||
|
||||
fDest << "\t" << "}" << endl; // Shape
|
||||
|
||||
fDest << " ]" << endl; // children
|
||||
fDest << " }" << endl; // Transform
|
||||
|
||||
fDest << " ]" << endl; // children
|
||||
fDest << "}" << endl; // Anchor
|
||||
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::ClearStore()
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** ClearStore()\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::BeginModeling()
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** BeginModeling\n";
|
||||
#endif
|
||||
G4VScene::BeginModeling();
|
||||
beginSending(); // error recovery:
|
||||
// This function should be already called in
|
||||
// DrawView() of the View class
|
||||
// before camera setting
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::EndModeling()
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** EndModeling \n";
|
||||
#endif
|
||||
G4VScene::EndModeling();
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::BeginPrimitives(const G4Transform3D& objectTransformation)
|
||||
{
|
||||
G4VScene::BeginPrimitives (objectTransformation);
|
||||
fpObjectTransformation = &objectTransformation;
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** BeginPrimitives \n";
|
||||
#endif
|
||||
beginSending(); // error recovery:
|
||||
// This function should be already called in
|
||||
// DrawView() of the View class
|
||||
// before camera setting
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::EndPrimitives()
|
||||
{
|
||||
#if defined DEBUG_SCENE_FUNC
|
||||
G4cerr << "***** EndPrimitives \n";
|
||||
#endif
|
||||
G4VScene::EndPrimitives();
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::SendMaterialNode( const G4VisAttributes* pVA )
|
||||
{
|
||||
// Initialization of drawing parameters
|
||||
G4bool flagWF = false ;
|
||||
G4double TRANSPARENCY = GetPVTransparency() ;
|
||||
|
||||
// Wireframe or not
|
||||
const G4ViewParameters& cur_view_param = fpView -> GetViewParameters ();
|
||||
if (pVA->IsForceDrawingStyle() &&
|
||||
(pVA->GetForcedDrawingStyle() == G4VisAttributes::wireframe))
|
||||
{
|
||||
// wireframe style is assigned to this object
|
||||
flagWF = true ;
|
||||
|
||||
} else if ( cur_view_param.GetDrawingStyle() == G4ViewParameters::wireframe )
|
||||
{
|
||||
// current viewing style is wireframe
|
||||
flagWF = true ;
|
||||
}
|
||||
|
||||
// VRML codes are generated below
|
||||
if (!pVA) {
|
||||
|
||||
// Error recovery: Use default values of VRML browser
|
||||
fDest << "\t\t" ;
|
||||
fDest << "appearance Appearance { material Material {} }";
|
||||
fDest << endl;
|
||||
|
||||
} else {
|
||||
|
||||
const G4Color& color = pVA->GetColor();
|
||||
|
||||
fDest << "\t\t" << "appearance Appearance {" << endl;
|
||||
fDest << "\t\t\t" << "material Material {" << endl;
|
||||
|
||||
// diffuse color
|
||||
fDest << "\t\t\t\t" << "diffuseColor ";
|
||||
fDest << color.GetRed() << " " ;
|
||||
fDest << color.GetGreen() << " " ;
|
||||
fDest << color.GetBlue() << endl;
|
||||
|
||||
// emmisive color
|
||||
// fDest << "\t\t\t\t" << "emissiveColor ";
|
||||
// fDest << color.GetRed() << " " ;
|
||||
// fDest << color.GetGreen() << " " ;
|
||||
//fDest << color.GetBlue() << endl;
|
||||
//
|
||||
|
||||
// wireframe is expressed as transparency
|
||||
if ( flagWF )
|
||||
{
|
||||
fDest << "\t\t\t\t" << "transparency " << TRANSPARENCY << endl;
|
||||
}
|
||||
|
||||
fDest << "\t\t\t" << "}" << endl; // material
|
||||
fDest << "\t\t" << "}" << endl; // appearance
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2SCENE::SendMaterialNode()
|
||||
{
|
||||
SendMaterialNode
|
||||
( fpView->GetApplicableVisAttributes (fpVisAttribs) );
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2SCENE::beginSending()
|
||||
{
|
||||
if (!IS_CONNECTED ) {
|
||||
this->connectPort();
|
||||
fDest << "#VRML V2.0 utf8" << endl;
|
||||
fDest << "# Generated by VRML 2.0 driver of GEANT4\n" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::endSending()
|
||||
{
|
||||
if ( IS_CONNECTED ) {
|
||||
fDest << "#End of file." << endl;
|
||||
this->closePort();
|
||||
}
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::SendMarkerColor ( const G4VMarker& mark )
|
||||
{
|
||||
const G4Color& color = GetColor( mark );
|
||||
|
||||
fDest << "\t\t" << "appearance Appearance {" << endl;
|
||||
fDest << "\t\t\t" << "material Material {" << endl;
|
||||
fDest << "\t\t\t\t" << "diffuseColor ";
|
||||
fDest << color.GetRed() << " " ;
|
||||
fDest << color.GetGreen() << " " ;
|
||||
fDest << color.GetBlue() << endl;
|
||||
fDest << "\t\t\t\t" << "emissiveColor ";
|
||||
fDest << color.GetRed() << " " ;
|
||||
fDest << color.GetGreen() << " " ;
|
||||
fDest << color.GetBlue() << endl;
|
||||
fDest << "\t\t\t" << "}" << endl; // material
|
||||
fDest << "\t\t" << "}" << endl; // appearance
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
G4VRML2SCENE::SendMarkerWorldPosition ( const G4VMarker& mark )
|
||||
{
|
||||
G4Point3D point = mark.GetPosition();
|
||||
|
||||
point.transform( *fpObjectTransformation );
|
||||
|
||||
fDest << " translation ";
|
||||
fDest << point.x() << " " << point.y() << " " << point.z() << endl;
|
||||
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::GetMarkerWorldPosition ( const G4VMarker& mark ,
|
||||
double* pX ,
|
||||
double* pY ,
|
||||
double* pZ )
|
||||
{
|
||||
G4Point3D point = mark.GetPosition();
|
||||
|
||||
point.transform( *fpObjectTransformation );
|
||||
|
||||
*pX = point.x() ;
|
||||
*pY = point.y() ;
|
||||
*pZ = point.z() ;
|
||||
}
|
||||
|
||||
G4double G4VRML2SCENE::GetMarkerHalfSize ( const G4VMarker& mark )
|
||||
{
|
||||
//----- return value ( marker radius in 3d units)
|
||||
G4double size = 1.0 ; // initialization
|
||||
|
||||
//----- parameters to calculate 3d size from 2d size
|
||||
const double HALF_SCREEN_SIZE_2D = 300.0 ; // pixels
|
||||
double zoom_factor = fpView->GetViewParameters().GetZoomFactor() ;
|
||||
if ( zoom_factor <= 0.0 ) { zoom_factor = 1.0 ; }
|
||||
double extent_radius_3d = GetSceneData().GetExtent().GetExtentRadius() ;
|
||||
if ( extent_radius_3d <= 0.0 ) { extent_radius_3d = 1.0 ; }
|
||||
|
||||
//----- get marker radius in 3D units
|
||||
if ( size = mark.GetWorldSize() ) {
|
||||
|
||||
// get mark radius in 3D units
|
||||
size = 0.5 * mark.GetWorldSize() ;
|
||||
|
||||
} else if ( size = mark.GetScreenSize() ) {
|
||||
|
||||
// local
|
||||
double mark_radius_2d = 0.5 * mark.GetScreenSize() ;
|
||||
|
||||
// get mark radius in 3D units
|
||||
size \
|
||||
= extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
|
||||
size *= zoom_factor ;
|
||||
|
||||
} else {
|
||||
// local
|
||||
double mark_radius_2d \
|
||||
= fpView->GetViewParameters().GetDefaultMarker().GetScreenSize();
|
||||
|
||||
// get mark radius in 3D units
|
||||
size \
|
||||
= extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
|
||||
size *= zoom_factor ;
|
||||
}
|
||||
|
||||
//----- global rescaling
|
||||
size *= fpView->GetViewParameters().GetGlobalMarkerScale();
|
||||
|
||||
//----- return size
|
||||
return size ;
|
||||
|
||||
}
|
||||
|
||||
void G4VRML2SCENE::SendLineColor ( const G4VisAttributes* pVA )
|
||||
{
|
||||
const G4Color& color = pVA->GetColor();
|
||||
|
||||
|
||||
fDest << "\t" << "appearance Appearance {" << endl;
|
||||
fDest << "\t\t" << "material Material {" << endl;
|
||||
fDest << "\t\t\t" << "diffuseColor ";
|
||||
fDest << color.GetRed() << " " ;
|
||||
fDest << color.GetGreen() << " " ;
|
||||
fDest << color.GetBlue() << endl;
|
||||
fDest << "\t\t\t" << "emissiveColor ";
|
||||
fDest << color.GetRed() << " " ;
|
||||
fDest << color.GetGreen() << " " ;
|
||||
fDest << color.GetBlue() << endl;
|
||||
fDest << "\t\t" << "}" << endl; // material
|
||||
fDest << "\t" << "}" << endl; // appearance
|
||||
}
|
||||
|
||||
G4double G4VRML2SCENE::SetPVTransparency ()
|
||||
{
|
||||
|
||||
G4double TRANSPARENCY = 0.7 ; // initialization
|
||||
|
||||
if( getenv( "G4VRML_TRANSPARENCY" ) != NULL ) {
|
||||
|
||||
// get a value from the env value
|
||||
sscanf( getenv("G4VRML_TRANSPARENCY"), "%lg", &TRANSPARENCY ) ;
|
||||
|
||||
// truncation
|
||||
TRANSPARENCY = fabs ( TRANSPARENCY ) ;
|
||||
if ( TRANSPARENCY > 1.0 ) { TRANSPARENCY = 1.0 ; }
|
||||
}
|
||||
|
||||
fPVTransparency = TRANSPARENCY ;
|
||||
|
||||
return fPVTransparency ;
|
||||
}
|
||||
|
||||
// End of file.
|
||||
@@ -0,0 +1,132 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VRML2View.cc,v 2.2 1998/11/09 19:33:40 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VRML2View.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRML_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_VIEW
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "G4SceneData.hh"
|
||||
#include "G4VRML2View.hh"
|
||||
#include "G4VRML2Scene.hh"
|
||||
#include "G4VRML2.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4VRML2View::G4VRML2View(G4VRML2Scene& scene, const G4String& name) :
|
||||
G4VView(scene, scene.IncrementViewCount(), name),
|
||||
fScene(scene),
|
||||
fDest(scene.fDest)
|
||||
{
|
||||
fViewHalfAngle = 0.5 * 0.785398 ; // 0.5 * 45*deg
|
||||
fsin_VHA = sin ( fViewHalfAngle ) ;
|
||||
}
|
||||
|
||||
G4VRML2View::~G4VRML2View()
|
||||
{}
|
||||
|
||||
void G4VRML2View::SetView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2View::SetView()" << endl;
|
||||
G4cerr << "G4VRML2View::SetView(); not imlemented. " << endl;
|
||||
#endif
|
||||
|
||||
// Do nothing, since VRML a browser is running as a different process.
|
||||
// SendViewParameters () will do this job instead.
|
||||
|
||||
}
|
||||
|
||||
|
||||
void G4VRML2View::DrawView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2View::DrawView()" << endl;
|
||||
#endif
|
||||
// Open VRML2 file and output header comments
|
||||
fScene.beginSending() ;
|
||||
|
||||
// Viewpoint node
|
||||
SendViewParameters();
|
||||
|
||||
// Here is a minimal DrawView() function.
|
||||
NeedKernelVisit();
|
||||
ProcessView();
|
||||
FinishView();
|
||||
}
|
||||
|
||||
void G4VRML2View::ClearView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2View::ClearView()" << endl;
|
||||
G4cerr << "G4VRML2View::ClearView(); not implemented. " << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4VRML2View::ShowView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2View::ShowView()" << endl;
|
||||
#endif
|
||||
fScene.endSending();
|
||||
}
|
||||
|
||||
void G4VRML2View::FinishView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2View::FinishView()" << endl;
|
||||
//G4cerr << "G4VRML2View::FinishView(); not implemented. " << endl;
|
||||
#endif
|
||||
//fScene.endSending();
|
||||
}
|
||||
|
||||
void G4VRML2View::SendViewParameters ()
|
||||
{
|
||||
// Calculates view representation based on extent of object being
|
||||
// viewed and (initial) direction of camera. (Note: it can change
|
||||
// later due to user interaction via visualization system's GUI.)
|
||||
|
||||
#if defined DEBUG_FR_VIEW
|
||||
G4cerr << "***** G4VRML2View::SendViewParameters()\n";
|
||||
#endif
|
||||
// error recovery
|
||||
if ( fsin_VHA < 1.0e-6 ) { return ; }
|
||||
|
||||
// camera distance
|
||||
G4double extent_radius = fScene.GetSceneData().GetExtent().GetExtentRadius();
|
||||
G4double camera_distance = extent_radius / fsin_VHA ;
|
||||
|
||||
// camera position on Z axis
|
||||
const G4Point3D& target_point = fVP.GetCurrentTargetPoint();
|
||||
G4double E_z = target_point.z() + camera_distance;
|
||||
G4Point3D E(0.0, 0.0, E_z );
|
||||
|
||||
// VRML codes are generated below
|
||||
fDest << endl;
|
||||
fDest << "#---------- CAMERA" << endl;
|
||||
fDest << "Viewpoint {" << endl;
|
||||
fDest << "\t" << "position " ;
|
||||
fDest << E.x() << " " ;
|
||||
fDest << E.y() << " " ;
|
||||
fDest << E.z() << endl ;
|
||||
fDest << "}" << endl;
|
||||
fDest << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user