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-2013 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef _OgreExternalTextureSource_H
00029 #define _OgreExternalTextureSource_H
00030  
00031 /***************************************************************************
00032 OgreExternalTextureSource.h  -  
00033     Base class that texture plugins need to derive from. This provides the hooks
00034     necessary for a plugin developer to easily extend the functionality of dynamic textures.
00035     It makes creation/destruction of dynamic textures more streamlined. While the plugin
00036     will need to talk with Ogre for the actual modification of textures, this class allows
00037     easy integration with Ogre apps. Material script files can be used to aid in the 
00038     creation of dynamic textures. Functionality can be added that is not defined here
00039     through the use of the base dictionary. For an example of how to use this class and the
00040     string interface see ffmpegVideoPlugIn.
00041 
00042 -------------------
00043 date                 : Jan 1 2004
00044 email                : pjcast@yahoo.com
00045 ***************************************************************************/
00046 
00047 #include "OgreStringInterface.h"
00048 #include "OgreResourceGroupManager.h"
00049 #include "OgreHeaderPrefix.h"
00050 
00051 namespace Ogre
00052 {
00060     enum eTexturePlayMode
00061     {
00062         TextureEffectPause = 0,         
00063         TextureEffectPlay_ASAP = 1,     
00064         TextureEffectPlay_Looping = 2   
00065     };
00066 
00074     class _OgreExport ExternalTextureSource : public StringInterface
00075     {
00076     public:
00078         ExternalTextureSource();
00080         virtual ~ExternalTextureSource() {}
00081 
00082         //------------------------------------------------------------------------------//
00083         /* Command objects for specifying some base features                            */
00084         /* Any Plugins wishing to add more specific params to "ExternalTextureSourcePlugins"*/
00085         /* dictionary, feel free to do so, that's why this is here                      */
00086         class _OgrePrivate CmdInputFileName : public ParamCommand
00087         {
00088         public:
00089             String doGet(const void* target) const;
00090             void doSet(void* target, const String& val);
00091         };
00092         class _OgrePrivate CmdFPS : public ParamCommand
00093         {
00094         public:
00095             String doGet(const void* target) const;
00096             void doSet(void* target, const String& val);
00097         };
00098         class _OgrePrivate CmdPlayMode : public ParamCommand
00099         {
00100         public:
00101             String doGet(const void* target) const;
00102             void doSet(void* target, const String& val);
00103         };
00104         class _OgrePrivate CmdTecPassState : public ParamCommand
00105         {
00106         public:
00107             String doGet(const void* target) const;
00108             void doSet(void* target, const String& val);
00109         };
00110         //--------------------------------------------------------//
00111         //Base Functions that work with Command String Interface... Or can be called
00112         //manually to create video through code 
00113 
00115         void setInputName( String sIN ) { mInputFileName = sIN; }
00117         const String& getInputName( ) const { return mInputFileName; }
00119         void setFPS( int iFPS ) { mFramesPerSecond = iFPS; }
00121         int getFPS( ) const { return mFramesPerSecond; }
00123         void setPlayMode( eTexturePlayMode eMode )  { mMode = eMode; }
00125         eTexturePlayMode getPlayMode() const { return mMode; }
00126 
00128         void setTextureTecPassStateLevel( int t, int p, int s ) 
00129                 { mTechniqueLevel = t;mPassLevel = p;mStateLevel = s; }
00131         void getTextureTecPassStateLevel( int& t, int& p, int& s ) const
00132                 {t = mTechniqueLevel;   p = mPassLevel; s = mStateLevel;}
00133         
00135         void addBaseParams();
00136 
00138         const String& getPluginStringName( void ) const { return mPluginName; }
00140         const String& getDictionaryStringName( void ) const { return mDictionaryName; }
00141 
00142         //Pure virtual functions that plugins must Override
00144         virtual bool initialise() = 0;
00146         virtual void shutDown() = 0;
00147 
00152         virtual void createDefinedTexture( const String& sMaterialName,
00153             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0;
00157         virtual void destroyAdvancedTexture( const String& sTextureName,
00158             const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0;
00159 
00160     protected:
00161         static CmdInputFileName msCmdInputFile;     
00162         static CmdFPS msCmdFramesPerSecond;         
00163         static CmdPlayMode msCmdPlayMode;           
00164         static CmdTecPassState msCmdTecPassState;   
00165 
00166 
00168         String mPluginName;
00169     
00170         //------ Vars used for setting/getting dictionary stuff -----------//
00171         eTexturePlayMode mMode;
00172         
00173         String mInputFileName;
00174         
00175         bool mUpdateEveryFrame;
00176         
00177         int mFramesPerSecond,
00178             mTechniqueLevel,
00179             mPassLevel, 
00180             mStateLevel;
00181         //------------------------------------------------------------------//
00182 
00183     protected:
00186         String mDictionaryName;
00187     };
00190 }
00191 
00192 #include "OgreHeaderSuffix.h"
00193 
00194 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:42