UnitCamera.h

00001 /***************************************************************************
00002  *   Copyright (c) 2008   Art Tevs                                         *
00003  *                                                                         *
00004  *   This library is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU Lesser General Public License as        *
00006  *   published by the Free Software Foundation; either version 3 of        *
00007  *   the License, or (at your option) any later version.                   *
00008  *                                                                         *
00009  *   This library is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU Lesse General Public License for more details.                    *
00013  *                                                                         *
00014  *   The full license is in LICENSE file included with this distribution.  *
00015  ***************************************************************************/
00016 
00017 #ifndef _C_UNIT_CAMERA_H_
00018 #define _C_UNIT_CAMERA_H_
00019 
00020 
00021 //-------------------------------------------------------------------------
00022 // Includes
00023 //-------------------------------------------------------------------------
00024 #include <osgPPU/UnitBypass.h>
00025 #include <osg/Camera>
00026 
00027 namespace osgPPU
00028 {
00029     //! Put camera into unit pipeline
00030     /**
00031     * This unit is very useful when you want to include camera directly into the unit pipeline.
00032     * Camera is attached to this unit and its output can be accessed through UnitCameraAttachmentBypass
00033     * unit. This allows direct including of multiple camera's outputs into the unit pipeline.
00034     **/
00035     class OSGPPU_EXPORT UnitCamera : public UnitBypass {
00036         public:
00037             META_Node(osgPPU, UnitCamera);
00038         
00039             UnitCamera();
00040             UnitCamera(const UnitCamera& u, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
00041             
00042             virtual ~UnitCamera();
00043             
00044             /**
00045             * Set camera which output is to be included into the pipeline. 
00046             * @param camera Camera pointer 
00047             * @param addAsChild If true camera will be added as child of this unit,
00048             *       which give the possibility to traversals also on the camera object
00049             *       without need of including the camera somehwere else in the scene graph.
00050             **/
00051             void setCamera(osg::Camera* camera, bool addAsChild = false);
00052 
00053             //! Get camera object used
00054             osg::Camera* getCamera() { return mCamera.get(); }
00055 
00056         protected:
00057             osg::ref_ptr<osg::Camera> mCamera;
00058             bool mUseCameraAsChild;
00059     };
00060 
00061 };
00062 
00063 #endif

Back to Homepage of osgPPU

Copyright (C) 2008 by Art Tevs (LGPL)