00001 /* 00002 Copyright (c) 2010 ASTRE Henri (http://www.visual-experiments.com) 00003 00004 Permission is hereby granted, free of charge, to any person obtaining a copy 00005 of this software and associated documentation files (the "Software"), to deal 00006 in the Software without restriction, including without limitation the rights 00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 copies of the Software, and to permit persons to whom the Software is 00009 furnished to do so, subject to the following conditions: 00010 00011 The above copyright notice and this permission notice shall be included in 00012 all copies or substantial portions of the Software. 00013 00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 THE SOFTWARE. 00021 */ 00022 00023 #pragma once 00024 00025 #include <string> 00026 #include <OgreTexture.h> 00027 #include <OgreResource.h> 00028 #include "CanvasPrerequisites.h" 00029 00030 class _OgreCanvasExport DynamicTexture : public Ogre::ManualResourceLoader 00031 { 00032 public: 00033 DynamicTexture(const std::string& _textureName, unsigned int _width, unsigned int _height, bool _enableAlpha = true, int _mipmaps = 0); 00034 virtual ~DynamicTexture(); 00035 00036 virtual void loadResource(Ogre::Resource* resource) = 0; 00037 void update(const Ogre::PixelBox& _box); 00038 00039 const std::string getName() const { return mName; } 00040 Ogre::TexturePtr getTexture() { return mTexture; } 00041 Ogre::PixelFormat getPixelFormat() { return mFormat; } 00042 00043 protected: 00044 void createTexture(void); 00045 00046 unsigned int mWidth; 00047 unsigned int mHeight; 00048 std::string mName; 00049 Ogre::PixelFormat mFormat; 00050 int mMipMaps; 00051 Ogre::TexturePtr mTexture; 00052 };
1.6.3