fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Window / Base / OSGCameraDecorator.cpp
blob9b2baa9a78a2ef0174469944f7d23ba052d94971
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 //---------------------------------------------------------------------------
40 // Includes
41 //---------------------------------------------------------------------------
43 #include <cstdlib>
44 #include <cstdio>
46 #include "OSGConfig.h"
48 #include "OSGCameraDecorator.h"
50 OSG_USING_NAMESPACE
52 /*! \class OSG::CameraDecorator
53 \ingroup GrpSystemWindowCameraDecorators
55 The base class for the camera decorator, see \ref
56 PageSystemWindowCameraDecorators for a description.
58 The decorated object is held in the _sfDecoratee field.
62 /*----------------------- constructors & destructors ----------------------*/
64 CameraDecorator::CameraDecorator(void) :
65 Inherited()
69 CameraDecorator::CameraDecorator(const CameraDecorator &source) :
70 Inherited(source)
74 CameraDecorator::~CameraDecorator(void)
78 /*----------------------------- class specific ----------------------------*/
80 void CameraDecorator::initMethod(InitPhase ePhase)
82 Inherited::initMethod(ePhase);
85 void CameraDecorator::changed(ConstFieldMaskArg whichField,
86 UInt32 origin,
87 BitVector details)
89 Inherited::changed(whichField, origin, details);
92 void CameraDecorator::dump( UInt32 ,
93 const BitVector ) const
95 SLOG << "Dump CameraDecorator NI" << std::endl;
99 /*---------------------- Decorated Functions ----------------------------*/
102 void CameraDecorator::getProjection(Matrix &result,
103 UInt32 width ,
104 UInt32 height)
106 Camera *camera = getDecoratee();
108 if(camera == NULL)
110 FWARNING(("CameraDecorator::getProjection: no decoratee!\n"));
112 result.setIdentity();
114 return;
117 camera->getProjection(result, width, height);
120 void CameraDecorator::getProjectionTranslation(Matrix &result,
121 UInt32 width ,
122 UInt32 height)
124 Camera *camera = getDecoratee();
126 if(camera == NULL)
128 FWARNING(("CameraDecorator::getProjectionTranslation: "
129 "no decoratee!\n"));
131 result.setIdentity();
133 return;
136 camera->getProjectionTranslation(result, width, height);
139 void CameraDecorator::getViewing(Matrix &result,
140 UInt32 width ,
141 UInt32 height)
143 Camera *camera = getDecoratee();
145 if(camera == NULL)
147 FWARNING(("CameraDecorator::getViewing: no decoratee!\n"));
149 result.setIdentity();
151 return;
154 camera->getViewing(result, width, height);
157 Vec2u CameraDecorator::tileGetFullSize(void) const
159 Camera *pCam = getDecoratee();
161 if(pCam != NULL)
163 return pCam->tileGetFullSize();
166 return Inherited::tileGetFullSize();
169 Vec4f CameraDecorator::tileGetRegion(void) const
171 Camera *pCam = getDecoratee();
173 if(pCam != NULL)
175 return pCam->tileGetRegion();
178 return Inherited::tileGetRegion();