# OgreExternalTextureSource.h

Go to the documentation of this file.

    00001 /*
    00002 -----------------------------------------------------------------------------
    00003 This source file is part of OGRE
    00004     (Object-oriented Graphics Rendering Engine)
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023
    00024 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef _OgreExternalTextureSource_H
    00030 #define _OgreExternalTextureSource_H
    00031
    00032 /***************************************************************************
    00033 OgreExternalTextureSource.h  -
    00034     Base class that texture plugins need to derive from. This provides the hooks
    00035     neccessary for a plugin developer to easily extend the functionality of dynamic textures.
    00036     It makes creation/destruction of dynamic textures more streamlined. While the plugin
    00037     will need to talk with Ogre for the actual modification of textures, this class allows
    00038     easy integration with Ogre apps. Material script files can be used to aid in the
    00039     creation of dynamic textures. Functionality can be added that is not defined here
    00040     through the use of the base dictionary. For an exmaple of how to use this class and the
    00041     string interface see ffmpegVideoPlugIn.
    00042
    00043 -------------------
    00044 date                 : Jan 1 2004
    00045 email                : pjcast@yahoo.com
    00046 ***************************************************************************/
    00047
    00048 #include "OgreStringInterface.h"
    00049 #include "OgreResourceGroupManager.h"
    00050
    00051 namespace Ogre
    00052 {
    00054     enum eTexturePlayMode
    00055     {
    00056         TextureEffectPause = 0,
    00057         TextureEffectPlay_ASAP = 1,
    00058         TextureEffectPlay_Looping = 2
    00059     };
    00060
    00068     class _OgreExport ExternalTextureSource : public StringInterface
    00069     {
    00070     public:
    00072         ExternalTextureSource();
    00074         virtual ~ExternalTextureSource() {}
    00075
    00076         //------------------------------------------------------------------------------//
    00077         /* Command objects for specifying some base features                            */
    00078         /* Any PlugIns wishing to add more specific params to "ExternalTextureSourcePlugins"*/
    00079         /* dictionary, feel free to do so, that's why this is here                      */
    00080         class _OgrePrivate CmdInputFileName : public ParamCommand
    00081         {
    00082         public:
    00083             String doGet(const void* target) const;
    00084             void doSet(void* target, const String& val);
    00085         };
    00086         class _OgrePrivate CmdFPS : public ParamCommand
    00087         {
    00088         public:
    00089             String doGet(const void* target) const;
    00090             void doSet(void* target, const String& val);
    00091         };
    00092         class _OgrePrivate CmdPlayMode : public ParamCommand
    00093         {
    00094         public:
    00095             String doGet(const void* target) const;
    00096             void doSet(void* target, const String& val);
    00097         };
    00098         class _OgrePrivate CmdTecPassState : public ParamCommand
    00099         {
    00100         public:
    00101             String doGet(const void* target) const;
    00102             void doSet(void* target, const String& val);
    00103         };
    00104         //--------------------------------------------------------//
    00105         //Base Functions that work with Command String Interface... Or can be called
    00106         //manually to create video through code
    00107
    00109         void setInputName( String sIN ) { mInputFileName = sIN; }
    00111         const String& getInputName( ) const { return mInputFileName; }
    00113         void setFPS( int iFPS ) { mFramesPerSecond = iFPS; }
    00115         const int getFPS( ) const { return mFramesPerSecond; }
    00117         void setPlayMode( eTexturePlayMode eMode )  { mMode = eMode; }
    00119         eTexturePlayMode getPlayMode() const { return mMode; }
    00120
    00122         void setTextureTecPassStateLevel( int t, int p, int s )
    00123                 { mTechniqueLevel = t;mPassLevel = p;mStateLevel = s; }
    00125         void getTextureTecPassStateLevel( int& t, int& p, int& s ) const
    00126                 {t = mTechniqueLevel;   p = mPassLevel; s = mStateLevel;}
    00127
    00129         void addBaseParams();
    00130
    00132         const String& getPlugInStringName( void ) const { return mPlugInName; }
    00134         const String& getDictionaryStringName( void ) const { return mDictionaryName; }
    00135
    00136         //Pure virtual functions that plugins must Override
    00138         virtual bool initialise() = 0;
    00140         virtual void shutDown() = 0;
    00141
    00146         virtual void createDefinedTexture( const String& sMaterialName,
    00147             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0;
    00151         virtual void destroyAdvancedTexture( const String& sTextureName,
    00152             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0;
    00153
    00154     protected:
    00155         static CmdInputFileName msCmdInputFile;
    00156         static CmdFPS msCmdFramesPerSecond;
    00157         static CmdPlayMode msCmdPlayMode;
    00158         static CmdTecPassState msCmdTecPassState;
    00159
    00160
    00162         String mPlugInName;
    00163
    00164         //------ Vars used for setting/getting dictionary stuff -----------//
    00165         eTexturePlayMode mMode;
    00166
    00167         String mInputFileName;
    00168
    00169         bool mUpdateEveryFrame;
    00170
    00171         int mFramesPerSecond,
    00172             mTechniqueLevel,
    00173             mPassLevel,
    00174             mStateLevel;
    00175         //------------------------------------------------------------------//
    00176
    00177     protected:
    00180         String mDictionaryName;
    00181     };
    00182 }
    00183
    00184 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat Apr 11 13:46:40 2009