theoraTextureObject.h
Engine/source/gfx/video/theoraTextureObject.h
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _THEORATEXTUREOBJECT_H_ 25#define _THEORATEXTUREOBJECT_H_ 26 27#ifdef TORQUE_OGGTHEORA 28 29#ifndef _SIMOBJECT_H_ 30#include "console/simObject.h" 31#endif 32 33#ifndef _THEORATEXTURE_H_ 34#include "gfx/video/theoraTexture.h" 35#endif 36 37#ifndef _MATTEXTURETARGET_H_ 38#include "materials/matTextureTarget.h" 39#endif 40 41 42class SFXDescription; 43 44 45class TheoraTextureObject : public SimObject 46{ 47 typedef SimObject Parent; 48 49protected: 50 51 /// Is the video currently playing 52 bool mIsPlaying; 53 54 /// Should the video loop 55 bool mLoop; 56 57 /// The Theora file we should play. 58 String mFilename; 59 60 /// Name for the NamedTexTarget. 61 String mTexTargetName; 62 63 /// Theora video player backend. 64 TheoraTexture mTheoraTexture; 65 66 /// The texture target which can be referenced in materials. 67 NamedTexTarget mTexTarget; 68 69 /// Sound description to use for the video's audio channel. 70 SFXDescription* mSFXDescription; 71 72 /// Method that is hooked up with the texture target's delegate. 73 GFXTextureObject* _texDelegate( U32 index ); 74 75public: 76 77 TheoraTextureObject(); 78 79 void play(); 80 void stop() { mTheoraTexture.stop(); mIsPlaying = false; } 81 void pause() { mTheoraTexture.pause(); mIsPlaying = false; } 82 83 // SimObject. 84 DECLARE_CONOBJECT( TheoraTextureObject ); 85 86 virtual bool onAdd(); 87 virtual void onRemove(); 88 89 static void initPersistFields(); 90}; 91 92#endif // TORQUE_OGGTHEORA 93#endif // _THEORATEXTUREOBJECT_H_ 94