|
1 #pragma once |
|
2 #include "src/basics.h" |
|
3 |
|
4 class InputVertices |
|
5 { |
|
6 std::vector<glm::vec3> polygon = {origin}; |
|
7 std::size_t numpoints = 1; |
|
8 public: |
|
9 bool currentPointOnExistingPoint() const; |
|
10 std::size_t calcNumPoints() const; |
|
11 void updateCurrentPoint(const glm::vec3& p); |
|
12 void removeLastPoint(); |
|
13 void finishCurrentPoint(); |
|
14 void clear(); |
|
15 const glm::vec3& operator[](std::size_t i) const |
|
16 { |
|
17 return this->polygon[i]; |
|
18 } |
|
19 std::size_t bufferSize() const |
|
20 { |
|
21 return this->polygon.size(); |
|
22 } |
|
23 std::size_t polygonSize() const |
|
24 { |
|
25 return this->numpoints; |
|
26 } |
|
27 auto begin() const |
|
28 { |
|
29 return std::begin(this->polygon); |
|
30 } |
|
31 auto end() const |
|
32 { |
|
33 return std::end(this->polygon); |
|
34 } |
|
35 auto polygonEnd() const |
|
36 { |
|
37 return std::begin(this->polygon) + static_cast<long int>(this->numpoints); |
|
38 } |
|
39 }; |