1 #pragma once 2 3 #include <mbgl/gl/types.hpp> 4 #include <mbgl/gl/primitives.hpp> 5 6 #include <cassert> 7 8 namespace mbgl { 9 namespace gl { 10 11 class Points { 12 public: 13 using Primitive = Point; 14 15 static constexpr std::size_t bufferGroupSize = 1; 16 static constexpr PrimitiveType primitiveType = PrimitiveType::Points; 17 Points(float pointSize_)18 explicit Points(float pointSize_) : pointSize(pointSize_) {} 19 20 float pointSize; 21 }; 22 23 class Lines { 24 public: 25 using Primitive = Line; 26 27 static constexpr std::size_t bufferGroupSize = 2; 28 static constexpr PrimitiveType primitiveType = PrimitiveType::Lines; 29 Lines(float lineWidth_)30 explicit Lines(float lineWidth_) : lineWidth(lineWidth_) { 31 assert(lineWidth > 0); 32 } 33 34 float lineWidth; 35 }; 36 37 class LineStrip { 38 public: 39 // LineStrip is a form of "Line" rendering, but the element buffer 40 // cannot be grouped into logical elements beyond a single Point. 41 using Primitive = Line; 42 43 static constexpr std::size_t bufferGroupSize = 1; 44 static constexpr PrimitiveType primitiveType = PrimitiveType::LineStrip; 45 LineStrip(float lineWidth_)46 explicit LineStrip(float lineWidth_) : lineWidth(lineWidth_) { 47 assert(lineWidth > 0); 48 } 49 50 float lineWidth; 51 }; 52 53 class Triangles { 54 public: 55 using Primitive = Triangle; 56 57 static constexpr std::size_t bufferGroupSize = 3; 58 static constexpr PrimitiveType primitiveType = PrimitiveType::Triangles; 59 }; 60 61 class TriangleStrip { 62 public: 63 // TriangleStrip is a form of "Triangle" rendering, but the element buffer 64 // cannot be grouped into logical elements beyond a single Point. 65 using Primitive = Triangle; 66 67 static constexpr std::size_t bufferGroupSize = 1; 68 static constexpr PrimitiveType primitiveType = PrimitiveType::TriangleStrip; 69 }; 70 71 // Special draw mode for use with VertexVector<Indexed, Vertex>, in which 72 // case the true draw mode is denoted by the IndexVector type. 73 class Indexed { 74 public: 75 static constexpr std::size_t bufferGroupSize = 1; 76 }; 77 78 } // namespace gl 79 } // namespace mbgl 80