Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/include/OgreExternalTextureSource.h @ 5

Last change on this file since 5 was 5, checked in by anonymous, 17 years ago

=hoffentlich gehts jetzt

File size: 7.6 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef _OgreExternalTextureSource_H
30#define _OgreExternalTextureSource_H
31 
32/***************************************************************************
33OgreExternalTextureSource.h  - 
34        Base class that texture plugins need to derive from. This provides the hooks
35        neccessary for a plugin developer to easily extend the functionality of dynamic textures.
36        It makes creation/destruction of dynamic textures more streamlined. While the plugin
37        will need to talk with Ogre for the actual modification of textures, this class allows
38        easy integration with Ogre apps. Material script files can be used to aid in the
39        creation of dynamic textures. Functionality can be added that is not defined here
40        through the use of the base dictionary. For an exmaple of how to use this class and the
41        string interface see ffmpegVideoPlugIn.
42
43-------------------
44date                 : Jan 1 2004
45email                : pjcast@yahoo.com
46***************************************************************************/
47
48#include "OgreStringInterface.h"
49#include "OgreResourceGroupManager.h"
50
51namespace Ogre
52{
53        /** Enum for type of texture play mode */
54        enum eTexturePlayMode
55        {
56                TextureEffectPause = 0,                 //! Video starts out paused
57                TextureEffectPlay_ASAP = 1,             //! Video starts playing as soon as posible
58                TextureEffectPlay_Looping = 2   //! Video Plays Instantly && Loops
59        };
60
61        /** IMPORTANT: **Plugins must override default dictionary name!**
62        Base class that texture plugins derive from. Any specific
63        requirements that the plugin needs to have defined before
64        texture/material creation must be define using the stringinterface
65        before calling create defined texture... or it will fail, though, it
66        is up to the plugin to report errors to the log file, or raise an
67        exception if need be. */
68        class _OgreExport ExternalTextureSource : public StringInterface
69        {
70        public:
71                /** Constructor */
72                ExternalTextureSource();
73                /** Virtual destructor */
74                virtual ~ExternalTextureSource() {}
75
76                //------------------------------------------------------------------------------//
77                /* Command objects for specifying some base features                                                    */
78                /* Any PlugIns wishing to add more specific params to "ExternalTextureSourcePlugins"*/
79                /* dictionary, feel free to do so, that's why this is here                                              */
80        class _OgrePrivate CmdInputFileName : public ParamCommand
81        {
82        public:
83                        String doGet(const void* target) const;
84            void doSet(void* target, const String& val);
85        };
86        class _OgrePrivate CmdFPS : public ParamCommand
87        {
88        public:
89                        String doGet(const void* target) const;
90            void doSet(void* target, const String& val);
91        };
92        class _OgrePrivate CmdPlayMode : public ParamCommand
93        {
94        public:
95                        String doGet(const void* target) const;
96            void doSet(void* target, const String& val);
97        };
98        class _OgrePrivate CmdTecPassState : public ParamCommand
99        {
100        public:
101                        String doGet(const void* target) const;
102            void doSet(void* target, const String& val);
103        };
104                //--------------------------------------------------------//
105                //Base Functions that work with Command String Interface... Or can be called
106                //manually to create video through code
107
108                //! Sets an input file name - if needed by plugin
109                void setInputName( String sIN ) { mInputFileName = sIN; }
110                //! Gets currently set input file name
111                const String& getInputName( ) const     { return mInputFileName; }
112                //! Sets the frames per second - plugin may or may not use this
113                void setFPS( int iFPS ) { mFramesPerSecond = iFPS; }
114                //! Gets currently set frames per second
115                const int getFPS( ) const { return mFramesPerSecond; }
116                //! Sets a play mode
117                void setPlayMode( eTexturePlayMode eMode )      { mMode = eMode; }
118                //! Gets currently set play mode
119                eTexturePlayMode getPlayMode() const { return mMode; }
120
121                //! Used for attaching texture to Technique, State, and texture unit layer
122                void setTextureTecPassStateLevel( int t, int p, int s ) 
123                                { mTechniqueLevel = t;mPassLevel = p;mStateLevel = s; }
124                //! Get currently selected Textute attribs.
125                void getTextureTecPassStateLevel( int& t, int& p, int& s ) const
126                                {t = mTechniqueLevel;   p = mPassLevel; s = mStateLevel;}
127               
128                /** Call from derived classes to ensure the dictionary is setup */
129                void addBaseParams();
130
131                /** Returns the string name of this PlugIn (as set by the PlugIn)*/
132                const String& getPlugInStringName( void ) const { return mPlugInName; }
133                /** Returns dictionary name */
134                const String& getDictionaryStringName( void ) const { return mDictionaryName; }
135
136                //Pure virtual functions that plugins must Override
137                /** Call this function from manager to init system */
138                virtual bool initialise() = 0;
139                /** Shuts down PlugIn */
140                virtual void shutDown() = 0;
141
142                /** Creates a texture into an already defined material or one that is created new
143                (it's up to plugin to use a material or create one)
144                Before calling, ensure that needed params have been defined via the stringInterface
145                or regular methods */
146                virtual void createDefinedTexture( const String& sMaterialName,
147                        const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0;
148                /** What this destroys is dependent on the plugin... See specific plugin
149                doc to know what is all destroyed (normally, plugins will destroy only
150                what they created, or used directly - ie. just texture unit) */
151                virtual void destroyAdvancedTexture( const String& sTextureName,
152                        const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0;
153
154        protected:
155        static CmdInputFileName msCmdInputFile;         //! Command for setting input file name
156                static CmdFPS msCmdFramesPerSecond;                     //! Command for setting frames per second
157                static CmdPlayMode msCmdPlayMode;                       //! Command for setting play mode
158                static CmdTecPassState msCmdTecPassState;       //! Command for setting the tecnique, pass, & state level
159
160
161                //! String Name of this PlugIn
162                String mPlugInName;
163       
164                //------ Vars used for setting/getting dictionary stuff -----------//
165                eTexturePlayMode mMode;
166               
167                String mInputFileName;
168               
169                bool mUpdateEveryFrame;
170               
171                int mFramesPerSecond,
172                        mTechniqueLevel,
173                        mPassLevel,     
174                        mStateLevel;
175                //------------------------------------------------------------------//
176
177        protected:
178                /** The string name of the dictionary name - each plugin
179                must override default name */
180                String mDictionaryName;
181        };
182}
183
184#endif
Note: See TracBrowser for help on using the repository browser.