322 for (
int tri = 0; tri < 8; tri++) {
323 for (
int v = 0;
v < 3;
v++) {
348 constexpr int resolution = 64;
353 float2 cv = ring[a % resolution];
382 verts.append(vert_strip[t]);
383 verts.append(vert_strip[t + 1]);
384 verts.append(vert_strip[t + 2]);
387 constexpr int resolution = 12;
390 float2 cv1 = ring[a % resolution];
391 float2 cv2 = ring[(a + 1) % resolution];
409 for (
int tri = 0; tri < 12; tri++) {
410 for (
int v = 0;
v < 3;
v++) {
435 constexpr int lon_res = 24;
436 constexpr int lat_res = 24;
437 constexpr float lon_inc = 2.0f *
M_PI / lon_res;
438 constexpr float lat_inc =
M_PI / lat_res;
440 auto lat_lon_to_co = [](
const float lat,
const float lon) {
446 for (
int i = 0; i < lon_res; i++, lon += lon_inc) {
449 for (
int j = 0; j < lat_res; j++, lat += lat_inc) {
450 verts.append({lat_lon_to_co(lat, lon),
VCLASS_NONE});
451 verts.append({lat_lon_to_co(lat, lon + lon_inc),
VCLASS_NONE});
462 constexpr int circle_resolution = 64;
469 v0 = circle_pt((2.0f *
M_PI * -2) /
float(circle_resolution));
470 v1 = circle_pt((2.0f *
M_PI * -1) /
float(circle_resolution));
471 for (
int a = 0; a <= circle_resolution; a++, v0 = v1, v1 =
v2) {
472 v2 = circle_pt((2.0f *
M_PI * a) /
float(circle_resolution));
473 verts.append({v0, v1,
v2});
482 constexpr int resolution = 16;
485 auto set_vert = [&](
const float x,
const float y,
const int quarter) {
486 verts.append({{(quarter % 2 == 0) ? -
x :
x, (quarter < 2) ? -
y :
y, 0.0f},
VCLASS_NONE});
492 float z =
sinf(
M_PI_2 * i /
float(resolution - 1));
495 float x =
sinf(
M_PI_2 * j /
float(resolution - 1));
496 if (j == resolution - i) {
498 set_vert(prev_x,
z, quarter);
499 set_vert(prev_x, prev_z, quarter);
500 set_vert(
x, prev_z, quarter);
504 set_vert(
x,
z, quarter);
505 set_vert(
x, prev_z, quarter);
506 set_vert(prev_x,
z, quarter);
508 set_vert(
x, prev_z, quarter);
509 set_vert(prev_x, prev_z, quarter);
510 set_vert(prev_x,
z, quarter);
522 constexpr int resolution = 16 * 4;
527 float2 cv = ring[a % resolution];
552 const Array<float2> quad = {{-1.0f, 1.0f}, {1.0f, 1.0f}, {-1.0f, -1.0f}, {1.0f, -1.0f}};
554 for (
const float2 &point : quad) {
576 float p[3][3] = {{0}};
582 p[1][2] = p[2][2] = 0.75f;
584 if (sides % 2 == 1) {
592 for (
int i = 0, a = 1; i < 2; i++, a++) {
622 constexpr int resolution = 64;
627 float2 cv1 = ring[(a + 0) % resolution];
628 float2 cv2 = ring[(a + 1) % resolution];
645 constexpr int resolution = 8;
650 float2 cv = ring[i % resolution];
656 float2 cv = ring[(i + j) % resolution];
666 constexpr int n_segments = 12;
674 for (
const float2 &point : ring) {
685 for (
const float2 &point : diamond) {
686 verts.append({{point.x, point.y, 1.0f},
VCLASS_NONE});
687 verts.append({{point.x, point.y, 0.0f},
VCLASS_NONE});
694 constexpr int n_segments = 24;
699 for (
const int i :
IndexRange(n_segments / 2)) {
700 const float2 &point = ring[i];
701 const float2 &next_point = ring[i + 1];
703 verts.append({{point.x, 0.0f, point.y},
VCLASS_NONE});
704 verts.append({{next_point.x, 0.0f, next_point.y},
VCLASS_NONE});
706 verts.append({{0.0f, point.x, point.y},
VCLASS_NONE});
707 verts.append({{0.0f, next_point.x, next_point.y},
VCLASS_NONE});
714 float2 x_axis_name_scale = {0.0215f, 0.025f};
716 float2(0.9f, 1.0f) * x_axis_name_scale,
717 float2(-1.0f, -1.0f) * x_axis_name_scale,
718 float2(-0.9f, 1.0f) * x_axis_name_scale,
719 float2(1.0f, -1.0f) * x_axis_name_scale,
722 float2 y_axis_name_scale = {0.0175f, 0.025f};
724 float2(-1.0f, 1.0f) * y_axis_name_scale,
725 float2(0.0f, -0.1f) * y_axis_name_scale,
726 float2(1.0f, 1.0f) * y_axis_name_scale,
727 float2(0.0f, -0.1f) * y_axis_name_scale,
728 float2(0.0f, -0.1f) * y_axis_name_scale,
729 float2(0.0f, -1.0f) * y_axis_name_scale,
732 float2 z_axis_name_scale = {0.02f, 0.025f};
734 float2(-0.95f, 1.00f) * z_axis_name_scale,
735 float2(0.95f, 1.00f) * z_axis_name_scale,
736 float2(0.95f, 1.00f) * z_axis_name_scale,
737 float2(0.95f, 0.90f) * z_axis_name_scale,
738 float2(0.95f, 0.90f) * z_axis_name_scale,
739 float2(-1.00f, -0.90f) * z_axis_name_scale,
740 float2(-1.00f, -0.90f) * z_axis_name_scale,
741 float2(-1.00f, -1.00f) * z_axis_name_scale,
742 float2(-1.00f, -1.00f) * z_axis_name_scale,
743 float2(1.00f, -1.00f) * z_axis_name_scale,
746 float2 axis_marker_scale = {0.007f, 0.007f};
749 float2(-1.0f, 1.0f) * axis_marker_scale,
750 float2(1.0f, 1.0f) * axis_marker_scale,
751 float2(1.0f, 1.0f) * axis_marker_scale,
752 float2(1.0f, -1.0f) * axis_marker_scale,
753 float2(1.0f, -1.0f) * axis_marker_scale,
754 float2(-1.0f, -1.0f) * axis_marker_scale,
755 float2(-1.0f, -1.0f) * axis_marker_scale,
756 float2(-1.0f, 1.0f) * axis_marker_scale,
758 float2(-1.0f, 0.0f) * axis_marker_scale,
759 float2(0.0f, 1.0f) * axis_marker_scale,
760 float2(0.0f, 1.0f) * axis_marker_scale,
761 float2(1.0f, 0.0f) * axis_marker_scale,
762 float2(1.0f, 0.0f) * axis_marker_scale,
763 float2(0.0f, -1.0f) * axis_marker_scale,
764 float2(0.0f, -1.0f) * axis_marker_scale,
765 float2(-1.0f, 0.0f) * axis_marker_scale,
777 float pos_on_axis =
float(axis) + 1e-8f;
779 verts.append({{0.0f, 0.0f, pos_on_axis}, flag});
781 constexpr int marker_fill_layer = 6;
782 for (
int j = 1; j < marker_fill_layer + 1; j++) {
783 for (
float2 axis_marker_vert : axis_marker) {
784 verts.append({{axis_marker_vert * ((4.0f * j) / marker_fill_layer), pos_on_axis}, flag});
788 const Vector<float2> *axis_names[3] = {&x_axis_name, &y_axis_name, &z_axis_name};
789 for (
float2 axis_name_vert : *(axis_names[axis])) {
791 verts.append({{axis_name_vert * 4.0f, pos_on_axis + 0.25f}, flag});
799 constexpr int resolution = 64;
800 constexpr float radius = 1.0f;
805 float2 cv = ring[i % resolution];
813 constexpr int segments = 16;
814 constexpr float bottom_r = 0.5f;
815 constexpr float bottom_z = -0.125f;
816 constexpr float step_z = 0.25f;
822 for (
float2 &point : ring) {
826 const float z = step_z * j + bottom_z;
830 for (
const float2 &point : diamond) {
863 const Vector<float2> rect{{-1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, -1.0f}};
868 for (
const float2 &point : rect) {
877 const Vector<float2> triangle = {{-1.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}};
886 for (
const float2 &point : triangle) {
897 const int v = tri[i];
942 const Array<float2> quad = {{0.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}, {1.0f, 0.0f}};
944 for (
const float2 &point : quad) {
968 constexpr float r = 9.0f;
978 constexpr float r = 9.0f;
991 constexpr int num_rays = 8;
992 constexpr float r = 9.0f;
994 const std::array<float, 4> scales{1.6f, 1.9f, 2.2f, 2.5f};
997 for (
const float2 &point : ring) {
998 for (
float scale : scales) {
1035 for (
const float2 &point : ring) {
1060 const Array<float2> rect{{-0.5f, -0.5f}, {-0.5f, 0.5f}, {0.5f, 0.5f}, {0.5f, -0.5f}};
1073 constexpr int circle_resol = 32;
1075 constexpr std::array<float, 2> scales{2.0f, 0.75};
1081 for (
const float scale : scales) {
1082 for (
float2 &point : ring) {
1093 constexpr int circle_resol = 32;
1099 const float z = 0.05f *
float(i);
1108 constexpr int spiral_resol = 32;
1115 const float r = (i - spiral_resol) /
float(spiral_resol);
1118 const float2 point = ring[
abs(spiral_resol - i) % spiral_resol] * r;
1126 constexpr int circle_resol = 32;
1138 constexpr int circle_resol = 32 * 2;
1150 constexpr int circle_resol = 32;
1151 constexpr int side_stipple = 32;
1159 const float z = i * 2.0f - 1.0f;
1163 for (
const float2 &point : diamond) {
1164 for (
const int i :
IndexRange(side_stipple)) {
1165 const float z = (i /
float(side_stipple)) * 2.0f - 1.0f;
1175 constexpr int circle_resol = 32;
1176 constexpr int side_stipple = 32;
1184 const float z = i * 2.0f - 1.0f;
1188 for (
const float2 &point : diamond) {
1189 for (
const int i :
IndexRange(side_stipple)) {
1190 const float z = (i /
float(side_stipple)) * 2.0f - 1.0f;
1200 constexpr float r = 14.0f;
1203 constexpr float sin_pi_3 = 0.86602540378f;
1204 constexpr float cos_pi_3 = 0.5f;
1207 float2(sin_pi_3, cos_pi_3) * r,
1208 float2(sin_pi_3, -cos_pi_3) * r,
1210 float2(-sin_pi_3, -cos_pi_3) * r,
1211 float2(-sin_pi_3, cos_pi_3) * r,
1218 const float2 &point = points[i * 2 + 1];
1219 verts.append(
Vertex{{point, 0.0f}, flag});
1220 verts.append(
Vertex{{0.0f, 0.0f, 0.0f}, flag});
1225 const std::string axes =
"zZyYxX";
1226 for (
const char axis : axes) {
1235 constexpr float r = 20.0f;
1237 constexpr float sin_pi_3 = 0.86602540378f;
1240 float2(sin_pi_3, 0.0f) * r,
1242 float2(-sin_pi_3, 0.0f) * r,
1253 constexpr float r = 14.0f;
1256 constexpr float sin_pi_3 = 0.86602540378f;
1257 constexpr float cos_pi_3 = 0.5f;
1259 float2(sin_pi_3, cos_pi_3) * r,
1260 float2(sin_pi_3, -cos_pi_3) * r,
1262 float2(-sin_pi_3, -cos_pi_3) * r,
1263 float2(-sin_pi_3, cos_pi_3) * r};
1269 const float2 tr = points[(i / 2) * 2 + 1] * -0.5f;
1270 const float2 t1 = points[i] + tr;
1271 const float2 t2 = points[(i + 1) % 6] + tr;
1272 verts.append({{t1, 0.0f}, flag});
1273 verts.append({{t2, 0.0f}, flag});
1276 const float2 &point = points[i * 2 + 1];
1277 verts.append(
Vertex{{point, 0.0f}, flag});
1278 verts.append(
Vertex{{0.0f, 0.0f, 0.0f}, flag});
1282 const std::string axes =
"zZyYxX";
1283 for (
const char axis : axes) {
1292 constexpr int resolution = 8;
1293 std::array<float, resolution + 1> steps;
1295 for (
const int i :
IndexRange(resolution + 1)) {
1296 steps[i] = -1.0f +
float(i * 2) / resolution;
1300 verts.
reserve(resolution * resolution * 6);
1303 verts.append(
Vertex{{steps[
x], steps[
y], 0.0f}});
1304 verts.append(
Vertex{{steps[
x + 1], steps[
y], 0.0f}});
1305 verts.append(
Vertex{{steps[
x], steps[
y + 1], 0.0f}});
1307 verts.append(
Vertex{{steps[
x], steps[
y + 1], 0.0f}});
1308 verts.append(
Vertex{{steps[
x + 1], steps[
y], 0.0f}});
1309 verts.append(
Vertex{{steps[
x + 1], steps[
y + 1], 0.0f}});
1317 const int segments = 12;
1318 const float radius = 0.5f;
1319 const float color_primary[3] = {1.0f, 0.0f, 0.0f};
1320 const float color_secondary[3] = {1.0f, 1.0f, 1.0f};
1324 for (
int i = 0; i < segments + 1; i++) {
1327 (i % 2 == 0) ? color_secondary : color_primary});
1335 const float outer_limit = 1.0f;
1336 const float color_limit = 0.85f;
1337 const float inner_limit = 0.25f;
1340 float crosshair_color[3];
1344 for (
int i = 0; i < 3; i++) {
1349 verts.append({outer_limit * axis, crosshair_color});
1350 verts.append({color_limit * axis, crosshair_color});
1354 verts.append({color_limit * axis, crosshair_color});
1355 verts.append({inner_limit * axis, crosshair_color});
1360 verts.append({outer_limit * axis, crosshair_color});
1361 verts.append({color_limit * axis, crosshair_color});
1365 verts.append({color_limit * axis, crosshair_color});
1366 verts.append({inner_limit * axis, crosshair_color});