forked from maplibre/maplibre-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvertex_buffer_resource.hpp
35 lines (25 loc) · 1.05 KB
/
vertex_buffer_resource.hpp
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
#pragma once
#include <mbgl/mtl/buffer_resource.hpp>
#include <mbgl/util/monotonic_timer.hpp>
#include <memory>
namespace mbgl {
namespace mtl {
class VertexBufferResource : public gfx::VertexBufferResource {
public:
VertexBufferResource(BufferResource&&) noexcept;
VertexBufferResource(VertexBufferResource&& other) noexcept
: buffer(std::move(other.buffer)) {}
~VertexBufferResource() noexcept override;
std::size_t getSizeInBytes() const noexcept { return buffer.getSizeInBytes(); }
const void* contents() const noexcept { return buffer.contents(); }
BufferResource& get() noexcept { return buffer; }
const BufferResource& get() const noexcept { return buffer; }
std::chrono::duration<double> getLastUpdated() const { return lastUpdated; }
void setLastUpdated(std::chrono::duration<double> time) { lastUpdated = time; }
protected:
BufferResource buffer;
std::chrono::duration<double> lastUpdated;
};
using UniqueVertexBufferResource = std::unique_ptr<VertexBufferResource>;
} // namespace mtl
} // namespace mbgl