Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -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: G4OpenInventor.cc,v 2.6 1998/12/08 09:51:38 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
#ifdef G4VIS_BUILD_OI_DRIVER
|
||||
|
||||
//#include <HEPVis/SoDB.h>
|
||||
#include <HEPVis/nodes/SoG4Box.h>
|
||||
#include <HEPVis/nodes/SoG4Tubs.h>
|
||||
#include <HEPVis/nodes/SoG4Cons.h>
|
||||
#include <HEPVis/nodes/SoG4Trd.h>
|
||||
#include <HEPVis/nodes/SoG4Trap.h>
|
||||
#include <HEPVis/nodekits/SoDetectorTreeKit.h>
|
||||
|
||||
#include "G4OpenInventor.hh"
|
||||
#include "G4OpenInventorScene.hh"
|
||||
#include "G4OpenInventorView.hh"
|
||||
|
||||
|
||||
G4OpenInventor::G4OpenInventor (
|
||||
const G4String name
|
||||
,const G4String nickname
|
||||
,G4VGraphicsSystem::Functionality f
|
||||
)
|
||||
:G4VGraphicsSystem(name,nickname,f)
|
||||
,interactorManager(NULL)
|
||||
{
|
||||
}
|
||||
void G4OpenInventor::SetInteractorManager (G4VInteractorManager* im) {
|
||||
interactorManager = im;
|
||||
}
|
||||
G4VInteractorManager* G4OpenInventor::GetInteractorManager () {
|
||||
return interactorManager;
|
||||
}
|
||||
G4VScene* G4OpenInventor::CreateScene (const G4String& name) {
|
||||
G4VScene* p = new G4OpenInventorScene (*this, name);
|
||||
G4cout << G4OpenInventorScene::GetSceneCount ()
|
||||
<< ' ' << fName << " scenes extanct." << endl;
|
||||
return p;
|
||||
}
|
||||
|
||||
G4VView* G4OpenInventor::CreateView (G4VScene& scene, const G4String& name)
|
||||
{
|
||||
G4OpenInventorScene* pScene = (G4OpenInventorScene*)&scene;
|
||||
G4OpenInventorView* pView = new G4OpenInventorView (*pScene, name);
|
||||
if (pView -> GetOIVisualFound ()) {
|
||||
}
|
||||
else {
|
||||
delete pView;
|
||||
pView = NULL;
|
||||
}
|
||||
return pView;
|
||||
}
|
||||
|
||||
void G4OpenInventor::InitHEPVis()
|
||||
{
|
||||
// The below is too much for most loaders :
|
||||
// HEPVis_SoDB::init();
|
||||
|
||||
SoG4Box::initClass();
|
||||
SoG4Tubs::initClass();
|
||||
SoG4Cons::initClass();
|
||||
SoG4Trd::initClass();
|
||||
SoG4Trap::initClass();
|
||||
SoDetectorTreeKit::initClass();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,740 @@
|
||||
// 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: G4OpenInventorScene.cc,v 2.10 1998/12/04 13:18:10 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Jeff Kallenbach 01 Aug 1996
|
||||
// OpenInventor stored scene - creates OpenInventor display lists.
|
||||
#ifdef G4VIS_BUILD_OI_DRIVER
|
||||
|
||||
#include <Inventor/SoPath.h>
|
||||
#include <Inventor/SoNodeKitPath.h>
|
||||
#include <Inventor/nodes/SoCoordinate3.h>
|
||||
#include <Inventor/nodes/SoCoordinate4.h>
|
||||
#include <Inventor/nodes/SoSeparator.h>
|
||||
#include <Inventor/nodes/SoDrawStyle.h>
|
||||
#include <Inventor/nodes/SoMaterial.h>
|
||||
#include <Inventor/nodes/SoLineSet.h>
|
||||
#include <Inventor/actions/SoWriteAction.h>
|
||||
#include <Inventor/nodes/SoCube.h>
|
||||
#include <Inventor/nodes/SoSphere.h>
|
||||
#include <Inventor/nodes/SoCylinder.h>
|
||||
#include <Inventor/nodes/SoFont.h>
|
||||
#include <Inventor/fields/SoMFString.h>
|
||||
#include <Inventor/nodes/SoText2.h>
|
||||
#include <Inventor/nodes/SoFaceSet.h>
|
||||
#include <Inventor/nodes/SoNormal.h>
|
||||
#include <Inventor/nodes/SoNormalBinding.h>
|
||||
#include <Inventor/nodes/SoComplexity.h>
|
||||
#include <Inventor/nodes/SoNurbsSurface.h>
|
||||
#include <Inventor/nodes/SoTranslation.h>
|
||||
#include <Inventor/nodes/SoMatrixTransform.h>
|
||||
#include <Inventor/nodes/SoTransform.h>
|
||||
#include <Inventor/nodes/SoResetTransform.h>
|
||||
|
||||
#include <HEPVis/nodes/SoG4Box.h>
|
||||
#include <HEPVis/nodes/SoG4Tubs.h>
|
||||
#include <HEPVis/nodes/SoG4Cons.h>
|
||||
#include <HEPVis/nodes/SoG4Trd.h>
|
||||
#include <HEPVis/nodes/SoG4Trap.h>
|
||||
#include <HEPVis/nodekits/SoDetectorTreeKit.h>
|
||||
|
||||
#include "G4NURBS.hh"
|
||||
#include "G4OpenInventor.hh"
|
||||
#include "G4OpenInventorScene.hh"
|
||||
#include "G4OpenInventorView.hh"
|
||||
#include "G4OpenInventorTransform3D.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4Normal3D.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4ModelingParameters.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
typedef SoDetectorTreeKit SoG4DetectorTreeKit;
|
||||
G4Point3D translation;
|
||||
|
||||
inline static unsigned pSolidHashFun
|
||||
(const G4OpenInventorScene::G4VSolidPointer& pSolid) {
|
||||
return (unsigned)pSolid;
|
||||
}
|
||||
|
||||
inline static unsigned pVPhysicalVolumeHashFun
|
||||
(const G4OpenInventorScene::G4VPhysicalVolumePointer & volume) {
|
||||
return (unsigned)(unsigned long)volume;
|
||||
}
|
||||
|
||||
G4OpenInventorScene::G4OpenInventorScene (G4OpenInventor& system,
|
||||
const G4String& name):
|
||||
G4VScene (system, fSceneIdCount++, name),
|
||||
fSolidDictionary (pSolidHashFun),
|
||||
SeparatorSet(pVPhysicalVolumeHashFun),
|
||||
root(NULL)
|
||||
{
|
||||
root = new SoSeparator;
|
||||
root->ref();
|
||||
root->setName("Root");
|
||||
fSceneCount++;
|
||||
}
|
||||
|
||||
G4OpenInventorScene::~G4OpenInventorScene ()
|
||||
{
|
||||
root->unref();
|
||||
fSceneCount--;
|
||||
}
|
||||
|
||||
//
|
||||
// Method for handling G4Polyline objects (from tracking or wireframe).
|
||||
//
|
||||
void G4OpenInventorScene::AddPrimitive (const G4Polyline& line) {
|
||||
G4int nPoints = line.entries () - 1;
|
||||
SbVec3f* pCoords = new SbVec3f[nPoints];
|
||||
|
||||
SoCoordinate3 *polyCoords = new SoCoordinate3;
|
||||
SoDrawStyle *drawStyle = new SoDrawStyle;
|
||||
SoLineSet *pLine = new SoLineSet;
|
||||
|
||||
for (G4int iPoint = 0; iPoint < nPoints ; iPoint++) {
|
||||
pCoords[iPoint].setValue(line(iPoint).x(),
|
||||
line(iPoint).y(),
|
||||
line(iPoint).z());
|
||||
}
|
||||
|
||||
//
|
||||
// Color
|
||||
//
|
||||
SoMaterial *pMaterial = new SoMaterial;
|
||||
const G4Colour& c = GetColour (line);
|
||||
pMaterial->diffuseColor.setValue(c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
currentSeparator->addChild(pMaterial);
|
||||
|
||||
//
|
||||
// Point Set
|
||||
//
|
||||
polyCoords->point.setValues(0,nPoints,pCoords);
|
||||
currentSeparator->addChild(polyCoords);
|
||||
|
||||
//
|
||||
// Wireframe
|
||||
//
|
||||
drawStyle->style = SoDrawStyle::LINES;
|
||||
currentSeparator->addChild(drawStyle);
|
||||
#ifdef INVENTOR2_0
|
||||
pLine->numVertices.setValues(0,1,(const long *)&nPoints);
|
||||
#else
|
||||
pLine->numVertices.setValues(0,1,&nPoints);
|
||||
#endif
|
||||
currentSeparator->addChild(pLine);
|
||||
|
||||
delete [] pCoords;
|
||||
}
|
||||
|
||||
// ********* NOTE ********* NOTE ********* NOTE ********* NOTE *********
|
||||
//
|
||||
// This method (Text) has not been tested, as it is
|
||||
// innaccessible from the menu in the current configuration
|
||||
//
|
||||
// ********* NOTE ********* NOTE ********* NOTE ********* NOTE *********
|
||||
//
|
||||
// Method for handling G4Text objects
|
||||
//
|
||||
void G4OpenInventorScene::AddPrimitive (const G4Text& text) {
|
||||
|
||||
//
|
||||
// Color
|
||||
//
|
||||
SoMaterial *pMaterial = new SoMaterial;
|
||||
const G4Colour& c = GetTextColour (text);
|
||||
pMaterial->diffuseColor.setValue(c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
//pMaterial->diffuseColor.setValue(1.0, 0.0, 1.0); // Magenta so we can see
|
||||
currentSeparator->addChild(pMaterial);
|
||||
|
||||
//
|
||||
// Font
|
||||
//
|
||||
|
||||
SoFont *g4Font = new SoFont();
|
||||
g4Font->size = 20.0;
|
||||
currentSeparator->addChild(g4Font);
|
||||
|
||||
//
|
||||
// Text
|
||||
//
|
||||
|
||||
SoMFString *tString = new SoMFString;
|
||||
tString->setValue("This is Text");
|
||||
|
||||
SoText2 *g4String = new SoText2();
|
||||
g4String->spacing = 2.0;
|
||||
g4String->justification = SoText2::LEFT;
|
||||
currentSeparator->addChild(g4String);
|
||||
}
|
||||
|
||||
//
|
||||
// Method for handling G4Circle objects
|
||||
//
|
||||
void G4OpenInventorScene::AddPrimitive (const G4Circle& circle) {
|
||||
//
|
||||
// Color
|
||||
//
|
||||
SoMaterial *pMaterial = new SoMaterial;
|
||||
const G4Colour& c = GetColour (circle);
|
||||
pMaterial->diffuseColor.setValue(c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
currentSeparator->addChild(pMaterial);
|
||||
|
||||
//
|
||||
// Dimensions
|
||||
//
|
||||
G4double userSpecified = circle.GetWorldSize() || circle.GetScreenSize();
|
||||
const G4VMarker& defaultMarker =
|
||||
fpView -> GetViewParameters().GetDefaultMarker();
|
||||
|
||||
G4double size = GetMarkerSize ( circle );
|
||||
|
||||
//
|
||||
// Position
|
||||
//
|
||||
|
||||
const G4Point3D cCtr = circle.GetPosition();
|
||||
|
||||
SoTranslation *cTrans = new SoTranslation;
|
||||
cTrans->translation.setValue(cCtr.x(),cCtr.y(),cCtr.z());
|
||||
currentSeparator->addChild(cTrans);
|
||||
|
||||
//
|
||||
// Sphere
|
||||
//
|
||||
|
||||
SoSphere *g4Sphere = new SoSphere();
|
||||
g4Sphere->radius = size;
|
||||
currentSeparator->addChild(g4Sphere);
|
||||
}
|
||||
|
||||
//
|
||||
// Method for handling G4Square objects - defaults to wireframe
|
||||
//
|
||||
void G4OpenInventorScene::AddPrimitive (const G4Square& Square) {
|
||||
|
||||
//
|
||||
// Color
|
||||
//
|
||||
SoMaterial *pMaterial = new SoMaterial;
|
||||
const G4Colour& c = GetColour (Square);
|
||||
pMaterial->diffuseColor.setValue(c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
currentSeparator->addChild(pMaterial);
|
||||
|
||||
//
|
||||
// Size
|
||||
//
|
||||
G4double sSize = GetMarkerSize(Square);
|
||||
sSize = sSize * 2.0;
|
||||
|
||||
//
|
||||
// Position
|
||||
//
|
||||
const G4Point3D sOrig = Square.GetPosition();
|
||||
|
||||
SoTranslation *sTrans = new SoTranslation;
|
||||
sTrans->translation.setValue(sOrig.x(),sOrig.y(),sOrig.z());
|
||||
currentSeparator->addChild(sTrans);
|
||||
|
||||
SoCube *g4Square = new SoCube();
|
||||
g4Square->width = sSize;
|
||||
g4Square->height = sSize;
|
||||
g4Square->depth = sSize;
|
||||
currentSeparator->addChild(g4Square);
|
||||
}
|
||||
|
||||
//
|
||||
// Method for handling G4Polyhedron objects for drawing solids.
|
||||
//
|
||||
void G4OpenInventorScene::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
#define MAXPOLYH 32767
|
||||
//
|
||||
// Assume all facets are convex quadrilaterals.
|
||||
//
|
||||
SbVec3f* polyVerts = new SbVec3f[MAXPOLYH*4];
|
||||
G4int* numPolyVert = new G4int [MAXPOLYH];
|
||||
SbVec3f* polyNorms = new SbVec3f[MAXPOLYH];
|
||||
|
||||
//
|
||||
// Loop through the G4Facets...
|
||||
//
|
||||
G4int vertIdx = 0, polyIdx = 0;
|
||||
|
||||
G4bool notLastFace;
|
||||
G4Normal3D SurfaceUnitNormal;
|
||||
|
||||
do {
|
||||
|
||||
//
|
||||
// First, find surface normal for the facet...
|
||||
//
|
||||
notLastFace = polyhedron.GetNextUnitNormal (SurfaceUnitNormal);
|
||||
|
||||
//
|
||||
// Second, set the normal for all vertices in the facet...
|
||||
//
|
||||
polyNorms[polyIdx].setValue(SurfaceUnitNormal.x(),
|
||||
SurfaceUnitNormal.y(),
|
||||
SurfaceUnitNormal.z());
|
||||
|
||||
//
|
||||
// Loop through the four edges of each G4Facet...
|
||||
//
|
||||
G4int faceIdx = 0;
|
||||
G4bool notLastEdge;
|
||||
G4Point3D vertex;
|
||||
G4int edgeFlag=1;
|
||||
do {
|
||||
notLastEdge = polyhedron.GetNextVertex (vertex, edgeFlag);
|
||||
vertex.transform (*fpObjectTransformation);
|
||||
|
||||
polyVerts[vertIdx].setValue(vertex.x(),
|
||||
vertex.y(),
|
||||
vertex.z());
|
||||
|
||||
vertIdx++;
|
||||
faceIdx++;
|
||||
} while (notLastEdge);
|
||||
|
||||
numPolyVert[polyIdx] = faceIdx;
|
||||
polyIdx++;
|
||||
|
||||
} while ((notLastFace)&&(polyIdx < MAXPOLYH));
|
||||
|
||||
//
|
||||
// Store Norms
|
||||
//
|
||||
SoNormal *pNorms = new SoNormal;
|
||||
pNorms->vector.setValues(0,polyIdx,polyNorms);
|
||||
currentSeparator->addChild(pNorms);
|
||||
|
||||
SoNormalBinding *pNormalBinding = new SoNormalBinding;
|
||||
pNormalBinding->value = SoNormalBinding::PER_FACE;
|
||||
currentSeparator->addChild(pNormalBinding);
|
||||
|
||||
//
|
||||
// Define Material
|
||||
//
|
||||
SoMaterial *pMaterial = new SoMaterial;
|
||||
const G4Colour& c = GetColour (polyhedron);
|
||||
pMaterial->diffuseColor.setValue(c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
currentSeparator->addChild(pMaterial);
|
||||
|
||||
//
|
||||
// Store Vertex Coordinates
|
||||
//
|
||||
SoCoordinate3 *polyCoords = new SoCoordinate3;
|
||||
polyCoords->point.setValues(0,vertIdx,polyVerts);
|
||||
currentSeparator->addChild(polyCoords);
|
||||
|
||||
//
|
||||
// Define FaceSet
|
||||
//
|
||||
SoFaceSet *pFaceSet = new SoFaceSet;
|
||||
#ifdef INVENTOR2_0
|
||||
pFaceSet->numVertices.setValues(0,polyIdx,(const long *)numPolyVert);
|
||||
#else
|
||||
pFaceSet->numVertices.setValues(0,polyIdx,numPolyVert);
|
||||
#endif
|
||||
currentSeparator->addChild(pFaceSet);
|
||||
|
||||
//
|
||||
// Clean-up
|
||||
//
|
||||
delete [] polyVerts;
|
||||
delete [] numPolyVert;
|
||||
delete [] polyNorms;
|
||||
}
|
||||
|
||||
//
|
||||
// Method for handling G4NURBS objects for drawing solids.
|
||||
// Knots and Ctrl Pnts MUST be arrays of GLfloats.
|
||||
//
|
||||
void G4OpenInventorScene::AddPrimitive (const G4NURBS& nurb) {
|
||||
|
||||
G4float *u_knot_array, *u_knot_array_ptr;
|
||||
u_knot_array = u_knot_array_ptr = new G4float [nurb.GetnbrKnots(G4NURBS::U)];
|
||||
G4NURBS::KnotsIterator u_iterator (nurb, G4NURBS::U);
|
||||
while (u_iterator.pick (u_knot_array_ptr++));
|
||||
|
||||
G4float *v_knot_array, *v_knot_array_ptr;
|
||||
v_knot_array = v_knot_array_ptr = new G4float [nurb.GetnbrKnots(G4NURBS::V)];
|
||||
G4NURBS::KnotsIterator v_iterator (nurb, G4NURBS::V);
|
||||
while (v_iterator.pick (v_knot_array_ptr++));
|
||||
|
||||
G4float *ctrl_pnt_array, *ctrl_pnt_array_ptr;
|
||||
ctrl_pnt_array = ctrl_pnt_array_ptr =
|
||||
new G4float [nurb.GettotalnbrCtrlPts () * G4NURBS::NofC*sizeof(G4float)];
|
||||
G4NURBS::CtrlPtsCoordsIterator c_p_iterator (nurb);
|
||||
while (c_p_iterator.pick (ctrl_pnt_array_ptr++));
|
||||
|
||||
SoSeparator *surfSep = new SoSeparator();
|
||||
|
||||
//
|
||||
// Color
|
||||
//
|
||||
SoMaterial *pMaterial = new SoMaterial;
|
||||
const G4Colour& c = GetColour (nurb);
|
||||
pMaterial->diffuseColor.setValue(c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
surfSep->addChild(pMaterial);
|
||||
|
||||
//
|
||||
// Set up NURBS
|
||||
//
|
||||
SoComplexity *complexity = new SoComplexity;
|
||||
SoCoordinate4 *ctlPts = new SoCoordinate4;
|
||||
SoNurbsSurface *oi_nurb = new SoNurbsSurface;
|
||||
|
||||
complexity->value = 0.6;
|
||||
G4int nPoints = nurb.GettotalnbrCtrlPts ();
|
||||
SbVec4f* points = new SbVec4f[nPoints];
|
||||
for (G4int iPoint = 0; iPoint < nPoints ; iPoint++) {
|
||||
points[iPoint].setValue(
|
||||
ctrl_pnt_array[iPoint*4 + 0],
|
||||
ctrl_pnt_array[iPoint*4 + 1],
|
||||
ctrl_pnt_array[iPoint*4 + 2],
|
||||
ctrl_pnt_array[iPoint*4 + 3]);
|
||||
}
|
||||
ctlPts->point.setValues (0,nPoints,points);
|
||||
oi_nurb->numUControlPoints = nurb.GetnbrCtrlPts(G4NURBS::U);
|
||||
oi_nurb->numVControlPoints = nurb.GetnbrCtrlPts(G4NURBS::V);
|
||||
oi_nurb->uKnotVector.setValues(0,nurb.GetnbrKnots(G4NURBS::U),u_knot_array);
|
||||
oi_nurb->vKnotVector.setValues(0,nurb.GetnbrKnots(G4NURBS::V),v_knot_array);
|
||||
|
||||
surfSep->addChild(complexity);
|
||||
surfSep->addChild(ctlPts);
|
||||
surfSep->addChild(oi_nurb);
|
||||
|
||||
currentSeparator->addChild(surfSep);
|
||||
|
||||
//
|
||||
// Clean-up
|
||||
//
|
||||
delete [] u_knot_array;
|
||||
delete [] v_knot_array;
|
||||
delete [] ctrl_pnt_array;
|
||||
delete [] points;
|
||||
}
|
||||
//
|
||||
// Generates prerequisites for primitives
|
||||
//
|
||||
void G4OpenInventorScene::BeginPrimitives
|
||||
(const G4Transform3D& objectTransformation) {
|
||||
|
||||
G4VScene::BeginPrimitives (objectTransformation);
|
||||
|
||||
// Store away for future use, e.g.,
|
||||
// AddPrimitive (const G4Polyhedron& polyhedron).
|
||||
//
|
||||
fpObjectTransformation = &objectTransformation;
|
||||
|
||||
// The coming primitive is either:
|
||||
// a placed detector-type element whose destination
|
||||
// in the Scene Database has been predetermined for it.
|
||||
// In that case this routinde does absolutely nothing.
|
||||
|
||||
// Or: an unplaced, transient, marker-type of object
|
||||
// which needs to be properly placed, and whose
|
||||
// destination (for now) is the root of the scene
|
||||
// database. For these types of objects, execute the
|
||||
// following code:
|
||||
//
|
||||
if (fReadyForTransients) {
|
||||
//
|
||||
// set the destination to "root"
|
||||
//
|
||||
currentSeparator=root;
|
||||
//
|
||||
// place the transient object:
|
||||
//
|
||||
G4OpenInventorTransform3D oiTran (objectTransformation);
|
||||
SoSFMatrix *oiMat = oiTran.GetOIMatrix();
|
||||
SoMatrixTransform *rootXform = new SoMatrixTransform;
|
||||
rootXform->matrix.setValue(oiMat->getValue());
|
||||
//
|
||||
// add a transform.
|
||||
//
|
||||
currentSeparator->addChild(new SoResetTransform);
|
||||
currentSeparator->addChild(rootXform);
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenInventorScene::EndPrimitives () {
|
||||
G4VScene::EndPrimitives ();
|
||||
}
|
||||
|
||||
void G4OpenInventorScene::EndModeling () {
|
||||
}
|
||||
|
||||
void G4OpenInventorScene::ClearStore () {
|
||||
|
||||
}
|
||||
|
||||
void G4OpenInventorScene::RequestPrimitives (const G4VSolid& solid) {
|
||||
// Stop-gap solution for display List re-use.
|
||||
// A proper implementation would use geometry hierarchy.
|
||||
//
|
||||
G4VScene::RequestPrimitives (solid);
|
||||
}
|
||||
|
||||
G4int G4OpenInventorScene::fSceneIdCount = 0;
|
||||
|
||||
G4int G4OpenInventorScene::fSceneCount = 0;
|
||||
|
||||
//
|
||||
// These methods add primitives using the HEPVis classes
|
||||
//
|
||||
void G4OpenInventorScene::AddThis (const G4Box & Box) {
|
||||
SoCube *g4Box = new SoCube();
|
||||
g4Box->width =2*Box.GetXHalfLength();
|
||||
g4Box->height=2*Box.GetYHalfLength();
|
||||
g4Box->depth =2*Box.GetZHalfLength();
|
||||
currentSeparator->addChild(g4Box);
|
||||
}
|
||||
void G4OpenInventorScene::AddThis (const G4Tubs & Tubs) {
|
||||
SoG4Tubs *g4Tubs = new SoG4Tubs();
|
||||
g4Tubs->pRMin = Tubs.GetRMin();
|
||||
g4Tubs->pRMax = Tubs.GetRMax();
|
||||
g4Tubs->pDz = Tubs.GetDz();
|
||||
g4Tubs->pSPhi = Tubs.GetSPhi();
|
||||
g4Tubs->pDPhi = Tubs.GetDPhi();
|
||||
currentSeparator->addChild(g4Tubs);
|
||||
}
|
||||
void G4OpenInventorScene::AddThis (const G4Cons &cons) {
|
||||
SoG4Cons *g4Cons = new SoG4Cons();
|
||||
g4Cons->fRmin1 = cons.GetRmin1();
|
||||
g4Cons->fRmin2 = cons.GetRmin2();
|
||||
g4Cons->fRmax1 = cons.GetRmax1();
|
||||
g4Cons->fRmax2 = cons.GetRmax2();
|
||||
g4Cons->fDz = cons.GetDz();
|
||||
g4Cons->fSPhi = cons.GetSPhi();
|
||||
g4Cons->fDPhi = cons.GetDPhi();
|
||||
currentSeparator->addChild(g4Cons);
|
||||
}
|
||||
|
||||
void G4OpenInventorScene::AddThis (const G4Trap &trap) {
|
||||
G4ThreeVector SymAxis=trap.GetSymAxis();
|
||||
|
||||
SoG4Trap *g4Trap = new SoG4Trap();
|
||||
g4Trap->pDz = trap.GetZHalfLength();
|
||||
g4Trap->pPhi = atan2(SymAxis(kYAxis),SymAxis(kXAxis));
|
||||
g4Trap->pTheta = acos(SymAxis(kZAxis));
|
||||
g4Trap->pDy1 = trap.GetYHalfLength1();
|
||||
g4Trap->pDx1 = trap.GetXHalfLength1();
|
||||
g4Trap->pDx2 = trap.GetXHalfLength2();
|
||||
g4Trap->pDy2 = trap.GetYHalfLength2();
|
||||
g4Trap->pDx3 = trap.GetXHalfLength3();
|
||||
g4Trap->pDx4 = trap.GetXHalfLength4();
|
||||
currentSeparator->addChild(g4Trap);
|
||||
}
|
||||
|
||||
void G4OpenInventorScene::AddThis (const G4Trd &trd) {
|
||||
SoG4Trd *g4Trd = new SoG4Trd();
|
||||
g4Trd->fDx1 = trd.GetXHalfLength1();
|
||||
g4Trd->fDx2 = trd.GetXHalfLength2();
|
||||
g4Trd->fDy1 = trd.GetYHalfLength1();
|
||||
g4Trd->fDy2 = trd.GetYHalfLength2();
|
||||
g4Trd->fDz = trd.GetZHalfLength();
|
||||
currentSeparator->addChild(g4Trd);
|
||||
}
|
||||
|
||||
void G4OpenInventorScene::PreAddThis
|
||||
(const G4Transform3D& objectTransformation,
|
||||
const G4VisAttributes& visAttribs) {
|
||||
|
||||
// This assumes that it is a "Pre" to the "Add" of a
|
||||
// G4VPhysicalVolume. This is true at present, but beware! We
|
||||
// might have to think about the cast in the following code.
|
||||
|
||||
G4VScene::PreAddThis (objectTransformation, visAttribs);
|
||||
// Stores arguments away for future use, e.g., AddPrimitives.
|
||||
|
||||
// This routines prepares to add solids to the scene database.
|
||||
// We are expecting two
|
||||
// kinds of solids: leaf parts and non-leaf parts. For non-leaf parts,
|
||||
// we create a detector tree kit. This has two separators. The solid itself
|
||||
// goes in the preview separator, the full separator is forseen for daughters.
|
||||
// This separator is not only created--it is also put in a dictionary for
|
||||
// future use by the leaf part.
|
||||
|
||||
// For leaf parts, we first locate the mother volume and find its separator
|
||||
// through the dictionary.
|
||||
|
||||
// The private member currentSeparator is set to the proper location on in the
|
||||
// scene database so that when the solid is actually added (in addthis), it is
|
||||
// put in the right place.
|
||||
|
||||
// First find the color attributes.
|
||||
//
|
||||
const G4VisAttributes* pVisAttribs =
|
||||
fpView -> GetApplicableVisAttributes (&visAttribs);
|
||||
const G4Colour& g4Col = pVisAttribs -> GetColour ();
|
||||
const double red=g4Col.GetRed ();
|
||||
const double green=g4Col.GetGreen ();
|
||||
const double blue=g4Col.GetBlue ();
|
||||
|
||||
|
||||
//
|
||||
// This block of code is executed for non-leaf parts:
|
||||
//
|
||||
if (fpCurrentLV->GetNoDaughters()!=0 ||
|
||||
fpCurrentPV->IsReplicated()) {
|
||||
|
||||
//
|
||||
// Make the detector tree kit:
|
||||
//
|
||||
SoG4DetectorTreeKit* g4DetectorTreeKit = new SoG4DetectorTreeKit();
|
||||
|
||||
SoSeparator* previewSeparator =
|
||||
(SoSeparator*) g4DetectorTreeKit->getPart("previewSeparator",TRUE);
|
||||
SoSeparator* fullSeparator =
|
||||
(SoSeparator*) g4DetectorTreeKit->getPart("fullSeparator", TRUE);
|
||||
previewSeparator->renderCaching=SoSeparator::OFF;
|
||||
fullSeparator->renderCaching=SoSeparator::OFF;
|
||||
SoMaterial* matColor = (SoMaterial*)
|
||||
g4DetectorTreeKit->getPart("appearance.material", TRUE);
|
||||
matColor->diffuseColor.setValue(red,green,blue);
|
||||
|
||||
//
|
||||
// Add the full separator to the dictionary; it is indexed by the
|
||||
// address of the physical volume!
|
||||
//
|
||||
SeparatorSet[fpCurrentPV]=fullSeparator;
|
||||
|
||||
//
|
||||
// Find out where to add this volume. This means locating its mother.
|
||||
// If no mother can be found, it goes under root.
|
||||
//
|
||||
G4VPhysicalVolume* MotherVolume = fpCurrentPV->GetMother();
|
||||
while (MotherVolume) {
|
||||
if (SeparatorSet.contains(MotherVolume)) {
|
||||
SeparatorSet[MotherVolume]->addChild(g4DetectorTreeKit);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
G4cerr << "OIScene non-leaf protocol error. Mother volume " <<
|
||||
MotherVolume->GetName() << " missing." << endl;
|
||||
G4cerr << " Daughter volume was: "
|
||||
<< fpCurrentPV->GetName()
|
||||
<< endl;
|
||||
}
|
||||
MotherVolume=MotherVolume->GetMother();
|
||||
}
|
||||
if (!MotherVolume) root->addChild(g4DetectorTreeKit);
|
||||
currentSeparator = previewSeparator;
|
||||
}
|
||||
//
|
||||
// This block of code is executed for leaf parts.
|
||||
//
|
||||
else {
|
||||
//
|
||||
// Locate the mother volume and find it's corresponding full separator
|
||||
//
|
||||
currentSeparator = NULL;
|
||||
G4VPhysicalVolume* MotherVolume = fpCurrentPV->GetMother();
|
||||
while (MotherVolume) {
|
||||
if (SeparatorSet.contains(MotherVolume)) {
|
||||
currentSeparator=SeparatorSet[MotherVolume];
|
||||
break;
|
||||
}
|
||||
else {
|
||||
G4cerr << "OIScene leaf protocol error. Mother volume " <<
|
||||
MotherVolume->GetName() << " missing." << endl;
|
||||
G4cerr << " Daughter volume was: "
|
||||
<< fpCurrentPV->GetName()
|
||||
<< endl;
|
||||
}
|
||||
MotherVolume = MotherVolume->GetMother();
|
||||
}
|
||||
//
|
||||
// If the mother volume has no full separator, then the solid and its
|
||||
// attributes will go under "root"
|
||||
//
|
||||
if (!currentSeparator) {
|
||||
SoMaterial* newColor = new SoMaterial();
|
||||
newColor->diffuseColor.setValue(red,green,blue);
|
||||
root->addChild(newColor);
|
||||
currentSeparator=root;
|
||||
}
|
||||
else {
|
||||
SoMaterial* newColor = new SoMaterial();
|
||||
newColor->diffuseColor.setValue(red,green,blue);
|
||||
currentSeparator->addChild(newColor);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Set up the geometrical transformation for the coming
|
||||
//
|
||||
G4OpenInventorTransform3D oiTran (objectTransformation);
|
||||
SoSFMatrix* oiMat = oiTran.GetOIMatrix();
|
||||
SoMatrixTransform* rootXform = new SoMatrixTransform;
|
||||
rootXform->matrix.setValue(oiMat->getValue());
|
||||
currentSeparator->addChild(new SoResetTransform);
|
||||
currentSeparator->addChild(rootXform);
|
||||
}
|
||||
|
||||
|
||||
G4double G4OpenInventorScene::GetMarkerSize ( 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 ;
|
||||
|
||||
} // G4OpenInventorScene::GetMarkerSize ()
|
||||
#endif
|
||||
@@ -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: G4OpenInventorTransform3D.cc,v 2.2 1998/09/19 14:09:50 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// jck 17 Dec 1996
|
||||
// G4OpenInventorTransform3D provides OpenGL style transformation matrix
|
||||
// from G4Transform3D.
|
||||
|
||||
#ifdef G4VIS_BUILD_OI_DRIVER
|
||||
|
||||
#include <Inventor/fields/SoSFMatrix.h>
|
||||
|
||||
#include "G4OpenInventorTransform3D.hh"
|
||||
|
||||
G4OpenInventorTransform3D::G4OpenInventorTransform3D (const G4Transform3D &t)
|
||||
: G4Transform3D (t) {
|
||||
m[0] = xx;
|
||||
m[1] = yx;
|
||||
m[2] = zx;
|
||||
m[3] = 0;
|
||||
m[4] = xy;
|
||||
m[5] = yy;
|
||||
m[6] = zy;
|
||||
m[7] = 0;
|
||||
m[8] = xz;
|
||||
m[9] = yz;
|
||||
m[10] = zz;
|
||||
m[11] = 0;
|
||||
m[12] = dx;
|
||||
m[13] = dy;
|
||||
m[14] = dz;
|
||||
m[15] = 1;
|
||||
}
|
||||
|
||||
SoSFMatrix* G4OpenInventorTransform3D::GetOIMatrix () const {
|
||||
SoSFMatrix *tm = new SoSFMatrix;
|
||||
tm->setValue(m[0],m[1],m[2],m[3],
|
||||
m[4],m[5],m[6],m[7],
|
||||
m[8],m[9],m[10],m[11],
|
||||
m[12],m[13],m[14],m[15]);
|
||||
return tm;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,235 @@
|
||||
// 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: G4OpenInventorView.cc,v 2.10 1998/12/04 13:18:12 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
/*
|
||||
* jck 05 Feb 1997 - Initial Implementation
|
||||
* jck 21 Apr 1997
|
||||
* Mods for SoXtHepViewer
|
||||
*
|
||||
*/
|
||||
#ifdef G4VIS_BUILD_OI_DRIVER
|
||||
|
||||
#ifndef WIN32 //SoXtHepViewer not ported on Windows/NT.
|
||||
#define HEP_VIEWER
|
||||
#endif
|
||||
|
||||
#include <Inventor/Xt/SoXt.h>
|
||||
#include <Inventor/nodes/SoSelection.h>
|
||||
|
||||
#ifdef HEP_VIEWER
|
||||
#include <HEPVis/Xt/viewers/SoXtHepViewer.h>
|
||||
#else
|
||||
#include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
|
||||
#endif
|
||||
|
||||
#include "G4OpenInventor.hh"
|
||||
#include "G4OpenInventorView.hh"
|
||||
#include "G4OpenInventorScene.hh"
|
||||
|
||||
#include "G4VInteractorManager.hh"
|
||||
|
||||
//
|
||||
// Global variables
|
||||
//
|
||||
|
||||
//static void SecondaryLoopPostAction ();
|
||||
|
||||
void G4OpenInventorView::FinishView () {
|
||||
#ifdef HEP_VIEWER
|
||||
((SoXtHepViewer*)G4OIViewer)->getCurrentViewer()->viewAll();
|
||||
((SoXtHepViewer*)G4OIViewer)->getCurrentViewer()->saveHomePosition();
|
||||
#else
|
||||
((SoXtViewer*)G4OIViewer)->viewAll();
|
||||
((SoXtViewer*)G4OIViewer)->saveHomePosition();
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Exit
|
||||
//
|
||||
int quitCB(void* interactorManager) {
|
||||
((G4VInteractorManager*)interactorManager) ->
|
||||
RequireExitSecondaryLoop (OIV_EXIT_CODE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//static void SecondaryLoopPostAction ()
|
||||
//{
|
||||
// Display *display = G4OIViewer->getDisplay();
|
||||
// XSync(display, False);
|
||||
// if(interactorManager -> GetExitSecondaryLoopCode ()==OIV_EXIT_CODE) {
|
||||
// if (G4OIShell!=NULL) XtRealizeWidget(G4OIShell);
|
||||
// }
|
||||
//}
|
||||
|
||||
void G4OpenInventorView::KernelVisitDecision () {
|
||||
|
||||
//
|
||||
// Trigger a display List refresh if necessary. This is a checklist
|
||||
// of relevant view parameters.
|
||||
//
|
||||
static G4ViewParameters lastVP; // Initialised to default.
|
||||
G4bool need = false;
|
||||
if (
|
||||
(lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(lastVP.GetRepStyle () != fVP.GetRepStyle ()) ||
|
||||
(lastVP.IsCulling () != fVP.IsCulling ()) ||
|
||||
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(lastVP.IsSection () != fVP.IsSection ()) ||
|
||||
|
||||
(lastVP.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
(lastVP.GetCutawayPlanes ().entries () !=
|
||||
fVP.GetCutawayPlanes ().entries ()) ||
|
||||
|
||||
(lastVP.IsExplode () != fVP.IsExplode ()) ||
|
||||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ())
|
||||
) {
|
||||
need = true;;
|
||||
}
|
||||
if (!need && lastVP.IsDensityCulling () &&
|
||||
(lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
|
||||
need = true;
|
||||
|
||||
if (!need && lastVP.IsExplode () &&
|
||||
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
need = true;
|
||||
|
||||
if (need) {
|
||||
lastVP = fVP;
|
||||
NeedKernelVisit ();
|
||||
}
|
||||
}
|
||||
|
||||
G4OpenInventorView::G4OpenInventorView (G4OpenInventorScene& scene,
|
||||
const G4String& name):
|
||||
G4VView (scene, scene.IncrementViewCount (), name),
|
||||
fScene (scene),
|
||||
OIvisualfound (false),
|
||||
G4OIViewer(NULL),
|
||||
G4OIShell(NULL)
|
||||
{
|
||||
interactorManager = ((G4OpenInventor*)fScene.GetGraphicsSystem()) ->
|
||||
GetInteractorManager ();
|
||||
Widget toplevel = (Widget)interactorManager->GetMainInteractor ();
|
||||
|
||||
//interactorManager->
|
||||
//AddSecondaryLoopPostAction ((G4SecondaryLoopAction)SecondaryLoopPostAction);
|
||||
|
||||
OIvisualfound = true;
|
||||
|
||||
G4cout << "Window name: " << fName << endl;
|
||||
//
|
||||
// Selection
|
||||
//
|
||||
G4OISelection = new SoSelection;
|
||||
G4OISelection->policy = SoSelection::SINGLE;
|
||||
G4OISelection->ref();
|
||||
G4OISelection->addChild(fScene.root);
|
||||
|
||||
Widget parent = (Widget)interactorManager->GetParentInteractor ();
|
||||
SbBool buildInsideParent;
|
||||
char charOIName[100];
|
||||
strncpy (charOIName, fName, 100);
|
||||
char* wname = charOIName;
|
||||
|
||||
if(parent==NULL) { //Ask Inventor to create a viewer in its own shell.
|
||||
parent = toplevel;
|
||||
buildInsideParent = FALSE;
|
||||
} else { //Ask Inventor to create a viewer in the given parent.
|
||||
buildInsideParent = TRUE;
|
||||
char* str = interactorManager->GetCreationString ();
|
||||
if(str!=NULL) wname = str;
|
||||
}
|
||||
//
|
||||
// Create and Customize the Viewer
|
||||
//
|
||||
#ifdef HEP_VIEWER
|
||||
G4OIViewer = new SoXtHepViewer (parent,wname,buildInsideParent);
|
||||
((SoXtHepViewer*)G4OIViewer)->hideTextArea();
|
||||
((SoXtHepViewer*)G4OIViewer)->resizeMain(550,550);
|
||||
((SoXtHepViewer*)G4OIViewer)->setQuitCallback(quitCB, interactorManager);
|
||||
((SoXtHepViewer*)G4OIViewer)->setSceneGraph(G4OISelection);
|
||||
((SoXtHepViewer*)G4OIViewer)->getCurrentViewer()->viewAll();
|
||||
((SoXtHepViewer*)G4OIViewer)->getCurrentViewer()->saveHomePosition();
|
||||
#else
|
||||
G4OIViewer = new SoXtExaminerViewer(parent,wname,buildInsideParent);
|
||||
G4OIViewer->setSize(SbVec2s(550,550));
|
||||
((SoXtViewer*)G4OIViewer)->setSceneGraph(G4OISelection);
|
||||
((SoXtViewer*)G4OIViewer)->viewAll();
|
||||
((SoXtViewer*)G4OIViewer)->saveHomePosition();
|
||||
#endif
|
||||
G4OIViewer->setTitle(fName);
|
||||
G4OIViewer->show();
|
||||
|
||||
#if defined(WIN32) && !defined(SoFreePackage)
|
||||
// buildInsideParent==FALSE, isTopLevel, getShellWidget
|
||||
// do not work with Inventor-2.4 on Win32 !
|
||||
// All viewers are going to be put in the same shell window !
|
||||
if(buildInsideParent==FALSE) {
|
||||
G4OIShell = toplevel;
|
||||
interactorManager->AddShell (G4OIShell);
|
||||
SoXt::show(G4OIShell);
|
||||
interactorManager->FlushAndWaitExecution ();
|
||||
}
|
||||
#else
|
||||
if(G4OIViewer->isTopLevelShell()==TRUE) {
|
||||
G4OIShell = G4OIViewer -> getShellWidget();
|
||||
if(G4OIShell!=NULL) {
|
||||
interactorManager->AddShell (G4OIShell);
|
||||
SoXt::show(G4OIShell);
|
||||
interactorManager->FlushAndWaitExecution ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
interactorManager->SetCreatedInteractor (G4OIViewer -> getWidget());
|
||||
}
|
||||
|
||||
G4OpenInventorView::~G4OpenInventorView () {
|
||||
if(G4OIShell!=NULL) {
|
||||
interactorManager -> RemoveShell (G4OIShell);
|
||||
}
|
||||
#ifdef HEP_VIEWER
|
||||
delete ((SoXtHepViewer*)G4OIViewer);
|
||||
#else
|
||||
delete ((SoXtExaminerViewer*)G4OIViewer);
|
||||
#endif
|
||||
if(G4OISelection!=NULL) {
|
||||
G4OISelection->unref();
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenInventorView::ClearView () {
|
||||
}
|
||||
|
||||
void G4OpenInventorView::SetView () {
|
||||
}
|
||||
|
||||
void G4OpenInventorView::DrawView () {
|
||||
KernelVisitDecision ();
|
||||
ProcessView ();
|
||||
FinishView ();
|
||||
}
|
||||
|
||||
void G4OpenInventorView::ShowView () {
|
||||
interactorManager -> SecondaryLoop ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// 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: G4OpenInventorWin32.cc,v 2.7 1998/12/08 09:51:39 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// OpenInventor graphics system factory.
|
||||
|
||||
#ifdef G4VIS_BUILD_OIWIN32_DRIVER
|
||||
|
||||
#include <Inventor/Xt/SoXt.h>
|
||||
|
||||
#include "G4OpenInventorWin32.hh"
|
||||
|
||||
#include "G4OpenInventorScene.hh"
|
||||
#include "G4OpenInventorView.hh"
|
||||
|
||||
#include "G4Win32.hh"
|
||||
|
||||
G4OpenInventorWin32::G4OpenInventorWin32 ()
|
||||
:G4OpenInventor("OpenInventorWin32","OIWIN32",G4VGraphicsSystem::threeD)
|
||||
{
|
||||
SetInteractorManager (G4Win32::getInstance());
|
||||
GetInteractorManager () -> RemoveDispatcher((G4DispatchFunction)G4Win32::dispatchWin32Event);
|
||||
GetInteractorManager () -> AddDispatcher ((G4DispatchFunction)SoXt::dispatchEvent);
|
||||
|
||||
Widget toplevel = (Widget)GetInteractorManager()->GetMainInteractor();
|
||||
|
||||
SoXt::init(toplevel);
|
||||
|
||||
InitHEPVis();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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: G4OpenInventorX.cc,v 2.6 1998/12/08 09:51:40 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Jeff Kallenbach 01 Aug 1996
|
||||
// OpenInventor graphics system factory.
|
||||
|
||||
#ifdef G4VIS_BUILD_OIX_DRIVER
|
||||
|
||||
#include <Inventor/Xt/SoXt.h>
|
||||
|
||||
#include "G4OpenInventorX.hh"
|
||||
#include "G4OpenInventorScene.hh"
|
||||
#include "G4OpenInventorView.hh"
|
||||
|
||||
#include "G4Xt.hh"
|
||||
|
||||
G4OpenInventorX::G4OpenInventorX ()
|
||||
:G4OpenInventor("OpenInventorX","OIX",G4VGraphicsSystem::threeD)
|
||||
{
|
||||
SetInteractorManager (G4Xt::getInstance ());
|
||||
GetInteractorManager () ->
|
||||
RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);
|
||||
GetInteractorManager () ->
|
||||
AddDispatcher ((G4DispatchFunction)SoXt::dispatchEvent);
|
||||
|
||||
Widget toplevel = (Widget)GetInteractorManager()->GetMainInteractor();
|
||||
|
||||
SoXt::init (toplevel);
|
||||
|
||||
InitHEPVis();
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user