fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Window / Base / OSGCamera.h
blobdcd894d726eafa543aacb048f5b6f9d4d18c0991
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 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGCAMERA_H_
40 #define _OSGCAMERA_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGMatrix.h"
46 #include "OSGFrustumVolume.h"
47 #include "OSGCameraBase.h"
49 OSG_BEGIN_NAMESPACE
51 class Viewport;
52 class FrustumVolume;
53 class Line;
55 /*! \brief Camera base class. See \ref PageSystemWindowCamera for a
56 description.
58 \ingroup GrpSystemWindowCamera
59 \ingroup GrpLibOSGSystem
60 \includebasedoc
63 class OSG_SYSTEM_DLLMAPPING Camera : public CameraBase
65 /*========================== PUBLIC =================================*/
67 public:
69 typedef CameraBase Inherited;
71 /*---------------------------------------------------------------------*/
72 /*! \name Class Get */
73 /*! \{ */
75 /*! \} */
76 /*---------------------------------------------------------------------*/
77 /*! \name transformation */
78 /*! \{ */
80 virtual void changed(ConstFieldMaskArg whichField,
81 UInt32 origin,
82 BitVector detail);
84 /*! \} */
85 /*---------------------------------------------------------------------*/
86 /*! \name Setup Rendering */
87 /*! \{ */
89 /*! \} */
90 /*---------------------------------------------------------------------*/
91 /*! \name Access Parameters */
92 /*! \{ */
94 virtual void getProjection (Matrix &result,
95 UInt32 width,
96 UInt32 height);
98 virtual void getProjectionTranslation (Matrix &result,
99 UInt32 width,
100 UInt32 height);
102 virtual void getViewing (Matrix &result,
103 UInt32 width,
104 UInt32 height);
106 virtual void getFrustum (FrustumVolume &result,
107 UInt32 width,
108 UInt32 height);
110 virtual void getDecoration (Matrix &result,
111 UInt32 width,
112 UInt32 height);
114 // Getters
115 virtual Matrix getProjectionVal (UInt32 width,
116 UInt32 height);
118 virtual Matrix getProjectionTranslationVal(UInt32 width,
119 UInt32 height);
121 virtual Matrix getViewingVal (UInt32 width,
122 UInt32 height);
124 virtual Matrix getDecorationVal (UInt32 width,
125 UInt32 height);
127 /*! \} */
128 /*---------------------------------------------------------------------*/
129 /*! \name Access Parameters */
130 /*! \{ */
132 void calcFrustum ( FrustumVolume &result,
133 const Viewport &port );
135 void calcWorldToScreen ( Matrix &result,
136 const Viewport &port );
139 FrustumVolume calcFrustumVal (const Viewport &port );
141 Matrix calcWorldToScreenVal(const Viewport &port );
143 #ifdef OSG_1_COMPAT
144 void getFrustum ( FrustumVolume &result,
145 const Viewport &port );
147 void getWorldToScreen ( Matrix &result,
148 const Viewport &port );
150 FrustumVolume getFrustumVal (const Viewport &port );
152 Matrix getWorldToScreenVal (const Viewport &port );
153 #endif
155 /*! \} */
156 /*---------------------------------------------------------------------*/
157 /*! \name Tile Information */
158 /*! \{ */
160 virtual Vec2u tileGetFullSize(void) const;
161 virtual Vec4f tileGetRegion (void) const;
163 /*! \} */
164 /*---------------------------------------------------------------------*/
165 /*! \name Intersection Helper */
166 /*! \{ */
168 bool calcViewRay( Line &line,
169 Int32 x,
170 Int32 y,
171 const Viewport &port,
172 Real32 *t = NULL );
174 /*! \} */
175 /*---------------------------------------------------------------------*/
176 /*! \name dump */
177 /*! \{ */
179 virtual void dump( UInt32 uiIndent = 0,
180 const BitVector bvFlags = 0) const;
182 /*! \} */
183 /*========================= PROTECTED ===============================*/
185 protected:
187 /*---------------------------------------------------------------------*/
188 /*! \name Constructors */
189 /*! \{ */
191 Camera(void);
192 Camera(const Camera &source);
194 /*! \} */
195 /*---------------------------------------------------------------------*/
196 /*! \name Destructors */
197 /*! \{ */
199 virtual ~Camera(void);
201 /*! \} */
202 /*---------------------------------------------------------------------*/
203 /*! \name Init */
204 /*! \{ */
206 static void initMethod(InitPhase ePhase);
208 /*! \} */
209 /*========================== PRIVATE ================================*/
211 private:
213 friend class FieldContainer;
214 friend class CameraBase;
216 // prohibit default functions (move to 'public' if you need one)
217 void operator =(const Camera &source);
220 //---------------------------------------------------------------------------
221 // Exported Types
222 //---------------------------------------------------------------------------
224 typedef Camera *CameraP;
226 OSG_END_NAMESPACE
228 #include "OSGCameraBase.inl"
229 #include "OSGCamera.inl"
231 #endif /* _OSGCAMERA_H_ */