Unravel Engine C++ Reference
Loading...
Searching...
No Matches
circle_shape.cpp
Go to the documentation of this file.
1#include "circle_shape.hpp"
2
3using namespace generator;
4
5circle_shape_t::circle_shape_t(double radius, int segments, double start, double sweep)
6 : parametric_shape_{[radius, start, sweep](double t)
7 {
8 const double angle = t * sweep + start;
9 const double sine = std::sin(angle);
10 const double cosine = std::cos(angle);
11
12 shape_vertex_t vertex;
13 vertex.position = gml::dvec2{radius * cosine, radius * sine};
14 vertex.tangent = gml::dvec2{-sine, cosine};
15 vertex.tex_coord = t;
16
17 return vertex;
18 },
20{
21}
circle_shape_t(double radius=1.0, int segments=32, double start=0.0, double sweep=gml::radians(360.0))
const segment_list * segments