9 std::vector<SDL_Vertex> vertices;
10 std::vector<int> indices;
11 vertices.push_back(SDL_Vertex {.position = {x, y}, .color = {1, 1, 1, 1}});
12 auto resf =
static_cast<float>(resolution);
13 for (
int i = 0; i < resolution; i++) {
14 float xp = cos(i / resf * std::numbers::pi_v<float> * 2.f) * radius +
15 vertices[0].position.x;
16 float yp = sin(i / resf * std::numbers::pi_v<float> * 2.f) * radius +
17 vertices[0].position.y;
18 vertices.emplace_back(
19 SDL_Vertex {.position = {xp, yp}, .color = {1, 1, 1, 1}}
22 indices.push_back(i + 1);
23 indices.push_back(((i + 2) % resolution) + 1);
34 unsigned int resolution,
37 static constexpr
auto tau = std::numbers::pi_v<float> * 2.f;
38 const float resf =
static_cast<float>(resolution);
39 const unsigned int arcRes = round((width / tau) * resf);
40 std::vector<SDL_Vertex> vertices;
41 std::vector<int> indices;
44 vertices.resize(arcRes * 2 + 2);
45 for (
unsigned int i = 0; i <= arcRes; i++) {
48 const float px = cos(a) * (radius - height) + x;
49 const float py = sin(a) * (radius - height) + y;
50 vertices[i * 2] = SDL_Vertex {.position = {px, py}, .color = col};
53 const float px = cos(a) * (radius + 2) + x;
54 const float py = sin(a) * (radius + 2) + y;
55 vertices[i * 2 + 1] = SDL_Vertex {.position = {px, py}, .color = col};
58 for (
unsigned int i = 0; i < arcRes * 2; ++i) {
60 indices.push_back(i + 1);
61 indices.push_back(i + 2);