root/branches/Carsten_PtrWork2/Tools/osgBench/TestWindow.h

Revision 446, 5.1 kB (checked in by dirk, 2 years ago)

Added RenderAction? RednerTraversal? comparison.
Added Window access

Line 
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
6  *                                                                           *
7  *                            www.opensg.org                                 *
8  *                                                                           *
9  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
10  *                                                                           *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13  *                                License                                    *
14  *                                                                           *
15  * This library is free software; you can redistribute it and/or modify it   *
16  * under the terms of the GNU Library General Public License as published    *
17  * by the Free Software Foundation, version 2.                               *
18  *                                                                           *
19  * This library is distributed in the hope that it will be useful, but       *
20  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
22  * Library General Public License for more details.                          *
23  *                                                                           *
24  * You should have received a copy of the GNU Library General Public         *
25  * License along with this library; if not, write to the Free Software       *
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
27  *                                                                           *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30  *                                Changes                                    *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35  *                                                                           *
36  *                                                                           *
37 \*---------------------------------------------------------------------------*/
38
39 #ifndef _TESTWINDOW_H_
40 #define _TESTWINDOW_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
44
45 #include <OpenSG/OSGConfig.h>
46 #include <OpenSG/OSGMatrix.h>
47 #include <OpenSG/OSGNode.h>
48 #include <OpenSG/OSGGLUTWindow.h>
49 #include <OpenSG/OSGSimpleSceneManager.h>
50 #include <OpenSG/OSGPerspectiveCamera.h>
51 #include <OpenSG/OSGImage.h>
52 #include <OpenSG/OSGGrabForeground.h>
53
54 #include <Nodes.h>
55
56 class TestWindow
57 {
58     /*==========================  PUBLIC  =================================*/
59   public:
60  
61     TestWindow(void);
62    
63     ~TestWindow();
64    
65     void setSize(OSG::UInt16 width, OSG::UInt16 height);
66     void setFullscreen(void);
67    
68     void setViewport(OSG::Real32 left,   OSG::Real32 right,
69                      OSG::Real32 bottom, OSG::Real32 top   );
70  
71     inline OSG::UInt16 getWidth (void);
72     inline OSG::UInt16 getHeight(void);
73    
74     inline OSG::PerspectiveCameraPtr getCamera(void);
75    
76     inline OSG::NodePtr getScene(void             );
77     inline void         setScene(OSG::NodePtr root);
78     inline void         setScene(NodeBase    &root);
79    
80     void setCamera(OSG::Matrix mat);
81     void setCamera(OSG::Real32 fromx, OSG::Real32 fromy, OSG::Real32 fromz,
82                    OSG::Real32 atx,   OSG::Real32 aty,   OSG::Real32 atz,
83                    OSG::Real32 upx,   OSG::Real32 upy,   OSG::Real32 upz);
84
85     void setNearFar(OSG::Real32 n, OSG::Real32 f);
86     void setFov(OSG::Real32 fov);
87    
88     void showAll(void);
89    
90     void finish(void);
91     void redraw(void);
92
93     OSG::ImagePtr snapshot(void);
94    
95     void open  (void);
96     void close (void);   
97     inline bool isOpen(void);
98    
99     inline OSG::SimpleSceneManager *getSSM(void);
100     inline OSG::WindowPtr           getWindow(void);
101    
102     /*=========================  PROTECTED  ===============================*/
103   protected:
104
105     void update(void);
106
107     /*==========================  PRIVATE  ================================*/
108   private:
109  
110     OSG::Int16 _width, _height;
111     OSG::Real32 _left, _right, _bottom, _top;
112     OSG::NodePtr _scene; 
113     OSG::GLUTWindowPtr _window;
114     OSG::SimpleSceneManager *_ssm;
115     OSG::Real32 _near, _far, _fov;
116     OSG::TransformPtr _beacon;
117     OSG::GrabForegroundPtr _grabber;
118    
119     bool _open;
120     int  _winid;
121 };
122
123 #include "TestWindow.inl"
124
125 #endif
Note: See TracBrowser for help on using the browser.