[529] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
[1046] | 27 | // $Id: G4OpenGLViewer.hh,v 1.32 2009/05/14 16:38:23 lgarnier Exp $ |
---|
[906] | 28 | // GEANT4 tag $Name: $ |
---|
[529] | 29 | // |
---|
| 30 | // |
---|
| 31 | // Andrew Walkden 27th March 1996 |
---|
| 32 | // OpenGL viewer - opens window, hard copy, etc. |
---|
| 33 | |
---|
| 34 | #ifdef G4VIS_BUILD_OPENGL_DRIVER |
---|
| 35 | |
---|
| 36 | #ifndef G4OPENGLVIEWER_HH |
---|
| 37 | #define G4OPENGLVIEWER_HH |
---|
| 38 | |
---|
| 39 | #include "G4VViewer.hh" |
---|
[923] | 40 | #include "G4OpenGL.hh" |
---|
[529] | 41 | |
---|
| 42 | class G4OpenGLSceneHandler; |
---|
[923] | 43 | class G4OpenGL2PSAction; |
---|
[529] | 44 | |
---|
| 45 | // Base class for various OpenGLView classes. |
---|
| 46 | class G4OpenGLViewer: virtual public G4VViewer { |
---|
| 47 | |
---|
| 48 | friend class G4OpenGLSceneHandler; |
---|
| 49 | friend class G4OpenGLImmediateSceneHandler; |
---|
| 50 | friend class G4OpenGLStoredSceneHandler; |
---|
[606] | 51 | friend class G4OpenGLFileSceneHandler; |
---|
[529] | 52 | friend class G4OpenGLViewerMessenger; |
---|
| 53 | |
---|
| 54 | public: |
---|
| 55 | void ClearView (); |
---|
| 56 | |
---|
| 57 | protected: |
---|
| 58 | G4OpenGLViewer (G4OpenGLSceneHandler& scene); |
---|
| 59 | virtual ~G4OpenGLViewer (); |
---|
| 60 | void SetView (); |
---|
| 61 | void HaloingFirstPass (); |
---|
| 62 | void HaloingSecondPass (); |
---|
| 63 | void HLRFirstPass (); |
---|
| 64 | void HLRSecondPass (); |
---|
| 65 | void HLRThirdPass (); |
---|
| 66 | void InitializeGLView (); |
---|
[1039] | 67 | void ResizeGLView(); |
---|
| 68 | void ResizeWindow(unsigned int, unsigned int); |
---|
[593] | 69 | void Pick(GLdouble x, GLdouble y); |
---|
[529] | 70 | virtual void CreateFontLists () {} |
---|
[798] | 71 | void rotateScene (G4double dx, G4double dy,G4double delta); |
---|
[1332] | 72 | void rotateSceneInViewDirection (G4double dx, G4double dy,G4double delta); |
---|
[593] | 73 | //////////////////////////////Vectored PostScript production functions/// |
---|
[941] | 74 | void printEPS(); |
---|
[1039] | 75 | // print EPS file. Depending of fVectoredPs, it will print Vectored or not |
---|
[1041] | 76 | void setPrintSize(G4int,G4int); |
---|
| 77 | // set the new print size. |
---|
| 78 | // -1 means 'print size' = 'window size' |
---|
| 79 | // Setting size greater than max OpenGL viewport size will set the size to |
---|
| 80 | // maximum |
---|
| 81 | void setPrintFilename(G4String name,G4bool inc); |
---|
| 82 | // set print filename. |
---|
| 83 | // if inc, then the filename will be increment by one each time |
---|
| 84 | std::string getRealPrintFilename(); |
---|
[1037] | 85 | unsigned int getWinWidth(); |
---|
[1040] | 86 | unsigned int getWinHeight(); |
---|
[1039] | 87 | G4bool sizeHasChanged(); |
---|
| 88 | // return true if size has change since last redraw |
---|
[712] | 89 | GLdouble getSceneNearWidth(); |
---|
| 90 | GLdouble getSceneFarWidth(); |
---|
| 91 | GLdouble getSceneDepth(); |
---|
[916] | 92 | G4bool fPrintColour; |
---|
| 93 | G4bool fVectoredPs; |
---|
[593] | 94 | |
---|
| 95 | G4OpenGLSceneHandler& fOpenGLSceneHandler; |
---|
[529] | 96 | G4Colour background; //the OpenGL clear colour |
---|
| 97 | G4bool |
---|
| 98 | transparency_enabled, //is alpha blending enabled? |
---|
| 99 | antialiasing_enabled, //is antialiasing enabled? |
---|
| 100 | haloing_enabled; //is haloing enabled for wireframe? |
---|
| 101 | G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps). |
---|
| 102 | G4double fFadeFactor; // 0: no fade; 1: maximum fade with time within range. |
---|
| 103 | G4bool fDisplayHeadTime; // Display head time (fEndTime) in 2D text. |
---|
| 104 | G4double fDisplayHeadTimeX, fDisplayHeadTimeY; // 2D screen coords. |
---|
| 105 | G4double fDisplayHeadTimeSize; // Screen size. |
---|
| 106 | G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue; |
---|
| 107 | G4bool fDisplayLightFront;// Display light front at head time originating at |
---|
| 108 | G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ, |
---|
| 109 | fDisplayLightFrontT; |
---|
| 110 | G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue; |
---|
[921] | 111 | G4OpenGL2PSAction* fGL2PSAction; |
---|
[916] | 112 | |
---|
| 113 | private : |
---|
[1041] | 114 | G4int fPrintSizeX; |
---|
| 115 | G4int fPrintSizeY; |
---|
| 116 | G4String fPrintFilename; |
---|
[1042] | 117 | int fPrintFilenameIndex; |
---|
[1039] | 118 | unsigned int fWinSize_x, fWinSize_y; |
---|
[916] | 119 | G4float fPointSize; |
---|
[1039] | 120 | G4bool fSizeHasChanged; |
---|
| 121 | // size of the OpenGL frame |
---|
[941] | 122 | bool printGl2PS(); |
---|
[1041] | 123 | G4int getRealPrintSizeX(); |
---|
| 124 | G4int getRealPrintSizeY(); |
---|
[946] | 125 | GLubyte* grabPixels (int inColor, |
---|
| 126 | unsigned int width, |
---|
| 127 | unsigned int height); |
---|
| 128 | bool printNonVectoredEPS (); |
---|
| 129 | // print non vectored EPS files |
---|
| 130 | |
---|
| 131 | bool printVectoredEPS(); |
---|
| 132 | // print vectored EPS files |
---|
[529] | 133 | }; |
---|
| 134 | |
---|
[593] | 135 | typedef struct G4OpenGLViewerFeedback3Dcolor { |
---|
| 136 | GLfloat x; |
---|
| 137 | GLfloat y; |
---|
| 138 | GLfloat z; |
---|
| 139 | GLfloat red; |
---|
| 140 | GLfloat green; |
---|
| 141 | GLfloat blue; |
---|
| 142 | GLfloat alpha; |
---|
| 143 | } Feedback3Dcolor; |
---|
| 144 | |
---|
[529] | 145 | #endif |
---|
| 146 | |
---|
| 147 | #endif |
---|