Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -68,10 +68,6 @@
//# Do NOT include glx Here ! It has to be done, after all <Qxx...> includes
//# include <GL/glx.h>
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
# include <Wt/WGLWidget>
# define G4OPENGL_VERSION_2 1
#endif
#if defined (G4VIS_BUILD_OPENGLQT_DRIVER) || defined (G4VIS_USE_OPENGLQT)
#if defined (G4VIS_BUILD_OPENGLX_DRIVER) || defined (G4VIS_USE_OPENGLX)
#else
@@ -1,50 +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. *
// ********************************************************************
//
//
//
//
// OpenGLImmediateWt graphics system factory.
#ifndef G4OPENGLIMMEDIATEWT_HH
#define G4OPENGLIMMEDIATEWT_HH
#include "G4VGraphicsSystem.hh"
namespace Wt {
class WContainerWidget;
}
class G4OpenGLImmediateWt: public G4VGraphicsSystem {
public:
G4OpenGLImmediateWt ();
G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
private:
Wt::WContainerWidget* fWGLContainer;
};
#endif
@@ -1,91 +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. *
// ********************************************************************
//
//
//
//
// Class G4OpenGLImmediateWtViewer : a class derived from
// G4OpenGLWtViewer and G4OpenGLImmediateViewer.
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
#ifndef G4OPENGLIMMEDIATEWTVIEWER_HH
#define G4OPENGLIMMEDIATEWTVIEWER_HH
#include "G4OpenGLImmediateViewer.hh"
#include "G4OpenGLWtViewer.hh"
#include <Wt/WEvent>
#include "globals.hh"
class G4OpenGLImmediateSceneHandler;
class G4OpenGLImmediateWtViewer :
public G4OpenGLWtViewer, public G4OpenGLImmediateViewer, public Wt::WGLWidget {
public:
G4OpenGLImmediateWtViewer (G4OpenGLImmediateSceneHandler& scene, Wt::WContainerWidget*, const G4String& name = "");
~G4OpenGLImmediateWtViewer ();
void Initialise ();
void resizeGL(int, int);
void paintGL();
void initializeGL ();
void DrawView();
void ShowView();
//
void popMatrix();
void pushMatrix();
void multMatrixd(const GLdouble*);
void setMatrixUniforms();
void loadIdentity();
void ComputeView ();
void FinishView();
private:
// void showEvent(QShowEvent event );
void mousePressEvent(Wt::WMouseEvent *event);
void mouseMoveEvent(Wt::WMouseEvent *event);
void mouseDoubleClickEvent(Wt::WMouseEvent *event);
void mouseReleaseEvent(Wt::WMouseEvent event);
// void WtContextMenuEvent(QContextMenuEvent e);
void keyPressEvent (Wt::WKeyEvent *event);
void paintEvent(Wt::WPaintDevice * event);
void updateWWidget();
// A client-side JavaScript matrix variable
JavaScriptMatrix4x4 jsMatrix_;
// void ComputeView ();
// implements G4VViewer::SetView() and ClearView()
// void SetView ();
// void ClearView ();
};
#endif
#endif
@@ -85,7 +85,8 @@ public:
void AddCompound (const G4VDigi&);
void AddCompound (const G4THitsMap<G4double>&);
void AddCompound (const G4THitsMap<G4StatDouble>&);
void AddCompound (const G4Mesh&);
// enum for /vis/ogl/flushAt.
enum FlushAction {
endOfEvent,
@@ -124,13 +125,8 @@ public:
void drawVBOArray(std::vector<double> vertices);
// Buffers used to access vertex and indices elements
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
Wt::WGLWidget::Buffer fVertexBufferObject;
Wt::WGLWidget::Buffer fIndicesBufferObject;
#else
GLuint fVertexBufferObject;
GLuint fIndicesBufferObject;
#endif // G4VIS_BUILD_OPENGLWT_DRIVER
#endif //G4OPENGL_VERSION_2
@@ -28,6 +28,7 @@
//
// 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
@@ -88,183 +89,6 @@
#define glReadPixels(a,b,c,d,e,f,g) fVboDrawer->empty()
#define glTranslatef(a,b,c) fVboDrawer->empty() // TO BE FIXED
// +--------------------------------+
// + WT (OpenGL ES) case +
// +--------------------------------+
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
class G4OpenGLImmediateWtViewer;
// specific definition for WT :
// WARNING fVboDrawer should be the exact name of the object!
#define glGetError() Wt::WGLWidget::NONE
#define glOrtho fVboDrawer->vboGlOrtho
#define glFrustum fVboDrawer->vboGlFrustum
#define glViewport fVboDrawer->vboGlViewport
#define glEnable fVboDrawer->vboGlEnable
#define glDisable fVboDrawer->vboGlDisable
#define glBlendFunc fVboDrawer->vboGlBlendFunc
#define glClear fVboDrawer->vboGlClear
#define glClearColor fVboDrawer->vboGlClearColor
#define glClearDepth fVboDrawer->vboGlClearDepth
#define glDepthFunc fVboDrawer->vboGlDepthFunc
#define glDepthMask fVboDrawer->vboGlDepthMask
#define glFlush fVboDrawer->vboGlFlush
#define glColorMask fVboDrawer->vboGlColorMask
#define glLineWidth fVboDrawer->vboGlLineWidth
#define glUniformMatrix4 fVboDrawer->vboGlUniformMatrix4
#define glDrawArrays fVboDrawer->vboGlDrawArrays
#define glCreateBuffer fVboDrawer->vboGlCreateBuffer
#define glVertexPointer fVboDrawer->vboGlVertexPointer
#define glBindBuffer fVboDrawer->vboGlBindBuffer
#define glDeleteBuffer fVboDrawer->vboGlDeleteBuffer
#define glBufferDatafv fVboDrawer->vboGlBufferDatafv
#define glBufferDataiv fVboDrawer->vboGlBufferDataiv
#define glGetAttribLocation fVboDrawer->vboGlGetAttribLocation
#define glEnableVertexAttribArray fVboDrawer->vboGlEnableVertexAttribArray
#define glDisableVertexAttribArray fVboDrawer->vboGlDisableVertexAttribArray
#define glShaderSource fVboDrawer->vboGlShaderSource
#define glCompileShader fVboDrawer->vboGlCompileShader
#define glCreateShader fVboDrawer->vboGlCreateShader
#define glCreateProgram fVboDrawer->vboGlCreateProgram
#define glAttachShader fVboDrawer->vboGlAttachShader
#define glLinkProgram fVboDrawer->vboGlLinkProgram
#define glUseProgram fVboDrawer->vboGlUseProgram
#define glDrawElements fVboDrawer->vboGlDrawElements
#define glVertexAttribPointer fVboDrawer->vboGlVertexAttribPointer
#define glGetUniformLocation fVboDrawer->vboGlGetUniformLocation
#define glPointSize fVboDrawer->vboGlPointSize
#define glColor3d fVboDrawer->vboGlColor3d
#define glColor4d fVboDrawer->vboGlColor4d
#define glColor4fv fVboDrawer->vboGlColor4fv
#define glMultMatrixd fVboDrawer->vboGlMultMatrixd
#define glMultMatrixf fVboDrawer->vboGlMultMatrixf
#define glGetUniformLocation fVboDrawer->vboGlGetUniformLocation
#define glGetAttribLocation fVboDrawer->vboGlGetAttribLocation
#define glMatrixMode fVboDrawer->vboGlMatrixMode
// Only used in fvboDrawer->VboDrawer to be compatible between Wt and Qt framework
#define glUniform1f fVboViewer->uniform1f
#define glUniform4fv fVboViewer->uniform4fv
#define glUniformMatrix4dv fVboDrawer->vboGlUniformMatrix4;
#define glUniformMatrix4fv fVboDrawer->vboGlUniformMatrix4fv;
#define GL_VIEWPORT Wt::WGLWidget::VIEWPORT
#define GL_RGBA Wt::WGLWidget::RGBA
#define GL_ONE_MINUS_SRC_ALPHA Wt::WGLWidget::ONE_MINUS_SRC_ALPHA
#define GL_BLEND Wt::WGLWidget::BLEND
#define GL_SRC_ALPHA Wt::WGLWidget::SRC_ALPHA
#define GL_LEQUAL Wt::WGLWidget::LEQUAL
#define GL_FALSE false
#define GL_LESS Wt::WGLWidget::LESS
#define GL_SELECT Wt::WGLWidget::SELECT
#define GL_TRUE true
#define GL_RGB Wt::WGLWidget::RGB
#define GL_CURRENT_RASTER_POSITION_VALID Wt::WGLWidget::CURRENT_RASTER_POSITION_VALID
#define GL_ONE Wt::WGLWidget::ONE
#define GL_ZERO Wt::WGLWidget::ZERO
#define GL_COLOR_INDEX Wt::WGLWidget::COLOR_INDEX
#define GL_LINE_TOKEN Wt::WGLWidget::LINE_TOKEN
#define GL_LINE_RESET_TOKEN Wt::WGLWidget::LINE_RESET_TOKEN
#define GL_POLYGON_TOKEN Wt::WGLWidget::POLYGON_TOKEN
#define GL_FEEDBACK Wt::WGLWidget::FEEDBACK
#define GL_COLOR_CLEAR_VALUE Wt::WGLWidget::COLOR_CLEAR_VALUE
#define GL_BITMAP_TOKEN Wt::WGLWidget::BITMAP_TOKEN
#define GL_DRAW_PIXEL_TOKEN Wt::WGLWidget::DRAW_PIXEL_TOKEN
#define GL_COPY_PIXEL_TOKEN Wt::WGLWidget::COPY_PIXEL_TOKEN
#define GL_PASS_THROUGH_TOKEN Wt::WGLWidget::PASS_THROUGH_TOKEN
#define GL_3D_COLOR Wt::WGLWidget::3D_COLOR
#define GL_DEPTH_TEST Wt::WGLWidget::DEPTH_TEST
#define GL_FRONT Wt::WGLWidget::FRONT
#define GL_BACK Wt::WGLWidget::BACK
#define GL_FRONT_AND_BACK Wt::WGLWidget::FRONT_AND_BACK
#define GL_OUT_OF_MEMORY Wt::WGLWidget::OUT_OF_MEMORY
#define GL_LINE_STRIP Wt::WGLWidget::LINE_STRIP
#define GL_QUADS Wt::WGLWidget::QUADS
#define GL_LINE_LOOP Wt::WGLWidget::LINE_LOOP
#define GL_LINES Wt::WGLWidget::LINES
#define GL_POINTS Wt::WGLWidget::POINTS
#define GL_TRIANGLES Wt::WGLWidget::TRIANGLES
#define GL_TRIANGLE_STRIP Wt::WGLWidget::TRIANGLE_STRIP
#define GL_TRIANGLE_FAN Wt::WGLWidget::TRIANGLE_FAN
#define GL_FLOAT Wt::WGLWidget::FLOAT
#define GL_STENCIL_TEST Wt::WGLWidget::STENCIL_TEST
#define GL_ALWAYS Wt::WGLWidget::ALWAYS
#define GL_INVERT Wt::WGLWidget::INVERT
#define GL_COMPILE_AND_EXECUTE Wt::WGLWidget::COMPILE_AND_EXECUTE
#define GL_COMPILE Wt::WGLWidget::COMPILE
#define GL_COLOR_BUFFER_BIT Wt::WGLWidget::COLOR_BUFFER_BIT
#define GL_DEPTH_BUFFER_BIT Wt::WGLWidget::DEPTH_BUFFER_BIT
#define GL_STENCIL_BUFFER_BIT Wt::WGLWidget::STENCIL_BUFFER_BIT
#define GL_UNSIGNED_BYTE Wt::WGLWidget::UNSIGNED_BYTE
#define GL_ARRAY_BUFFER Wt::WGLWidget::ARRAY_BUFFER
#define GL_ELEMENT_ARRAY_BUFFER Wt::WGLWidget::ELEMENT_ARRAY_BUFFER
#define GL_RENDER Wt::WGLWidget::RENDER
#define GL_LUMINANCE Wt::WGLWidget::LUMINANCE
#define GL_STATIC_DRAW Wt::WGLWidget::STATIC_DRAW
#define GL_FRAGMENT_SHADER Wt::WGLWidget::FRAGMENT_SHADER
#define GL_VERTEX_SHADER Wt::WGLWidget::VERTEX_SHADER
#define GL_UNSIGNED_INT Wt::WGLWidget::UNSIGNED_INT
#define GL_UNSIGNED_SHORT Wt::WGLWidget::UNSIGNED_SHORT
#define GL_CULL_FACE Wt::WGLWidget::CULL_FACE
#define GL_MAX_VIEWPORT_DIMS Wt::WGLWidget::MAX_VIEWPORT_DIMS
#define GL_PROJECTION Wt::WGLWidget::FRAGMENT_SHADER // Not the good value, but should be ok, work together with GL_MODELVIEW
#define GL_MODELVIEW Wt::WGLWidget::VERTEX_SHADER // Not the good value, but should be ok, work together with GL_PROJECTION
// to be implemented
#define GL_LINE 0
#define GL_FILL 0
#define GL_PROJECTION_MATRIX 0
#define GL_UNPACK_SWAP_BYTES 0
#define GL_UNPACK_LSB_FIRST 0
#define GL_UNPACK_SKIP_ROWS 0
#define GL_UNPACK_LOW_LENGHT 0
#define GL_UNPACK_SKIP_PIXELS 0
#define GL_UNPACK_ALIGNMENT 0
#define GL_UNPACK_ROW_LENGTH 0
#define GL_CLIP_PLANE0 Wt::WGLWidget::NONE
#define GL_CLIP_PLANE1 Wt::WGLWidget::NONE
#define GL_CLIP_PLANE2 Wt::WGLWidget::NONE
#define GL_CLIP_PLANE3 Wt::WGLWidget::NONE
#define GL_CLIP_PLANE4 Wt::WGLWidget::NONE
#define GL_COLOR_MATERIAL Wt::WGLWidget::NONE
#define GL_AMBIENT_AND_DIFFUSE Wt::WGLWidget::NONE
#define GL_POLYGON 0
#define GL_LIGHTING Wt::WGLWidget::NONE
#define GL_POINT_SMOOTH Wt::WGLWidget::NONE
#define GL_LINE_SMOOTH Wt::WGLWidget::NONE
#define GL_POLYGON_SMOOTH Wt::WGLWidget::NONE
#define GL_LIGHT0 Wt::WGLWidget::NONE
#define GL_AMBIENT Wt::WGLWidget::NONE
#define GL_DIFFUSE Wt::WGLWidget::NONE
#define GL_POSITION Wt::WGLWidget::NONE
#define GLenum Wt::WGLWidget::GLenum
#define GLchar char
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef void GLvoid;
typedef char GLbyte;
typedef short GLshort;
typedef int GLint;
typedef unsigned char GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef int GLsizei;
typedef float GLfloat;
typedef float GLclampf;
typedef double GLdouble;
typedef double GLclampd;
#else
// +--------------------------------+
// + QT (OpenGL ES) case +
// +--------------------------------+
@@ -282,9 +106,6 @@ class G4OpenGLImmediateQtViewer;
#define glColor4fv fVboDrawer->vboGlColor4fv
#endif // G4VIS_BUILD_OPENGLQT_DRIVER
class G4OpenGLViewer;
class G4OpenGLVboDrawer {
@@ -295,49 +116,8 @@ public:
virtual ~G4OpenGLVboDrawer ();
// WT specific
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
void vboGlClear(Wt::WFlags< GLenum > mask);
void vboGlUniformMatrix4(const Wt::WGLWidget::UniformLocation &location, const Wt::WMatrix4x4 &mat);
void vboGlUniformMatrix4(const Wt::WGLWidget::UniformLocation &location, const double* matrix);
void vboGlUniformMatrix4fv(const Wt::WGLWidget::UniformLocation &location, const float* matrix);
void vboGlUniformMatrix4(const Wt::WGLWidget::UniformLocation &location, const Wt::WGLWidget::JavaScriptMatrix4x4 &mat);
Wt::WGLWidget::Buffer vboGlCreateBuffer();
void vboGlBindBuffer(GLenum target, Wt::WGLWidget::Buffer buffer);
void vboGlDeleteBuffer(Wt::WGLWidget::Buffer buffer);
void vboGlVertexAttribPointer(Wt::WGLWidget::AttribLocation location, int size, GLenum type, bool normalized, unsigned stride, unsigned offset);
void vboGlShaderSource(Wt::WGLWidget::Shader shader, GLsizei , const GLchar **src, const GLint *);
void vboGlCompileShader(Wt::WGLWidget::Shader shader);
Wt::WGLWidget::Shader vboGlCreateShader(GLenum shader);
Wt::WGLWidget::Program vboGlCreateProgram();
void vboGlAttachShader(Wt::WGLWidget::Program program, Wt::WGLWidget::Shader shader);
void vboGlLinkProgram(Wt::WGLWidget::Program program);
void vboGlUseProgram(Wt::WGLWidget::Program program);
void vboGlEnableVertexAttribArray(Wt::WGLWidget::AttribLocation pointer);
void vboGlDisableVertexAttribArray(Wt::WGLWidget::AttribLocation pointer);
Wt::WGLWidget::UniformLocation vboGlGetUniformLocation(Wt::WGLWidget::Program programm,const std::string &src);
Wt::WGLWidget::AttribLocation vboGlGetAttribLocation(Wt::WGLWidget::Program shader,const std::string &src);
void vboGlClearColor (double r, double g, double b, double a);
void vboGlClearDepth(double depth);
void vboGlViewport(int x, int y, unsigned width, unsigned height);
void vboGlEnable(GLenum cap);
void vboGlDisable(GLenum cap);
void vboGlBlendFunc (GLenum sfactor, GLenum dfactor);
void vboGlDepthFunc (GLenum func);
void vboGlDepthMask(bool flag);
void vboGlColorMask (bool red, bool green, bool blue, bool alpha);
void vboGlLineWidth(double width);
void vboGlDrawArrays(GLenum mode, int first, unsigned count);
void vboGlBufferDatafv(GLenum target, const std::vector<double>::iterator begin, const std::vector<double>::iterator end, GLenum usage);
void vboGlBufferDataiv(GLenum target, const std::vector<unsigned short>::iterator begin, const std::vector<unsigned short>::iterator end, GLenum usage, GLenum type);
void vboGlDrawElements(GLenum mode, unsigned count, GLenum type, unsigned offset);
void vboGlMultMatrixf( const GLfloat *m );
void vboGlMultMatrixd( const GLdouble *m );
#else
void vboGlMultMatrixf( const GLfloat *m );
void vboGlMultMatrixd( const GLdouble *m );
#endif // G4VIS_BUILD_OPENGLWT_DRIVER
void vboGlFlush();
void vboGlOrtho(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
@@ -372,11 +152,7 @@ private:
std::string fOGLType;
GLenum fMatrixMode;
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
G4OpenGLImmediateWtViewer* fVboViewer;
#else
G4OpenGLImmediateQtViewer* fVboViewer;
#endif // G4VIS_BUILD_OPENGLWT_DRIVER
};
#endif // G4OPENGL_VERSION_2
@@ -115,11 +115,8 @@ public:
bool setExportImageFormat(std::string format,bool quiet = false);
// change the export image format according to thoses available for the current viewer
// Special case for Wt, we want to have acces to the drawer
#ifdef G4OPENGL_VERSION_2
inline G4OpenGLVboDrawer* getWtDrawer() {return fVboDrawer;}
// Associate the Wt drawer to the OpenGLViewer and the OpenGLSceneHandler
void setVboDrawer(G4OpenGLVboDrawer* drawer);
G4OpenGLVboDrawer* fVboDrawer;
@@ -251,17 +248,6 @@ private :
#ifdef G4OPENGL_VERSION_2
public:
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
inline Wt::WGLWidget::Program getShaderProgram() {
return fShaderProgram;
}
inline Wt::WGLWidget::UniformLocation getShaderProjectionMatrix() {
return fpMatrixUniform;
}
inline Wt::WGLWidget::UniformLocation getShaderTransformMatrix() {
return ftMatrixUniform;
}
#else
inline GLuint getShaderProgram() {
return fShaderProgram;
}
@@ -274,30 +260,13 @@ public:
inline GLuint getShaderViewModelMatrix() {
return fmvMatrixUniform;
}
#endif // G4VIS_BUILD_OPENGLWT_DRIVER
protected :
// define the keyword shader to handle it in a better way for OpenGL and WebGL
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
#define Shader Wt::WGLWidget::Shader
#else
#define Shader GLuint
#endif // G4VIS_BUILD_OPENGLWT_DRIVER
// define some attributes and variables for OpenGL and WebGL
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
Wt::WGLWidget::Program fShaderProgram;
// Program and related variables
Wt::WGLWidget::AttribLocation fVertexPositionAttribute;
Wt::WGLWidget::AttribLocation fVertexNormalAttribute;
Wt::WGLWidget::UniformLocation fpMatrixUniform;
Wt::WGLWidget::UniformLocation fcMatrixUniform;
Wt::WGLWidget::UniformLocation fmvMatrixUniform;
Wt::WGLWidget::UniformLocation fnMatrixUniform;
Wt::WGLWidget::UniformLocation ftMatrixUniform;
#else
GLuint fShaderProgram;
// Program and related variables
@@ -308,7 +277,6 @@ protected :
GLuint fmvMatrixUniform;
GLuint fnMatrixUniform;
GLuint ftMatrixUniform;
#endif // G4VIS_BUILD_OPENGLWT_DRIVER
#endif
};
@@ -56,17 +56,11 @@ private:
G4UIcmdWithoutParameter* fpCommandPrintEPS;
G4UIdirectory* fpDirectorySet;
G4UIcommand* fpCommandDisplayHeadTime;
G4UIcommand* fpCommandDisplayLightFront;
G4UIcmdWithAnInteger* fpCommandDisplayListLimit;
G4UIcommand* fpCommandEndTime;
G4UIcmdWithAnInteger* fpCommandEventsDrawInterval;
G4UIcommand* fpCommandExportFormat;
G4UIcmdWithADouble* fpCommandFade;
G4UIcommand* fpCommandPrintFilename;
G4UIcmdWithAString* fpCommandPrintMode;
G4UIcommand* fpCommandPrintSize;
G4UIcommand* fpCommandStartTime;
G4UIcmdWithABool* fpCommandTransparency;
};
@@ -53,12 +53,24 @@ protected:
void CreateGLWin32Context ();
virtual void CreateMainWindow ();
HDC fHDC;
G4bool fMouseHovered;
G4bool fMousePressed;
G4int fMousePressedX, fMousePressedY;
private:
static LRESULT CALLBACK WindowProc(HWND,UINT,WPARAM,LPARAM);
static bool SetWindowPixelFormat(HDC);
private:
static G4bool SetWindowPixelFormat(HDC);
void TrackMouse(G4int, G4int);
void ReleaseMouse();
void SetShift(G4int, G4int);
void SetRotation(G4int, G4int);
void SetZoom(G4int);
HWND fWindow;
HGLRC fHGLRC;
G4bool fInCreateWindow;
};
#endif
@@ -1,271 +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. *
// ********************************************************************
//
//
//
//
// G4OpenGLWtViewer : Class to provide WindowsNT specific
// functionality for OpenGL in GEANT4
#if defined (G4VIS_BUILD_OPENGLWT_DRIVER) || defined (G4VIS_USE_OPENGLWT)
#ifndef G4OPENGLWTVIEWER_HH
#define G4OPENGLWTVIEWER_HH
#include "globals.hh"
#include "G4OpenGLViewer.hh"
#include <Wt/WObject>
#include <Wt/WPoint>
#include <Wt/WTime>
#include <Wt/WContainerWidget>
#include <Wt/WMatrix4x4>
class G4OpenGLSceneHandler;
class G4UImanager;
class WDialog;
#ifdef _A_FINIR_FIXME
class WContextMenuEvent;
#endif
class WMenu;
class WImage;
#ifdef _A_FINIR_FIXME
class WWheelEvent;
#endif
class WProcess;
class G4UIWt;
class G4OpenGLSceneHandler;
class G4OpenGLWtMovieDialog;
class G4OpenGLWtViewer: virtual public G4OpenGLViewer {
public:
G4OpenGLWtViewer (G4OpenGLSceneHandler& scene);
virtual ~G4OpenGLWtViewer ();
virtual void updateWWidget()=0;
Wt::WMatrix4x4 mMatrix;
#ifdef _A_FINIR_FIXME
Wt::WString setEncoderPath(Wt::WString path);
Wt::WString getEncoderPath();
Wt::WString setTempFolderPath(Wt::WString path);
Wt::WString getTempFolderPath();
Wt::WString setSaveFileName(Wt::WString path);
Wt::WString getSaveFileName();
bool isRecording();
bool isStopped();
bool isPaused();
bool isEncoding();
bool isWaiting();
bool isFailed();
void setWaiting();
bool isBadEncoder();
bool isBadOutput();
bool isBadTmp();
bool isSuccess();
void setBadTmp();
void setBadOutput();
void setBadEncoder();
bool isReadyToEncode();
void resetRecording();
void encodeVideo();
void stopVideo();
void saveVideo();
bool generateMpegEncoderParameters();
void displayRecordingStatus();
#endif
void drawText(const char * ,int x,int y,int z, int size);
protected:
void CreateGLWtContext ();
virtual void CreateMainWindow (Wt::WGLWidget*,Wt::WString);
#ifdef _A_FINIR_FIXME
void G4manageContextMenuEvent(Wt::WContextMenuEvent *e);
#endif
void G4MousePressEvent(Wt::WMouseEvent *event);
void G4MouseReleaseEvent();
void G4MouseDoubleClickEvent();
void G4MouseMoveEvent(Wt::WMouseEvent *event);
// void G4wheelEvent (Wt::WWheelEvent * event);
void G4keyPressEvent (Wt::WKeyEvent * event);
void rotateWtScene(float, float);
void rotateWtSceneToggle(float, float);
void moveScene(float, float, float,bool);
#ifdef _A_FINIR_FIXME
void updateKeyModifierState(Wt::KeyboardModifiers);
#endif
inline Wt::WGLWidget* getGLWindow() {
return fWindow;
}
protected:
Wt::WGLWidget* fWindow;
Wt::WWidget* fGLWindow;
bool hasPendingEvents();
void resizeGL(int width, int height);
#ifdef _A_FINIR_FIXME
void savePPMToTemp();
#endif
int fRecordFrameNumber;
bool fHasToRepaint;
bool fReadyToPaint;
bool fIsRepainting;
private:
enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS,BAD_ENCODER,BAD_OUTPUT,BAD_TMP,SAVE};
#ifdef _A_FINIR_FIXME
void createPopupMenu();
void createRadioAction(Wt::WAction *,Wt::WAction *, const std::string&,unsigned int a=1);
#endif
void rescaleImage(int, int);
#ifdef _A_FINIR_FIXME
bool printPDF(const std::string,int,WImage);
void showMovieParametersDialog();
void initMovieParameters();
Wt::WString createTempFolder();
Wt::WString removeTempFolder();
void setRecordingStatus(RECORDING_STEP);
void setRecordingInfos(Wt::WString);
Wt::WString getProcessErrorMsg();
WMenu *fContextMenu;
#endif
mouseActions fMouseAction; // 1: rotate 2:move 3:pick 4:shortcuts
Wt::WPoint fLastPos1;
Wt::WPoint fLastPos2;
Wt::WPoint fLastPos3;
/** delta of scene rotation. This delta is put in degree */
G4double fDeltaRotation;
/** delta of scene translation. This delta is put in % of the scene view */
G4double fDeltaSceneTranslation;
/** delta of depth move. This delta is put in % of the scene view */
G4double fDeltaDepth;
/** delta of zoom move. This delta is put in % of the scene view */
G4double fDeltaZoom;
/** delta of auto move/rotation. This delta is put in % of the move/rotation param */
G4double fDeltaMove;
/** To ensure key event are keep one by one */
bool fHoldKeyEvent;
/** To ensure move event are keep one by one */
bool fHoldMoveEvent;
/** To ensure rotate event are keep one by one */
bool fHoldRotateEvent;
bool fAutoMove;
Wt::WString fEncoderPath;
Wt::WString fTempFolderPath;
Wt::WString fMovieTempFolderPath;
Wt::WString fSaveFileName;
Wt::WString fParameterFileName;
#ifdef _A_FINIR_FIXME
WAction *fRotateAction;
WAction *fMoveAction;
WAction *fPickAction;
WAction *fFullScreenOn;
WAction *fFullScreenOff;
WAction *fDrawingWireframe;
WAction *fDrawingLineRemoval;
WAction *fDrawingSurfaceRemoval;
WAction *fDrawingLineSurfaceRemoval;
#endif
G4OpenGLWtMovieDialog* fMovieParametersDialog;
RECORDING_STEP fRecordingStep;
WProcess *fProcess;
Wt::WTime *fLastEventTime;
int fSpinningDelay;
int fNbMaxFramesPerSec;
float fNbMaxAnglePerSec;
int fLaunchSpinDelay;
Wt::WTabWidget* fUISceneTreeComponentsTBWidget;
G4double fXRot;
G4double fYRot;
bool fNoKeyPress;
bool fAltKeyPress;
bool fControlKeyPress;
bool fShiftKeyPress;
bool fBatchMode;
G4UIWt* fUiWt;
#ifdef _A_FINIR_FIXME
void rotateTheta(int);
void rotatePhi(int);
void moveX(int);
void moveY(int);
void moveZ(int);
#endif
public :
void startPauseVideo();
private :
#ifdef _A_FINIR_FIXME
void actionMouseRotate();
void actionMouseMove();
void actionMousePick();
void actionDrawingWireframe();
void actionDrawingLineRemoval();
void actionDrawingSurfaceRemoval();
void actionDrawingLineSurfaceRemoval();
void actionSaveImage();
void actionChangeBackgroundColor();
void actionChangeTextColor();
void actionChangeDefaultColor();
void actionMovieParameters();
#endif
void showShortcuts();
#ifdef _A_FINIR_FIXME
void toggleDrawingAction(int);
void toggleMouseAction(mouseActions);
void toggleRepresentation(bool);
void toggleProjection(bool);
void toggleTransparency(bool);
void toggleAntialiasing(bool);
void toggleHaloing(bool);
void toggleAux(bool);
void toggleFullScreen(bool);
#endif
void processEncodeFinished();
void processLookForFinished();
void processEncodeStdout();
// Only use for Wt>4.0
// void dialogClosed();
};
#endif
#endif
@@ -40,7 +40,5 @@ G4String G4VisFeaturesOfOpenGLIWin32 ();
G4String G4VisFeaturesOfOpenGLSWin32 ();
G4String G4VisFeaturesOfOpenGLIQt ();
G4String G4VisFeaturesOfOpenGLSQt ();
G4String G4VisFeaturesOfOpenGLIWt ();
//G4String G4VisFeaturesOfOpenGLSWt ();
#endif