gdk-graphics 0a0aef92e917cfbac53dffbc32c295e4de914093
Loading...
Searching...
No Matches
texture.h
1// © Joseph Cameron - MIT License
2
3#ifndef GDK_GRAPHICS_TEXTURE_H
4#define GDK_GRAPHICS_TEXTURE_H
5
7#include <gdk/graphics/types.h>
8
9#include <cstddef>
10#include <vector>
11
12namespace gdk::graphics {
14 class texture {
15 public:
18
25
27 enum class filter_mode {
30 };
31
33 virtual void update_data(const texture_data::view &) = 0;
34
38 virtual void update_data(const texture_data::view &, const std::size_t offsetX, const std::size_t offsetY) = 0;
39
41 virtual ~texture() = default;
42
43 protected:
45 texture() = default;
46 };
47}
48
49#endif
50
texture()=default
interface type cannot be instantiated
texture_data::format format
format of data in the component_type array.
Definition texture.h:17
filter_mode
how a texel is chosen when a pixel does not land exactly on one
Definition texture.h:27
@ sharp
nearest: the one texel closest to the sample, so texels stay square
Definition texture.h:28
@ smooth
linear: a weighted average of the texels around the sample
Definition texture.h:29
virtual void update_data(const texture_data::view &)=0
replace the texture data with new data
virtual ~texture()=default
trivial destructor
wrap_mode
behavior when sampling outside of the normalized texture range (u0-1, v0-1)
Definition texture.h:20
@ repeat
sampled values repeat. e.g: {2,2}, {3,3}, 100,100} would all sample {1,1}
Definition texture.h:22
@ clamped
returns the closest value in range. e.g: {0, 2} OR {0, 1.1} would sample {0, 1}
Definition texture.h:21
@ mirrored
every odd whole value flips the index of the sampled value. {1.25, 0.5} would sample {0....
Definition texture.h:23
virtual void update_data(const texture_data::view &, const std::size_t offsetX, const std::size_t offsetY)=0
update a section of texture data
provides a pointer a contiguous list of channel data representing 2D texture metadata that contains i...
Definition texture_data.h:27
what the core takes: decoded channel data and the metadata describing it
format
format of data in the component_type array
Definition texture_data.h:13