Import Geant4 8.2.0 source tree
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
|
||||
#include "G4OpenGLFontBaseStore.hh"
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.22 2006/06/29 21:18:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.24 2006/09/04 12:03:25 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -42,13 +42,12 @@
|
||||
#define CENTERLINE_CLPP /* CenterLine C++ workaround: */
|
||||
// Also seems to be required for HP's CC and AIX xlC, at least.
|
||||
|
||||
#include "G4OpenGLSceneHandler.hh"
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLTransform3D.hh"
|
||||
|
||||
#include "G4OpenGLImmediateSceneHandler.hh"
|
||||
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4OpenGLTransform3D.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
|
||||
G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler (G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
@@ -60,6 +59,30 @@ G4OpenGLImmediateSceneHandler::~G4OpenGLImmediateSceneHandler ()
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
|
||||
{
|
||||
const G4Colour& c = GetColour (visible);
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyline& polyline)
|
||||
{
|
||||
AddPrimitivePreamble(polyline);
|
||||
G4OpenGLSceneHandler::AddPrimitive(polyline);
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle)
|
||||
{
|
||||
AddPrimitivePreamble(circle);
|
||||
G4OpenGLSceneHandler::AddPrimitive(circle);
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Square& square)
|
||||
{
|
||||
AddPrimitivePreamble(square);
|
||||
G4OpenGLSceneHandler::AddPrimitive(square);
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::BeginPrimitives
|
||||
(const G4Transform3D& objectTransformation) {
|
||||
G4VSceneHandler::BeginPrimitives (objectTransformation);
|
||||
@@ -79,11 +102,13 @@ void G4OpenGLImmediateSceneHandler::BeginPrimitives
|
||||
glMultMatrixd (oglt.GetGLMatrix ());
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::EndPrimitives () {
|
||||
void G4OpenGLImmediateSceneHandler::EndPrimitives ()
|
||||
{
|
||||
glPopMatrix();
|
||||
if (fReadyForTransients) {
|
||||
glFlush ();
|
||||
}
|
||||
|
||||
// See all primitives immediately...
|
||||
glFlush ();
|
||||
|
||||
G4VSceneHandler::EndPrimitives ();
|
||||
}
|
||||
|
||||
@@ -110,9 +135,8 @@ void G4OpenGLImmediateSceneHandler::EndPrimitives2D()
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
if (fReadyForTransients) {
|
||||
glFlush ();
|
||||
}
|
||||
// See all primitives immediately...
|
||||
glFlush ();
|
||||
|
||||
G4VSceneHandler::EndPrimitives2D ();
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateViewer.cc,v 1.7 2006/06/29 21:19:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -42,4 +42,29 @@ G4VViewer (scene, -1),
|
||||
G4OpenGLViewer (scene)
|
||||
{}
|
||||
|
||||
void G4OpenGLImmediateViewer::ProcessView ()
|
||||
{
|
||||
const G4Planes& cutaways = fVP.GetCutawayPlanes();
|
||||
G4bool cutawayUnion = fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion;
|
||||
size_t nPasses = cutawayUnion? cutaways.size(): 1;
|
||||
for (size_t i = 0; i < nPasses; ++i) {
|
||||
|
||||
if (cutawayUnion) {
|
||||
double a[4];
|
||||
a[0] = cutaways[i].a();
|
||||
a[1] = cutaways[i].b();
|
||||
a[2] = cutaways[i].c();
|
||||
a[3] = cutaways[i].d();
|
||||
glClipPlane (GL_CLIP_PLANE2, a);
|
||||
glEnable (GL_CLIP_PLANE2);
|
||||
}
|
||||
|
||||
NeedKernelVisit (); // Always need to visit G4 kernel.
|
||||
G4VViewer::ProcessView ();
|
||||
|
||||
if (cutawayUnion) glDisable (GL_CLIP_PLANE2);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateWin32.cc,v 1.10 2006/06/29 21:19:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// OpenGLImmediateWin32 graphics system factory.
|
||||
@@ -38,12 +38,16 @@
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLImmediateWin32.hh"
|
||||
#include "G4OpenGLImmediateWin32Viewer.hh"
|
||||
#include "G4OpenGLViewerMessenger.hh"
|
||||
|
||||
G4OpenGLImmediateWin32::G4OpenGLImmediateWin32 ():
|
||||
G4VGraphicsSystem ("OpenGLImmediateWin32",
|
||||
"OGLIWin32",
|
||||
G4VisFeaturesOfOpenGLIWin32 (),
|
||||
G4VGraphicsSystem::threeD) {}
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
}
|
||||
|
||||
G4VSceneHandler* G4OpenGLImmediateWin32::CreateSceneHandler
|
||||
(const G4String& name) {
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.15 2006/06/29 21:19:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
|
||||
@@ -58,7 +58,6 @@ void G4OpenGLImmediateWin32Viewer::Initialise () {
|
||||
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
doublebuffer = false;
|
||||
glDrawBuffer (GL_FRONT);
|
||||
|
||||
// clear the buffers and window.
|
||||
@@ -73,7 +72,6 @@ void G4OpenGLImmediateWin32Viewer::DrawView () {
|
||||
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
doublebuffer = false;
|
||||
glDrawBuffer (GL_FRONT);
|
||||
|
||||
G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateX.cc,v 1.10 2006/06/29 21:19:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLImmediateX.cc,v 1.12 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -39,12 +39,18 @@
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLImmediateX.hh"
|
||||
#include "G4OpenGLImmediateXViewer.hh"
|
||||
#include "G4OpenGLViewerMessenger.hh"
|
||||
#include "G4OpenGLXViewerMessenger.hh"
|
||||
|
||||
G4OpenGLImmediateX::G4OpenGLImmediateX ():
|
||||
G4VGraphicsSystem ("OpenGLImmediateX",
|
||||
"OGLIX",
|
||||
G4VisFeaturesOfOpenGLIX (),
|
||||
G4VGraphicsSystem::threeD) {}
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
G4OpenGLXViewerMessenger::GetInstance();
|
||||
}
|
||||
|
||||
G4OpenGLImmediateX::~G4OpenGLImmediateX () {}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXViewer.cc,v 1.15 2006/06/29 21:19:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -71,23 +71,9 @@ void G4OpenGLImmediateXViewer::Initialise () {
|
||||
ClearView ();
|
||||
FinishView ();
|
||||
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
//The following code was in the constructor and found not to work for
|
||||
//the reasons below. It was moved to DrawView(), but has now been moved
|
||||
//to Initialise().
|
||||
//The following code is useless in its current position, as the
|
||||
//G4OpenGLXmViewer constructor gets called *after* it, and hence sets
|
||||
//doublebuffer to true or false there, after our little test to correct
|
||||
//it in the case of a double buffer being got for an immediate view.
|
||||
//Hence, code moved to DrawView.
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
if (doublebuffer) {
|
||||
doublebuffer = false;
|
||||
glDrawBuffer (GL_FRONT);
|
||||
}
|
||||
glDrawBuffer (GL_FRONT);
|
||||
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
glDepthMask (GL_TRUE);
|
||||
@@ -119,4 +105,10 @@ void G4OpenGLImmediateXViewer::DrawView () {
|
||||
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateXViewer::FinishView () {
|
||||
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
|
||||
//be propogated before progressing.
|
||||
glFlush ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXm.cc,v 1.12 2006/06/29 21:19:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLImmediateXm.hh"
|
||||
#include "G4OpenGLImmediateXmViewer.hh"
|
||||
#include "G4OpenGLViewerMessenger.hh"
|
||||
#include "G4OpenGLXmViewerMessenger.hh"
|
||||
|
||||
G4OpenGLImmediateXm::G4OpenGLImmediateXm ():
|
||||
@@ -47,6 +48,7 @@ G4OpenGLImmediateXm::G4OpenGLImmediateXm ():
|
||||
G4VisFeaturesOfOpenGLIXm (),
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
G4OpenGLXmViewerMessenger::GetInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXmViewer.cc,v 1.16 2006/06/29 21:19:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -80,23 +80,9 @@ void G4OpenGLImmediateXmViewer::Initialise () {
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
//The following code was in the constructor and found not to work for
|
||||
//the reasons below. It was moved to DrawView(), but has now been moved
|
||||
//to Initialise().
|
||||
//The following code is useless in its current position, as the
|
||||
//G4OpenGLXmViewer constructor gets called *after* it, and hence sets
|
||||
//doublebuffer to true or false there, after our little test to correct
|
||||
//it in the case of a double buffer being got for an immediate view.
|
||||
//Hence, code moved to DrawView.
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
if (doublebuffer) {
|
||||
doublebuffer = false;
|
||||
glDrawBuffer (GL_FRONT);
|
||||
}
|
||||
glDrawBuffer (GL_FRONT);
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateXmViewer::DrawView () {
|
||||
@@ -125,4 +111,10 @@ void G4OpenGLImmediateXmViewer::DrawView () {
|
||||
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateXmViewer::FinishView () {
|
||||
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
|
||||
//be propogated before progressing.
|
||||
glFlush ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLSceneHandler.cc,v 1.43 2006/06/29 21:19:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLSceneHandler.cc,v 1.45 2006/08/30 11:37:34 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -61,6 +61,8 @@
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4Scene.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
|
||||
G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
|
||||
G4int id,
|
||||
@@ -92,13 +94,32 @@ const GLubyte G4OpenGLSceneHandler::fStippleMaskHashed [128] = {
|
||||
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
|
||||
};
|
||||
|
||||
const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron ()
|
||||
{
|
||||
// Clipping done in G4OpenGLViewer::SetView.
|
||||
return 0;
|
||||
|
||||
// But...OpenGL no longer seems to reconstruct clipped edges, so,
|
||||
// when the BooleanProcessor is up to it, abandon this and use
|
||||
// generic clipping in G4VSceneHandler::CreateSectionPolyhedron...
|
||||
// return G4VSceneHandler::CreateSectionPolyhedron();
|
||||
}
|
||||
|
||||
const G4Polyhedron* G4OpenGLSceneHandler::CreateCutawayPolyhedron ()
|
||||
{
|
||||
// Cutaway done in G4OpenGLViewer::SetView.
|
||||
return 0;
|
||||
|
||||
// But...if not, when the BooleanProcessor is up to it...
|
||||
// return G4VSceneHandler::CreateCutawayPolyhedron();
|
||||
}
|
||||
|
||||
void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
{
|
||||
G4int nPoints = line.size ();
|
||||
if (nPoints <= 0) return;
|
||||
|
||||
const G4Colour& c = GetColour (line);
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
// Note: colour treated in sub-class.
|
||||
|
||||
if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
@@ -106,6 +127,9 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
|
||||
glDisable (GL_LIGHTING);
|
||||
|
||||
G4double lineWidth = GetLineWidth(line);
|
||||
glLineWidth(lineWidth);
|
||||
|
||||
glBegin (GL_LINE_STRIP);
|
||||
for (G4int iPoint = 0; iPoint < nPoints; iPoint++) {
|
||||
G4double x, y, z;
|
||||
@@ -172,15 +196,17 @@ void G4OpenGLSceneHandler::AddCircleSquare
|
||||
(const G4VMarker& marker,
|
||||
G4int nSides) {
|
||||
|
||||
const G4Colour& c = GetColour (marker);
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
|
||||
// Note: colour treated in sub-class.
|
||||
|
||||
if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
else {glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS);}
|
||||
|
||||
glDisable (GL_LIGHTING);
|
||||
|
||||
G4double lineWidth = GetLineWidth(marker);
|
||||
glLineWidth(lineWidth);
|
||||
|
||||
G4VMarker::FillStyle style = marker.GetFillStyle();
|
||||
|
||||
switch (style) {
|
||||
@@ -216,18 +242,15 @@ void G4OpenGLSceneHandler::AddCircleSquare
|
||||
|
||||
// A few useful quantities...
|
||||
G4Point3D centre = marker.GetPosition();
|
||||
G4bool userSpecified = (marker.GetWorldSize() || marker.GetScreenSize());
|
||||
const G4VMarker& def = fpViewer -> GetViewParameters().GetDefaultMarker();
|
||||
const G4Vector3D& viewpointDirection =
|
||||
fpViewer -> GetViewParameters().GetViewpointDirection();
|
||||
const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
|
||||
G4double scale = fpViewer -> GetViewParameters().GetGlobalMarkerScale();
|
||||
G4double size = scale *
|
||||
userSpecified ? marker.GetWorldSize() : def.GetWorldSize();
|
||||
MarkerSizeType sizeType;
|
||||
G4double size = GetMarkerSize(marker, sizeType);
|
||||
|
||||
// Find "size" of marker in world space (but see note below)...
|
||||
G4double worldSize;
|
||||
if (size) { // Size specified in world coordinates.
|
||||
if (sizeType == world) { // Size specified in world coordinates.
|
||||
worldSize = size;
|
||||
}
|
||||
else { // Size specified in screen (window) coordinates.
|
||||
@@ -253,9 +276,7 @@ void G4OpenGLSceneHandler::AddCircleSquare
|
||||
&winDx, &winDy, &winDz);
|
||||
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;
|
||||
worldSize = size / winWorldRatio;
|
||||
}
|
||||
|
||||
// Draw...
|
||||
@@ -360,7 +381,7 @@ void G4OpenGLSceneHandler::DrawXYPolygon
|
||||
G4double phi;
|
||||
G4int i;
|
||||
glBegin (GL_POLYGON);
|
||||
for (i = 0, phi = -dPhi / 2.; i < nSides; i++, phi += dPhi) {
|
||||
for (i = 0, phi = 0.; i < nSides; i++, phi += dPhi) {
|
||||
G4Vector3D r = start; r.rotate(phi, viewpointDirection);
|
||||
G4Vector3D p = centre + r;
|
||||
glVertex3d (p.x(), p.y(), p.z());
|
||||
@@ -399,11 +420,16 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
materialColour [3] = 1.;
|
||||
}
|
||||
|
||||
G4double lineWidth = GetLineWidth(polyhedron);
|
||||
glLineWidth(lineWidth);
|
||||
|
||||
GLfloat clear_colour[4];
|
||||
glGetFloatv (GL_COLOR_CLEAR_VALUE, clear_colour);
|
||||
|
||||
G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
|
||||
|
||||
G4bool clipping = pViewer->fVP.IsSection() || pViewer->fVP.IsCutaway();
|
||||
|
||||
switch (drawing_style) {
|
||||
case (G4ViewParameters::hlhsr):
|
||||
// Set up as for hidden line removal but paint polygon faces later...
|
||||
@@ -421,9 +447,14 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||
} else {
|
||||
// Opaque...
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_LINE);
|
||||
if (clipping) {
|
||||
glDisable (GL_CULL_FACE);
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||
} else {
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_LINE);
|
||||
}
|
||||
}
|
||||
glDisable (GL_LIGHTING);
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
@@ -440,9 +471,14 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
} else {
|
||||
// Opaque...
|
||||
glDepthMask (1); // Make depth buffer writable (default).
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_FILL);
|
||||
if (clipping) {
|
||||
glDisable (GL_CULL_FACE);
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||
} else {
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_FILL);
|
||||
}
|
||||
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
|
||||
}
|
||||
glEnable (GL_LIGHTING);
|
||||
@@ -547,9 +583,14 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
} else {
|
||||
// Opaque...
|
||||
glDepthMask (1); // Make depth buffer writable (default).
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_FILL);
|
||||
if (clipping) {
|
||||
glDisable (GL_CULL_FACE);
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||
} else {
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_FILL);
|
||||
}
|
||||
}
|
||||
GLfloat* painting_colour;
|
||||
if (drawing_style == G4ViewParameters::hlr) {
|
||||
@@ -596,9 +637,14 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||
} else {
|
||||
// Opaque...
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_LINE);
|
||||
if (clipping) {
|
||||
glDisable (GL_CULL_FACE);
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||
} else {
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_LINE);
|
||||
}
|
||||
}
|
||||
glDisable (GL_LIGHTING);
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.28 2006/06/29 21:19:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.31 2006/08/30 11:43:57 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -45,18 +45,91 @@
|
||||
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Polymarker.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
|
||||
G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4OpenGLSceneHandler (system, fSceneIdCount++, name),
|
||||
fMemoryForDisplayLists (true),
|
||||
fAddPrimitivePreambleNestingDepth (0),
|
||||
fTopPODL (0)
|
||||
{}
|
||||
|
||||
G4OpenGLStoredSceneHandler::~G4OpenGLStoredSceneHandler ()
|
||||
{}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
|
||||
{
|
||||
// Track nesting depth to avoid recursive calls, for example, from a
|
||||
// G4Polymarker that invokes a G4Circle...
|
||||
fAddPrimitivePreambleNestingDepth++;
|
||||
if (fAddPrimitivePreambleNestingDepth > 1) return;
|
||||
|
||||
const G4Colour& c = GetColour (visible);
|
||||
|
||||
if (fMemoryForDisplayLists && fReadyForTransients) {
|
||||
|
||||
TO& to = fTOList.back(); // Transient object information.
|
||||
|
||||
// Get vis attributes - pick up defaults if none.
|
||||
const G4VisAttributes* pVA =
|
||||
fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
|
||||
|
||||
// Get time information from vis attributes.
|
||||
to.fStartTime = pVA->GetStartTime();
|
||||
to.fEndTime = pVA->GetEndTime();
|
||||
|
||||
// Keep colour out of (already started) display list so that it
|
||||
// can be applied independently.
|
||||
glEndList();
|
||||
glDeleteLists(fDisplayListId, 1);
|
||||
to.fColour = c;
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
|
||||
|
||||
} else {
|
||||
|
||||
// Make sure colour is set in other cases.
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()
|
||||
{
|
||||
fAddPrimitivePreambleNestingDepth--;
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
|
||||
{
|
||||
AddPrimitivePreamble(polyline);
|
||||
G4OpenGLSceneHandler::AddPrimitive(polyline);
|
||||
AddPrimitivePostamble();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)
|
||||
{
|
||||
AddPrimitivePreamble(circle);
|
||||
G4OpenGLSceneHandler::AddPrimitive(circle);
|
||||
AddPrimitivePostamble();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)
|
||||
{
|
||||
AddPrimitivePreamble(square);
|
||||
G4OpenGLSceneHandler::AddPrimitive(square);
|
||||
AddPrimitivePostamble();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
{
|
||||
AddPrimitivePreamble(polymarker);
|
||||
G4OpenGLSceneHandler::AddPrimitive(polymarker);
|
||||
AddPrimitivePostamble();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::BeginPrimitives
|
||||
(const G4Transform3D& objectTransformation) {
|
||||
|
||||
@@ -74,8 +147,8 @@ void G4OpenGLStoredSceneHandler::BeginPrimitives
|
||||
}
|
||||
if (fMemoryForDisplayLists) {
|
||||
if (fReadyForTransients) {
|
||||
fTODLList.push_back (fDisplayListId);
|
||||
fTODLTransformList.push_back (objectTransformation);
|
||||
TO to(fDisplayListId, objectTransformation);
|
||||
fTOList.push_back(to);
|
||||
glDrawBuffer (GL_FRONT);
|
||||
glPushMatrix();
|
||||
G4OpenGLTransform3D oglt (objectTransformation);
|
||||
@@ -83,8 +156,7 @@ void G4OpenGLStoredSceneHandler::BeginPrimitives
|
||||
glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
|
||||
}
|
||||
else {
|
||||
fPODLList.push_back (fDisplayListId);
|
||||
fPODLTransformList.push_back (objectTransformation);
|
||||
fPOList.push_back(PO(fDisplayListId, objectTransformation));
|
||||
glNewList (fDisplayListId, GL_COMPILE);
|
||||
}
|
||||
} else {
|
||||
@@ -123,14 +195,12 @@ void G4OpenGLStoredSceneHandler::BeginPrimitives2D()
|
||||
}
|
||||
if (fMemoryForDisplayLists) {
|
||||
if (fReadyForTransients) {
|
||||
fTODLList.push_back (fDisplayListId);
|
||||
fTODLTransformList.push_back (G4Transform3D()); // Identity (ignored).
|
||||
fTOList.push_back(TO(fDisplayListId));
|
||||
glDrawBuffer (GL_FRONT);
|
||||
glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
|
||||
}
|
||||
else {
|
||||
fPODLList.push_back (fDisplayListId);
|
||||
fPODLTransformList.push_back (G4Transform3D()); // Identity (ignored).
|
||||
fPOList.push_back(PO(fDisplayListId));
|
||||
glNewList (fDisplayListId, GL_COMPILE);
|
||||
}
|
||||
} else {
|
||||
@@ -185,11 +255,11 @@ void G4OpenGLStoredSceneHandler::EndModeling () {
|
||||
}
|
||||
else {
|
||||
glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); {
|
||||
for (size_t i = 0; i < fPODLList.size (); i++) {
|
||||
for (size_t i = 0; i < fPOList.size (); i++) {
|
||||
glPushMatrix();
|
||||
G4OpenGLTransform3D oglt (fPODLTransformList [i]);
|
||||
G4OpenGLTransform3D oglt (fPOList[i].fTransform);
|
||||
glMultMatrixd (oglt.GetGLMatrix ());
|
||||
glCallList (fPODLList[i]);
|
||||
glCallList (fPOList[i].fDisplayListId);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -208,55 +278,30 @@ void G4OpenGLStoredSceneHandler::ClearStore () {
|
||||
|
||||
G4VSceneHandler::ClearStore (); // Sets need kernel visit, etc.
|
||||
|
||||
size_t i;
|
||||
|
||||
// Delete OpenGL permanent display lists.
|
||||
for (i = 0; i < fPODLList.size (); i++) {
|
||||
if (fPODLList [i]) {
|
||||
glDeleteLists (fPODLList [i], 1);
|
||||
} else {
|
||||
G4cerr << "Warning : NULL display List in fPODLList." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < fPOList.size (); i++)
|
||||
glDeleteLists (fPOList[i].fDisplayListId, 1);
|
||||
if (fTopPODL) glDeleteLists (fTopPODL, 1);
|
||||
fTopPODL = 0;
|
||||
|
||||
// Clear other lists, dictionary, etc.
|
||||
fPODLList.clear ();
|
||||
fPODLTransformList.clear ();
|
||||
fPOList.clear ();
|
||||
fSolidMap.clear ();
|
||||
|
||||
// ...and clear transient store...
|
||||
for (i = 0; i < fTODLList.size (); i++) {
|
||||
if (fTODLList [i]) {
|
||||
glDeleteLists (fTODLList [i], 1);
|
||||
} else {
|
||||
G4cerr << "Warning : NULL display List in fTODLList." << G4endl;
|
||||
}
|
||||
}
|
||||
fTODLList.clear ();
|
||||
fTODLTransformList.clear ();
|
||||
for (size_t i = 0; i < fTOList.size (); i++)
|
||||
glDeleteLists(fTOList[i].fDisplayListId, 1);
|
||||
fTOList.clear ();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::ClearTransientStore () {
|
||||
|
||||
G4VSceneHandler::ClearTransientStore ();
|
||||
|
||||
size_t i;
|
||||
|
||||
// Delete OpenGL transient display lists.
|
||||
for (i = 0; i < fTODLList.size (); i++) {
|
||||
if (fTODLList [i]) {
|
||||
glDeleteLists (fTODLList [i], 1);
|
||||
} else {
|
||||
G4cerr << "Warning : NULL display List in fTODLList." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear other lists, dictionary, etc.
|
||||
fTODLList.clear ();
|
||||
fTODLTransformList.clear ();
|
||||
// Delete OpenGL transient display lists and Transient Objects themselves.
|
||||
for (size_t i = 0; i < fTOList.size (); i++)
|
||||
glDeleteLists(fTOList[i].fDisplayListId, 1);
|
||||
fTOList.clear ();
|
||||
|
||||
// Make sure screen corresponds to graphical database...
|
||||
if (fpViewer) {
|
||||
@@ -329,8 +374,7 @@ void G4OpenGLStoredSceneHandler::RequestPrimitives (const G4VSolid& solid)
|
||||
// ...and if the solid has already been rendered...
|
||||
(fSolidMap.find (pSolid) != fSolidMap.end ())) {
|
||||
fDisplayListId = fSolidMap [pSolid];
|
||||
fPODLList.push_back (fDisplayListId);
|
||||
fPODLTransformList.push_back (*fpObjectTransformation);
|
||||
fPOList.push_back(PO(fDisplayListId,*fpObjectTransformation));
|
||||
}
|
||||
else {
|
||||
G4VSceneHandler::RequestPrimitives (solid);
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredViewer.cc,v 1.14 2006/06/29 21:19:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLStoredViewer.cc,v 1.20 2006/10/24 06:23:18 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -37,9 +37,11 @@
|
||||
|
||||
#include "G4OpenGLStoredViewer.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4OpenGLStoredSceneHandler.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4Scene.hh"
|
||||
|
||||
G4OpenGLStoredViewer::G4OpenGLStoredViewer
|
||||
(G4OpenGLStoredSceneHandler& sceneHandler):
|
||||
@@ -69,19 +71,22 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
|
||||
if (
|
||||
(lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(lastVP.GetRepStyle () != fVP.GetRepStyle ()) ||
|
||||
(lastVP.IsCulling () != fVP.IsCulling ()) ||
|
||||
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(lastVP.IsSection () != fVP.IsSection ()) ||
|
||||
// No need to visit kernel if section plane changes.
|
||||
// Section (DCUT) implemented locally. But still need to visit
|
||||
// kernel if status changes so that back plane culling can be
|
||||
// switched.
|
||||
(lastVP.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
(lastVP.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) ||
|
||||
// No need to visit kernel if cutaway planes change.
|
||||
// Cutaways implemented locally. But still need to visit kernel
|
||||
// if status changes so that back plane culling can be switched.
|
||||
(lastVP.IsExplode () != fVP.IsExplode ()) ||
|
||||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
|
||||
(lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
|
||||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
|
||||
) {
|
||||
return true;
|
||||
@@ -91,6 +96,26 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
(lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
|
||||
return true;
|
||||
|
||||
/**************************************************************
|
||||
Section (DCUT) implemented locally. No need to visit kernel if
|
||||
section plane itself changes.
|
||||
if (lastVP.IsSection () &&
|
||||
(lastVP.GetSectionPlane () != fVP.GetSectionPlane ()))
|
||||
return true;
|
||||
***************************************************************/
|
||||
|
||||
/**************************************************************
|
||||
Cutaways implemented locally. No need to visit kernel if cutaway
|
||||
planes themselves change.
|
||||
if (lastVP.IsCutaway ()) {
|
||||
if (lastVP.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < lastVP.GetCutawayPlanes().size(); ++i)
|
||||
if (lastVP.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
|
||||
return true;
|
||||
}
|
||||
***************************************************************/
|
||||
|
||||
if (lastVP.IsExplode () &&
|
||||
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
return true;
|
||||
@@ -99,18 +124,121 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
}
|
||||
|
||||
void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
|
||||
if (fG4OpenGLStoredSceneHandler.fTopPODL)
|
||||
glCallList (fG4OpenGLStoredSceneHandler.fTopPODL);
|
||||
|
||||
G4int nTODLs = fG4OpenGLStoredSceneHandler.fTODLList.size ();
|
||||
for (int i = 0; i < nTODLs; i++) {
|
||||
|
||||
const G4Planes& cutaways = fVP.GetCutawayPlanes();
|
||||
G4bool cutawayUnion = fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion;
|
||||
size_t nPasses = cutawayUnion? cutaways.size(): 1;
|
||||
for (size_t i = 0; i < nPasses; ++i) {
|
||||
|
||||
if (cutawayUnion) {
|
||||
double a[4];
|
||||
a[0] = cutaways[i].a();
|
||||
a[1] = cutaways[i].b();
|
||||
a[2] = cutaways[i].c();
|
||||
a[3] = cutaways[i].d();
|
||||
glClipPlane (GL_CLIP_PLANE2, a);
|
||||
glEnable (GL_CLIP_PLANE2);
|
||||
}
|
||||
|
||||
if (fG4OpenGLStoredSceneHandler.fTopPODL)
|
||||
glCallList (fG4OpenGLStoredSceneHandler.fTopPODL);
|
||||
|
||||
for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) {
|
||||
G4OpenGLStoredSceneHandler::TO& to =
|
||||
fG4OpenGLStoredSceneHandler.fTOList[i];
|
||||
if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) {
|
||||
glPushMatrix();
|
||||
G4OpenGLTransform3D oglt (to.fTransform);
|
||||
glMultMatrixd (oglt.GetGLMatrix ());
|
||||
G4Colour& c = to.fColour;
|
||||
G4double bsf = 1.; // Brightness scaling factor.
|
||||
if (fFadeFactor > 0. && to.fEndTime < fEndTime)
|
||||
bsf = 1. - fFadeFactor *
|
||||
((fEndTime - to.fEndTime) / (fEndTime - fStartTime));
|
||||
glColor3d(bsf * c.GetRed (), bsf * c.GetGreen (), bsf * c.GetBlue ());
|
||||
glCallList (to.fDisplayListId);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
if (cutawayUnion) glDisable (GL_CLIP_PLANE2);
|
||||
}
|
||||
|
||||
// Display time at "head" of time range, which is fEndTime...
|
||||
if (fDisplayHeadTime && fEndTime < DBL_MAX) {
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
G4OpenGLTransform3D oglt
|
||||
(fG4OpenGLStoredSceneHandler.fTODLTransformList [i]);
|
||||
glMultMatrixd (oglt.GetGLMatrix ());
|
||||
glCallList (fG4OpenGLStoredSceneHandler.fTODLList[i]);
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
G4Text headTimeText(G4BestUnit(fEndTime,"Time"),
|
||||
G4Point3D(fDisplayHeadTimeX, fDisplayHeadTimeY, 0.));
|
||||
headTimeText.SetScreenSize(fDisplayHeadTimeSize);
|
||||
G4VisAttributes visAtts (G4Colour
|
||||
(fDisplayHeadTimeRed,
|
||||
fDisplayHeadTimeGreen,
|
||||
fDisplayHeadTimeBlue));
|
||||
headTimeText.SetVisAttributes(&visAtts);
|
||||
fG4OpenGLStoredSceneHandler.AddPrimitive(headTimeText);
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
// Display light front...
|
||||
if (fDisplayLightFront && fEndTime < DBL_MAX) {
|
||||
G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
|
||||
if (lightFrontRadius > 0.) {
|
||||
G4Point3D lightFrontCentre(fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ);
|
||||
G4Point3D circleCentre = lightFrontCentre;
|
||||
G4double circleRadius = lightFrontRadius;
|
||||
if (fVP.GetFieldHalfAngle() > 0.) {
|
||||
// Perspective view. Find horizon centre and radius...
|
||||
G4Point3D targetPoint = fSceneHandler.GetScene()->GetStandardTargetPoint() +
|
||||
fVP.GetCurrentTargetPoint();
|
||||
G4double sceneRadius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
|
||||
if(sceneRadius <= 0.) sceneRadius = 1.;
|
||||
G4double cameraDistance = fVP.GetCameraDistance(sceneRadius);
|
||||
G4Point3D cameraPosition = targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
|
||||
G4Vector3D lightFrontToCameraDirection = cameraPosition - lightFrontCentre;
|
||||
G4double lightFrontCentreDistance = lightFrontToCameraDirection.mag();
|
||||
/*
|
||||
G4cout << "cameraPosition: " << cameraPosition
|
||||
<< ", lightFrontCentre: " << lightFrontCentre
|
||||
<< ", lightFrontRadius: " << lightFrontRadius
|
||||
<< ", lightFrontCentreDistance: " << lightFrontCentreDistance
|
||||
<< ", dot: " << lightFrontToCameraDirection * fVP.GetViewpointDirection()
|
||||
<< G4endl;
|
||||
*/
|
||||
if (lightFrontToCameraDirection * fVP.GetViewpointDirection() > 0. && lightFrontRadius < lightFrontCentreDistance) {
|
||||
// Light front in front of camera...
|
||||
G4double sineHorizonAngle = lightFrontRadius / lightFrontCentreDistance;
|
||||
circleCentre = lightFrontCentre + (lightFrontRadius * sineHorizonAngle) * lightFrontToCameraDirection.unit();
|
||||
circleRadius = lightFrontRadius * std::sqrt(1. - std::pow(sineHorizonAngle, 2));
|
||||
/*
|
||||
G4cout << "sineHorizonAngle: " << sineHorizonAngle
|
||||
<< ", circleCentre: " << circleCentre
|
||||
<< ", circleRadius: " << circleRadius
|
||||
<< G4endl;
|
||||
*/
|
||||
} else {
|
||||
circleRadius = -1.;
|
||||
}
|
||||
}
|
||||
if (circleRadius > 0.) {
|
||||
G4Circle lightFront(circleCentre);
|
||||
lightFront.SetWorldRadius(circleRadius);
|
||||
glColor3d(fDisplayLightFrontRed,
|
||||
fDisplayLightFrontGreen,
|
||||
fDisplayLightFrontBlue);
|
||||
static_cast<G4OpenGLSceneHandler&>(fSceneHandler).
|
||||
G4OpenGLSceneHandler::AddPrimitive(lightFront);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredWin32.cc,v 1.13 2006/06/29 21:19:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// OpenGLStoredWin32 graphics system factory.
|
||||
@@ -39,12 +39,16 @@
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLStoredWin32.hh"
|
||||
#include "G4OpenGLStoredWin32Viewer.hh"
|
||||
#include "G4OpenGLViewerMessenger.hh"
|
||||
|
||||
G4OpenGLStoredWin32::G4OpenGLStoredWin32 ():
|
||||
G4VGraphicsSystem ("OpenGLStoredWin32",
|
||||
"OGLSWin32",
|
||||
G4VisFeaturesOfOpenGLSWin32 (),
|
||||
G4VGraphicsSystem::threeD) {}
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
}
|
||||
|
||||
G4VSceneHandler* G4OpenGLStoredWin32::CreateSceneHandler
|
||||
(const G4String& name) {
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.17 2006/06/29 21:19:22 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.18 2006/09/04 12:07:59 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Class G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
|
||||
@@ -100,6 +100,15 @@ void G4OpenGLStoredWin32Viewer::DrawView () {
|
||||
if (!kernelVisitWasNeeded) {
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
} else {
|
||||
// However, union cutaways are implemented in DrawDisplayLists, so make
|
||||
// an extra pass...
|
||||
if (fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
|
||||
ClearView();
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredX.cc,v 1.11 2006/06/29 21:19:24 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLStoredX.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -40,12 +40,18 @@
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLStoredX.hh"
|
||||
#include "G4OpenGLStoredXViewer.hh"
|
||||
#include "G4OpenGLViewerMessenger.hh"
|
||||
#include "G4OpenGLXViewerMessenger.hh"
|
||||
|
||||
G4OpenGLStoredX::G4OpenGLStoredX ():
|
||||
G4VGraphicsSystem ("OpenGLStoredX",
|
||||
"OGLSX",
|
||||
G4VisFeaturesOfOpenGLSX (),
|
||||
G4VGraphicsSystem::threeD) {}
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
G4OpenGLXViewerMessenger::GetInstance();
|
||||
}
|
||||
|
||||
G4OpenGLStoredX::~G4OpenGLStoredX () {}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXViewer.cc,v 1.19 2006/06/29 21:19:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLStoredXViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -109,8 +109,23 @@ void G4OpenGLStoredXViewer::DrawView () {
|
||||
if (!kernelVisitWasNeeded) {
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
} else {
|
||||
// However, union cutaways are implemented in DrawDisplayLists, so make
|
||||
// an extra pass...
|
||||
if (fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
|
||||
ClearView();
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenGLStoredXViewer::FinishView () {
|
||||
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
|
||||
//be propogated before progressing.
|
||||
glXSwapBuffers (dpy, win);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXm.cc,v 1.10 2006/06/29 21:19:28 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLStoredXm.hh"
|
||||
#include "G4OpenGLStoredXmViewer.hh"
|
||||
#include "G4OpenGLViewerMessenger.hh"
|
||||
#include "G4OpenGLXmViewerMessenger.hh"
|
||||
|
||||
G4OpenGLStoredXm::G4OpenGLStoredXm ():
|
||||
@@ -47,6 +48,7 @@ G4OpenGLStoredXm::G4OpenGLStoredXm ():
|
||||
G4VisFeaturesOfOpenGLSXm (),
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
G4OpenGLXmViewerMessenger::GetInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXmViewer.cc,v 1.19 2006/06/29 21:19:30 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLStoredXmViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -76,6 +76,8 @@ void G4OpenGLStoredXmViewer::Initialise () {
|
||||
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glDrawBuffer (GL_BACK);
|
||||
}
|
||||
|
||||
void G4OpenGLStoredXmViewer::DrawView () {
|
||||
@@ -112,8 +114,23 @@ void G4OpenGLStoredXmViewer::DrawView () {
|
||||
if (!kernelVisitWasNeeded) {
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
} else {
|
||||
// However, union cutaways are implemented in DrawDisplayLists, so make
|
||||
// an extra pass...
|
||||
if (fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
|
||||
ClearView();
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenGLStoredXmViewer::FinishView () {
|
||||
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
|
||||
//be propogated before progressing.
|
||||
glXSwapBuffers (dpy, win);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 24th October 1996
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLViewer.cc,v 1.24 2006/06/29 21:19:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLViewer.cc,v 1.29 2006/09/19 16:13:15 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -51,7 +51,25 @@ G4VViewer (scene, -1),
|
||||
background (G4Colour(0.,0.,0.)),
|
||||
transparency_enabled (true),
|
||||
antialiasing_enabled (false),
|
||||
haloing_enabled (false)
|
||||
haloing_enabled (false),
|
||||
fStartTime(-DBL_MAX),
|
||||
fEndTime(DBL_MAX),
|
||||
fFadeFactor(0.),
|
||||
fDisplayHeadTime(false),
|
||||
fDisplayHeadTimeX(-0.9),
|
||||
fDisplayHeadTimeY(-0.9),
|
||||
fDisplayHeadTimeSize(24.),
|
||||
fDisplayHeadTimeRed(0.),
|
||||
fDisplayHeadTimeGreen(1.),
|
||||
fDisplayHeadTimeBlue(1.),
|
||||
fDisplayLightFront(false),
|
||||
fDisplayLightFrontX(0.),
|
||||
fDisplayLightFrontY(0.),
|
||||
fDisplayLightFrontZ(0.),
|
||||
fDisplayLightFrontT(0.),
|
||||
fDisplayLightFrontRed(0.),
|
||||
fDisplayLightFrontGreen(1.),
|
||||
fDisplayLightFrontBlue(0.)
|
||||
{
|
||||
// Make changes to view parameters for OpenGL...
|
||||
fVP.SetAutoRefresh(true);
|
||||
@@ -159,7 +177,11 @@ void G4OpenGLViewer::SetView () {
|
||||
// Light position is "true" light direction, so must come after gluLookAt.
|
||||
glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
|
||||
|
||||
// Clip planes.
|
||||
// OpenGL no longer seems to reconstruct clipped edges, so, when the
|
||||
// BooleanProcessor is up to it, abandon this and use generic
|
||||
// clipping in G4OpenGLSceneHandler::CreateSectionPolyhedron. Also,
|
||||
// force kernel visit on change of clipping plane in
|
||||
// G4OpenGLStoredViewer::CompareForKernelVisit.
|
||||
if (fVP.IsSection () ) { // pair of back to back clip planes.
|
||||
const G4Plane3D& s = fVP.GetSectionPlane ();
|
||||
double sArray[4];
|
||||
@@ -175,12 +197,45 @@ void G4OpenGLViewer::SetView () {
|
||||
sArray[3] = -s.d() + radius * 1.e-05;
|
||||
glClipPlane (GL_CLIP_PLANE1, sArray);
|
||||
glEnable (GL_CLIP_PLANE1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
glDisable (GL_CLIP_PLANE0);
|
||||
glDisable (GL_CLIP_PLANE1);
|
||||
}
|
||||
|
||||
const G4Planes& cutaways = fVP.GetCutawayPlanes();
|
||||
size_t nPlanes = cutaways.size();
|
||||
if (fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayIntersection &&
|
||||
nPlanes > 0) {
|
||||
double a[4];
|
||||
a[0] = cutaways[0].a();
|
||||
a[1] = cutaways[0].b();
|
||||
a[2] = cutaways[0].c();
|
||||
a[3] = cutaways[0].d();
|
||||
glClipPlane (GL_CLIP_PLANE2, a);
|
||||
glEnable (GL_CLIP_PLANE2);
|
||||
if (nPlanes > 1) {
|
||||
a[0] = cutaways[1].a();
|
||||
a[1] = cutaways[1].b();
|
||||
a[2] = cutaways[1].c();
|
||||
a[3] = cutaways[1].d();
|
||||
glClipPlane (GL_CLIP_PLANE3, a);
|
||||
glEnable (GL_CLIP_PLANE3);
|
||||
}
|
||||
if (nPlanes > 2) {
|
||||
a[0] = cutaways[2].a();
|
||||
a[1] = cutaways[2].b();
|
||||
a[2] = cutaways[2].c();
|
||||
a[3] = cutaways[2].d();
|
||||
glClipPlane (GL_CLIP_PLANE4, a);
|
||||
glEnable (GL_CLIP_PLANE4);
|
||||
}
|
||||
} else {
|
||||
glDisable (GL_CLIP_PLANE2);
|
||||
glDisable (GL_CLIP_PLANE3);
|
||||
glDisable (GL_CLIP_PLANE4);
|
||||
}
|
||||
|
||||
// Background.
|
||||
background = fVP.GetBackgroundColour ();
|
||||
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLViewerMessenger.cc,v 1.5 2006/10/24 06:20:42 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
|
||||
#include "G4OpenGLViewerMessenger.hh"
|
||||
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLStoredViewer.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include <sstream>
|
||||
|
||||
G4OpenGLViewerMessenger*
|
||||
G4OpenGLViewerMessenger::fpInstance = 0;
|
||||
|
||||
G4OpenGLViewerMessenger*
|
||||
G4OpenGLViewerMessenger::GetInstance()
|
||||
{
|
||||
if (!fpInstance) fpInstance = new G4OpenGLViewerMessenger;
|
||||
return fpInstance;
|
||||
}
|
||||
|
||||
G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
|
||||
{
|
||||
G4bool omitable;
|
||||
|
||||
fpDirectory = new G4UIdirectory("/vis/ogl/");
|
||||
fpDirectory->SetGuidance("G4OpenGLViewer commands.");
|
||||
|
||||
fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
|
||||
fpDirectorySet->SetGuidance("G4OpenGLViewer set commands.");
|
||||
|
||||
G4UIparameter* parameter;
|
||||
|
||||
fpCommandDisplayHeadTime =
|
||||
new G4UIcommand("/vis/ogl/set/displayHeadTime", this);
|
||||
fpCommandDisplayHeadTime->SetGuidance
|
||||
("Display head time of range in 2D text.");
|
||||
parameter = new G4UIparameter ("displayHeadTime", 'b', omitable = false);
|
||||
parameter->SetDefaultValue(false);
|
||||
fpCommandDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("screenX", 'd', omitable = true);
|
||||
parameter->SetGuidance("-1 < screenX < 1");
|
||||
parameter->SetParameterRange("screenX >= -1. && screenX <= 1.");
|
||||
parameter->SetDefaultValue(-0.9);
|
||||
fpCommandDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("screenY", 'd', omitable = true);
|
||||
parameter->SetGuidance("-1 < screenY < 1");
|
||||
parameter->SetParameterRange("screenY >= -1. && screenY <= 1.");
|
||||
parameter->SetDefaultValue(-0.9);
|
||||
fpCommandDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("screenSize", 'd', omitable = true);
|
||||
parameter->SetDefaultValue(24.);
|
||||
fpCommandDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("red", 'd', omitable = true);
|
||||
parameter->SetParameterRange("red >= 0. && red <= 1.");
|
||||
parameter->SetDefaultValue(0.);
|
||||
fpCommandDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("green", 'd', omitable = true);
|
||||
parameter->SetParameterRange("green >= 0. && green <= 1.");
|
||||
parameter->SetDefaultValue(1.);
|
||||
fpCommandDisplayHeadTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("blue", 'd', omitable = true);
|
||||
parameter->SetParameterRange("blue >= 0. && blue <= 1.");
|
||||
parameter->SetDefaultValue(1.);
|
||||
fpCommandDisplayHeadTime->SetParameter(parameter);
|
||||
|
||||
fpCommandDisplayLightFront =
|
||||
new G4UIcommand("/vis/ogl/set/displayLightFront", this);
|
||||
fpCommandDisplayLightFront->SetGuidance
|
||||
("Display the light front at head time.");
|
||||
fpCommandDisplayLightFront->SetGuidance
|
||||
("Tip: The trajectories can appear of jump ahead of the light front"
|
||||
"\nbecause their time range overlaps the viewer's time range. To"
|
||||
"\naverage out this discrete time effect, advance the light front by"
|
||||
"\nhalf the trajectories interval. E.g., if the trajectory time slice"
|
||||
"\ninterval is 0.01 ns:"
|
||||
"\n /vis/ogl/set/displayLightFront true -90 0 0 mm -0.005 ns"
|
||||
"\nTo prevent them beating the light front at all:"
|
||||
"\n /vis/ogl/set/displayLightFront true -90 0 0 mm -0.01 ns");
|
||||
parameter = new G4UIparameter ("displayLightFront", 'b', omitable = false);
|
||||
parameter->SetDefaultValue(false);
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("originX", 'd', omitable = true);
|
||||
parameter->SetDefaultValue(0.);
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("originY", 'd', omitable = true);
|
||||
parameter->SetDefaultValue(0.);
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("originZ", 'd', omitable = true);
|
||||
parameter->SetDefaultValue(0.);
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("space_unit", 's', omitable = true);
|
||||
parameter->SetDefaultValue("m");
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("originT", 'd', omitable = true);
|
||||
parameter->SetDefaultValue(0.);
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("time_unit", 's', omitable = true);
|
||||
parameter->SetDefaultValue("s");
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("red", 'd', omitable = true);
|
||||
parameter->SetParameterRange("red >= 0. && red <= 1.");
|
||||
parameter->SetDefaultValue(0.);
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("green", 'd', omitable = true);
|
||||
parameter->SetParameterRange("green >= 0. && green <= 1.");
|
||||
parameter->SetDefaultValue(1.);
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("blue", 'd', omitable = true);
|
||||
parameter->SetParameterRange("blue >= 0. && blue <= 1.");
|
||||
parameter->SetDefaultValue(0.);
|
||||
fpCommandDisplayLightFront->SetParameter(parameter);
|
||||
|
||||
fpCommandEndTime =
|
||||
new G4UIcommand("/vis/ogl/set/endTime", this);
|
||||
fpCommandEndTime->SetGuidance("Set end and range of track time.");
|
||||
parameter = new G4UIparameter ("end-time", 'd', omitable = false);
|
||||
parameter->SetDefaultValue(DBL_MAX);
|
||||
fpCommandEndTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
|
||||
parameter->SetDefaultValue("ns");
|
||||
fpCommandEndTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("time-range", 'd', omitable = true);
|
||||
parameter->SetDefaultValue(-1.);
|
||||
fpCommandEndTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
|
||||
parameter->SetDefaultValue("ns");
|
||||
fpCommandEndTime->SetParameter(parameter);
|
||||
|
||||
fpCommandFade = new G4UIcmdWithADouble("/vis/ogl/set/fade", this);
|
||||
fpCommandFade->SetGuidance
|
||||
("0: no fade; 1: maximum fade with time within range.");
|
||||
fpCommandFade->SetParameterName("fadefactor", omitable = false);
|
||||
fpCommandFade->SetRange("fadefactor>=0.&&fadefactor<=1.");
|
||||
fpCommandFade->SetDefaultValue(0.);
|
||||
|
||||
fpCommandStartTime =
|
||||
new G4UIcommand("/vis/ogl/set/startTime", this);
|
||||
fpCommandStartTime->SetGuidance("Set start and range of track time.");
|
||||
parameter = new G4UIparameter ("start-time", 'd', omitable = false);
|
||||
parameter->SetDefaultValue(-DBL_MAX);
|
||||
fpCommandStartTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
|
||||
parameter->SetDefaultValue("ns");
|
||||
fpCommandStartTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("time-range", 'd', omitable = true);
|
||||
parameter->SetDefaultValue(-1.);
|
||||
fpCommandStartTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
|
||||
parameter->SetDefaultValue("ns");
|
||||
fpCommandStartTime->SetParameter(parameter);
|
||||
|
||||
fpCommandTransparency =
|
||||
new G4UIcmdWithABool("/vis/ogl/set/transparency", this);
|
||||
fpCommandTransparency->SetGuidance
|
||||
("True/false to enable/disable rendering of transparent objects.");
|
||||
fpCommandTransparency->SetParameterName
|
||||
("transparency-enabled", omitable = true);
|
||||
fpCommandTransparency->SetDefaultValue(true);
|
||||
}
|
||||
|
||||
G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
|
||||
{
|
||||
delete fpCommandTransparency;
|
||||
delete fpCommandStartTime;
|
||||
delete fpCommandFade;
|
||||
delete fpCommandEndTime;
|
||||
delete fpCommandDisplayLightFront;
|
||||
delete fpCommandDisplayHeadTime;
|
||||
delete fpDirectorySet;
|
||||
delete fpDirectory;
|
||||
}
|
||||
|
||||
void G4OpenGLViewerMessenger::SetNewValue
|
||||
(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
G4VisManager* pVisManager = G4VisManager::GetInstance();
|
||||
|
||||
G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
|
||||
|
||||
if (!pVViewer) {
|
||||
G4cout <<
|
||||
"G4OpenGLViewerMessenger::SetNewValue: No current viewer."
|
||||
"\n \"/vis/open\", or similar, to get one."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
G4OpenGLViewer* pOGLViewer = dynamic_cast<G4OpenGLViewer*>(pVViewer);
|
||||
|
||||
if (!pOGLViewer) {
|
||||
G4cout <<
|
||||
"G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type"
|
||||
"\n OGL. Use \"/vis/viewer/select\" or \"/vis/open\"."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
G4OpenGLStoredViewer* pViewer =
|
||||
dynamic_cast<G4OpenGLStoredViewer*>(pVViewer);
|
||||
|
||||
if (!pViewer) {
|
||||
G4cout <<
|
||||
"G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS."
|
||||
"\n The time slice viewing feature is only implemented for OGL Stored"
|
||||
"\n viewers at present. Use \"/vis/viewer/select\" or \"/vis/open\"."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (command == fpCommandDisplayHeadTime)
|
||||
{
|
||||
G4String display;
|
||||
G4double screenX, screenY, screenSize, red, green, blue;
|
||||
std::istringstream iss(newValue);
|
||||
iss >> display >> screenX >> screenY
|
||||
>> screenSize >> red >> green >> blue;
|
||||
pViewer->fDisplayHeadTime = command->ConvertToBool(display);
|
||||
pViewer->fDisplayHeadTimeX = screenX;
|
||||
pViewer->fDisplayHeadTimeY = screenY;
|
||||
pViewer->fDisplayHeadTimeSize = screenSize;
|
||||
pViewer->fDisplayHeadTimeRed = red;
|
||||
pViewer->fDisplayHeadTimeGreen = green;
|
||||
pViewer->fDisplayHeadTimeBlue = blue;
|
||||
}
|
||||
|
||||
if (command == fpCommandDisplayLightFront)
|
||||
{
|
||||
G4String display, originX, originY, originZ, unitS, originT, unitT;
|
||||
G4double red, green, blue;
|
||||
std::istringstream iss(newValue);
|
||||
iss >> display
|
||||
>> originX >> originY >> originZ >> unitS
|
||||
>> originT >> unitT
|
||||
>> red >> green >> blue;
|
||||
pViewer->fDisplayLightFront = command->ConvertToBool(display);
|
||||
pViewer->fDisplayLightFrontX =
|
||||
command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS));
|
||||
pViewer->fDisplayLightFrontY =
|
||||
command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS));
|
||||
pViewer->fDisplayLightFrontZ =
|
||||
command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS));
|
||||
pViewer->fDisplayLightFrontT =
|
||||
command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT));
|
||||
pViewer->fDisplayLightFrontRed = red;
|
||||
pViewer->fDisplayLightFrontGreen = green;
|
||||
pViewer->fDisplayLightFrontBlue = blue;
|
||||
}
|
||||
|
||||
if (command == fpCommandEndTime)
|
||||
{
|
||||
G4String end_time_string, end_time_unit,
|
||||
time_range_string, time_range_unit;
|
||||
std::istringstream iss(newValue);
|
||||
iss >> end_time_string >> end_time_unit
|
||||
>> time_range_string >> time_range_unit;
|
||||
pViewer->fEndTime = command->ConvertToDimensionedDouble
|
||||
(G4String(end_time_string + ' ' + end_time_unit));
|
||||
G4double timeRange = command->ConvertToDimensionedDouble
|
||||
(G4String(time_range_string + ' ' + time_range_unit));
|
||||
if (timeRange > 0.) {
|
||||
pViewer->fStartTime = pViewer->fEndTime - timeRange;
|
||||
}
|
||||
if (pViewer->fVP.IsAutoRefresh())
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
|
||||
}
|
||||
|
||||
if (command == fpCommandFade)
|
||||
{
|
||||
pViewer->fFadeFactor = command->ConvertToDouble(newValue);
|
||||
if (pViewer->fVP.IsAutoRefresh())
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
|
||||
}
|
||||
|
||||
if (command == fpCommandStartTime)
|
||||
{
|
||||
G4String start_time_string, start_time_unit,
|
||||
time_range_string, time_range_unit;
|
||||
std::istringstream iss(newValue);
|
||||
iss >> start_time_string >> start_time_unit
|
||||
>> time_range_string >> time_range_unit;
|
||||
pViewer->fStartTime = command->ConvertToDimensionedDouble
|
||||
(G4String(start_time_string + ' ' + start_time_unit));
|
||||
G4double timeRange = command->ConvertToDimensionedDouble
|
||||
(G4String(time_range_string + ' ' + time_range_unit));
|
||||
if (timeRange > 0.) {
|
||||
pViewer->fEndTime = pViewer->fStartTime + timeRange;
|
||||
}
|
||||
if (pViewer->fVP.IsAutoRefresh())
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
|
||||
}
|
||||
|
||||
if (command == fpCommandTransparency)
|
||||
{
|
||||
pViewer->transparency_enabled = command->ConvertToBool(newValue);
|
||||
if (pViewer->fVP.IsAutoRefresh())
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXViewer.cc,v 1.30 2006/06/29 21:19:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenGLXViewer.cc,v 1.34 2006/11/01 11:22:26 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -122,19 +122,10 @@ void G4OpenGLXViewer::SetView () {
|
||||
|
||||
void G4OpenGLXViewer::ShowView () {
|
||||
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
|
||||
//be propogated before progressing.
|
||||
//be propagated before progressing.
|
||||
glFlush ();
|
||||
}
|
||||
|
||||
void G4OpenGLXViewer::FinishView () {
|
||||
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
|
||||
//be propogated before progressing.
|
||||
if (doublebuffer == true) {
|
||||
glXSwapBuffers (dpy, win);
|
||||
}
|
||||
else glFlush ();
|
||||
}
|
||||
|
||||
void G4OpenGLXViewer::GetXConnection () {
|
||||
// get a connection.
|
||||
dpy = XOpenDisplay (0);
|
||||
@@ -395,7 +386,6 @@ vi_stored (0)
|
||||
if (vi_single_buffer) {
|
||||
vi_immediate = vi_single_buffer;
|
||||
attributeList = snglBuf_RGBA;
|
||||
doublebuffer = false;
|
||||
}
|
||||
|
||||
if (!vi_immediate){
|
||||
@@ -403,7 +393,6 @@ vi_stored (0)
|
||||
if (vi_double_buffer) {
|
||||
vi_immediate = vi_double_buffer;
|
||||
attributeList = dblBuf_RGBA;
|
||||
doublebuffer = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +401,6 @@ vi_stored (0)
|
||||
if (vi_double_buffer) {
|
||||
vi_stored = vi_double_buffer;
|
||||
attributeList = dblBuf_RGBA;
|
||||
doublebuffer = true;
|
||||
}
|
||||
|
||||
if (!vi_immediate || !vi_stored) {
|
||||
@@ -472,14 +460,10 @@ void G4OpenGLXViewer::print() {
|
||||
} else {
|
||||
|
||||
XVisualInfo* pvi;
|
||||
G4bool new_db;
|
||||
G4bool last_db;
|
||||
GLXContext pcx = create_GL_print_context(pvi, new_db);
|
||||
GLXContext pcx = create_GL_print_context(pvi);
|
||||
GLXContext tmp_cx;
|
||||
tmp_cx = cx;
|
||||
cx=pcx;
|
||||
last_db=doublebuffer;
|
||||
doublebuffer=new_db;
|
||||
|
||||
Pixmap pmap = XCreatePixmap (dpy,
|
||||
XRootWindow (dpy, pvi->screen),
|
||||
@@ -509,7 +493,6 @@ void G4OpenGLXViewer::print() {
|
||||
|
||||
win=tmp_win;
|
||||
cx=tmp_cx;
|
||||
doublebuffer=last_db;
|
||||
|
||||
glXMakeCurrent (dpy,
|
||||
glxpmap,
|
||||
@@ -807,12 +790,18 @@ G4float* G4OpenGLXViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) {
|
||||
break;
|
||||
default:
|
||||
/* XXX Left as an excersie to the reader. */
|
||||
std::ostringstream oss;
|
||||
oss << "Incomplete implementation. Unexpected token (" << token << ").";
|
||||
G4Exception("G4OpenGLXViewer::spewPrimitiveEPS",
|
||||
"Writing_eps_file_01",
|
||||
FatalException,
|
||||
oss.str().c_str());
|
||||
static G4bool spewPrimitiveEPSWarned = false;
|
||||
if (!spewPrimitiveEPSWarned) {
|
||||
std::ostringstream oss;
|
||||
oss <<
|
||||
"Incomplete implementation. Unexpected token (" << token << ")."
|
||||
"\n (Seems to be caused by text.)";
|
||||
G4Exception("G4OpenGLXViewer::spewPrimitiveEPS",
|
||||
"Unexpected token",
|
||||
JustWarning,
|
||||
oss.str().c_str());
|
||||
spewPrimitiveEPSWarned = true;
|
||||
}
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
@@ -875,12 +864,19 @@ void G4OpenGLXViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buff
|
||||
break;
|
||||
default:
|
||||
/* XXX Left as an excersie to the reader. */
|
||||
std::ostringstream oss;
|
||||
oss << "Incomplete implementation. Unexpected token (" << token << ").";
|
||||
G4Exception("G4OpenGLXViewer::spewPrimitiveEPS",
|
||||
"Writing_eps_file_02",
|
||||
FatalException,
|
||||
oss.str().c_str());
|
||||
static G4bool spewSortedFeedbackWarned = false;
|
||||
if (!spewSortedFeedbackWarned) {
|
||||
std::ostringstream oss;
|
||||
oss <<
|
||||
"Incomplete implementation. Unexpected token (" << token << ")."
|
||||
"\n (Seems to be caused by text.)";
|
||||
G4Exception("G4OpenGLXViewer::spewSortedFeedback",
|
||||
"Unexpected token",
|
||||
JustWarning,
|
||||
oss.str().c_str());
|
||||
spewSortedFeedbackWarned = true;
|
||||
}
|
||||
nprimitives++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,21 +944,16 @@ void G4OpenGLXViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buff
|
||||
free(prims);
|
||||
}
|
||||
|
||||
GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi, G4bool& db) {
|
||||
GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) {
|
||||
|
||||
pvi = glXChooseVisual (dpy,
|
||||
XDefaultScreen (dpy),
|
||||
snglBuf_RGBA);
|
||||
|
||||
if (pvi) {
|
||||
db=false;
|
||||
} else {
|
||||
if (!pvi) {
|
||||
pvi = glXChooseVisual (dpy,
|
||||
XDefaultScreen (dpy),
|
||||
dblBuf_RGBA);
|
||||
if (!pvi) {
|
||||
db=true;
|
||||
}
|
||||
}
|
||||
|
||||
return glXCreateContext (dpy,
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXViewerMessenger.cc,v 1.5 2006/11/21 16:24:00 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLX_DRIVER
|
||||
|
||||
#include "G4OpenGLXViewerMessenger.hh"
|
||||
|
||||
#include "G4OpenGLXViewer.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include <sstream>
|
||||
|
||||
G4OpenGLXViewerMessenger* G4OpenGLXViewerMessenger::fpInstance = 0;
|
||||
|
||||
G4OpenGLXViewerMessenger* G4OpenGLXViewerMessenger::GetInstance()
|
||||
{
|
||||
if (!fpInstance) fpInstance = new G4OpenGLXViewerMessenger;
|
||||
return fpInstance;
|
||||
}
|
||||
|
||||
G4OpenGLXViewerMessenger::G4OpenGLXViewerMessenger()
|
||||
{
|
||||
fpDirectory = new G4UIdirectory("/vis/oglx/");
|
||||
fpDirectory->SetGuidance("G4OpenGLXViewer commands.");
|
||||
|
||||
fpCommandPrintEPS =
|
||||
new G4UIcmdWithoutParameter("/vis/oglx/printEPS", this);
|
||||
fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
|
||||
fpCommandPrintEPS->SetGuidance
|
||||
("Generates files with names G4OpenGL_n.eps, where n is a sequence"
|
||||
"\nnumber, starting at 0.");
|
||||
}
|
||||
|
||||
G4OpenGLXViewerMessenger::~G4OpenGLXViewerMessenger ()
|
||||
{
|
||||
delete fpCommandPrintEPS;
|
||||
delete fpDirectory;
|
||||
}
|
||||
|
||||
void G4OpenGLXViewerMessenger::SetNewValue
|
||||
(G4UIcommand* command, G4String)
|
||||
{
|
||||
G4VisManager* pVisManager = G4VisManager::GetInstance();
|
||||
|
||||
G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
|
||||
|
||||
if (!pVViewer) {
|
||||
G4cout <<
|
||||
"G4OpenGLXViewerMessenger::SetNewValue: No current viewer."
|
||||
"\n \"/vis/open\", or similar, to get one."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
G4OpenGLXViewer* pViewer = dynamic_cast<G4OpenGLXViewer*>(pVViewer);
|
||||
|
||||
if (!pViewer) {
|
||||
G4cout <<
|
||||
"G4OpenGLXViewerMessenger::SetNewValue: Current viewer is not of type"
|
||||
"\n OGL*X*. This feature currently only available on X Windows."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (command == fpCommandPrintEPS)
|
||||
{
|
||||
// Keep copy of print_string to preserve Xm behaviour...
|
||||
char* tmp_string = new char[50];
|
||||
strcpy (tmp_string, pViewer->print_string);
|
||||
// Make new print string...
|
||||
static G4int file_count = 0;
|
||||
std::ostringstream oss;
|
||||
oss << "G4OpenGL_" << file_count++ << ".eps";
|
||||
strcpy (pViewer->print_string, oss.str().c_str());
|
||||
// Print eps file...
|
||||
pViewer->print();
|
||||
// Restore print_string for Xm...
|
||||
strcpy (pViewer->print_string, tmp_string);
|
||||
delete tmp_string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Box container class
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Framed box container class
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Push button class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Separator class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Text field class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Top level shell class
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Base class for all Motif component widgets
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Base class for all Motif container widgets
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Virtual base class for all Motif widgets.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//Base class for all Motif shell widgets
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmViewer.cc,v 1.23 2006/06/29 21:20:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th June 1997
|
||||
|
||||
Reference in New Issue
Block a user