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 "../common/WProperties.h" 00026 00027 #include "shaders/WGEShader.h" 00028 #include "shaders/WGEPropertyUniform.h" 00029 00030 #include "WGEViewerEffectHorizon.h" 00031 00032 WGEViewerEffectHorizon::WGEViewerEffectHorizon(): 00033 WGEViewerEffect( "Horizon Background", "Configurable horizon background effect." ) 00034 { 00035 WPropColor bottom1Color = m_properties->addProperty( "First Bottom Color", "Bottom color gradient: first color.", 00036 WColor( 1.00, 1.00, 1.00, 1.00 ) ); 00037 WPropColor bottom2Color = m_properties->addProperty( "Second Bottom Color", "Bottom color gradient: second color.", 00038 WColor( 0.82, 0.82, 0.82, 1.00 ) ); 00039 WPropColor top1Color = m_properties->addProperty( "First Top Color", "Top color gradient: first color.", 00040 WColor( 0.85, 0.85, 0.85, 1.0 ) ); 00041 WPropColor top2Color = m_properties->addProperty( "Second Top Color", "Top color gradient: second color.", 00042 WColor( 0.95, 0.95, 0.95, 0.95 ) ); 00043 00044 WPropDouble horizonLine = m_properties->addProperty( "Horizon in %", "Horizon line in percent.", 33.0 ); 00045 horizonLine->setMin( 0.0 ); 00046 horizonLine->setMax( 100.0 ); 00047 00048 m_state->addUniform( new WGEPropertyUniform< WPropDouble >( "u_horizon", horizonLine ) ); 00049 m_state->addUniform( new WGEPropertyUniform< WPropColor >( "u_bottom1Color", bottom1Color ) ); 00050 m_state->addUniform( new WGEPropertyUniform< WPropColor >( "u_bottom2Color", bottom2Color ) ); 00051 m_state->addUniform( new WGEPropertyUniform< WPropColor >( "u_top1Color", top1Color ) ); 00052 m_state->addUniform( new WGEPropertyUniform< WPropColor >( "u_top2Color", top2Color ) ); 00053 00054 // default cam is a post render cam. The Horizon needs to be done BEFORE everything else 00055 setRenderOrder( WGECamera::NESTED_RENDER, -1000 ); 00056 00057 osg::ref_ptr< WGEShader > horizonShader = new WGEShader( "WGECameraHorizon" ); 00058 horizonShader->apply( m_geode ); 00059 } 00060 00061 WGEViewerEffectHorizon::~WGEViewerEffectHorizon() 00062 { 00063 // cleanup 00064 } 00065