337 for (
int tri = 0; tri < 8; tri++) {
338 for (
int v = 0;
v < 3;
v++) {
363 constexpr int resolution = 64;
368 float2 cv = ring[a % resolution];
397 verts.append(vert_strip[t]);
398 verts.append(vert_strip[t + 1]);
399 verts.append(vert_strip[t + 2]);
402 constexpr int resolution = 12;
405 float2 cv1 = ring[a % resolution];
406 float2 cv2 = ring[(a + 1) % resolution];
424 for (
int tri = 0; tri < 12; tri++) {
425 for (
int v = 0;
v < 3;
v++) {
450 constexpr int lon_res = 24;
451 constexpr int lat_res = 24;
452 constexpr float lon_inc = 2.0f *
M_PI / lon_res;
453 constexpr float lat_inc =
M_PI / lat_res;
455 auto lat_lon_to_co = [](
const float lat,
const float lon) {
461 for (
int i = 0;
i < lon_res;
i++, lon += lon_inc) {
464 for (
int j = 0; j < lat_res; j++, lat += lat_inc) {
477 constexpr int circle_resolution = 64;
484 v0 = circle_pt((2.0f *
M_PI * -2) /
float(circle_resolution));
485 v1 = circle_pt((2.0f *
M_PI * -1) /
float(circle_resolution));
486 for (
int a = 0; a <= circle_resolution; a++, v0 = v1, v1 =
v2) {
487 v2 = circle_pt((2.0f *
M_PI * a) /
float(circle_resolution));
497 constexpr int resolution = 16;
500 auto set_vert = [&](
const float x,
const float y,
const int quarter) {
510 float x =
sinf(
M_PI_2 * j /
float(resolution - 1));
511 if (j == resolution -
i) {
513 set_vert(prev_x,
z, quarter);
514 set_vert(prev_x, prev_z, quarter);
515 set_vert(
x, prev_z, quarter);
519 set_vert(
x,
z, quarter);
520 set_vert(
x, prev_z, quarter);
521 set_vert(prev_x,
z, quarter);
523 set_vert(
x, prev_z, quarter);
524 set_vert(prev_x, prev_z, quarter);
525 set_vert(prev_x,
z, quarter);
537 constexpr int resolution = 16 * 4;
542 float2 cv = ring[a % resolution];
567 const Array<float2> quad = {{-1.0f, 1.0f}, {1.0f, 1.0f}, {-1.0f, -1.0f}, {1.0f, -1.0f}};
591 float p[3][3] = {{0}};
597 p[1][2] = p[2][2] = 0.75f;
599 if (sides % 2 == 1) {
607 for (
int i = 0, a = 1;
i < 2;
i++, a++) {
637 constexpr int resolution = 64;
642 float2 cv1 = ring[(a + 0) % resolution];
643 float2 cv2 = ring[(a + 1) % resolution];
660 constexpr int resolution = 8;
665 float2 cv = ring[
i % resolution];
671 float2 cv = ring[(
i + j) % resolution];
681 constexpr int n_segments = 12;
689 for (
const float2 &point : ring) {
700 for (
const float2 &point : diamond) {
709 constexpr int n_segments = 24;
716 const float2 &next_point = ring[
i + 1];
729 float2 x_axis_name_scale = {0.0215f, 0.025f};
731 float2(0.9f, 1.0f) * x_axis_name_scale,
732 float2(-1.0f, -1.0f) * x_axis_name_scale,
733 float2(-0.9f, 1.0f) * x_axis_name_scale,
734 float2(1.0f, -1.0f) * x_axis_name_scale,
737 float2 y_axis_name_scale = {0.0175f, 0.025f};
739 float2(-1.0f, 1.0f) * y_axis_name_scale,
740 float2(0.0f, -0.1f) * y_axis_name_scale,
741 float2(1.0f, 1.0f) * y_axis_name_scale,
742 float2(0.0f, -0.1f) * y_axis_name_scale,
743 float2(0.0f, -0.1f) * y_axis_name_scale,
744 float2(0.0f, -1.0f) * y_axis_name_scale,
747 float2 z_axis_name_scale = {0.02f, 0.025f};
749 float2(-0.95f, 1.00f) * z_axis_name_scale,
750 float2(0.95f, 1.00f) * z_axis_name_scale,
751 float2(0.95f, 1.00f) * z_axis_name_scale,
752 float2(0.95f, 0.90f) * z_axis_name_scale,
753 float2(0.95f, 0.90f) * z_axis_name_scale,
754 float2(-1.00f, -0.90f) * z_axis_name_scale,
755 float2(-1.00f, -0.90f) * z_axis_name_scale,
756 float2(-1.00f, -1.00f) * z_axis_name_scale,
757 float2(-1.00f, -1.00f) * z_axis_name_scale,
758 float2(1.00f, -1.00f) * z_axis_name_scale,
761 float2 axis_marker_scale = {0.007f, 0.007f};
764 float2(-1.0f, 1.0f) * axis_marker_scale,
765 float2(1.0f, 1.0f) * axis_marker_scale,
766 float2(1.0f, 1.0f) * axis_marker_scale,
767 float2(1.0f, -1.0f) * axis_marker_scale,
768 float2(1.0f, -1.0f) * axis_marker_scale,
769 float2(-1.0f, -1.0f) * axis_marker_scale,
770 float2(-1.0f, -1.0f) * axis_marker_scale,
771 float2(-1.0f, 1.0f) * axis_marker_scale,
773 float2(-1.0f, 0.0f) * axis_marker_scale,
774 float2(0.0f, 1.0f) * axis_marker_scale,
775 float2(0.0f, 1.0f) * axis_marker_scale,
776 float2(1.0f, 0.0f) * axis_marker_scale,
777 float2(1.0f, 0.0f) * axis_marker_scale,
778 float2(0.0f, -1.0f) * axis_marker_scale,
779 float2(0.0f, -1.0f) * axis_marker_scale,
780 float2(-1.0f, 0.0f) * axis_marker_scale,
792 float pos_on_axis =
float(axis) + 1e-8f;
794 verts.append({{0.0f, 0.0f, pos_on_axis},
flag});
796 constexpr int marker_fill_layer = 6;
797 for (
int j = 1; j < marker_fill_layer + 1; j++) {
798 for (
float2 axis_marker_vert : axis_marker) {
799 verts.append({{axis_marker_vert * ((4.0f * j) / marker_fill_layer), pos_on_axis},
flag});
803 const Vector<float2> *axis_names[3] = {&x_axis_name, &y_axis_name, &z_axis_name};
804 for (
float2 axis_name_vert : *(axis_names[axis])) {
806 verts.append({{axis_name_vert * 4.0f, pos_on_axis + 0.25f},
flag});
814 constexpr int resolution = 64;
815 constexpr float radius = 1.0f;
820 float2 cv = ring[
i % resolution];
828 constexpr int segments = 16;
829 constexpr float bottom_r = 0.5f;
830 constexpr float bottom_z = -0.125f;
831 constexpr float step_z = 0.25f;
837 for (
float2 &point : ring) {
841 const float z = step_z * j + bottom_z;
845 for (
const float2 &point : diamond) {
847 verts.append(vertex);
848 vertex.
pos =
float3(point * 0.5f, bottom_z + step_z);
849 verts.append(vertex);
850 verts.append(vertex);
851 vertex.
pos.z += step_z;
852 verts.append(vertex);
878 const Vector<float2> rect{{-1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, -1.0f}};
883 for (
const float2 &point : rect) {
892 const Vector<float2> triangle = {{-1.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}};
901 for (
const float2 &point : triangle) {
912 const int v = tri[
i];
957 const Array<float2> quad = {{0.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}, {1.0f, 0.0f}};
983 constexpr float r = 9.0f;
993 constexpr float r = 9.0f;
1006 constexpr int num_rays = 8;
1007 constexpr float r = 9.0f;
1009 const std::array<float, 4> scales{1.6f, 1.9f, 2.2f, 2.5f};
1012 for (
const float2 &point : ring) {
1013 for (
float scale : scales) {
1050 for (
const float2 &point : ring) {
1075 const Array<float2> rect{{-0.5f, -0.5f}, {-0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, -0.5f}};
1088 constexpr int circle_resol = 32;
1090 constexpr std::array<float, 2> scales{2.0f, 0.75};
1096 for (
const float scale : scales) {
1097 for (
float2 &point : ring) {
1108 constexpr int circle_resol = 32;
1114 const float z = 0.05f *
float(
i);
1123 constexpr int spiral_resol = 32;
1130 const float r = (
i - spiral_resol) /
float(spiral_resol);
1133 const float2 point = ring[
abs(spiral_resol -
i) % spiral_resol] * r;
1141 constexpr int circle_resol = 32;
1153 constexpr int circle_resol = 32 * 2;
1165 constexpr int circle_resol = 32;
1166 constexpr int side_stipple = 32;
1174 const float z =
i * 2.0f - 1.0f;
1178 for (
const float2 &point : diamond) {
1180 const float z = (
i /
float(side_stipple)) * 2.0f - 1.0f;
1190 constexpr int circle_resol = 32;
1191 constexpr int side_stipple = 32;
1199 const float z =
i * 2.0f - 1.0f;
1203 for (
const float2 &point : diamond) {
1205 const float z = (
i /
float(side_stipple)) * 2.0f - 1.0f;
1215 constexpr float r = 14.0f;
1218 constexpr float sin_pi_3 = 0.86602540378f;
1219 constexpr float cos_pi_3 = 0.5f;
1222 float2(sin_pi_3, cos_pi_3) * r,
1223 float2(sin_pi_3, -cos_pi_3) * r,
1225 float2(-sin_pi_3, -cos_pi_3) * r,
1226 float2(-sin_pi_3, cos_pi_3) * r,
1233 const float2 &point = points[
i * 2 + 1];
1240 const std::string axes =
"zZyYxX";
1241 for (
const char axis : axes) {
1250 constexpr float r = 20.0f;
1252 constexpr float sin_pi_3 = 0.86602540378f;
1255 float2(sin_pi_3, 0.0f) * r,
1257 float2(-sin_pi_3, 0.0f) * r,
1268 constexpr float r = 14.0f;
1271 constexpr float sin_pi_3 = 0.86602540378f;
1272 constexpr float cos_pi_3 = 0.5f;
1274 float2(sin_pi_3, cos_pi_3) * r,
1275 float2(sin_pi_3, -cos_pi_3) * r,
1277 float2(-sin_pi_3, -cos_pi_3) * r,
1278 float2(-sin_pi_3, cos_pi_3) * r};
1284 const float2 tr = points[(
i / 2) * 2 + 1] * -0.5f;
1285 const float2 t1 = points[
i] + tr;
1286 const float2 t2 = points[(
i + 1) % 6] + tr;
1291 const float2 &point = points[
i * 2 + 1];
1297 const std::string axes =
"zZyYxX";
1298 for (
const char axis : axes) {
1307 constexpr int resolution = 8;
1308 std::array<float, resolution + 1> steps;
1311 steps[
i] = -1.0f +
float(
i * 2) / resolution;
1315 verts.reserve(resolution * resolution * 6);
1332 const int segments = 12;
1333 const float radius = 0.5f;
1334 const float color_primary[3] = {1.0f, 0.0f, 0.0f};
1335 const float color_secondary[3] = {1.0f, 1.0f, 1.0f};
1339 for (
int i = 0;
i < segments + 1;
i++) {
1342 (
i % 2 == 0) ? color_secondary : color_primary});
1350 const float outer_limit = 1.0f;
1351 const float color_limit = 0.85f;
1352 const float inner_limit = 0.25f;
1355 float crosshair_color[3];
1359 for (
int i = 0;
i < 3;
i++) {
1364 verts.append({outer_limit * axis, crosshair_color});
1365 verts.append({color_limit * axis, crosshair_color});
1369 verts.append({color_limit * axis, crosshair_color});
1370 verts.append({inner_limit * axis, crosshair_color});
1375 verts.append({outer_limit * axis, crosshair_color});
1376 verts.append({color_limit * axis, crosshair_color});
1380 verts.append({color_limit * axis, crosshair_color});
1381 verts.append({inner_limit * axis, crosshair_color});