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 #ifndef WGEVIEWEREFFECT_H 00026 #define WGEVIEWEREFFECT_H 00027 00028 #include <string> 00029 00030 #include <osg/Camera> 00031 #include <osg/Geode> 00032 #include <osg/StateSet> 00033 00034 #include "core/common/WObjectNDIP.h" 00035 #include "core/common/WProperties.h" 00036 00037 #include "WGECamera.h" 00038 00039 /** 00040 * Base class for implementing basic fullscreen effects for the WGEViewer. It uses properties for configuration. 00041 */ 00042 class WGEViewerEffect: public WObjectNDIP< WGECamera > 00043 { 00044 public: 00045 /** 00046 * Convenience typedef for a boost::shared_ptr< WGEViewerEffect >. 00047 */ 00048 typedef osg::ref_ptr< WGEViewerEffect > SPtr; 00049 00050 /** 00051 * Convenience typedef for a boost::shared_ptr< const WGEViewerEffect >. 00052 */ 00053 typedef osg::ref_ptr< const WGEViewerEffect > ConstSPtr; 00054 00055 /** 00056 * Create the effect. 00057 * 00058 * \param name the name 00059 * \param description the description 00060 * \param icon an icon in XPM format. Can be NULL if no icon is required. 00061 */ 00062 WGEViewerEffect( std::string name, std::string description, const char** icon = NULL ); 00063 00064 /** 00065 * Destructor. 00066 */ 00067 virtual ~WGEViewerEffect(); 00068 00069 /** 00070 * Check whether the effect is active or not. 00071 * 00072 * \return true if active 00073 */ 00074 virtual bool isEnabled() const; 00075 00076 /** 00077 * Set the effect enabled. 00078 * 00079 * \param enable true to enable. False to disable. 00080 */ 00081 virtual void setEnabled( bool enable = true ); 00082 00083 /** 00084 * Use this to activate an effect by default. This sets the default value of the active property. It can be overwritten by user settings. 00085 * 00086 * \param enableByDefault activate this effect by default if true. 00087 */ 00088 virtual void setEnabledByDefault( bool enableByDefault = true ); 00089 protected: 00090 /** 00091 * The fullscreen quad 00092 */ 00093 osg::ref_ptr< osg::Geode > m_geode; 00094 00095 /** 00096 * The stateset of the cam 00097 */ 00098 osg::ref_ptr< osg::StateSet > m_state; 00099 00100 /** 00101 * Enable or disable effect. 00102 */ 00103 WPropBool m_active; 00104 private: 00105 }; 00106 00107 #endif // WGEVIEWEREFFECT_H 00108