00001 /* 00002 spacegameengine is a portable easy to use game engine written in C++. 00003 Copyright (C) 2006-2007 Carl Philipp Reh (sefi@s-e-f-i.de) 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public License 00007 as published by the Free Software Foundation; either version 2 00008 of the License, or (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 00021 #ifndef SGE_TEXTURE_MANAGER_HPP_INCLUDED 00022 #define SGE_TEXTURE_MANAGER_HPP_INCLUDED 00023 00024 #include "fragmented.hpp" 00025 #include "../export.hpp" 00026 #include "../shared_ptr.hpp" 00027 #include "../exception.hpp" 00028 #include "../renderer/device.hpp" 00029 #include "../renderer/texture.hpp" 00030 #include <boost/noncopyable.hpp> 00031 #include <boost/function.hpp> 00032 #include <boost/ptr_container/ptr_list.hpp> 00033 00034 namespace sge 00035 { 00036 namespace texture 00037 { 00038 00039 class manager : boost::noncopyable { 00040 public: 00041 typedef boost::function<fragmented* ()> onalloc_function; 00042 SGE_SYMBOL manager( 00043 renderer::device_ptr rend, 00044 const onalloc_function&); 00045 SGE_SYMBOL const part_ptr add( 00046 renderer::const_image_view const &src); 00047 SGE_SYMBOL const part_ptr add( 00048 renderer::texture_ptr tex); 00049 SGE_SYMBOL const renderer::device_ptr get_renderer() const; 00050 SGE_SYMBOL void onalloc(const onalloc_function&); 00051 00052 class SGE_CLASS_SYMBOL image_too_big : public exception { 00053 public: 00054 SGE_SYMBOL image_too_big(); 00055 }; 00056 private: 00057 const part_ptr init_texture( 00058 fragmented&, 00059 renderer::const_image_view const &src) const; 00060 00061 const renderer::device_ptr rend; 00062 onalloc_function onalloc_; 00063 typedef boost::ptr_list<fragmented> fragmented_texture_list; 00064 fragmented_texture_list fragmented_textures; 00065 }; 00066 00067 typedef shared_ptr<manager> manager_ptr; 00068 00069 } 00070 } 00071 00072 #endif
1.5.5