Import Geant4 8.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.13 2005/06/02 17:43:46 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.17 2005/09/29 14:27:03 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -41,19 +41,13 @@
|
||||
|
||||
#include "G4OpenGLSceneHandler.hh"
|
||||
#include "G4OpenGLViewer.hh"
|
||||
#include "G4OpenGLViewerDataStore.hh"
|
||||
#include "G4OpenGLTransform3D.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4Normal3D.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
#include "G4OpenGLImmediateSceneHandler.hh"
|
||||
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler (G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4OpenGLSceneHandler (system, fSceneIdCount++, name)
|
||||
@@ -111,6 +105,40 @@ void G4OpenGLImmediateSceneHandler::ClearTransientStore () {
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::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 {
|
||||
// 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;
|
||||
// Else invoke base class method...
|
||||
G4VSceneHandler::RequestPrimitives (solid);
|
||||
}
|
||||
}
|
||||
|
||||
G4int G4OpenGLImmediateSceneHandler::fSceneIdCount = 0;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user