UnitOut.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_OUT_IO_H_
00018 #define _C_UNIT_OUT_IO_H_
00019 
00020 
00021 //-------------------------------------------------------------------------
00022 // Includes
00023 //-------------------------------------------------------------------------
00024 #include <osgPPU/Export.h>
00025 #include <osgPPU/Unit.h>
00026 
00027 namespace osgPPU
00028 {
00029     //! Output the input to the frame buffer instead to the output texture
00030     /**
00031     * Pass input texture to the frame buffer. Use this ppu
00032     * to render results of the previous ppus into the framebuffer. So it is usual that
00033     * this ppu is applied at the end of the pipeline
00034     **/
00035     class OSGPPU_EXPORT UnitOut : public Unit {
00036         public:
00037             META_Node(osgPPU,UnitOut);
00038         
00039             UnitOut();
00040             UnitOut(const UnitOut&, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
00041             
00042             //! Release it and used memory
00043             virtual ~UnitOut();
00044             
00045             //! Initialze the default Processoring unit
00046             virtual void init();
00047 
00048         protected:
00049             /**
00050             * Since UnitOut forces to use no FBO, here we will disable the used FBO.
00051             * Derived classes has to take care abou that step
00052             **/
00053             virtual bool  noticeBeginRendering (osg::RenderInfo&, const osg::Drawable* ) ;
00054 
00055             /** 
00056             * Disabled FBO will be restored back.
00057             **/
00058             virtual void noticeFinishRendering(osg::RenderInfo &renderInfo, const osg::Drawable*);
00059         
00060             //! Default FBO instance, so when apply this it FBO with id 0 will be applied
00061             osg::ref_ptr<osg::FrameBufferObject> mDefaultFBO;
00062     };
00063 };
00064 
00065 #endif

Back to Homepage of osgPPU

Copyright (C) 2008 by Art Tevs (LGPL)