Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -354,11 +354,11 @@ protected:
|
||||
public:
|
||||
PseudoSceneFor3DRectMeshPositions
|
||||
(G4PhysicalVolumeModel* pvModel // input
|
||||
, G4int depth // input...the following are outputs by reference
|
||||
, const G4Mesh* pMesh // input...the following are outputs by reference
|
||||
, std::multimap<const G4Material*,const G4ThreeVector>& positionByMaterial
|
||||
, std::map<const G4Material*,NameAndVisAtts>& nameAndVisAttsByMaterial)
|
||||
: fpPVModel(pvModel)
|
||||
, fDepth(depth)
|
||||
, fpMesh(pMesh)
|
||||
, fPositionByMaterial(positionByMaterial)
|
||||
, fNameAndVisAttsByMaterial(nameAndVisAttsByMaterial)
|
||||
{}
|
||||
@@ -369,7 +369,7 @@ protected:
|
||||
// Do nothing if uninteresting solids found, e.g., the container if not marked invisible.
|
||||
}
|
||||
G4PhysicalVolumeModel* fpPVModel;
|
||||
G4int fDepth;
|
||||
const G4Mesh* fpMesh;
|
||||
std::multimap<const G4Material*,const G4ThreeVector>& fPositionByMaterial;
|
||||
std::map<const G4Material*,NameAndVisAtts>& fNameAndVisAttsByMaterial;
|
||||
};
|
||||
@@ -378,11 +378,11 @@ protected:
|
||||
public:
|
||||
PseudoSceneForTetVertices
|
||||
(G4PhysicalVolumeModel* pvModel // input
|
||||
, G4int depth // input...the following are outputs by reference
|
||||
, const G4Mesh* pMesh // input...the following are outputs by reference
|
||||
, std::multimap<const G4Material*,std::vector<G4ThreeVector>>& verticesByMaterial
|
||||
, std::map<const G4Material*,NameAndVisAtts>& nameAndVisAttsByMaterial)
|
||||
: fpPVModel(pvModel)
|
||||
, fDepth(depth)
|
||||
, fpMesh(pMesh)
|
||||
, fVerticesByMaterial(verticesByMaterial)
|
||||
, fNameAndVisAttsByMaterial(nameAndVisAttsByMaterial)
|
||||
{}
|
||||
@@ -393,7 +393,7 @@ protected:
|
||||
// Do nothing if uninteresting solids found, e.g., the container if not marked invisible.
|
||||
}
|
||||
G4PhysicalVolumeModel* fpPVModel;
|
||||
G4int fDepth;
|
||||
const G4Mesh* fpMesh;
|
||||
std::multimap<const G4Material*,std::vector<G4ThreeVector>>& fVerticesByMaterial;
|
||||
std::map<const G4Material*,NameAndVisAtts>& fNameAndVisAttsByMaterial;
|
||||
};
|
||||
|
||||
@@ -24,45 +24,50 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
// Class Description:
|
||||
//
|
||||
// G4VUserVisAction is added to the scene by the command
|
||||
// /vis/scene/add/userAction, which instantiates a G4CallbackModel to
|
||||
// add to the RunDurationModels. Thus the pure virtual Draw() method
|
||||
// G4VUserVisAction is brought into effect by the command
|
||||
// /vis/scene/add/userAction. The vis manager instantiates a
|
||||
// G4CallbackModel when the vis action is registered, and adds
|
||||
// it to the scene. The pure virtual Draw() method
|
||||
// is invoked whenever the viewer needs to "visit the kernel", e.g.,
|
||||
// to remake its graphical database, if any, or simply to refresh the
|
||||
// screen. operator() is defined to satisfy the template
|
||||
// screen. It is not intended to be called directly. It is called
|
||||
// via the operator() which is defined to satisfy the template
|
||||
// G4CallbackModel<G4VUserVisAction>.
|
||||
//
|
||||
// See the User Guide for Application Developers, Section 8.8.7 and 8.8.8.
|
||||
|
||||
// A concrete Draw() method would normally make use of the Draw() methods
|
||||
// of the vis manager, e.g:
|
||||
// G4VVisManager* pVisManager = G4VVisManager::GetConcreteInstance();
|
||||
// if (pVisManager) {
|
||||
// pVisManager->Draw(G4Box("box",2*cm,2*cm,2*cm),
|
||||
// G4VisAttributes(G4Colour(1,1,0)));
|
||||
// ...
|
||||
// but it can also use pointers fpSceneHandler and pMP that give it
|
||||
// direct access to the current scene handler and modeling parameters
|
||||
// for more advanced use.
|
||||
//
|
||||
// See the User Guide for Application Developers.
|
||||
|
||||
#ifndef G4VUSERVISACTION_HH
|
||||
#define G4VUSERVISACTION_HH
|
||||
|
||||
#include "G4Transform3D.hh"
|
||||
|
||||
class G4VGraphicsScene;
|
||||
class G4ModelingParameters;
|
||||
|
||||
class G4VUserVisAction
|
||||
{
|
||||
public: // With description
|
||||
G4VUserVisAction()
|
||||
: fpSceneHandler(nullptr)
|
||||
, fpMP(nullptr)
|
||||
{}
|
||||
G4VUserVisAction(): fpSceneHandler(nullptr), fpMP(nullptr) {}
|
||||
virtual ~G4VUserVisAction() {}
|
||||
virtual void Draw() = 0;
|
||||
void operator()(G4VGraphicsScene& scene, const G4ModelingParameters* pMP) {
|
||||
fpSceneHandler = &scene;
|
||||
fpMP = pMP;
|
||||
Draw();
|
||||
}
|
||||
protected:
|
||||
virtual void Draw() = 0;
|
||||
G4VGraphicsScene* fpSceneHandler;
|
||||
const G4ModelingParameters* fpMP;
|
||||
};
|
||||
|
||||
@@ -37,8 +37,14 @@
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4SceneTreeItem.hh"
|
||||
|
||||
#include "G4ViewParameters.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4PseudoScene.hh"
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
class G4VSceneHandler;
|
||||
|
||||
@@ -131,6 +137,57 @@ public: // With description
|
||||
virtual void SwitchToMasterThread ();
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Stuff for scene tree.
|
||||
/**
|
||||
- The scene tree is a tree of G4SceneTreeItem objects (see graphics-reps).
|
||||
- Its root is a data member fSceneTree of all viewers by virtue of
|
||||
G4VViewer inheritance,
|
||||
- G4SceneTreeItem is an aggregate of data members that represent
|
||||
properties of objects in the scene (G4Scene). Its data members are
|
||||
low-level types - G4String, G4VisAttributes and G4AttDef/Value - so
|
||||
that it can be used across categories, avoiding coupling.
|
||||
- The root item has children that represent the models (G4VModel
|
||||
sub-classes) in the scene.
|
||||
- For a G4PhysicalVolumeModel (detector components), its children and
|
||||
children's children, etc., imitate the geometry hierarchy of that
|
||||
model. These descendants are called "touchables".
|
||||
- There may be more than one G4PhysicalVolumeModel, depending how
|
||||
the user creates his/her scene.
|
||||
- The scene tree is reviewed, and updated if necessary, at every pass
|
||||
of G4VSceneHandler::ProcessScene. This is called a "kernel visit".
|
||||
- A kernel visit is triggered by some vis commands (e.g.,
|
||||
/vis/viewer/rebuild) and by a viewer if it deems necessary. For
|
||||
example, a kernel visit may not be required for a rotation, zoom, etc.,
|
||||
but required for a change from surface to wireframe.
|
||||
- The idea is that the scene tree can be passed to a GUI, the GUI can
|
||||
create a tree widget, and interactions with it raise UI commands such as
|
||||
/vis/scene/activateModel, /vis/set/touchable and /vis/touchable/set/...
|
||||
The viewer decides if this requires a kernel visit, otherwise it
|
||||
must update fSceneTree itself (utilities are provided -
|
||||
G4VViewer::TouchableSetVisibility/Colour).
|
||||
*/
|
||||
class SceneTreeScene: public G4PseudoScene {
|
||||
// G4PhysicalVolumeModel sends touchables to this scene
|
||||
public:
|
||||
SceneTreeScene() = default;
|
||||
~SceneTreeScene() = default;
|
||||
void SetViewer(G4VViewer* pViewer) {fpViewer = pViewer;}
|
||||
void SetModel(G4VModel* pModel);
|
||||
private:
|
||||
void ProcessVolume(const G4VSolid& solid) override;
|
||||
std::list<G4SceneTreeItem>::iterator FindOrInsertModel
|
||||
(const G4String& modelType,const G4String& modelID);
|
||||
std::list<G4SceneTreeItem>::iterator FindOrInsertTouchable
|
||||
(const G4String& modelID, G4SceneTreeItem& mother,
|
||||
G4int depth, const G4String& partialPathString, const G4String& fullPathString);
|
||||
G4VViewer* fpViewer = nullptr;
|
||||
G4VModel* fpModel = nullptr;
|
||||
};
|
||||
SceneTreeScene& AccessSceneTreeScene() {return fSceneTreeScene;}
|
||||
G4SceneTreeItem& AccessSceneTree() {return fSceneTree;}
|
||||
void UpdateGUISceneTree(); // A utility
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Access functions.
|
||||
const G4String& GetName () const;
|
||||
@@ -221,6 +278,8 @@ protected:
|
||||
G4ViewParameters fDefaultVP; // Default view parameters.
|
||||
G4double fKernelVisitElapsedTimeSeconds = 999.; // Default to a large number
|
||||
// Note: fKernelVisitElapsedTimeSeconds is measured in ProcessView().
|
||||
SceneTreeScene fSceneTreeScene; // G4PhysicalVolumeModel sends touchables to this scene
|
||||
G4SceneTreeItem fSceneTree;
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Other parameters.
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "G4VMarker.hh"
|
||||
#include "G4ModelingParameters.hh"
|
||||
#include "G4PhysicalVolumesSearchScene.hh"
|
||||
#include "G4SceneTreeItem.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4UIcommand;
|
||||
@@ -165,6 +167,7 @@ protected:
|
||||
// handler.
|
||||
static G4bool fThereWasAViewer; // True if there was a viewer
|
||||
static G4ViewParameters fExistingVP; // Its view parameters
|
||||
static G4SceneTreeItem fExistingSceneTree; // Its scene tree
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -101,7 +101,7 @@ public: // With description
|
||||
|
||||
enum CutawayMode {
|
||||
cutawayUnion, // Union (addition) of result of each cutaway plane.
|
||||
cutawayIntersection // Intersection (multiplication) " .
|
||||
cutawayIntersection // Intersection (multiplication).
|
||||
};
|
||||
|
||||
enum RotationStyle {
|
||||
@@ -110,6 +110,7 @@ public: // With description
|
||||
};
|
||||
|
||||
enum SMROption { // Special Mesh Rendering Option
|
||||
meshAsDefault,
|
||||
meshAsDots,
|
||||
meshAsSurfaces
|
||||
};
|
||||
|
||||
@@ -53,6 +53,7 @@ private:
|
||||
G4UIcommand* fpCommandFindPath;
|
||||
G4UIcmdWithoutParameter* fpCommandLocalAxes;
|
||||
G4UIcmdWithABool* fpCommandShowExtent;
|
||||
G4UIcmdWithoutParameter* fpCommandTwinkle;
|
||||
G4UIcmdWithABool* fpCommandVolumeForField;
|
||||
};
|
||||
|
||||
|
||||
@@ -93,18 +93,34 @@
|
||||
#include "G4ToolsSGX11GLES.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_X11_ZB
|
||||
#include "G4ToolsSGX11ZB.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_WINDOWS_GLES
|
||||
#include "G4ToolsSGWindowsGLES.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_WINDOWS_ZB
|
||||
#include "G4ToolsSGWindowsZB.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_XT_GLES
|
||||
#include "G4ToolsSGXtGLES.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_XT_ZB
|
||||
#include "G4ToolsSGXtZB.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
|
||||
#include "G4ToolsSGQtGLES.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_QT_ZB
|
||||
#include "G4ToolsSGQtZB.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VTK
|
||||
#include "G4Vtk.hh" // no_geant4_module_check
|
||||
#endif
|
||||
@@ -113,6 +129,10 @@
|
||||
#include "G4VtkQt.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#if defined (G4VIS_USE_OPENGLQT) || (G4VIS_USE_TOOLSSG_QT_GLES)
|
||||
#include <QtGlobal>
|
||||
#endif
|
||||
|
||||
// The inline keyword prevents the compiler making an external
|
||||
// reference even though they cannot actually be inlined since they
|
||||
// are virtual functions. This prevents a "multiple definition" error
|
||||
@@ -148,6 +168,7 @@ G4VisExecutive::RegisterGraphicsSystems () {
|
||||
// super-abbreviated names and fallback names where approproiate.
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLQT
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
G4VGraphicsSystem* ogliqt = new G4OpenGLImmediateQt;
|
||||
G4VGraphicsSystem* oglsqt = new G4OpenGLStoredQt;
|
||||
RegisterGraphicsSystem(ogliqt);
|
||||
@@ -156,6 +177,7 @@ G4VisExecutive::RegisterGraphicsSystems () {
|
||||
oglsqt->AddNickname("OGL");
|
||||
oglsqt->AddNickname("OGLS");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLXM
|
||||
G4VGraphicsSystem* oglixm = new G4OpenGLImmediateXm;
|
||||
@@ -252,6 +274,12 @@ G4VisExecutive::RegisterGraphicsSystems () {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_X11_ZB
|
||||
G4VGraphicsSystem* tsg_x11_zb = new G4ToolsSGX11ZB;
|
||||
RegisterGraphicsSystem(tsg_x11_zb);
|
||||
tsg_x11_zb->AddNickname("TSGX11ZB");
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_XT_GLES
|
||||
G4VGraphicsSystem* tsg_xt_gles = new G4ToolsSGXtGLES;
|
||||
RegisterGraphicsSystem(tsg_xt_gles);
|
||||
@@ -261,19 +289,40 @@ G4VisExecutive::RegisterGraphicsSystems () {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_XT_ZB
|
||||
G4VGraphicsSystem* tsg_xt_zb = new G4ToolsSGXtZB;
|
||||
RegisterGraphicsSystem(tsg_xt_zb);
|
||||
tsg_xt_zb->AddNickname("TSGXtZB");
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
|
||||
G4VGraphicsSystem* tsg_qt_gles = new G4ToolsSGQtGLES;
|
||||
RegisterGraphicsSystem(tsg_qt_gles);
|
||||
tsg_qt_gles->AddNickname("TSGQt");
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_QT_ZB
|
||||
G4VGraphicsSystem* tsg_qt_zb = new G4ToolsSGQtZB;
|
||||
RegisterGraphicsSystem(tsg_qt_zb);
|
||||
tsg_qt_zb->AddNickname("TSGQtZB");
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_WINDOWS_GLES
|
||||
G4VGraphicsSystem* tsg_windows_gles = new G4ToolsSGWindowsGLES;
|
||||
RegisterGraphicsSystem(tsg_windows_gles);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_WINDOWS_ZB
|
||||
G4VGraphicsSystem* tsg_windows_zb = new G4ToolsSGWindowsZB;
|
||||
RegisterGraphicsSystem(tsg_windows_zb);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
|
||||
tsg_qt_gles->AddNickname("TSG");
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
G4cout << " Qt6: Asking ToolsSG to stand in for OpenGL" << G4endl;
|
||||
tsg_qt_gles->AddNickname("OGL");
|
||||
# endif
|
||||
#elif defined(G4VIS_USE_TOOLSSG_XT_GLES)
|
||||
tsg_xt_gles->AddNickname("TSG");
|
||||
#elif defined(G4VIS_USE_TOOLSSG_X11_GLES)
|
||||
|
||||
Reference in New Issue
Block a user