texture_provider.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 **    Harry Storbacka
00028 */
00029 
00032 
00033 #pragma once
00034 
00035 #include "../Render/texture.h"
00036 #include "../api_display.h"
00037 #include "../../Core/System/sharedptr.h"
00038 #include "../../Core/Text/string_types.h"
00039 
00040 enum CL_TextureWrapMode;
00041 enum CL_TextureFilter;
00042 enum CL_TextureCompareMode;
00043 enum CL_CompareFunction;
00044 class CL_PixelBuffer;
00045 class CL_PixelFormat;
00046 class CL_GraphicContextProvider;
00047 
00051 class CL_API_DISPLAY CL_TextureProvider
00052 {
00055 
00056 public:
00057         virtual ~CL_TextureProvider() { return; }
00058 
00062 
00063 public:
00064 
00068 
00069 public:
00071         virtual void destroy() = 0;
00072 
00074         virtual void create(int width, int height, CL_TextureFormat internal_format, int depth) = 0;
00075 
00077         virtual CL_PixelBuffer get_pixeldata(CL_TextureFormat sized_format, int level) const = 0;
00078 
00080         virtual void generate_mipmap() = 0;
00081 
00083         virtual void set_image(CL_PixelBuffer &image, int level) = 0;
00084 
00086         virtual void set_cube_map(
00087                 CL_PixelBuffer &cube_map_positive_x,
00088                 CL_PixelBuffer &cube_map_negative_x,
00089                 CL_PixelBuffer &cube_map_positive_y,
00090                 CL_PixelBuffer &cube_map_negative_y,
00091                 CL_PixelBuffer &cube_map_positive_z,
00092                 CL_PixelBuffer &cube_map_negative_z,
00093                 int level) = 0;
00094 
00095         virtual void set_compressed_image(
00096                 int level,
00097                 CL_TextureFormat internal_format,
00098                 int width,
00099                 int height,
00100                 CL_DataBuffer &image) = 0;
00101 
00103         virtual void set_subimage(
00104                 int x,
00105                 int y,
00106                 const CL_PixelBuffer &image,
00107                 const CL_Rect &src_rect,
00108                 int level) = 0;
00109 
00111         virtual void copy_image_from(
00112                 int x,
00113                 int y,
00114                 int width,
00115                 int height,
00116                 int level,
00117                 CL_TextureFormat internal_format,
00118                 CL_GraphicContextProvider *gc) = 0;
00119 
00121         virtual void copy_subimage_from(
00122                 int offset_x,
00123                 int offset_y,
00124                 int x,
00125                 int y,
00126                 int width,
00127                 int height,
00128                 int level,
00129                 CL_GraphicContextProvider *gc) = 0;
00130 
00132         virtual void set_min_lod(double min_lod) = 0;
00133 
00135         virtual void set_max_lod(double max_lod) = 0;
00136 
00138         virtual void set_lod_bias(double lod_bias) = 0;
00139 
00141         virtual void set_base_level(int base_level) = 0;
00142 
00144         virtual void set_max_level(int max_level) = 0;
00145 
00147         virtual void set_wrap_mode(
00148                 CL_TextureWrapMode wrap_s,
00149                 CL_TextureWrapMode wrap_t,
00150                 CL_TextureWrapMode wrap_r) = 0;
00151 
00152         virtual void set_wrap_mode(
00153                 CL_TextureWrapMode wrap_s,
00154                 CL_TextureWrapMode wrap_t) = 0;
00155 
00156         virtual void set_wrap_mode(
00157                 CL_TextureWrapMode wrap_s) = 0;
00158 
00160         virtual void set_min_filter(CL_TextureFilter filter) = 0;
00161 
00163         virtual void set_mag_filter(CL_TextureFilter filter) = 0;
00164 
00166         virtual void set_max_anisotropy(float v) = 0;
00167 
00169         virtual void set_texture_compare(CL_TextureCompareMode mode, CL_CompareFunction func) = 0;
00170 
00174 
00175 private:
00177 };
00178