Import Geant4 10.6.0.beta source tree
This commit is contained in:
@@ -61,7 +61,13 @@ G4OpenGLImmediateXViewer::~G4OpenGLImmediateXViewer () {}
|
||||
|
||||
void G4OpenGLImmediateXViewer::Initialise () {
|
||||
|
||||
CreateGLXContext (vi_immediate);
|
||||
// CreateGLXContext (vi_immediate);
|
||||
// Force double buffer context. (This can happen anyway when the display
|
||||
// list limit is reached in stored mode. Seems to be no problem. We were
|
||||
// finding that the single buffer visual gave an X Error (BadMatch) on
|
||||
// some systems, so let us force the use if a double buffer. All systems
|
||||
// have double buffers nowadays.
|
||||
CreateGLXContext (vi_stored);
|
||||
CreateMainWindow ();
|
||||
CreateFontLists ();
|
||||
|
||||
|
||||
@@ -321,19 +321,22 @@ void G4OpenGLSceneHandler::EndPrimitives2D ()
|
||||
G4VSceneHandler::EndPrimitives2D ();
|
||||
}
|
||||
|
||||
G4VSolid* G4OpenGLSceneHandler::CreateSectionSolid ()
|
||||
G4DisplacedSolid* G4OpenGLSceneHandler::CreateSectionSolid ()
|
||||
{
|
||||
return G4VSceneHandler::CreateSectionSolid();
|
||||
// If clipping done in G4OpenGLViewer::SetView
|
||||
// return 0;
|
||||
// Note: if you change this, you must also change
|
||||
// G4OpenGLStoredViewer::CompareForKernelVisit
|
||||
}
|
||||
|
||||
G4VSolid* G4OpenGLSceneHandler::CreateCutawaySolid ()
|
||||
G4DisplacedSolid* G4OpenGLSceneHandler::CreateCutawaySolid ()
|
||||
{
|
||||
// Cutaway done in G4OpenGLViewer::SetView.
|
||||
return 0;
|
||||
// Else
|
||||
// return G4VSceneHandler::CreateCutawaySolid();
|
||||
// If cutaway done in G4OpenGLViewer::SetView.
|
||||
return 0;
|
||||
// Note: if you change this, you must also change
|
||||
// G4OpenGLStoredViewer::CompareForKernelVisit
|
||||
}
|
||||
|
||||
void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
@@ -588,7 +591,8 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
// even if the colour is changed, for example, by interaction with a Qt
|
||||
// window, current_colour does not change.
|
||||
GLfloat* painting_colour;
|
||||
GLfloat current_colour [4];
|
||||
GLfloat clear_colour[4];
|
||||
GLfloat current_colour[4];
|
||||
glGetFloatv (GL_CURRENT_COLOR, current_colour);
|
||||
|
||||
G4bool isTransparent = false;
|
||||
@@ -596,10 +600,8 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
isTransparent = true;
|
||||
}
|
||||
|
||||
|
||||
if (drawing_style == G4ViewParameters::hlr) {
|
||||
// This is the colour used to paint surfaces in hlr mode.
|
||||
GLfloat clear_colour[4];
|
||||
glGetFloatv (GL_COLOR_CLEAR_VALUE, clear_colour);
|
||||
painting_colour = clear_colour;
|
||||
} else { // drawing_style == G4ViewParameters::hlhsr
|
||||
@@ -676,7 +678,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
#ifndef G4OPENGL_VERSION_2
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
#endif
|
||||
glEnable (GL_CULL_FACE);
|
||||
glEnable (GL_CULL_FACE);
|
||||
glCullFace (GL_BACK);
|
||||
glPolygonMode (GL_FRONT, GL_FILL);
|
||||
}
|
||||
@@ -870,14 +872,14 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
fEdgeFlag = false;
|
||||
}
|
||||
}
|
||||
glNormal3d (normals[edgeCount].x(),
|
||||
normals[edgeCount].y(),
|
||||
normals[edgeCount].z());
|
||||
glNormal3d (normals[edgeCount].x(),
|
||||
normals[edgeCount].y(),
|
||||
normals[edgeCount].z());
|
||||
glVertex3d (vertex[edgeCount].x(),
|
||||
vertex[edgeCount].y(),
|
||||
vertex[edgeCount].z());
|
||||
#else
|
||||
fOglVertex.push_back(vertex[edgeCount].x());
|
||||
fOglVertex.push_back(vertex[edgeCount].x());
|
||||
fOglVertex.push_back(vertex[edgeCount].y());
|
||||
fOglVertex.push_back(vertex[edgeCount].z());
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ G4bool G4OpenGLStoredQtSceneHandler::ExtraPOProcessing
|
||||
|
||||
// This call comes from a G4PhysicalVolumeModel. drawnPVPath is
|
||||
// the path of the current drawn (non-culled) volume in terms of
|
||||
// drawn (non-culled) ancesters. Each node is identified by a
|
||||
// drawn (non-culled) ancestors. Each node is identified by a
|
||||
// PVNodeID object, which is a physical volume and copy number. It
|
||||
// is a vector of PVNodeIDs corresponding to the geometry hierarchy
|
||||
// actually selected, i.e., not culled.
|
||||
|
||||
@@ -113,6 +113,7 @@ G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
// modifiers (fTreeItemModels, etc.).
|
||||
if (
|
||||
(lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(lastVP.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
|
||||
(lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(lastVP.IsCulling () != fVP.IsCulling ()) ||
|
||||
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
@@ -153,17 +154,15 @@ G4bool G4OpenGLStoredQtViewer::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;
|
||||
***************************************************************/
|
||||
// /**************************************************************
|
||||
// If section (DCUT) is implemented locally, comment this out.
|
||||
if (lastVP.IsSection () &&
|
||||
(lastVP.GetSectionPlane () != fVP.GetSectionPlane ()))
|
||||
return true;
|
||||
// ***************************************************************/
|
||||
|
||||
/**************************************************************
|
||||
Cutaways implemented locally. No need to visit kernel if cutaway
|
||||
planes themselves change.
|
||||
If cutaways are implemented locally, comment this out.
|
||||
if (lastVP.IsCutaway ()) {
|
||||
if (lastVP.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
@@ -181,7 +180,7 @@ G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
if (lastVP.IsExplode () &&
|
||||
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -274,64 +274,69 @@ G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal
|
||||
fPickMap[fPickName] = holder;
|
||||
}
|
||||
|
||||
// Can we re-use a display list?
|
||||
const G4VSolid* pSolid = 0;
|
||||
G4PhysicalVolumeModel* pPVModel =
|
||||
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
|
||||
|
||||
// Can we re-use a display list?
|
||||
if (isMarker)
|
||||
// It is a marker, which may have its own position relative to fObjectTransformation
|
||||
goto end_of_display_list_reuse_test;
|
||||
if (fpViewer->GetViewParameters().GetVisAttributesModifiers().size())
|
||||
// Touchables have been modified - don't risk re-using display list.
|
||||
goto end_of_display_list_reuse_test;
|
||||
if (pPVModel) {
|
||||
// Check that it isn't a G4LogicalVolumeModel (which is a sub-class of
|
||||
// G4PhysicalVolumeModel).
|
||||
G4LogicalVolumeModel* pLVModel =
|
||||
dynamic_cast<G4LogicalVolumeModel*>(pPVModel);
|
||||
if (pLVModel)
|
||||
// Logical volume model - don't re-use.
|
||||
goto end_of_display_list_reuse_test;
|
||||
// If part of the geometry hierarchy, i.e., from a
|
||||
// G4PhysicalVolumeModel, check if a display list already exists for
|
||||
// this solid, re-use it if possible. We could be smarter, and
|
||||
// recognise repeated branches of the geometry hierarchy, for
|
||||
// example. But this algorithm should be secure, I think...
|
||||
G4VPhysicalVolume* pPV = pPVModel->GetCurrentPV();
|
||||
if (!pPV)
|
||||
// It's probably a dummy model, e.g., for a user-drawn hit?
|
||||
goto end_of_display_list_reuse_test;
|
||||
G4LogicalVolume* pLV = pPV->GetLogicalVolume();
|
||||
if (!pLV)
|
||||
// Dummy model again?
|
||||
goto end_of_display_list_reuse_test;
|
||||
pSolid = pLV->GetSolid();
|
||||
EAxis axis = kRho;
|
||||
G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
|
||||
if (pCurrentPV -> IsReplicated ()) {
|
||||
G4int nReplicas;
|
||||
G4double width;
|
||||
G4double offset;
|
||||
G4bool consuming;
|
||||
pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
|
||||
}
|
||||
// Provided it is not parametrised (because if so, the
|
||||
// solid's parameters might have been changed)...
|
||||
if (!(pCurrentPV -> IsParameterised ()) &&
|
||||
// Provided it is not replicated radially (because if so, the
|
||||
// solid's parameters will have been changed)...
|
||||
!(pCurrentPV -> IsReplicated () && axis == kRho) &&
|
||||
// ...and if the solid has already been rendered...
|
||||
(fSolidMap.find (pSolid) != fSolidMap.end ())) {
|
||||
fDisplayListId = fSolidMap [pSolid];
|
||||
PO po(fDisplayListId,fObjectTransformation);
|
||||
if (isPicking) po.fPickName = fPickName;
|
||||
po.fColour = c;
|
||||
po.fMarkerOrPolyline = isMarkerOrPolyline;
|
||||
fPOList.push_back(po);
|
||||
// No need to test if gl commands are used (result of
|
||||
// ExtraPOProcessing) because we have already decided they will
|
||||
// not, at least not here. Also, pass a dummy G4Visible since
|
||||
// not relevant for G4PhysicalVolumeModel.
|
||||
(void) ExtraPOProcessing(G4Visible(), fPOList.size() - 1);
|
||||
return false; // No further processing.
|
||||
{ // It is a viable candidate for display list re-use
|
||||
G4PhysicalVolumeModel* pPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
|
||||
if (pPVModel) {
|
||||
// Check that it isn't a G4LogicalVolumeModel (which is a sub-class of
|
||||
// G4PhysicalVolumeModel).
|
||||
G4LogicalVolumeModel* pLVModel =
|
||||
dynamic_cast<G4LogicalVolumeModel*>(pPVModel);
|
||||
if (pLVModel)
|
||||
// Logical volume model - don't re-use.
|
||||
goto end_of_display_list_reuse_test;
|
||||
// If part of the geometry hierarchy, i.e., from a
|
||||
// G4PhysicalVolumeModel, check if a display list already exists for
|
||||
// this solid, re-use it if possible. We could be smarter, and
|
||||
// recognise repeated branches of the geometry hierarchy, for
|
||||
// example. But this algorithm should be secure, I think...
|
||||
G4VPhysicalVolume* pPV = pPVModel->GetCurrentPV();
|
||||
if (!pPV)
|
||||
// It's probably a dummy model, e.g., for a user-drawn hit?
|
||||
goto end_of_display_list_reuse_test;
|
||||
G4LogicalVolume* pLV = pPV->GetLogicalVolume();
|
||||
if (!pLV)
|
||||
// Dummy model again?
|
||||
goto end_of_display_list_reuse_test;
|
||||
pSolid = pLV->GetSolid();
|
||||
EAxis axis = kRho;
|
||||
G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
|
||||
if (pCurrentPV -> IsReplicated ()) {
|
||||
G4int nReplicas;
|
||||
G4double width;
|
||||
G4double offset;
|
||||
G4bool consuming;
|
||||
pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
|
||||
}
|
||||
// Provided it is not parametrised (because if so, the
|
||||
// solid's parameters might have been changed)...
|
||||
if (!(pCurrentPV -> IsParameterised ()) &&
|
||||
// Provided it is not replicated radially (because if so, the
|
||||
// solid's parameters will have been changed)...
|
||||
!(pCurrentPV -> IsReplicated () && axis == kRho) &&
|
||||
// ...and if the solid has already been rendered...
|
||||
(fSolidMap.find (pSolid) != fSolidMap.end ())) {
|
||||
fDisplayListId = fSolidMap [pSolid];
|
||||
PO po(fDisplayListId,fObjectTransformation);
|
||||
if (isPicking) po.fPickName = fPickName;
|
||||
po.fColour = c;
|
||||
po.fMarkerOrPolyline = isMarkerOrPolyline;
|
||||
fPOList.push_back(po);
|
||||
// No need to test if gl commands are used (result of
|
||||
// ExtraPOProcessing) because we have already decided they will
|
||||
// not, at least not here. Also, pass a dummy G4Visible since
|
||||
// not relevant for G4PhysicalVolumeModel.
|
||||
(void) ExtraPOProcessing(G4Visible(), fPOList.size() - 1);
|
||||
return false; // No further processing.
|
||||
}
|
||||
}
|
||||
}
|
||||
end_of_display_list_reuse_test:
|
||||
|
||||
@@ -72,6 +72,7 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
|
||||
if (
|
||||
(lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(lastVP.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
|
||||
(lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(lastVP.IsCulling () != fVP.IsCulling ()) ||
|
||||
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
@@ -103,17 +104,15 @@ 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;
|
||||
***************************************************************/
|
||||
// /**************************************************************
|
||||
// If section (DCUT) is implemented locally, comment this out.
|
||||
if (lastVP.IsSection () &&
|
||||
(lastVP.GetSectionPlane () != fVP.GetSectionPlane ()))
|
||||
return true;
|
||||
// ***************************************************************/
|
||||
|
||||
/**************************************************************
|
||||
Cutaways implemented locally. No need to visit kernel if cutaway
|
||||
planes themselves change.
|
||||
If cutaways are implemented locally, comment this out.
|
||||
if (lastVP.IsCutaway ()) {
|
||||
if (lastVP.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
@@ -130,7 +129,7 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
|
||||
if (lastVP.IsExplode () &&
|
||||
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
return true;
|
||||
return true;
|
||||
|
||||
// Time window parameters operate on the existing database so no need
|
||||
// to rebuild even if they change.
|
||||
|
||||
@@ -277,7 +277,7 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
|
||||
new G4UIcommand("/vis/ogl/set/printSize", this);
|
||||
fpCommandPrintSize->SetGuidance ("Set print size");
|
||||
fpCommandPrintSize->SetGuidance ("Tip : -1 will mean 'print size' = 'window size'");
|
||||
fpCommandPrintSize->SetGuidance (" Setting size greatter than your maximum graphic card capacity , will set the size to maximum size.");
|
||||
fpCommandPrintSize->SetGuidance (" Setting size greater than your maximum graphic card capacity , will set the size to maximum size.");
|
||||
G4UIparameter* parameterPrintSize;
|
||||
parameterPrintSize = new G4UIparameter ("width", 'd', omitable = false);
|
||||
parameterPrintSize->SetDefaultValue(-1);
|
||||
|
||||
Reference in New Issue
Block a user