diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-26 12:53:32 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-05 10:52:19 -0700 |
commit | 7a3bef091e7390fa57bf33f1a704c893768b5625 (patch) | |
tree | af798d879923fd45e763f5dc5449b7e8419aa192 /src/mbgl/gl/index_buffer.hpp | |
parent | ac8a74ebccb85f83c40b9fccfeb11dc2cb3c79e4 (diff) | |
download | qtlocation-mapboxgl-7a3bef091e7390fa57bf33f1a704c893768b5625.tar.gz |
[core] Refactor Buffer
Diffstat (limited to 'src/mbgl/gl/index_buffer.hpp')
-rw-r--r-- | src/mbgl/gl/index_buffer.hpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/mbgl/gl/index_buffer.hpp b/src/mbgl/gl/index_buffer.hpp new file mode 100644 index 0000000000..f38d7fd4f5 --- /dev/null +++ b/src/mbgl/gl/index_buffer.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include <mbgl/gl/object.hpp> + +namespace mbgl { +namespace gl { + +class Line { +public: + Line(uint16_t a_, uint16_t b_) + : a(a_), b(b_) {} + + uint16_t a; + uint16_t b; + + static constexpr std::size_t IndexCount = 2; +}; + +class Triangle { +public: + Triangle(uint16_t a_, uint16_t b_, uint16_t c_) + : a(a_), b(b_), c(c_) {} + + uint16_t a; + uint16_t b; + uint16_t c; + + static constexpr std::size_t IndexCount = 3; +}; + +template <class Primitive> +class IndexBuffer { +public: + static_assert(std::is_same<Primitive, Line>::value || std::is_same<Primitive, Triangle>::value, + "primitive must be Line or Triangle"); + static constexpr std::size_t primitiveSize = sizeof(Primitive); + UniqueBuffer buffer; +}; + +} // namespace gl +} // namespace mbgl |