/src/ogre/OgreMain/include/OgreExternalTextureSource.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | ----------------------------------------------------------------------------- |
3 | | This source file is part of OGRE |
4 | | (Object-oriented Graphics Rendering Engine) |
5 | | For the latest info, see http://www.ogre3d.org/ |
6 | | |
7 | | Copyright (c) 2000-2014 Torus Knot Software Ltd |
8 | | |
9 | | Permission is hereby granted, free of charge, to any person obtaining a copy |
10 | | of this software and associated documentation files (the "Software"), to deal |
11 | | in the Software without restriction, including without limitation the rights |
12 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13 | | copies of the Software, and to permit persons to whom the Software is |
14 | | furnished to do so, subject to the following conditions: |
15 | | |
16 | | The above copyright notice and this permission notice shall be included in |
17 | | all copies or substantial portions of the Software. |
18 | | |
19 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
22 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
25 | | THE SOFTWARE. |
26 | | ----------------------------------------------------------------------------- |
27 | | */ |
28 | | #ifndef _OgreExternalTextureSource_H |
29 | | #define _OgreExternalTextureSource_H |
30 | | |
31 | | /*************************************************************************** |
32 | | OgreExternalTextureSource.h - |
33 | | Base class that texture plugins need to derive from. This provides the hooks |
34 | | necessary for a plugin developer to easily extend the functionality of dynamic textures. |
35 | | It makes creation/destruction of dynamic textures more streamlined. While the plugin |
36 | | will need to talk with Ogre for the actual modification of textures, this class allows |
37 | | easy integration with Ogre apps. Material script files can be used to aid in the |
38 | | creation of dynamic textures. Functionality can be added that is not defined here |
39 | | through the use of the base dictionary. For an example of how to use this class and the |
40 | | string interface see ffmpegVideoPlugIn. |
41 | | |
42 | | ------------------- |
43 | | date : Jan 1 2004 |
44 | | email : pjcast@yahoo.com |
45 | | ***************************************************************************/ |
46 | | |
47 | | #include "OgreStringInterface.h" |
48 | | #include "OgreResourceGroupManager.h" |
49 | | #include "OgreHeaderPrefix.h" |
50 | | |
51 | | namespace Ogre |
52 | | { |
53 | | /** \addtogroup Core |
54 | | * @{ |
55 | | */ |
56 | | /** \addtogroup Materials |
57 | | * @{ |
58 | | */ |
59 | | /** Enum for type of texture play mode */ |
60 | | enum eTexturePlayMode |
61 | | { |
62 | | TextureEffectPause = 0, /// Video starts out paused |
63 | | TextureEffectPlay_ASAP = 1, /// Video starts playing as soon as possible |
64 | | TextureEffectPlay_Looping = 2 /// Video Plays Instantly && Loops |
65 | | }; |
66 | | |
67 | | /** IMPORTANT: **Plugins must override default dictionary name!** |
68 | | Base class that texture plugins derive from. Any specific |
69 | | requirements that the plugin needs to have defined before |
70 | | texture/material creation must be define using the stringinterface |
71 | | before calling create defined texture... or it will fail, though, it |
72 | | is up to the plugin to report errors to the log file, or raise an |
73 | | exception if need be. */ |
74 | | class _OgreExport ExternalTextureSource : public StringInterface |
75 | | { |
76 | | public: |
77 | | /** Constructor */ |
78 | | ExternalTextureSource(); |
79 | | /** Virtual destructor */ |
80 | 0 | virtual ~ExternalTextureSource() {} |
81 | | |
82 | | //--------------------------------------------------------// |
83 | | //Base Functions that work with Command String Interface... Or can be called |
84 | | //manually to create video through code |
85 | | |
86 | | /// Sets an input file name - if needed by plugin |
87 | 0 | void setInputName( const String &sIN ) { mInputFileName = sIN; } |
88 | | /// Gets currently set input file name |
89 | 0 | const String& getInputName( ) const { return mInputFileName; } |
90 | | /// Sets the frames per second - plugin may or may not use this |
91 | 0 | void setFPS( int iFPS ) { mFramesPerSecond = iFPS; } |
92 | | /// Gets currently set frames per second |
93 | 0 | int getFPS( ) const { return mFramesPerSecond; } |
94 | | /// Sets a play mode |
95 | 0 | void setPlayMode( eTexturePlayMode eMode ) { mMode = eMode; } |
96 | | /// Gets currently set play mode |
97 | 0 | eTexturePlayMode getPlayMode() const { return mMode; } |
98 | | |
99 | | /// Used for attaching texture to Technique, State, and texture unit layer |
100 | | void setTextureTecPassStateLevel( int t, int p, int s ) |
101 | 0 | { mTechniqueLevel = t;mPassLevel = p;mStateLevel = s; } |
102 | | /// Get currently selected Texture attribs. |
103 | | void getTextureTecPassStateLevel( int& t, int& p, int& s ) const |
104 | 0 | {t = mTechniqueLevel; p = mPassLevel; s = mStateLevel;} |
105 | | |
106 | | /** Call from derived classes to ensure the dictionary is setup */ |
107 | | void addBaseParams(); |
108 | | |
109 | | /** Returns the string name of this Plugin (as set by the Plugin)*/ |
110 | 0 | const String& getPluginStringName( void ) const { return mPluginName; } |
111 | | /** Returns dictionary name */ |
112 | 0 | const String& getDictionaryStringName( void ) const { return mDictionaryName; } |
113 | | |
114 | | //Pure virtual functions that plugins must Override |
115 | | /** Call this function from manager to init system */ |
116 | | virtual bool initialise() = 0; |
117 | | /** Shuts down Plugin */ |
118 | | virtual void shutDown() = 0; |
119 | | |
120 | | /** Creates a texture into an already defined material or one that is created new |
121 | | (it's up to plugin to use a material or create one) |
122 | | Before calling, ensure that needed params have been defined via the stringInterface |
123 | | or regular methods */ |
124 | | virtual void createDefinedTexture( const String& sMaterialName, |
125 | | const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0; |
126 | | /** What this destroys is dependent on the plugin... See specific plugin |
127 | | doc to know what is all destroyed (normally, plugins will destroy only |
128 | | what they created, or used directly - ie. just texture unit) */ |
129 | | virtual void destroyAdvancedTexture( const String& sTextureName, |
130 | | const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0; |
131 | | |
132 | | protected: |
133 | | /// String Name of this Plugin |
134 | | String mPluginName; |
135 | | |
136 | | //------ Vars used for setting/getting dictionary stuff -----------// |
137 | | eTexturePlayMode mMode; |
138 | | |
139 | | String mInputFileName; |
140 | | |
141 | | bool mUpdateEveryFrame; |
142 | | |
143 | | int mFramesPerSecond, |
144 | | mTechniqueLevel, |
145 | | mPassLevel, |
146 | | mStateLevel; |
147 | | //------------------------------------------------------------------// |
148 | | |
149 | | protected: |
150 | | /** The string name of the dictionary name - each plugin |
151 | | must override default name */ |
152 | | String mDictionaryName; |
153 | | }; |
154 | | /** @} */ |
155 | | /** @} */ |
156 | | } |
157 | | |
158 | | #include "OgreHeaderSuffix.h" |
159 | | |
160 | | #endif |