texture_provider.h Source File - ClanLib SDK
Description: texture_provider.h Source File

texture_provider.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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
30#pragma once
31
32#include "../Render/texture.h"
33#include <memory>
34
35namespace clan
36{
39
40 enum class TextureWrapMode;
41 enum class TextureFilter;
42 enum class TextureCompareMode;
43 enum class CompareFunction;
44 class PixelBuffer;
45 class PixelFormat;
46 class GraphicContextProvider;
47
49 class TextureProvider
50 {
51 public:
52 virtual ~TextureProvider() { return; }
53
55 virtual void create(int width, int height, int depth, int array_size, TextureFormat texture_format, int levels) = 0;
56
58 virtual PixelBuffer get_pixeldata(GraphicContext &gc, TextureFormat texture_format, int level) const = 0;
59
61 virtual void generate_mipmap() = 0;
62
64 virtual void copy_from(GraphicContext &gc, int x, int y, int slice, int level, const PixelBuffer &src, const Rect &src_rect) = 0;
65
67 virtual void copy_image_from(
68 int x,
69 int y,
70 int width,
71 int height,
72 int level,
73 TextureFormat texture_format,
74 GraphicContextProvider *gc) = 0;
75
77 virtual void copy_subimage_from(
78 int offset_x,
79 int offset_y,
80 int x,
81 int y,
82 int width,
83 int height,
84 int level,
85 GraphicContextProvider *gc) = 0;
86
88 virtual void set_min_lod(double min_lod) = 0;
89
91 virtual void set_max_lod(double max_lod) = 0;
92
94 virtual void set_lod_bias(double lod_bias) = 0;
95
97 virtual void set_base_level(int base_level) = 0;
98
100 virtual void set_max_level(int max_level) = 0;
101
103 virtual void set_wrap_mode(
104 TextureWrapMode wrap_s,
105 TextureWrapMode wrap_t,
106 TextureWrapMode wrap_r) = 0;
107
108 virtual void set_wrap_mode(
109 TextureWrapMode wrap_s,
110 TextureWrapMode wrap_t) = 0;
111
112 virtual void set_wrap_mode(
113 TextureWrapMode wrap_s) = 0;
114
116 virtual void set_min_filter(TextureFilter filter) = 0;
117
119 virtual void set_mag_filter(TextureFilter filter) = 0;
120
122 virtual void set_max_anisotropy(float v) = 0;
123
125 virtual void set_texture_compare(TextureCompareMode mode, CompareFunction func) = 0;
126
128 virtual TextureProvider *create_view(TextureDimensions texture_dimensions, TextureFormat texture_format, int min_level, int num_levels, int min_layer, int num_layers) = 0;
129 };
130
132}
clan::GraphicContextProvider
Interface for implementing a GraphicContext target.
Definition graphic_context_provider.h:86
clan::GraphicContext
Interface to drawing graphics.
Definition graphic_context.h:257
clan::PixelBuffer
Pixel data container.
Definition pixel_buffer.h:68
clan::Rect
2D (left,top,right,bottom) rectangle structure - Integer
Definition rect.h:489
clan::TextureProvider
Interface for implementing a Texture target.
Definition texture_provider.h:50
clan::TextureProvider::set_wrap_mode
virtual void set_wrap_mode(TextureWrapMode wrap_s)=0
clan::TextureProvider::set_lod_bias
virtual void set_lod_bias(double lod_bias)=0
Sets the level of detail bias constant.
clan::TextureProvider::copy_subimage_from
virtual void copy_subimage_from(int offset_x, int offset_y, int x, int y, int width, int height, int level, GraphicContextProvider *gc)=0
Copy sub image data from a graphic context.
clan::TextureProvider::set_wrap_mode
virtual void set_wrap_mode(TextureWrapMode wrap_s, TextureWrapMode wrap_t, TextureWrapMode wrap_r)=0
Set the texture wrapping mode.
clan::TextureProvider::set_max_level
virtual void set_max_level(int max_level)=0
Sets the texture max level texture parameter.
clan::TextureProvider::set_base_level
virtual void set_base_level(int base_level)=0
Sets the texture base level texture parameter.
clan::TextureProvider::copy_from
virtual void copy_from(GraphicContext &gc, int x, int y, int slice, int level, const PixelBuffer &src, const Rect &src_rect)=0
Copy image data to texture.
clan::TextureProvider::set_texture_compare
virtual void set_texture_compare(TextureCompareMode mode, CompareFunction func)=0
Sets the texture compare mode and compare function texture parameters.
clan::TextureProvider::get_pixeldata
virtual PixelBuffer get_pixeldata(GraphicContext &gc, TextureFormat texture_format, int level) const =0
Retrieve image data from texture.
clan::TextureProvider::set_mag_filter
virtual void set_mag_filter(TextureFilter filter)=0
Set the magnification filter.
clan::TextureProvider::set_max_lod
virtual void set_max_lod(double max_lod)=0
Set the maximum level of detail texture parameter.
clan::TextureProvider::create_view
virtual TextureProvider * create_view(TextureDimensions texture_dimensions, TextureFormat texture_format, int min_level, int num_levels, int min_layer, int num_layers)=0
\breif Creates a texture view for this texture
clan::TextureProvider::create
virtual void create(int width, int height, int depth, int array_size, TextureFormat texture_format, int levels)=0
Create texture.
clan::TextureProvider::~TextureProvider
virtual ~TextureProvider()
Definition texture_provider.h:52
clan::TextureProvider::set_max_anisotropy
virtual void set_max_anisotropy(float v)=0
Set the maximum degree of anisotropy.
clan::TextureProvider::set_min_lod
virtual void set_min_lod(double min_lod)=0
Set the minimum level of detail texture parameter.
clan::TextureProvider::generate_mipmap
virtual void generate_mipmap()=0
Generate the mipmap.
clan::TextureProvider::set_wrap_mode
virtual void set_wrap_mode(TextureWrapMode wrap_s, TextureWrapMode wrap_t)=0
clan::TextureProvider::copy_image_from
virtual void copy_image_from(int x, int y, int width, int height, int level, TextureFormat texture_format, GraphicContextProvider *gc)=0
Copy image data from a graphic context.
clan::TextureProvider::set_min_filter
virtual void set_min_filter(TextureFilter filter)=0
Set the minification filter.
clan::CompareFunction
CompareFunction
Compare functions.
Definition graphic_context.h:92
clan::TextureFormat
TextureFormat
Texture format.
Definition texture_format.h:39
clan::TextureDimensions
TextureDimensions
Texture dimensions.
Definition texture.h:91
clan::TextureCompareMode
TextureCompareMode
Texture compare modes.
Definition texture.h:84
clan::TextureFilter
TextureFilter
Texture filters.
Definition texture.h:73
clan::TextureWrapMode
TextureWrapMode
Texture coordinate wrapping modes.
Definition texture.h:65
clan
Definition clanapp.h:36
clan::Key::y
@ y
clan::Key::x
@ x
clan::Key::v
@ v