Import Geant4 8.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.20 2005/06/02 17:43:46 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.23 2005/09/29 14:27:03 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -40,7 +40,9 @@
|
||||
|
||||
#include "G4OpenGLStoredSceneHandler.hh"
|
||||
|
||||
#include "G4OpenGLViewerDataStore.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
@@ -196,13 +198,45 @@ void G4OpenGLStoredSceneHandler::ClearTransientStore () {
|
||||
|
||||
void G4OpenGLStoredSceneHandler::RequestPrimitives (const G4VSolid& solid) {
|
||||
if (fReadyForTransients) {
|
||||
// Always draw transient solids, e.g., hits represented as solids.
|
||||
// (As we have no control over the order of drawing of transient
|
||||
// objects, we cannot do anything about transparent ones, as
|
||||
// below, so always draw them.)
|
||||
G4VSceneHandler::RequestPrimitives (solid);
|
||||
}
|
||||
else {
|
||||
// Stop-gap solution for display List re-use. A proper
|
||||
// implementation would use geometry hierarchy.
|
||||
|
||||
// For non-transient (run-duration) objects, ensure transparent
|
||||
// objects are drawn last. The problem of
|
||||
// blending/transparency/alpha is quite a tricky one - see History
|
||||
// of opengl-V07-01-01/2/3.
|
||||
// Get vis attributes - pick up defaults if none.
|
||||
const G4VisAttributes* pVA =
|
||||
fpViewer -> GetApplicableVisAttributes(fpVisAttribs);
|
||||
const G4Colour& c = pVA -> GetColour ();
|
||||
G4double opacity = c.GetAlpha ();
|
||||
if (!fSecondPass) {
|
||||
G4bool transparency_enabled =
|
||||
G4OpenGLViewerDataStore::GetTransparencyEnabled(fpViewer);
|
||||
if (transparency_enabled && opacity < 1.) {
|
||||
// On first pass, transparent objects are not drawn, but flag is set...
|
||||
fSecondPassRequested = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// On second pass, opaque objects are not drwan...
|
||||
if (fSecondPass && opacity >= 1.) return;
|
||||
|
||||
// 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 a;gorithm
|
||||
// should be secure, I think...
|
||||
const G4VSolid* pSolid = &solid;
|
||||
if (fpCurrentPV && !(fpCurrentPV -> IsReplicated ()) &&
|
||||
if (fpCurrentPV &&
|
||||
// Provided it is not replicated (because if so, the solid's
|
||||
// parameters might have been changed)...
|
||||
!(fpCurrentPV -> IsReplicated ()) &&
|
||||
// ...and if the solid has already been rendered...
|
||||
(fSolidMap.find (pSolid) != fSolidMap.end ())) {
|
||||
fDisplayListId = fSolidMap [pSolid];
|
||||
fPODLList.push_back (fDisplayListId);
|
||||
|
||||
Reference in New Issue
Block a user