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 | #ifdef G4VIS_BUILD_OI_DRIVER |
---|
27 | |
---|
28 | /*----------------------------HEPVis----------------------------------------*/ |
---|
29 | /* */ |
---|
30 | /* Node: SoGL2PSAction */ |
---|
31 | /* Author: Guy Barrand */ |
---|
32 | /* */ |
---|
33 | /*--------------------------------------------------------------------------*/ |
---|
34 | |
---|
35 | // this : |
---|
36 | #include <HEPVis/actions/SoGL2PSAction.h> |
---|
37 | |
---|
38 | // Inventor : |
---|
39 | #include <Inventor/elements/SoViewportRegionElement.h> |
---|
40 | #include <Inventor/errors/SoDebugError.h> |
---|
41 | |
---|
42 | #include "Geant4_gl2ps.h" |
---|
43 | |
---|
44 | #include <stdio.h> |
---|
45 | |
---|
46 | SO_ACTION_SOURCE(SoGL2PSAction) |
---|
47 | ////////////////////////////////////////////////////////////////////////////// |
---|
48 | void SoGL2PSAction::initClass( |
---|
49 | ) |
---|
50 | ////////////////////////////////////////////////////////////////////////////// |
---|
51 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
52 | { |
---|
53 | SO_ACTION_INIT_CLASS(SoGL2PSAction,SoGLRenderAction); |
---|
54 | } |
---|
55 | ////////////////////////////////////////////////////////////////////////////// |
---|
56 | SoGL2PSAction::SoGL2PSAction( |
---|
57 | const SbViewportRegion& aViewPortRegion |
---|
58 | ) |
---|
59 | :SoGLRenderAction(aViewPortRegion) |
---|
60 | ,G4OpenGL2PSAction() |
---|
61 | ,fFileName("out.ps") |
---|
62 | ,fFile(0) |
---|
63 | ////////////////////////////////////////////////////////////////////////////// |
---|
64 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
65 | { |
---|
66 | SO_ACTION_CONSTRUCTOR(SoGL2PSAction); |
---|
67 | } |
---|
68 | ////////////////////////////////////////////////////////////////////////////// |
---|
69 | void SoGL2PSAction::setViewport( |
---|
70 | ) |
---|
71 | ////////////////////////////////////////////////////////////////////////////// |
---|
72 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
73 | { |
---|
74 | // Useful ?? L.Garnier 02/2009 |
---|
75 | #ifdef __COIN__ |
---|
76 | #else //SGI |
---|
77 | const SbViewportRegion& vpr = getViewportRegion(); |
---|
78 | SoViewportRegionElement::set(getState(),vpr); |
---|
79 | |
---|
80 | const SbVec2s& win = vpr.getWindowSize(); |
---|
81 | fViewport[0] = 0; |
---|
82 | fViewport[1] = 0; |
---|
83 | fViewport[2] = win[0]; |
---|
84 | fViewport[3] = win[1]; |
---|
85 | #endif |
---|
86 | } |
---|
87 | ////////////////////////////////////////////////////////////////////////////// |
---|
88 | void SoGL2PSAction::beginTraversal( |
---|
89 | SoNode* aNode |
---|
90 | ) |
---|
91 | ////////////////////////////////////////////////////////////////////////////// |
---|
92 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
93 | { |
---|
94 | if(fFile) { |
---|
95 | #ifdef __COIN__ |
---|
96 | const SbViewportRegion& vpr = getViewportRegion(); |
---|
97 | SoViewportRegionElement::set(getState(),vpr); |
---|
98 | G4gl2psBegin(); |
---|
99 | traverse(aNode); |
---|
100 | gl2psEndPage(); |
---|
101 | #else //SGI |
---|
102 | SoGLRenderAction::beginTraversal(aNode); |
---|
103 | #endif |
---|
104 | } else { |
---|
105 | SoGLRenderAction::beginTraversal(aNode); |
---|
106 | } |
---|
107 | } |
---|
108 | |
---|
109 | #endif |
---|