texture.h
1 /*
2 ** UICore
3 ** Copyright (c) 1997-2015 The UICore 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 UICore may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 */
29 
30 #pragma once
31 
32 #include <memory>
33 #include "graphic_context.h"
34 #include "../Image/image_import_description.h"
35 #include "../Image/texture_format.h"
36 
37 namespace uicore
38 {
39  class Color;
40  class Point;
41  class PixelBuffer;
42  class PixelBufferSet;
43  typedef std::shared_ptr<PixelBufferSet> PixelBufferSetPtr;
44  class PixelFormat;
45  class TextureProvider;
46  class Texture1D;
47  class Texture1DArray;
48  class Texture2D;
49  class Texture2DArray;
50  class Texture3D;
51  class TextureCube;
52  class TextureCubeArray;
53  class TextureObject;
54 
57  {
61  };
62 
65  {
72  };
73 
76  {
79  };
80 
83  {
91  };
92 
94  class Texture
95  {
96  public:
98  static std::shared_ptr<Texture> create(const GraphicContextPtr &gc, PixelBufferSetPtr pixelbuffer_set);
99 
101  virtual float min_lod() const = 0;
102 
104  virtual float max_lod() const = 0;
105 
107  virtual float lod_bias() const = 0;
108 
110  virtual int base_level() const = 0;
111 
113  virtual int max_level() const = 0;
114 
116  virtual TextureFilter min_filter() const = 0;
117 
119  virtual TextureFilter mag_filter() const = 0;
120 
122  virtual TextureCompareMode compare_mode() const = 0;
123 
125  virtual CompareFunction compare_function() const = 0;
126 
128  virtual void generate_mipmap() = 0;
129 
131  virtual void set_min_lod(float min_lod) = 0;
132 
134  virtual void set_max_lod(float max_lod) = 0;
135 
137  virtual void set_lod_bias(float lod_bias) = 0;
138 
140  virtual void set_base_level(int base_level) = 0;
141 
143  virtual void set_max_level(int max_level) = 0;
144 
146  virtual void set_min_filter(TextureFilter filter) = 0;
147 
149  virtual void set_mag_filter(TextureFilter filter) = 0;
150 
152  virtual void set_max_anisotropy(float max_anisotropy) = 0;
153 
155  virtual void set_texture_compare(TextureCompareMode mode, CompareFunction func) = 0;
156 
158  virtual TextureObject *texture_object() = 0;
159  };
160 
161  typedef std::shared_ptr<Texture> TexturePtr;
162 }
virtual TextureFilter mag_filter() const =0
Get the texture magnification filter.
TextureFilter
Texture filters.
Definition: texture.h:64
Texture object class.
Definition: texture.h:94
virtual void set_max_level(int max_level)=0
Sets the texture max level texture parameter.
virtual void set_min_lod(float min_lod)=0
Set the minimum level of detail texture parameter.
Definition: texture.h:89
virtual void generate_mipmap()=0
Generate mipmap textures.
std::shared_ptr< Texture > TexturePtr
Definition: d3d_target.h:37
Definition: texture.h:77
virtual void set_max_anisotropy(float max_anisotropy)=0
Set the maximum degree of anisotropy.
Definition: texture.h:87
Definition: texture.h:70
virtual CompareFunction compare_function() const =0
Get the texture compare function.
virtual float min_lod() const =0
Get the minimum level of detail.
Definition: texture.h:84
virtual TextureObject * texture_object()=0
virtual int base_level() const =0
Get the texture base level.
virtual float max_lod() const =0
Get the maximum level of detail.
CompareFunction
Compare functions.
Definition: graphic_context.h:95
Definition: texture.h:90
Definition: texture.h:67
Definition: texture.h:69
static std::shared_ptr< Texture > create(const GraphicContextPtr &gc, PixelBufferSetPtr pixelbuffer_set)
Constructs a texture as described by a pixelbuffer set.
Definition: texture.h:85
TextureCompareMode
Texture compare modes.
Definition: texture.h:75
virtual void set_max_lod(float max_lod)=0
Set the maximum level of detail texture parameter.
Definition: texture.h:86
virtual int max_level() const =0
Get the texture max level.
virtual void set_texture_compare(TextureCompareMode mode, CompareFunction func)=0
Sets the texture compare mode and compare function texture parameters.
virtual TextureCompareMode compare_mode() const =0
Get the texture compare mode.
Definition: texture.h:88
TextureDimensions
Texture dimensions.
Definition: texture.h:82
Definition: texture.h:66
virtual void set_base_level(int base_level)=0
Sets the texture base level texture parameter.
Definition: texture.h:59
Definition: texture.h:71
virtual void set_mag_filter(TextureFilter filter)=0
Set the magnification filter.
std::shared_ptr< GraphicContext > GraphicContextPtr
Definition: d3d_target.h:49
virtual void set_lod_bias(float lod_bias)=0
Sets the level of detail bias constant.
Definition: texture.h:60
virtual float lod_bias() const =0
Get the level of detail bias constant.
TextureWrapMode
Texture coordinate wrapping modes.
Definition: texture.h:56
Definition: texture.h:58
virtual TextureFilter min_filter() const =0
Get the texture minification filter.
std::shared_ptr< PixelBufferSet > PixelBufferSetPtr
Definition: pixel_buffer_set.h:79
Definition: Application/application.h:35
virtual void set_min_filter(TextureFilter filter)=0
Set the minification filter.