Unravel Engine C++ Reference
Loading...
Searching...
No Matches
convex_polygon_mesh.hpp
Go to the documentation of this file.
1#ifndef GENERATOR_CONVEX_POLYGON_MESH_HPP
2#define GENERATOR_CONVEX_POLYGON_MESH_HPP
3
4#include <vector>
5
6#include "math.hpp"
7
8#include "mesh_vertex.hpp"
9#include "triangle.hpp"
10
11namespace generator
12{
13
18{
19private:
20 class triangles_t
21 {
22 public:
23 bool done() const noexcept;
24 triangle_t generate() const;
25 void next();
26
27 private:
28 const convex_polygon_mesh_t* mesh_;
29
30 bool odd_;
31
32 int segment_index_;
33
34 int side_index_;
35
36 int ring_index_;
37
38 explicit triangles_t(const convex_polygon_mesh_t&) noexcept;
39
40 friend class convex_polygon_mesh_t;
41 };
42
43 class vertices_t
44 {
45 public:
46 bool done() const noexcept;
47 mesh_vertex_t generate() const;
48 void next();
49
50 private:
51 const convex_polygon_mesh_t* mesh_;
52
53 bool center_done_;
54
55 int segment_index_;
56
57 int side_index_;
58
59 int ring_index_;
60
61 explicit vertices_t(const convex_polygon_mesh_t&) noexcept;
62
63 friend class convex_polygon_mesh_t;
64 };
65
66 std::vector<gml::dvec3> vertices_;
67
68 int segments_;
69
70 int rings_;
71
72 gml::dvec3 center_;
73
74 gml::dvec3 normal_;
75
76 gml::dvec3 tangent_;
77
78 gml::dvec3 bitangent_;
79
80 gml::dvec2 tex_delta_;
81
82public:
89 explicit convex_polygon_mesh_t(double radius = 1.0, int sides = 5, int segments = 4, int rings = 4) noexcept;
90
92 explicit convex_polygon_mesh_t(const std::vector<gml::dvec2>& vertices, int segments = 1, int rings = 1) noexcept;
93
97 explicit convex_polygon_mesh_t(std::vector<gml::dvec3> vertices, int segments = 1, int rings = 1) noexcept;
98
99 triangles_t triangles() const noexcept;
100
101 vertices_t vertices() const noexcept;
102};
103} // namespace generator
104
105#endif
vertices_t vertices() const noexcept
convex_polygon_mesh_t(double radius=1.0, int sides=5, int segments=4, int rings=4) noexcept
triangles_t triangles() const noexcept
const segment_list * segments