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 | // |
---|
27 | // $Id: G4OpenGLViewer.hh,v 1.26 2009/02/04 16:48:41 lgarnier Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
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" |
---|
40 | #include <GL/gl.h> |
---|
41 | |
---|
42 | class G4OpenGLSceneHandler; |
---|
43 | |
---|
44 | // Base class for various OpenGLView classes. |
---|
45 | class G4OpenGLViewer: virtual public G4VViewer { |
---|
46 | |
---|
47 | friend class G4OpenGLSceneHandler; |
---|
48 | friend class G4OpenGLImmediateSceneHandler; |
---|
49 | friend class G4OpenGLStoredSceneHandler; |
---|
50 | friend class G4OpenGLFileSceneHandler; |
---|
51 | friend class G4OpenGLViewerMessenger; |
---|
52 | |
---|
53 | public: |
---|
54 | void ClearView (); |
---|
55 | |
---|
56 | protected: |
---|
57 | G4OpenGLViewer (G4OpenGLSceneHandler& scene); |
---|
58 | virtual ~G4OpenGLViewer (); |
---|
59 | void SetView (); |
---|
60 | void HaloingFirstPass (); |
---|
61 | void HaloingSecondPass (); |
---|
62 | void HLRFirstPass (); |
---|
63 | void HLRSecondPass (); |
---|
64 | void HLRThirdPass (); |
---|
65 | void InitializeGLView (); |
---|
66 | void ResizeGLView(); |
---|
67 | void Pick(GLdouble x, GLdouble y); |
---|
68 | virtual void CreateFontLists () {} |
---|
69 | virtual void printVectoredEPS(); |
---|
70 | void rotateScene (G4double dx, G4double dy,G4double delta); |
---|
71 | //////////////////////////////Vectored PostScript production functions/// |
---|
72 | GLubyte* grabPixels (int inColor, |
---|
73 | unsigned int width, |
---|
74 | unsigned int height); |
---|
75 | int generateEPS (const char* filnam, |
---|
76 | int inColour, |
---|
77 | unsigned int width, |
---|
78 | unsigned int height); |
---|
79 | void WritePostScript(const char *aFile); |
---|
80 | void printBuffer(GLint, GLfloat*); |
---|
81 | GLfloat* spewPrimitiveEPS (FILE*, GLfloat*); |
---|
82 | void spewSortedFeedback (FILE*, GLint, GLfloat*); |
---|
83 | void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*); |
---|
84 | void print3DcolorVertex(GLint, GLint*, GLfloat*); |
---|
85 | GLdouble getSceneNearWidth(); |
---|
86 | GLdouble getSceneFarWidth(); |
---|
87 | GLdouble getSceneDepth(); |
---|
88 | std::string fPrintFilename; |
---|
89 | G4bool fPrintColour; |
---|
90 | G4bool fVectoredPs; |
---|
91 | |
---|
92 | G4OpenGLSceneHandler& fOpenGLSceneHandler; |
---|
93 | G4Colour background; //the OpenGL clear colour |
---|
94 | unsigned int fWinSize_x, fWinSize_y; |
---|
95 | // size of the OpenGL frame |
---|
96 | G4bool |
---|
97 | transparency_enabled, //is alpha blending enabled? |
---|
98 | antialiasing_enabled, //is antialiasing enabled? |
---|
99 | haloing_enabled; //is haloing enabled for wireframe? |
---|
100 | G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps). |
---|
101 | G4double fFadeFactor; // 0: no fade; 1: maximum fade with time within range. |
---|
102 | G4bool fDisplayHeadTime; // Display head time (fEndTime) in 2D text. |
---|
103 | G4double fDisplayHeadTimeX, fDisplayHeadTimeY; // 2D screen coords. |
---|
104 | G4double fDisplayHeadTimeSize; // Screen size. |
---|
105 | G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue; |
---|
106 | G4bool fDisplayLightFront;// Display light front at head time originating at |
---|
107 | G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ, |
---|
108 | fDisplayLightFrontT; |
---|
109 | G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue; |
---|
110 | |
---|
111 | private : |
---|
112 | G4float fPointSize; |
---|
113 | }; |
---|
114 | |
---|
115 | typedef struct G4OpenGLViewerFeedback3Dcolor { |
---|
116 | GLfloat x; |
---|
117 | GLfloat y; |
---|
118 | GLfloat z; |
---|
119 | GLfloat red; |
---|
120 | GLfloat green; |
---|
121 | GLfloat blue; |
---|
122 | GLfloat alpha; |
---|
123 | } Feedback3Dcolor; |
---|
124 | |
---|
125 | #endif |
---|
126 | |
---|
127 | #endif |
---|