ClanLib  2.3.7
texture_provider.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 */
29 
32 
33 #pragma once
34 
35 #include "../Render/texture.h"
36 #include "../api_display.h"
37 #include "../../Core/System/sharedptr.h"
38 #include "../../Core/Text/string_types.h"
39 
41 enum CL_TextureFilter;
44 class CL_PixelBuffer;
45 class CL_PixelFormat;
47 
52 {
55 
56 public:
57  virtual ~CL_TextureProvider() { return; }
58 
62 
63 public:
64 
68 
69 public:
71  virtual void destroy() = 0;
72 
74  virtual void create(int width, int height, CL_TextureFormat internal_format, int depth) = 0;
75 
77  virtual CL_PixelBuffer get_pixeldata(CL_TextureFormat sized_format, int level) const = 0;
78 
80  virtual void generate_mipmap() = 0;
81 
83  virtual void set_image(CL_PixelBuffer &image, int level) = 0;
84 
86  virtual void set_cube_map(
87  CL_PixelBuffer &cube_map_positive_x,
88  CL_PixelBuffer &cube_map_negative_x,
89  CL_PixelBuffer &cube_map_positive_y,
90  CL_PixelBuffer &cube_map_negative_y,
91  CL_PixelBuffer &cube_map_positive_z,
92  CL_PixelBuffer &cube_map_negative_z,
93  int level) = 0;
94 
95  virtual void set_compressed_image(
96  int level,
97  CL_TextureFormat internal_format,
98  int width,
99  int height,
100  CL_DataBuffer &image) = 0;
101 
103  virtual void set_subimage(
104  int x,
105  int y,
106  const CL_PixelBuffer &image,
107  const CL_Rect &src_rect,
108  int level) = 0;
109 
111  virtual void copy_image_from(
112  int x,
113  int y,
114  int width,
115  int height,
116  int level,
117  CL_TextureFormat internal_format,
118  CL_GraphicContextProvider *gc) = 0;
119 
121  virtual void copy_subimage_from(
122  int offset_x,
123  int offset_y,
124  int x,
125  int y,
126  int width,
127  int height,
128  int level,
129  CL_GraphicContextProvider *gc) = 0;
130 
132  virtual void set_min_lod(double min_lod) = 0;
133 
135  virtual void set_max_lod(double max_lod) = 0;
136 
138  virtual void set_lod_bias(double lod_bias) = 0;
139 
141  virtual void set_base_level(int base_level) = 0;
142 
144  virtual void set_max_level(int max_level) = 0;
145 
147  virtual void set_wrap_mode(
148  CL_TextureWrapMode wrap_s,
149  CL_TextureWrapMode wrap_t,
150  CL_TextureWrapMode wrap_r) = 0;
151 
152  virtual void set_wrap_mode(
153  CL_TextureWrapMode wrap_s,
154  CL_TextureWrapMode wrap_t) = 0;
155 
156  virtual void set_wrap_mode(
157  CL_TextureWrapMode wrap_s) = 0;
158 
160  virtual void set_min_filter(CL_TextureFilter filter) = 0;
161 
163  virtual void set_mag_filter(CL_TextureFilter filter) = 0;
164 
166  virtual void set_max_anisotropy(float v) = 0;
167 
169  virtual void set_texture_compare(CL_TextureCompareMode mode, CL_CompareFunction func) = 0;
170 
174 
175 private:
177 };
178