blob: a30c086323b67d2bf76edfddd6a2ce5164c21c83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include <mbgl/gl/object_store.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/atomic.hpp>
namespace mbgl {
namespace gl {
class Config;
} // namespace gl
class Raster {
public:
enum class MipMap : bool { No = false, Yes = true };
enum class Scaling : bool { Nearest = false, Linear = true };
// load image data
void load(PremultipliedImage, uint32_t mipmapLevel = 0);
// bind current texture
void bind(gl::ObjectStore&,
gl::Config&,
uint32_t unit,
Scaling = Scaling::Nearest,
MipMap = MipMap::No);
// uploads the texture if it hasn't been uploaded yet.
void upload(gl::ObjectStore&, gl::Config&, uint32_t unit);
// loaded status
bool isLoaded() const;
private:
// raw pixels have been loaded
util::Atomic<bool> loaded { false };
// filters
Scaling filter = Scaling::Nearest;
MipMap mipmap = MipMap::No;
// the raw pixels
std::vector<PremultipliedImage> images;
// GL buffer object handle.
mbgl::optional<gl::UniqueTexture> texture;
};
} // namespace mbgl
|