OpenWalnut
1.4.0
|
00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #include <string> 00026 00027 #include "../WGETextureHud.h" 00028 00029 #include "WGEOffscreenFinalPass.h" 00030 00031 WGEOffscreenFinalPass::WGEOffscreenFinalPass( size_t textureWidth, size_t textureHeight, int num ): 00032 WGEOffscreenTexturePass( textureWidth, textureHeight, num ) 00033 { 00034 // initialize members 00035 setRenderTargetImplementation( WGECamera::FRAME_BUFFER ); 00036 setRenderOrder( WGECamera::NESTED_RENDER, 0 ); 00037 00038 // render before the hud 00039 if( m_hud ) 00040 { 00041 getOrCreateStateSet()->setRenderBinDetails( m_hud->getRenderBin() - 1, "RenderBin" ); 00042 } 00043 else 00044 { 00045 getOrCreateStateSet()->setRenderBinDetails( 10000, "RenderBin" ); 00046 } 00047 00048 osg::StateSet* state = this->getOrCreateStateSet(); 00049 state->setMode( GL_DEPTH_TEST, osg::StateAttribute::ON ); 00050 00051 // allow the user to use blending 00052 getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON ); 00053 } 00054 00055 WGEOffscreenFinalPass::WGEOffscreenFinalPass( size_t textureWidth, size_t textureHeight, osg::ref_ptr< WGETextureHud > hud, std::string name, 00056 int num ): 00057 WGEOffscreenTexturePass( textureWidth, textureHeight, hud, name, num ) 00058 { 00059 // initialize members 00060 setRenderTargetImplementation( WGECamera::FRAME_BUFFER ); 00061 setRenderOrder( WGECamera::NESTED_RENDER, 0 ); 00062 00063 // render before the hud 00064 if( m_hud ) 00065 { 00066 getOrCreateStateSet()->setRenderBinDetails( m_hud->getRenderBin() - 1, "RenderBin" ); 00067 } 00068 else 00069 { 00070 getOrCreateStateSet()->setRenderBinDetails( 10000, "RenderBin" ); 00071 } 00072 00073 osg::StateSet* state = this->getOrCreateStateSet(); 00074 state->setMode( GL_DEPTH_TEST, osg::StateAttribute::ON ); 00075 00076 // allow the user to use blending 00077 getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON ); 00078 } 00079 00080 WGEOffscreenFinalPass::~WGEOffscreenFinalPass() 00081 { 00082 // cleanup 00083 } 00084