OSGCameraDecorator.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038
00039 //---------------------------------------------------------------------------
00040 //  Includes
00041 //---------------------------------------------------------------------------
00042
00043 #include <cstdlib>
00044 #include <cstdio>
00045
00046 #include "OSGConfig.h"
00047
00048 #include "OSGCameraDecorator.h"
00049
00050 OSG_USING_NAMESPACE
00051
00062 /*----------------------- constructors & destructors ----------------------*/
00063
00064 CameraDecorator::CameraDecorator(void) :
00065     Inherited()
00066 {
00067 }
00068
00069 CameraDecorator::CameraDecorator(const CameraDecorator &source) :
00070     Inherited(source)
00071 {
00072 }
00073
00074 CameraDecorator::~CameraDecorator(void)
00075 {
00076 }
00077
00078 /*----------------------------- class specific ----------------------------*/
00079
00080 void CameraDecorator::initMethod(InitPhase ePhase)
00081 {
00082     Inherited::initMethod(ePhase);
00083 }
00084
00085 void CameraDecorator::changed(ConstFieldMaskArg whichField,
00086                               UInt32            origin,
00087                               BitVector         details)
00088 {
00089     Inherited::changed(whichField, origin, details);
00090 }
00091
00092 void CameraDecorator::dump(      UInt32    ,
00093                          const BitVector ) const
00094 {
00095     SLOG << "Dump CameraDecorator NI" << std::endl;
00096 }
00097
00098
00099 /*---------------------- Decorated Functions ----------------------------*/
00100
00101
00102 void CameraDecorator::getProjection(Matrix &result,
00103                                     UInt32  width ,
00104                                     UInt32  height)
00105 {
00106     Camera *camera = getDecoratee();
00107
00108     if(camera == NULL)
00109     {
00110         FWARNING(("CameraDecorator::getProjection: no decoratee!\n"));
00111
00112         result.setIdentity();
00113
00114         return;
00115     }
00116
00117     camera->getProjection(result, width, height);
00118 }
00119
00120 void CameraDecorator::getProjectionTranslation(Matrix &result,
00121                                                UInt32  width ,
00122                                                UInt32  height)
00123 {
00124     Camera *camera = getDecoratee();
00125
00126     if(camera == NULL)
00127     {
00128         FWARNING(("CameraDecorator::getProjectionTranslation: "
00129                   "no decoratee!\n"));
00130
00131         result.setIdentity();
00132
00133         return;
00134     }
00135
00136     camera->getProjectionTranslation(result, width, height);
00137 }
00138
00139 void CameraDecorator::getViewing(Matrix &result,
00140                                  UInt32  width ,
00141                                  UInt32  height)
00142 {
00143     Camera *camera = getDecoratee();
00144
00145     if(camera == NULL)
00146     {
00147         FWARNING(("CameraDecorator::getViewing: no decoratee!\n"));
00148
00149         result.setIdentity();
00150
00151         return;
00152     }
00153
00154     camera->getViewing(result, width, height);
00155 }
00156
00157 Vec2u CameraDecorator::tileGetFullSize(void) const
00158 {
00159     Camera *pCam = getDecoratee();
00160
00161     if(pCam != NULL)
00162     {
00163         return pCam->tileGetFullSize();
00164     }
00165
00166     return Inherited::tileGetFullSize();
00167 }
00168
00169 Vec4f CameraDecorator::tileGetRegion(void) const
00170 {
00171     Camera *pCam = getDecoratee();
00172
00173     if(pCam != NULL)
00174     {
00175         return pCam->tileGetRegion();
00176     }
00177
00178     return Inherited::tileGetRegion();
00179 }