gdk-graphics 0b051eb9b5c1eaa0658babaa4463dd7a80aa9d2c
Loading...
Searching...
No Matches
texture.h
1// © Joseph Cameron - All Rights Reserved
2
3#ifndef GDK_GFX_TEXTURE_H
4#define GDK_GFX_TEXTURE_H
5
6#include <gdk/graphics_types.h>
7
8#include <cstddef>
9#include <vector>
10
11namespace gdk {
12 namespace texture_data {
13 struct view;
14 }
17 class texture {
18 public:
19 //TODO: rename one,two,three,four since which channels the data is stored in from the perspective of a shader depends on the implementation
20 // Why: opengles rgba, rgb, luminance (1ch), luminance alpha (2ch). I cant change this behavior,
21 // giving them the more intuitive 'grey' and 'rg' are misleading
23 enum class format {
28 };
29
36
38 virtual void update_data(const texture_data::view &) = 0;
39
43 virtual void update_data(const texture_data::view &, const size_t offsetX, const size_t offsetY) = 0;
44
46 virtual ~texture() = default;
47
48 protected:
50 texture() = default;
51 };
52}
53
54#endif
55
wrap_mode
behavior when sampling outside of the normalized texture range (u0-1, v0-1)
Definition texture.h:31
@ repeat
sampled values repeat. e.g: {2,2}, {3,3}, 100,100} would all sample {1,1}
Definition texture.h:33
@ clamped
returns the closest value in range. e.g: {0, 2} OR {0, 1.1} would sample {0, 1}
Definition texture.h:32
@ mirrored
every odd whole value flips the index of the sampled value. {1.25, 0.5} would sample {0....
Definition texture.h:34
virtual ~texture()=default
trivial destructor
virtual void update_data(const texture_data::view &)=0
replace the texture data with new data
virtual void update_data(const texture_data::view &, const size_t offsetX, const size_t offsetY)=0
texture()=default
interface type cannot be instantiated
format
format of data in the component_type array
Definition texture.h:23
@ rg
a sequence of 2 channels, single byte colors: red, green, ...
Definition texture.h:25
@ rgba
a sequence of 4 channels, single byte colors: red, green, blue, alpha, ...
Definition texture.h:27
@ grey
a sequence of 1 channel, single byte color: grey, ...
Definition texture.h:24
@ rgb
a sequence of 3 channels, single byte colors: red, green, blue, ...
Definition texture.h:26
provides a pointer a contiguous list of channel data representing 2D texture metadata that contains i...
Definition texture_data.h:20