Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.9 2003/06/16 17:13:39 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.10 2004/07/01 15:29:10 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -97,16 +97,9 @@ void G4OpenGLImmediateSceneHandler::EndPrimitives () {
void G4OpenGLImmediateSceneHandler::BeginModeling () {
G4VSceneHandler::BeginModeling();
if (fpViewer -> GetViewParameters ().GetDrawingStyle() == G4ViewParameters::hlr) {
initialize_hlr = true;
}
}
void G4OpenGLImmediateSceneHandler::EndModeling () {
if (fpViewer -> GetViewParameters ().GetDrawingStyle() == G4ViewParameters::hlr) {
initialize_hlr = true;
// glDisable (GL_POLYGON_OFFSET_FILL);
}
G4VSceneHandler::EndModeling ();
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLImmediateViewer.cc,v 1.6 2002/10/16 10:44:15 johna Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLImmediateWin32.cc,v 1.8 2002/10/16 10:44:15 johna Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// OpenGLImmediateWin32 graphics system factory.
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.7 2003/06/10 17:13:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLImmediateX.cc,v 1.8 2002/02/24 01:48:02 johna Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 27th March 1996
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLImmediateXViewer.cc,v 1.9 2004/04/07 15:18:22 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLImmediateXm.cc,v 1.9 2004/04/07 15:18:22 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLImmediateXmViewer.cc,v 1.9 2004/04/07 15:18:22 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLSceneHandler.cc,v 1.18 2003/06/10 17:13:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLSceneHandler.cc,v 1.29 2004/12/10 18:16:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
//
// Andrew Walkden 27th March 1996
@@ -53,15 +53,15 @@
#include "G4VMarker.hh"
#include "G4Polyhedron.hh"
#include "G4VisAttributes.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
G4int id,
const G4String& name):
G4VSceneHandler (system, id, name)
{
initialize_hlr = true;
// glPolygonOffset (1.0, 2);
}
{}
G4OpenGLSceneHandler::~G4OpenGLSceneHandler ()
{
@@ -118,6 +118,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
static G4int callCount (0);
++callCount;
const G4Colour& c = GetColour (text); // Picks up default if none.
MarkerSizeType sizeType;
G4double size = GetMarkerSize (text, sizeType);
G4ThreeVector position (*fpObjectTransformation * text.GetPosition ());
@@ -131,6 +132,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
<< ", size " << size
<< ", offsets " << text.GetXOffset () << ", " << text.GetYOffset ()
<< ", type " << G4int(sizeType)
<< ", colour " << c
<< G4endl;
}
}
@@ -228,8 +230,8 @@ void G4OpenGLSceneHandler::AddCircleSquare
gluProject(p.x(), p.y(), p.z(),
modelMatrix, projectionMatrix, viewport,
&winDx, &winDy, &winDz);
G4double winWorldRatio = sqrt(pow(winx - winDx, 2) +
pow(winy - winDy, 2));
G4double winWorldRatio = std::sqrt(std::pow(winx - winDx, 2) +
std::pow(winy - winDy, 2));
G4double winSize = scale *
userSpecified ? marker.GetScreenSize() : def.GetScreenSize();
worldSize = winSize / winWorldRatio;
@@ -272,9 +274,9 @@ transformations. Some clever stuff is needed.
gluProject(centre.x() + size, centre.y() + size, centre.z() + size,
modelMatrix, projectionMatrix, viewport,
&winx1, &winy1, &winz1);
winSize = sqrt((pow(winx - winx1, 2) +
pow(winy - winy1, 2) +
pow(winz - winz1, 2)) / 3.);
winSize = std::sqrt((std::pow(winx - winx1, 2) +
std::pow(winy - winy1, 2) +
std::pow(winz - winz1, 2)) / 3.);
}
else {
winSize = scale *
@@ -302,20 +304,21 @@ transformations. Some clever stuff is needed.
glMatrixMode (GL_MODELVIEW);
glPopMatrix();
...
}
void G4OpenGLSceneHandler::DrawScreenPolygon
(G4double size,
const G4Point3D& centre,
G4int nSides) {
glBegin (GL_POLYGON);
const G4double dPhi = 2. * M_PI / nSides;
const G4double dPhi = twopi / nSides;
const G4double r = size / 2.;
G4double phi;
G4int i;
for (i = 0, phi = -dPhi / 2.; i < nSides; i++, phi += dPhi) {
G4double x, y, z;
x = centre.x() + r * cos(phi);
y = centre.y() + r * sin(phi);
x = centre.x() + r * std::cos(phi);
y = centre.y() + r * std::sin(phi);
z = centre.z();
glVertex3d (x, y, z);
}
@@ -330,7 +333,7 @@ void G4OpenGLSceneHandler::DrawXYPolygon
const G4Vector3D& viewpointDirection =
fpViewer -> GetViewParameters().GetViewpointDirection();
const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
const G4double dPhi = 2. * M_PI / nSides;
const G4double dPhi = twopi / nSides;
const G4double radius = size / 2.;
G4Vector3D start = radius * (up.cross(viewpointDirection)).unit();
G4double phi;
@@ -352,156 +355,183 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
if (polyhedron.GetNoFacets() == 0) return;
G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (polyhedron);
// Get vis attributes - pick up defaults if none.
const G4VisAttributes* pVA =
fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
// Get view parameters that the user can force through the vis
// attributes, thereby over-riding the current view parameter.
G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
//Get colour, etc..
const G4Colour& c = GetColour (polyhedron);
const G4Colour& c = pVA -> GetColour ();
GLfloat materialColour [4];
materialColour [0] = c.GetRed ();
materialColour [1] = c.GetGreen ();
materialColour [2] = c.GetBlue ();
materialColour [3] = 1.0;
GLdouble clear_colour[4];
glGetDoublev (GL_COLOR_CLEAR_VALUE, clear_colour);
switch (drawing_style) {
// case (G4ViewParameters::hlhsr):
// cout << "Hidden edge not implememented in G4OpenGL.\n"
// << "Using hidden surface removal." << G4endl;
case (G4ViewParameters::hsr):
{
glPolygonMode (GL_FRONT, GL_FILL);
glCullFace (GL_BACK);
//glEnable (GL_CULL_FACE);
glEnable (GL_LIGHTING);
glEnable (GL_DEPTH_TEST);
GLfloat materialColour [4];
materialColour [0] = c.GetRed ();
materialColour [1] = c.GetGreen ();
materialColour [2] = c.GetBlue ();
materialColour [3] = 1.0;
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
break;
}
case (G4ViewParameters::hlhsr):
// Set up as for hidden line removal but paint polygons...
case (G4ViewParameters::hlr):
if (initialize_hlr) {
glEnable (GL_STENCIL_TEST);
glClear (GL_STENCIL_BUFFER_BIT);
glStencilFunc (GL_ALWAYS, 0, 1);
glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
glGetDoublev (GL_COLOR_CLEAR_VALUE, clear_colour);
initialize_hlr = false;
// glEnable (GL_POLYGON_OFFSET_FILL);
}
glDepthFunc (GL_LESS);
//drop through to wireframe for first pass...
case (G4ViewParameters::wireframe):
default:
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
glDisable (GL_CULL_FACE);
glDisable (GL_LIGHTING);
glEnable (GL_STENCIL_TEST);
// The stencil buffer is cleared in G4OpenGLViewer::ClearView.
// The procedure below leaves it clear.
glStencilFunc (GL_ALWAYS, 0, 1);
glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
glEnable (GL_DEPTH_TEST);
glDepthFunc (GL_LESS);
glEnable (GL_CULL_FACE);
glCullFace (GL_BACK);
glPolygonMode (GL_FRONT, GL_LINE);
glDisable (GL_LIGHTING);
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
break;
}
glBegin (GL_QUADS);
case (G4ViewParameters::hsr):
glEnable (GL_DEPTH_TEST);
glDepthFunc (GL_LESS);
glEnable (GL_CULL_FACE);
glCullFace (GL_BACK);
glEnable (GL_LIGHTING);
glPolygonMode (GL_FRONT, GL_FILL);
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
break;
case (G4ViewParameters::wireframe):
default:
//glDisable (GL_DEPTH_TEST);
glEnable (GL_DEPTH_TEST);
glDepthFunc (GL_ALWAYS);
glDisable (GL_CULL_FACE);
glDisable (GL_LIGHTING);
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
break;
}
//Loop through all the facets...
glBegin (GL_QUADS);
G4bool notLastFace;
G4Normal3D SurfaceUnitNormal;
do {
//First, find surface normal for the facet...
//First, find surface normal and note "not last facet"...
G4Normal3D SurfaceUnitNormal;
notLastFace = polyhedron.GetNextUnitNormal (SurfaceUnitNormal);
glNormal3d(SurfaceUnitNormal.x(), SurfaceUnitNormal.y(),
SurfaceUnitNormal.z());
//Loop through the four edges of each G4Facet...
G4bool notLastEdge;
G4Point3D vertex[4];
G4int edgeFlag[4], lastEdgeFlag (true);
edgeFlag[0] = G4int (true);
G4int edgeFlag[4];
G4int edgeCount = 0;
glEdgeFlag (GL_TRUE);
glNormal3d(SurfaceUnitNormal.x(), SurfaceUnitNormal.y(),
SurfaceUnitNormal.z());
do {
notLastEdge = polyhedron.GetNextVertex (vertex[edgeCount],
edgeFlag[edgeCount]);
// Check to see if edge is visible or not...
if (edgeFlag[edgeCount] != lastEdgeFlag) {
lastEdgeFlag = edgeFlag[edgeCount];
if (edgeFlag[edgeCount]) {
glEdgeFlag (GL_TRUE);
} else {
glEdgeFlag (GL_FALSE);
}
if (isAuxEdgeVisible) {
edgeFlag[edgeCount] = G4int (true);
}
if (edgeFlag[edgeCount]) {
glEdgeFlag (GL_TRUE);
} else {
glEdgeFlag (GL_FALSE);
}
glVertex3d (vertex[edgeCount].x(),
vertex[edgeCount].y(),
vertex[edgeCount].z());
edgeCount++;
} while (notLastEdge);
while (edgeCount < 4) { // duplicate last real vertex.
} while (notLastEdge && edgeCount < 4);
// HEPPolyhedron produces triangles too; in that case add an extra vertex..
while (edgeCount < 4) {
vertex[edgeCount] = vertex[edgeCount-1];
edgeFlag[edgeCount] = G4int (false);
glEdgeFlag (GL_FALSE);
glVertex3d (vertex[edgeCount].x(),
vertex[edgeCount].y(),
vertex[edgeCount].z());
edgeCount++;
}
//do it all over again for hlr 2nd pass...
if (drawing_style == G4ViewParameters::hlr) {
glEnd();
//glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, clear_colour);
// Trap situation where number of edges is > 4...
while (notLastEdge) {
notLastFace = polyhedron.GetNextUnitNormal (SurfaceUnitNormal);
edgeCount++;
}
if (edgeCount > 4) {
G4cerr <<
"G4OpenGLSceneHandler::AddPrimitive(G4Polyhedron): WARNING"
"\n Volume " << fpCurrentPV->GetName() <<
", Solid " << fpCurrentLV->GetSolid()->GetName() <<
" (" << fpCurrentLV->GetSolid()->GetEntityType() <<
"\n G4Polyhedron facet with " << edgeCount << " edges";
}
// Do it all over again (twice) for hlr...
if (drawing_style == G4ViewParameters::hlr ||
drawing_style == G4ViewParameters::hlhsr) {
glEnd (); // Placed here to balance glBegin above, allowing GL
// state changes below, then glBegin again. Avoids
// having glBegin/End pairs *inside* loop in the more
// usual case of no hidden line removal.
// Draw through stencil...
glStencilFunc (GL_EQUAL, 0, 1);
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
glPolygonMode (GL_FRONT, GL_FILL);
glColor4dv (clear_colour);
edgeCount=0;
if (drawing_style == G4ViewParameters::hlhsr) glEnable (GL_LIGHTING);
glBegin (GL_QUADS);
do {
if (edgeFlag[edgeCount] != lastEdgeFlag) {
lastEdgeFlag = edgeFlag[edgeCount];
if (edgeFlag[edgeCount]) {
glEdgeFlag (GL_TRUE);
} else {
glEdgeFlag (GL_FALSE);
}
if (drawing_style == G4ViewParameters::hlr) {
glColor4dv (clear_colour);
} else { // drawing_style == G4ViewParameters::hlhsr
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
}
glNormal3d(SurfaceUnitNormal.x(), SurfaceUnitNormal.y(),
SurfaceUnitNormal.z());
for (int edgeCount = 0; edgeCount < 4; ++edgeCount) {
if (edgeFlag[edgeCount]) {
glEdgeFlag (GL_TRUE);
} else {
glEdgeFlag (GL_FALSE);
}
glVertex3d (vertex[edgeCount].x(),
vertex[edgeCount].y(),
vertex[edgeCount].z());
} while (++edgeCount < 4);
glEnd();
//and once more to reset the stencil bits...
}
glEnd ();
glDisable (GL_LIGHTING);
// and once more to reset the stencil bits...
glStencilFunc (GL_ALWAYS, 0, 1);
glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
glDepthFunc (GL_LEQUAL); // to make sure line gets drawn.
glPolygonMode (GL_FRONT, GL_LINE);
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
edgeCount=0;
glBegin(GL_QUADS);
do {
if (edgeFlag[edgeCount] != lastEdgeFlag) {
lastEdgeFlag = edgeFlag[edgeCount];
if (edgeFlag[edgeCount]) {
glEdgeFlag (GL_TRUE);
} else {
glEdgeFlag (GL_FALSE);
}
}
glVertex3d (vertex[edgeCount].x(),
vertex[edgeCount].y(),
vertex[edgeCount].z());
} while (++edgeCount < 4);
}
glBegin (GL_QUADS);
for (int edgeCount = 0; edgeCount < 4; ++edgeCount) {
if (edgeFlag[edgeCount]) {
glEdgeFlag (GL_TRUE);
} else {
glEdgeFlag (GL_FALSE);
}
glVertex3d (vertex[edgeCount].x(),
vertex[edgeCount].y(),
vertex[edgeCount].z());
}
glEnd ();
glDepthFunc (GL_LESS); // Revert for next quadrilateral.
glBegin (GL_QUADS); // Ready for next quadrilateral. GL
// says it ignores incomplete
// quadrilaterals, so final empty
// glBegin/End sequence should be OK.
}
} while (notLastFace);
glEnd ();
glDisable (GL_STENCIL_TEST);
}
//Method for handling G4NURBS objects for drawing solids.
@@ -527,9 +557,19 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
G4NURBS::CtrlPtsCoordsIterator c_p_iterator (nurb);
while (c_p_iterator.pick (ctrl_pnt_array_ptr++));
const G4Colour& c = GetColour (nurb);
// Get vis attributes - pick up defaults if none.
const G4VisAttributes* pVA =
fpViewer -> GetApplicableVisAttributes (nurb.GetVisAttributes ());
switch (GetDrawingStyle(nurb)) {
// Get view parameters that the user can force through the vis
// attributes, thereby over-riding the current view parameter.
G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
//G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
//Get colour, etc..
const G4Colour& c = pVA -> GetColour ();
switch (drawing_style) {
case (G4ViewParameters::hlhsr):
// G4cout << "Hidden line removal not implememented in G4OpenGL.\n"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.16 2003/06/10 17:13:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.17 2004/07/01 15:29:13 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -108,9 +108,6 @@ void G4OpenGLStoredSceneHandler::EndPrimitives () {
void G4OpenGLStoredSceneHandler::BeginModeling () {
G4VSceneHandler::BeginModeling();
if (fpViewer -> GetViewParameters ().GetDrawingStyle() == G4ViewParameters::hlr) {
initialize_hlr = true;
}
ClearStore(); // ...and all that goes with it.
}
@@ -124,7 +121,6 @@ void G4OpenGLStoredSceneHandler::EndModeling () {
<< G4endl;
}
else {
glNewList (fTopPODL, GL_COMPILE); {
for (size_t i = 0; i < fPODLList.size (); i++) {
glPushMatrix();
@@ -135,12 +131,6 @@ void G4OpenGLStoredSceneHandler::EndModeling () {
}
}
glEndList ();
if (fpViewer -> GetViewParameters ().GetDrawingStyle() == G4ViewParameters::hlr) {
initialize_hlr = false;
// glDisable (GL_POLYGON_OFFSET_FILL);
}
}
G4VSceneHandler::EndModeling ();
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredViewer.cc,v 1.10 2003/06/10 17:13:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLStoredViewer.cc,v 1.11 2004/11/18 15:19:40 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -56,12 +56,10 @@ void G4OpenGLStoredViewer::KernelVisitDecision () {
// of either the scene handler or this viewer, trigger a rebuild.
if (!fG4OpenGLStoredSceneHandler.fTopPODL ||
CompareForKernelVisit(fG4OpenGLStoredSceneHandler.fLastVP) ||
CompareForKernelVisit(fLastVP)) {
NeedKernelVisit ();
}
fLastVP = fVP;
fG4OpenGLStoredSceneHandler.fLastVP = fVP;
}
G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLStoredWin32.cc,v 1.11 2004/04/07 15:18:22 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// OpenGLStoredWin32 graphics system factory.
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.7 2003/06/10 17:13:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Class G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLStoredX.cc,v 1.9 2004/04/07 15:18:22 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLStoredXViewer.cc,v 1.10 2004/04/07 15:18:22 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLStoredXm.cc,v 1.7 2002/02/24 01:48:20 johna Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLStoredXmViewer.cc,v 1.9 2004/04/07 15:18:23 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLTransform3D.cc,v 1.6 2003/06/10 17:41:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLTransform3D.cc,v 1.7 2004/09/13 12:12:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 24th October 1996
@@ -38,23 +38,16 @@ G4OpenGLTransform3D::G4OpenGLTransform3D (const G4Transform3D &t):
const GLdouble* G4OpenGLTransform3D::GetGLMatrix ()
{
m[0] = (GLdouble)xx;
m[1] = (GLdouble)yx;
m[2] = (GLdouble)zx;
m[3] = (GLdouble)0;
m[4] = (GLdouble)xy;
m[5] = (GLdouble)yy;
m[6] = (GLdouble)zy;
m[7] = (GLdouble)0;
m[8] = (GLdouble)xz;
m[9] = (GLdouble)yz;
m[10] = (GLdouble)zz;
m[11] = (GLdouble)0;
m[12] = (GLdouble)dx;
m[13] = (GLdouble)dy;
m[14] = (GLdouble)dz;
m[15] = (GLdouble)1;
GLdouble *p = m;
for (size_t i=0; i<4; i++)
{
for (size_t k=0; k<3; k++)
{
*p++ = operator()(k,i);
}
*p++ = 0.;
}
m[15] = 1.;
return m;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.cc,v 1.18 2003/06/10 17:58:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLViewer.cc,v 1.19 2004/07/09 15:44:26 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 27th March 1996
@@ -203,88 +203,4 @@ void G4OpenGLViewer::HaloingSecondPass () {
}
void G4OpenGLViewer::HLRFirstPass () {
G4cout << "First pass HLR" << G4endl;
//Hidden line drawing requires three renderings to different buffers, so it
//cannot be treated in G4OpenGLSceneHandler alone (as can wireframe or hidden
//surface (solid) mode)
//So, after SIGGRAPH97
//1) Disable the colour and depth buffers, and Draw polygons in wireframe
// mode to the stencil buffer, setting stencil value to 1 where pixels go.
//First, disable writing to the colo(u)r buffer...
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
//Enable the stencil buffer...
glEnable (GL_STENCIL_TEST);
//Now disable writing to the depth buffer...
glDisable (GL_DEPTH_TEST);
//Clear all stencil buffer values to 0...
glClearStencil (0);
glClear (GL_STENCIL_BUFFER_BIT);
//Prepare stencil buffer...
glStencilFunc (GL_ALWAYS, //When to pass a pixel in the stencil test
0x1, //The ref val to compare with masked stencil val
0x1); //The mask to AND with ref and val before test
glStencilOp (GL_KEEP, //If stencil test fails *irrelevant*
GL_KEEP, //If depth test passes *irrelevant*
GL_REPLACE); //If no depth test *this is applied to every pixel
//drawn to the stencil buffer in this pass*
//Hence, everywhere a pixel is drawn, stencil value=1, 0 everywhere else.
//Set the drawing style to wireframe...
fVP.SetDrawingStyle (G4ViewParameters::wireframe);
NeedKernelVisit ();
ProcessView ();
}
void G4OpenGLViewer::HLRSecondPass () {
G4cout << "Second pass HLR" << G4endl;
//2) Use the stencil buffer to mask out pixels where stencil value = 1, and
// render to the stencil buffer as depth tested filled polygons.
glStencilFunc (GL_EQUAL, 0x1, 0x1);
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
glDepthFunc (GL_LEQUAL);
glEnable (GL_DEPTH_TEST);
//Set the drawing style to hlhsr (solid)...
fVP.SetDrawingStyle (G4ViewParameters::hsr);
NeedKernelVisit ();
ProcessView ();
}
void G4OpenGLViewer::HLRThirdPass () {
//3) Turn off the stencil buffer, turn on the colour buffer
// and render polygons in wireframe mode.
G4cout << "Third pass HLR" << G4endl;
glDisable (GL_STENCIL_TEST);
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
//Set the drawing style to hlr wireframe...
fVP.SetDrawingStyle (G4ViewParameters::wireframe);
NeedKernelVisit ();
ProcessView ();
fVP.SetDrawingStyle (G4ViewParameters::hlr);
}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLWin32Viewer.cc,v 1.13 2004/04/08 15:36:32 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4OpenGLWin32Viewer.cc,v 1.14 2004/11/15 12:13:08 gbarrand Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
@@ -60,7 +60,7 @@ void G4OpenGLWin32Viewer::ShowView (
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
glFlush ();
FinishView();
}
//////////////////////////////////////////////////////////////////////////////
@@ -70,6 +70,7 @@ void G4OpenGLWin32Viewer::FinishView (
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
if(!fHDC) return;
glFlush ();
::SwapBuffers(fHDC);
// Empty the Windows message queue :
MSG event;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXViewer.cc,v 1.21 2004/04/07 15:18:23 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4OpenGLXViewer.cc,v 1.23 2004/12/07 23:40:59 perl Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// Andrew Walkden 7th February 1997
@@ -46,13 +46,24 @@
#include <assert.h>
int G4OpenGLXViewer::snglBuf_RGBA[10] =
{ GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE, 1, None };
int G4OpenGLXViewer::snglBuf_RGBA[12] =
{ GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
GLX_STENCIL_SIZE, 1,
None };
int G4OpenGLXViewer::dblBuf_RGBA[11] =
{ GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 1, None };
int G4OpenGLXViewer::dblBuf_RGBA[13] =
{ GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
GLX_STENCIL_SIZE, 1,
None };
#define NewString(str) \
((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
@@ -289,20 +300,29 @@ vi_stored (0)
vi_single_buffer =
glXChooseVisual (dpy, XDefaultScreen (dpy), snglBuf_RGBA);
}
if (!vi_single_buffer) {
G4cout <<
"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a single buffer visual."
<< G4endl;
}
if (!vi_double_buffer) {
vi_double_buffer =
glXChooseVisual (dpy, XDefaultScreen (dpy), dblBuf_RGBA);
}
if (!vi_double_buffer) {
G4cout <<
"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
<< G4endl;
if (vi_single_buffer || vi_double_buffer) {
if (!vi_double_buffer) {
G4cout <<
"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
"\n Working with a single buffer."
<< G4endl;
}
} else {
if (!vi_single_buffer) {
G4cout <<
"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a single buffer visual."
<< G4endl;
}
if (!vi_double_buffer) {
G4cout <<
"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
<< G4endl;
}
}
if (vi_single_buffer) {
@@ -353,6 +373,7 @@ G4OpenGLXViewer::~G4OpenGLXViewer () {
void G4OpenGLXViewer::print() {
//using namespace std;
//cout << "print_col_callback requested with file name: " << print_string << G4endl;
if (vectored_ps) {
@@ -562,11 +583,11 @@ G4float* G4OpenGLXViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) {
if (dr!=0 || dg!=0 || db!=0) {
dx=vertex[1].x - vertex[0].x;
dy=vertex[1].y - vertex[0].y;
distance=sqrt(dx*dx + dy*dy);
distance=std::sqrt(dx*dx + dy*dy);
absR=fabs(dr);
absG=fabs(dg);
absB=fabs(db);
absR=std::fabs(dr);
absG=std::fabs(dg);
absB=std::fabs(db);
#define Max(a, b) (((a)>(b))?(a):(b))
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmBox.cc,v 1.5 2001/07/11 10:08:56 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Box container class
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.9 2002/12/11 15:57:59 johna Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.10 2004/12/07 23:40:59 perl Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// Andrew Walkden 16th April 1997
@@ -397,11 +397,11 @@ void G4OpenGLXmViewer::Add_slider_box (char* label_string,
XmNtitleString, slider_name_str); j++;
XtSetArg (slider_args[i][j],
XmNmaximum, G4int(max_array[i] * pow(10.0, (G4double)decimals[i]))); j++;
XmNmaximum, G4int(max_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
XtSetArg (slider_args[i][j],
XmNminimum, G4int(min_array[i] * pow(10.0, (G4double)decimals[i]))); j++;
XmNminimum, G4int(min_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
XtSetArg (slider_args[i][j],
XmNvalue, G4int(value_array[i] * pow(10.0, (G4double)decimals[i]))); j++;
XmNvalue, G4int(value_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
XtSetArg (slider_args[i][j],
XmNshowValue, show[i]); j++;
XtSetArg (slider_args[i][j],
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.4 2001/07/11 10:08:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmFramedBox.cc,v 1.5 2001/07/11 10:08:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Framed box container class
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.10 2003/06/16 17:13:40 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.11 2004/07/01 15:29:15 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 16th April 1997
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.6 2001/07/11 10:08:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.7 2004/07/01 15:28:09 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 16th April 1997
@@ -100,7 +100,7 @@ void G4OpenGLXmViewer::dolly_callback (Widget w,
G4double dolly = (G4double)(cbs->value) / ten_to_the_dp;
pView->fVP.IncrementDolly (dolly);
pView->fVP.SetDolly (dolly);
pView->SetView ();
pView->ClearView ();
pView->DrawView ();
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmPushButton.cc,v 1.5 2001/07/11 10:08:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Push button class. Inherits from G4OpenGLXmVWidgetComponent
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmRadioButton.cc,v 1.5 2001/07/11 10:08:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.11 2001/07/11 10:08:57 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.13 2004/12/10 18:16:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
//
// Andrew Walkden 16th April 1997
@@ -82,14 +82,14 @@ void G4OpenGLXmViewer::rotate_in_theta (XtPointer clientData,
const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
const G4Vector3D& zprime = up;
G4double cosalpha = up.dot (vp);
G4double sinalpha = sqrt (1. - pow (cosalpha, 2));
G4double sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
G4Vector3D yprime = (zprime.cross (vp)).unit ();
G4Vector3D xprime = yprime.cross (zprime);
// Projection of vp on plane perpendicular to up...
G4Vector3D a1 = sinalpha * xprime;
// Required new projection...
G4Vector3D a2 =
sinalpha * (cos (delta_theta) * xprime + sin (delta_theta) * yprime);
sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
// Required Increment vector...
G4Vector3D delta = a2 - a1;
// So new viewpoint is...
@@ -154,7 +154,7 @@ void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
G4Vector3D yprime = (up.cross(xprime)).unit();
G4Vector3D zprime = (xprime.cross(yprime)).unit();
G4Vector3D new_vp = cos(delta_alpha) * xprime + sin(delta_alpha) * zprime;
G4Vector3D new_vp = std::cos(delta_alpha) * xprime + std::sin(delta_alpha) * zprime;
pView->fVP.SetViewAndLights (new_vp.unit());
@@ -250,9 +250,9 @@ void G4OpenGLXmViewer::wobble_timer_callback (XtPointer clientData,
G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
const G4Vector3D& up = pView->fVP.GetUpVector();
G4Vector3D third_axis = up.cross(pView->original_vp);
G4double pi_div_by_ten = M_PI / 10.0;
G4Vector3D d_up = 0.1 * (sin ((G4double)pView->frameNo * pi_div_by_ten * 2.)) * up;
G4Vector3D d_third_axis = 0.1 * (sin ((G4double)pView->frameNo * (pi_div_by_ten))) * third_axis;
G4double pi_div_by_ten = pi / 10.0;
G4Vector3D d_up = 0.1 * (std::sin ((G4double)pView->frameNo * pi_div_by_ten * 2.)) * up;
G4Vector3D d_third_axis = 0.1 * (std::sin ((G4double)pView->frameNo * (pi_div_by_ten))) * third_axis;
pView->fVP.SetViewAndLights (pView->original_vp + d_up + d_third_axis);
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmSeparator.cc,v 1.4 2001/07/11 10:08:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Separator class. Inherits from G4OpenGLXmVWidgetComponent
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXmSliderBar.cc,v 1.5 2001/07/11 10:08:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLXmSliderBar.cc,v 1.6 2004/12/07 23:40:59 perl Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
@@ -49,9 +49,9 @@ G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (const char* n,
callback = c;
show = s;
decimal_places = dp;
initial_value = int(v * pow(10.0, (G4double)dp));
max_value = int(max * pow(10.0, (G4double)dp));
min_value = int(min * pow(10.0, (G4double)dp));
initial_value = int(v * std::pow(10.0, (G4double)dp));
max_value = int(max * std::pow(10.0, (G4double)dp));
min_value = int(min * std::pow(10.0, (G4double)dp));
orientation = o;
direction = d;
}
@@ -76,17 +76,17 @@ short G4OpenGLXmSliderBar::GetDecimalPlaces ()
G4double G4OpenGLXmSliderBar::GetInitialValue ()
{
return (G4double)initial_value / pow(10.0, (G4double)GetDecimalPlaces());
return (G4double)initial_value / std::pow(10.0, (G4double)GetDecimalPlaces());
}
G4double G4OpenGLXmSliderBar::GetMaxValue ()
{
return (G4double)max_value / pow(10.0, (G4double)GetDecimalPlaces());
return (G4double)max_value / std::pow(10.0, (G4double)GetDecimalPlaces());
}
G4double G4OpenGLXmSliderBar::GetMinValue ()
{
return (G4double)min_value / pow(10.0, (G4double)GetDecimalPlaces());
return (G4double)min_value / std::pow(10.0, (G4double)GetDecimalPlaces());
}
unsigned char G4OpenGLXmSliderBar::GetOrientation ()
@@ -129,7 +129,7 @@ void G4OpenGLXmSliderBar::SetDecimalPlaces (short dp)
void G4OpenGLXmSliderBar::SetInitialValue (G4double v)
{
initial_value = int(v * pow(10.0, (G4double)GetDecimalPlaces()));
initial_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
XtVaSetValues (sliderbar,
XmNvalue, initial_value,
NULL);
@@ -138,7 +138,7 @@ void G4OpenGLXmSliderBar::SetInitialValue (G4double v)
void G4OpenGLXmSliderBar::SetMaxValue (G4double v)
{
max_value = int(v * pow(10.0, (G4double)GetDecimalPlaces()));
max_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
XtVaSetValues (sliderbar,
XmNmaximum, max_value,
NULL);
@@ -147,7 +147,7 @@ void G4OpenGLXmSliderBar::SetMaxValue (G4double v)
void G4OpenGLXmSliderBar::SetMinValue (G4double v)
{
min_value = int(v * pow(10.0, (G4double)GetDecimalPlaces()));
min_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
XtVaSetValues (sliderbar,
XmNminimum, min_value,
NULL);
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.6 2001/11/12 18:22:09 johna Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.7 2004/07/23 15:23:58 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 16th April 1997
@@ -249,6 +249,36 @@ void G4OpenGLXmViewer::haloing_callback (Widget w,
pView->DrawView ();
}
void G4OpenGLXmViewer::aux_edge_callback (Widget w,
XtPointer clientData,
XtPointer)
{
G4long choice = (G4long)clientData;
G4OpenGLXmViewer* pView;
XtVaGetValues (XtParent(w),
XmNuserData, &pView,
NULL);
switch (choice) {
case 0:
pView->fVP.SetAuxEdgeVisible(false);
break;
case 1:
pView->fVP.SetAuxEdgeVisible(true);
break;
default:
G4Exception("Unrecognised case in aux_edge_callback.");
}
pView->SetNeedKernelVisit ();
pView->SetView ();
pView->ClearView ();
pView->DrawView ();
}
void G4OpenGLXmViewer::projection_callback (Widget w,
XtPointer clientData,
XtPointer)
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmTextField.cc,v 1.6 2001/07/11 10:08:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Text field class. Inherits from G4OpenGLXmVWidgetComponent
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmTopLevelShell.cc,v 1.4 2001/07/11 10:08:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Top level shell class
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.4 2001/07/11 10:08:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Base class for all Motif component widgets
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.4 2001/07/11 10:08:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Base class for all Motif container widgets
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmVWidgetObject.cc,v 1.4 2001/07/11 10:08:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Virtual base class for all Motif widgets.
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmVWidgetShell.cc,v 1.4 2001/07/11 10:08:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//Base class for all Motif shell widgets
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXmViewer.cc,v 1.12 2004/04/07 15:18:23 gbarrand Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4OpenGLXmViewer.cc,v 1.14 2004/07/23 15:24:01 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -43,7 +43,6 @@
#include "G4Point3D.hh"
#include "G4Normal3D.hh"
#include "G4VisManager.hh"
#include "G4OpenGLXmSliderBar.hh"
#include "G4Xt.hh"
@@ -386,6 +385,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
trans_str = XmStringCreateLocalized ((char*)"Transparency");
anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
halo_str = XmStringCreateLocalized ((char*)"Haloing");
aux_edge_str = XmStringCreateLocalized ((char*)"Auxiliary edges");
//*********Create special pulldown menu on menubar*********
spec_cascade = XmVaCreateSimplePulldownMenu
@@ -396,6 +396,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
XmVaCASCADEBUTTON, trans_str, 'T',
XmVaCASCADEBUTTON, anti_str, 'A',
XmVaCASCADEBUTTON, halo_str, 'H',
XmVaCASCADEBUTTON, aux_edge_str, 'E',
XtNvisual, vi -> visual,
XtNdepth, vi -> depth,
XtNcolormap, cmap,
@@ -406,6 +407,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
XmStringFree (trans_str);
XmStringFree (anti_str);
XmStringFree (halo_str);
XmStringFree (aux_edge_str);
// G4cout << "Created Special pulldown menu" << G4endl;
@@ -508,6 +510,36 @@ void G4OpenGLXmViewer::CreateMainWindow () {
G4Exception("haloing_enabled in G4OpenGLXmViewer is neither true nor false!!");
}
//Add Aux_Edge pullright menu to special cascade...
aux_edge_pullright = XmVaCreateSimplePulldownMenu
(spec_cascade,
(char*)"aux_edge",
3,
aux_edge_callback,
XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
XmNradioBehavior, True,
XmNradioAlwaysOne, True,
XmNuserData, this,
XtNvisual, vi -> visual,
XtNdepth, vi -> depth,
XtNcolormap, cmap,
XtNborderColor, borcol,
XtNbackground, bgnd,
NULL);
if (!fVP.IsAuxEdgeVisible()) {
special_widget = XtNameToWidget(aux_edge_pullright, "button_0");
if(special_widget) {
XtVaSetValues (special_widget, XmNset, True, NULL);
}
} else {
special_widget = XtNameToWidget(aux_edge_pullright, "button_1");
if(special_widget) {
XtVaSetValues (special_widget, XmNset, True, NULL);
}
}
XtManageChild (menubar);
frame = XtVaCreateManagedWidget ((char*)"frame",
xmFrameWidgetClass, main_win,
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.5 2001/07/11 10:08:59 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Andrew Walkden 16th June 1997