Import Geant4 11.2.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2023-06-30 09:09:57 +02:00
parent aef78ca386
commit dd1f179cda
3780 changed files with 212808 additions and 142780 deletions
-37
View File
@@ -1,37 +0,0 @@
name := G4visQt3D
ifndef G4INSTALL
G4INSTALL = ../../..
endif
GLOBLIBS = libG4vis_management.lib libG4modeling.lib
GLOBLIBS += libG4interfaces.lib libG4run.lib libG4event.lib
GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
GLOBLIBS += libG4intercoms.lib libG4global.lib
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
include $(G4INSTALL)/config/G4UI_BUILD.gmk
include $(G4INSTALL)/config/interactivity.gmk
CPPFLAGS += -I$(G4BASE)/visualization/management/include
CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
CPPFLAGS += -I$(G4BASE)/global/management/include
CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
CPPFLAGS += -I$(G4BASE)/graphics_reps/include
CPPFLAGS += -I$(G4BASE)/intercoms/include
CPPFLAGS += -I$(G4BASE)/interfaces/common/include
CPPFLAGS += -I$(G4BASE)/interfaces/basic/include
CPPFLAGS += -I$(G4BASE)/geometry/management/include
CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
CPPFLAGS += -I$(G4BASE)/tracking/include
CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
include $(G4INSTALL)/config/common.gmk
+13
View File
@@ -6,6 +6,19 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-04-26 Ben Morgan (visQt3D-V11-01-03)
- Support compilation against Qt5 and Qt6.
## 2023-03-22 Ben Morgan (visQt3D-V11-01-02)
- Export public compile definitions to indicate availablity of specific drivers. Moves to
"use on link" model.
## 2023-02-06 Ben Morgan (visQt3D-V11-01-01)
- Isolate private headers and update dependencies
## 2023-01-30 Ben Morgan (visQt3D-V11-01-00)
- Link to new G4UIcore/UIimplementation modules in place of former G4UIbasic/UIcommon
## 2022-11-25 Gabriele Cosmo (visQt3D-V11-00-12)
- Fixed compilation warning for implicit type conversions on macOS/XCode 14.1.
+13 -16
View File
@@ -4,6 +4,7 @@
geant4_add_module(G4visQt3D
PUBLIC_HEADERS
G4Qt3D.hh
PRIVATE_HEADERS
G4Qt3DQEntity.hh
G4Qt3DSceneHandler.hh
G4Qt3DUtils.hh
@@ -14,27 +15,23 @@ geant4_add_module(G4visQt3D
G4Qt3DUtils.cc
G4Qt3DViewer.cc)
geant4_module_compile_definitions(G4visQt3D PRIVATE G4VIS_BUILD_QT3D_DRIVER)
geant4_module_compile_definitions(G4visQt3D PUBLIC G4VIS_USE_QT3D)
geant4_module_link_libraries(G4visQt3D
PUBLIC
G4modeling
G4globman
G4hepgeometry
G4vis_management
PRIVATE
G4csg
G4graphics_reps
G4globman
G4geometrymng
G4hepgeometry
G4modeling
G4navigation
G4UIimplementation
G4intercoms
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::3DCore
Qt${QT_VERSION_MAJOR}::3DExtras
Qt${QT_VERSION_MAJOR}::3DRender
PRIVATE
G4csg
G4graphics_reps
G4geometrymng
G4navigation
G4UIbasic
G4intercoms)
Qt${QT_VERSION_MAJOR}::3DRender)
@@ -63,7 +63,25 @@
// following warning: "findBoundingVolumeComputeData: Position attribute not
// suited for bounding volume computation", so for now we use float.
#define PRECISION float
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#define BASETYPE Qt3DRender::QAttribute::Float
#else
#define BASETYPE Qt3DCore::QAttribute::Float
#endif
// Qt3D types move between namespaces between 5 and 6
namespace G4Qt3DCompat
{
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
using Qt3DRender::QAttribute;
using Qt3DRender::QBuffer;
using Qt3DRender::QGeometry;
#else
using Qt3DCore::QAttribute;
using Qt3DCore::QBuffer;
using Qt3DCore::QGeometry;
#endif
}
G4int G4Qt3DSceneHandler::fSceneIdCount = 0;
@@ -302,17 +320,18 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyline& polyline)
polylineBufferArray[iLine++] = polyline[i+1].y();
polylineBufferArray[iLine++] = polyline[i+1].z();
}
auto polylineGeometry = new Qt3DRender::QGeometry();
auto polylineGeometry = new G4Qt3DCompat::QGeometry();
polylineGeometry->setObjectName("polylineGeometry");
auto polylineBuffer = new Qt3DRender::QBuffer(polylineGeometry);
auto polylineBuffer = new G4Qt3DCompat::QBuffer(polylineGeometry);
polylineBuffer->setObjectName("Polyline buffer");
polylineBuffer->setData(polylineByteArray);
auto polylineAtt = new Qt3DRender::QAttribute;
auto polylineAtt = new G4Qt3DCompat::QAttribute;
polylineAtt->setObjectName("Position attribute");
polylineAtt->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
polylineAtt->setName(G4Qt3DCompat::QAttribute::defaultPositionAttributeName());
polylineAtt->setBuffer(polylineBuffer);
polylineAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
polylineAtt->setAttributeType(G4Qt3DCompat::QAttribute::VertexAttribute);
polylineAtt->setVertexBaseType(BASETYPE);
polylineAtt->setVertexSize(3);
polylineAtt->setCount((G4int)nLines);
@@ -331,10 +350,19 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyline& polyline)
polylineEntity->addComponent(material);
auto renderer = new Qt3DRender::QGeometryRenderer;
renderer->setObjectName("polylineWireframeRenderer");
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
auto geometryView = new Qt3DCore::QGeometryView(polylineGeometry);
geometryView->setObjectName("polylineGeometryView");
geometryView->setGeometry(polylineGeometry);
geometryView->setVertexCount(2*nLines);
geometryView->setPrimitiveType(Qt3DCore::QGeometryView::Lines);
renderer->setView(geometryView);
#else
renderer->setObjectName("polylineRenderer");
renderer->setGeometry(polylineGeometry);
renderer->setVertexCount(2*(G4int)nLines);
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
#endif
polylineEntity->addComponent(renderer);
}
@@ -383,17 +411,17 @@ void G4Qt3DSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
polymarkerBufferArray[iMarker++] = polymarker[i].y();
polymarkerBufferArray[iMarker++] = polymarker[i].z();
}
auto polymarkerGeometry = new Qt3DRender::QGeometry();
auto polymarkerGeometry = new G4Qt3DCompat::QGeometry();
polymarkerGeometry->setObjectName("polymarkerGeometry");
auto polymarkerBuffer = new Qt3DRender::QBuffer(polymarkerGeometry);
auto polymarkerBuffer = new G4Qt3DCompat::QBuffer(polymarkerGeometry);
polymarkerBuffer->setObjectName("Polymarker buffer");
polymarkerBuffer->setData(polymarkerByteArray);
auto polymarkerAtt = new Qt3DRender::QAttribute;
auto polymarkerAtt = new G4Qt3DCompat::QAttribute;
polymarkerAtt->setObjectName("Position attribute");
polymarkerAtt->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
polymarkerAtt->setName(G4Qt3DCompat::QAttribute::defaultPositionAttributeName());
polymarkerAtt->setBuffer(polymarkerBuffer);
polymarkerAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
polymarkerAtt->setAttributeType(G4Qt3DCompat::QAttribute::VertexAttribute);
polymarkerAtt->setVertexBaseType(BASETYPE);
polymarkerAtt->setVertexSize(3);
polymarkerAtt->setCount((G4int)nDots);
@@ -821,14 +849,14 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
const auto vertexByteSize = 3*sizeof(PRECISION);
Qt3DRender::QGeometry* vertexGeometry = nullptr;
Qt3DRender::QGeometry* lineGeometry = nullptr;
G4Qt3DCompat::QGeometry* vertexGeometry = nullptr;
G4Qt3DCompat::QGeometry* lineGeometry = nullptr;
Qt3DRender::QAttribute* positionAtt = nullptr;
Qt3DRender::QAttribute* normalAtt = nullptr;
Qt3DRender::QAttribute* lineAtt = nullptr;
G4Qt3DCompat::QAttribute* positionAtt = nullptr;
G4Qt3DCompat::QAttribute* normalAtt = nullptr;
G4Qt3DCompat::QAttribute* lineAtt = nullptr;
Qt3DRender::QBuffer* vertexBuffer = nullptr;
G4Qt3DCompat::QBuffer* vertexBuffer = nullptr;
if (drawing_style == G4ViewParameters::hlr ||
drawing_style == G4ViewParameters::hsr ||
drawing_style == G4ViewParameters::hlhsr) {
@@ -849,18 +877,18 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
vertexBufferArray[i1++] = normals[i].z();
}
// Vertex buffer (vertices and normals)
vertexGeometry = new Qt3DRender::QGeometry();
vertexGeometry = new G4Qt3DCompat::QGeometry();
vertexGeometry->setObjectName("vertexGeometry");
vertexBuffer = new Qt3DRender::QBuffer(vertexGeometry);
vertexBuffer = new G4Qt3DCompat::QBuffer(vertexGeometry);
vertexBuffer->setObjectName("Vertex buffer");
vertexBuffer->setData(vertexByteArray);
// Position attribute
positionAtt = new Qt3DRender::QAttribute;
positionAtt = new G4Qt3DCompat::QAttribute;
positionAtt->setObjectName("Position attribute");
positionAtt->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
positionAtt->setName(G4Qt3DCompat::QAttribute::defaultPositionAttributeName());
positionAtt->setBuffer(vertexBuffer);
positionAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
positionAtt->setAttributeType(G4Qt3DCompat::QAttribute::VertexAttribute);
positionAtt->setVertexBaseType(BASETYPE);
positionAtt->setVertexSize(3);
positionAtt->setCount((G4int)nVerts);
@@ -868,11 +896,11 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
positionAtt->setByteStride(2*vertexByteSize);
// Normal attribute
normalAtt = new Qt3DRender::QAttribute;
normalAtt = new G4Qt3DCompat::QAttribute;
normalAtt->setObjectName("Normal attribute");
normalAtt->setName(Qt3DRender::QAttribute::defaultNormalAttributeName());
normalAtt->setName(G4Qt3DCompat::QAttribute::defaultNormalAttributeName());
normalAtt->setBuffer(vertexBuffer);
normalAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
normalAtt->setAttributeType(G4Qt3DCompat::QAttribute::VertexAttribute);
normalAtt->setVertexBaseType(BASETYPE);
normalAtt->setVertexSize(3);
normalAtt->setCount((G4int)nVerts);
@@ -880,7 +908,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
normalAtt->setByteStride(2*vertexByteSize);
}
Qt3DRender::QBuffer* lineBuffer = nullptr;
G4Qt3DCompat::QBuffer* lineBuffer = nullptr;
if (drawing_style == G4ViewParameters::wireframe ||
drawing_style == G4ViewParameters::hlr ||
drawing_style == G4ViewParameters::hlhsr) {
@@ -900,18 +928,18 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
lineBufferArray[i2++] = line.second.z();
}
// Line loop buffer
lineGeometry = new Qt3DRender::QGeometry();
lineGeometry = new G4Qt3DCompat::QGeometry();
lineGeometry->setObjectName("lineGeometry");
lineBuffer = new Qt3DRender::QBuffer(lineGeometry);
lineBuffer = new G4Qt3DCompat::QBuffer(lineGeometry);
lineBuffer->setObjectName("Line buffer");
lineBuffer->setData(lineByteArray);
// Line attribute
lineAtt = new Qt3DRender::QAttribute;
lineAtt = new G4Qt3DCompat::QAttribute;
lineAtt->setObjectName("Position attribute");
lineAtt->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
lineAtt->setName(G4Qt3DCompat::QAttribute::defaultPositionAttributeName());
lineAtt->setBuffer(lineBuffer);
lineAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
lineAtt->setAttributeType(G4Qt3DCompat::QAttribute::VertexAttribute);
lineAtt->setVertexBaseType(BASETYPE);
lineAtt->setVertexSize(3);
lineAtt->setCount((G4int)nLines);
+10 -1
View File
@@ -338,9 +338,13 @@ void G4Qt3DViewer::mouseMoveEvent(QMouseEvent* ev)
unless mouse tracking has been enabled with QWidget::setMouseTracking().*/
// But this is a window not a widget.
// As a workaround we maintain a flag changed by mousePress/ReleaseEvent.
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
G4double x = ev->x();
G4double y = ev->y();
#else
G4double x = ev->position().x();
G4double y = ev->position().y();
#endif
G4double dx = x-fMousePressedX;
G4double dy = y-fMousePressedY;
fMousePressedX = x;
@@ -383,8 +387,13 @@ void G4Qt3DViewer::mouseMoveEvent(QMouseEvent* ev)
void G4Qt3DViewer::mousePressEvent(QMouseEvent* ev)
{
fMousePressed = true;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
fMousePressedX = ev->x();
fMousePressedY = ev->y();
#else
fMousePressedX = ev->position().x();
fMousePressedY = ev->position().y();
#endif
}
void G4Qt3DViewer::mouseReleaseEvent(QMouseEvent* /*ev*/)