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
@@ -71,21 +71,13 @@
#if defined (G4VIS_BUILD_OPENGLX_DRIVER) || defined (G4VIS_USE_OPENGLX)
#else
#ifdef __MACH__
//# define G4OPENGL_VERSION_2 1
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include <qgl.h>
#endif
#endif
#ifdef G4OPENGL_VERSION_2
# undef G4VIS_BUILD_OPENGL_GL2PS
// include all redefinitions of openGl functions for Vertex Buffer Objects
# include "G4OpenGLVboDrawer.hh"
#endif
#define G4OPENGL_FLT_BIG 1.e20
#endif
@@ -35,14 +35,12 @@
#include "G4OpenGLImmediateViewer.hh"
#include "G4OpenGLQtViewer.hh"
#include <qgl.h> // include <qglwidget.h>
#include "globals.hh"
class G4OpenGLImmediateSceneHandler;
class G4OpenGLImmediateQtViewer:
public G4OpenGLQtViewer, public G4OpenGLImmediateViewer, public QGLWidget {
public G4OpenGLQtViewer, public G4OpenGLImmediateViewer, public G4QGLWidgetType {
public:
G4OpenGLImmediateQtViewer (G4OpenGLImmediateSceneHandler& scene,
@@ -49,7 +49,15 @@ class G4UImanager;
class G4Text;
class G4UIcommand;
class QGLWidget;
#include <QtGlobal>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QGLWidget>
using G4QGLWidgetType = QGLWidget;
#else
#include <QOpenGLWidget>
using G4QGLWidgetType = QOpenGLWidget;
#endif
class QDialog;
class QTextEdit;
class QContextMenuEvent;
@@ -72,9 +80,6 @@ class QColor;
class G4OpenGLSceneHandler;
class G4OpenGLQtMovieDialog;
class QLineEdit;
#if QT_VERSION < 0x050600
class QSignalMapper;
#endif
class G4UIQt;
class QTableWidget;
class QTableWidgetItem;
@@ -166,7 +171,7 @@ public:
protected:
void CreateGLQtContext ();
virtual void CreateMainWindow (QGLWidget*,const QString&);
virtual void CreateMainWindow (G4QGLWidgetType*,const QString&);
void G4manageContextMenuEvent(QContextMenuEvent *e);
void rotateQtScene(float, float);
void rotateQtSceneToggle(float, float);
@@ -184,6 +189,7 @@ protected:
bool isCurrentWidget();
protected:
G4UIQt* fUiQt;
QWidget* fGLWidget;
void savePPMToTemp();
int fRecordFrameNumber;
@@ -307,7 +313,7 @@ private:
G4OpenGLQtMovieDialog* fMovieParametersDialog;
RECORDING_STEP fRecordingStep;
QProcess *fProcess;
#if QT_VERSION < 0x050e00
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QTime *fLastEventTime;
#else
QElapsedTimer *fLastEventTime;
@@ -358,12 +364,7 @@ private:
QTreeWidgetItem* fModelShortNameItem;
int fNumber;
int fMaxPOindexInserted;
G4UIQt* fUiQt;
#if QT_VERSION < 0x050600
QSignalMapper *fSignalMapperMouse;
QSignalMapper *fSignalMapperSurface;
QSignalMapper *fSignalMapperPicking;
#endif
// quick map index to find next item
std::map <int, QTreeWidgetItem*>::const_iterator fLastSceneTreeWidgetAskForIterator;
std::map <int, QTreeWidgetItem*>::const_iterator fLastSceneTreeWidgetAskForIteratorEnd;
@@ -103,31 +103,6 @@ public:
static void SetFlushAction(FlushAction action)
{fFlushAction = action;}
#ifdef G4OPENGL_VERSION_2
private :
// vertex vector to be given to the graphic card
std::vector<double> fOglVertex;
// indices vector to be given to the graphic card
std::vector<unsigned short> fOglIndices;
// before, drawyType (as GL_QUADS, GL_TRIANGLES...) was
// given in glBegin. Now it has to be given in glDrawArray (at the end)
GLenum fDrawArrayType;
// emulate GL_QUADS behaviour by inverting two last positions
bool fEmulate_GL_QUADS;
// Try to optimize a bit the pipeline
void OptimizeVBOForTrd();
void OptimizeVBOForCons(G4int aNoFacet);
// emulating glEnd and glBegin
void glEndVBO();
void glBeginVBO(GLenum type);
void drawVBOArray(std::vector<double> vertices);
// Buffers used to access vertex and indices elements
GLuint fVertexBufferObject;
GLuint fIndicesBufferObject;
#endif //G4OPENGL_VERSION_2
protected:
G4OpenGLSceneHandler (G4VGraphicsSystem& system,
@@ -141,19 +116,6 @@ protected:
void ClearAndDestroyAtts(); // Destroys att holders and clears pick map.
#ifdef G4OPENGL_VERSION_2
// Special case for VBO, we want to have acces to the VBO drawer everywhere
// because instead of OpenGL call which are static, VBO openGL functions :
// - Are functions of an WGLWidget object(G4OpenGLImmediateViewer in our case)
// - Needs an access to the QGLSHader
// - Have to be redefined in a VBO way
inline void setVboDrawer(G4OpenGLVboDrawer* drawer) {
fVboDrawer = drawer;
}
G4OpenGLVboDrawer* fVboDrawer;
#endif // G4OPENGL_VERSION_2
GLuint fPickName;
std::map<GLuint, G4AttHolder*> fPickMap; // For picking.
@@ -34,7 +34,6 @@
#include "G4OpenGLStoredViewer.hh"
#include "G4OpenGLQtViewer.hh"
#include <qgl.h> // include qglwidget
class QMouseEvent;
class QWheelEvent;
@@ -43,7 +42,7 @@ class QContextMenuEvent;
class G4OpenGLStoredSceneHandler;
class G4OpenGLStoredQtViewer:
public G4OpenGLQtViewer, public G4OpenGLStoredViewer, public QGLWidget {
public G4OpenGLQtViewer, public G4OpenGLStoredViewer, public G4QGLWidgetType {
public:
G4OpenGLStoredQtViewer (G4OpenGLStoredSceneHandler& scene,
@@ -1,161 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// G4OpenGLVboDrawer : Class to provide Wt and Qt specific
// functionality for OpenGL in GEANT4
// All references to Wt removed - 1/3/21 JA
#ifndef G4OpenGLVboDrawer_HH
#define G4OpenGLVboDrawer_HH
#include "G4OpenGL.hh"
#ifdef G4OPENGL_VERSION_2
// GL2PS
#define GL2PS_TEXT_B 4
#define GL2PS_TEXT_BL 5
#define GL2PS_TEXT_BR 6
#define GL2PS_EPS 1
#define GL2PS_PDF 2
#define GL2PS_PS 3
#define GL2PS_SVG 4
#define glEdgeFlag(a) fVboDrawer->empty()
#define glRenderMode(a) fVboDrawer->returnNULL()
#define glClipPlane(a,b) fVboDrawer->empty()
#define glGetIntegerv(a,b) fVboDrawer->empty()
#define glGetFloatv(a,b) fVboDrawer->empty()
#define glGetDoublev(a,b) fVboDrawer->empty()
#define glPassThrough fVboDrawer->empty()
#define glGetBooleanv fVboDrawer->empty()
#define glLoadName(a) fVboDrawer->empty()
#define glPushMatrix() fVboDrawer->empty()
#define glLoadIdentity() fVboDrawer->empty()
#define glPopMatrix() fVboDrawer->empty()
#define glCallList(a) fVboDrawer->empty()
#define glGenLists(a) fVboDrawer->returnNULL()
#define glVertex3d fVboDrawer->empty()
#define glBegin fVboDrawer->empty()
#define glEnd fVboDrawer->empty()
#define glNewList(a,b) fVboDrawer->empty()
#define glEndList() fVboDrawer->empty()
#define glPolygonMode(a,b) fVboDrawer->empty()
#define glDrawBuffer(a) fVboDrawer->empty()
#define glDeleteLists(a,b) fVboDrawer->empty()
#define glStencilFunc(a,b,c) fVboDrawer->empty()
#define glStencilOp(a,b,c) fVboDrawer->empty()
#define glColorMaterial(a,b) fVboDrawer->empty()
#define glLightfv(a,b,c) fVboDrawer->empty()
#define glScaled(a,b,c) fVboDrawer->empty()
#define gluLookAt fVboDrawer->empty()
#define gluPickMatrix fVboDrawer->empty()
#define glSelectBuffer(a,b) fVboDrawer->empty()
#define glInitNames() fVboDrawer->empty()
#define glPushNames(a) fVboDrawer->empty()
#define glPushName(a) fVboDrawer->empty()
#define glPixelStorei(a,b) fVboDrawer->empty()
#define glRasterPos3d(a,b,c) fVboDrawer->empty()
#define Geant4_gl2psTextOpt(a,b,c,d,e) fVboDrawer->empty()
#define glMaterialfv(a,b,c) fVboDrawer->empty()
#define glCullFace(a) fVboDrawer->empty()
#define glReadBuffer(a) fVboDrawer->empty()
#define glReadPixels(a,b,c,d,e,f,g) fVboDrawer->empty()
#define glTranslatef(a,b,c) fVboDrawer->empty() // TO BE FIXED
// +--------------------------------+
// + QT (OpenGL ES) case +
// +--------------------------------+
class G4OpenGLImmediateQtViewer;
#define glOrtho fVboDrawer->vboGlOrtho
#define glFrustum fVboDrawer->vboGlFrustum
#define glMultMatrixf fVboDrawer->vboGlMultMatrixf
#define glMultMatrixd fVboDrawer->vboGlMultMatrixd
#define glMatrixMode fVboDrawer->vboGlMatrixMode
#define glPointSize fVboDrawer->vboGlPointSize
#define glColor3d fVboDrawer->vboGlColor3d
#define glColor4d fVboDrawer->vboGlColor4d
#define glColor4fv fVboDrawer->vboGlColor4fv
class G4OpenGLViewer;
class G4OpenGLVboDrawer {
public:
G4OpenGLVboDrawer (G4OpenGLViewer*, std::string type);
// Create a new OpenGL Drawer. Type could be one of the following :
// OGL-ES, OGL-Stored, OGL-Immediate, OGL-VBO
virtual ~G4OpenGLVboDrawer ();
void vboGlMultMatrixf( const GLfloat *m );
void vboGlMultMatrixd( const GLdouble *m );
void vboGlFlush();
void vboGlOrtho(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
void vboGlFrustum(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
void vboGlMatrixMode(GLenum);
void vboGlPointSize(float size);
inline void vboGlColor3d(int red,int green,int blue) {
vboGlColor4d(red,green, blue, 1.0);
}
void vboGlColor4d(int red,int green,int blue,int alpha);
void vboGlColor4fv(const GLfloat*);
inline const char * getFragmentShaderSrc() {
return fFragmentShaderSrc;
}
inline const char * getVertexShaderSrc() {
return fVertexShaderSrc;
}
inline bool isVBO() {
if ((fOGLType == "OGL-ES") || (fOGLType == "OGL-VBO")) {
return true;
}
return false;
}
inline void empty() {}
inline GLuint returnNULL() {
return 0;
}
private:
const char *fFragmentShaderSrc;
const char *fVertexShaderSrc;
std::string fOGLType;
GLenum fMatrixMode;
G4OpenGLImmediateQtViewer* fVboViewer;
};
#endif // G4OPENGL_VERSION_2
#endif // G4OpenGLVboDrawer_HH
@@ -34,9 +34,6 @@
#include "G4VViewer.hh"
#include "G4OpenGL.hh"
#ifdef G4OPENGL_VERSION_2
#include "G4OpenGLVboDrawer.hh"
#endif
class G4OpenGLSceneHandler;
class G4gl2ps;
@@ -110,16 +107,6 @@ public:
virtual bool exportImage(std::string name="", int width=-1, int height=-1);
bool setExportImageFormat(std::string format,bool quiet = false);
#ifdef G4OPENGL_VERSION_2
void setVboDrawer(G4OpenGLVboDrawer* drawer);
G4OpenGLVboDrawer* fVboDrawer;
inline bool isInitialized() {
return fGlViewInitialized;
}
#endif
protected:
G4OpenGLViewer (G4OpenGLSceneHandler& scene);
virtual ~G4OpenGLViewer ();
@@ -241,39 +228,6 @@ private :
bool fIsGettingPickInfos;
// Block SetView() during picking
#ifdef G4OPENGL_VERSION_2
public:
inline GLuint getShaderProgram() {
return fShaderProgram;
}
inline GLuint getShaderProjectionMatrix() {
return fpMatrixUniform;
}
inline GLuint getShaderTransformMatrix() {
return ftMatrixUniform;
}
inline GLuint getShaderViewModelMatrix() {
return fmvMatrixUniform;
}
protected :
// define the keyword shader to handle it in a better way for OpenGL and WebGL
#define Shader GLuint
// define some attributes and variables for OpenGL and WebGL
GLuint fShaderProgram;
// Program and related variables
GLuint fVertexPositionAttribute;
GLuint fVertexNormalAttribute;
GLuint fpMatrixUniform;
GLuint fcMatrixUniform;
GLuint fmvMatrixUniform;
GLuint fnMatrixUniform;
GLuint ftMatrixUniform;
#endif
};
#endif