43#define VCLASS_LIGHT_AREA_SHAPE (1 << 0)
44#define VCLASS_LIGHT_SPOT_SHAPE (1 << 1)
45#define VCLASS_LIGHT_SPOT_BLEND (1 << 2)
46#define VCLASS_LIGHT_SPOT_CONE (1 << 3)
47#define VCLASS_LIGHT_DIST (1 << 4)
49#define VCLASS_CAMERA_FRAME (1 << 5)
50#define VCLASS_CAMERA_DIST (1 << 6)
51#define VCLASS_CAMERA_VOLUME (1 << 7)
53#define VCLASS_SCREENSPACE (1 << 8)
54#define VCLASS_SCREENALIGNED (1 << 9)
56#define VCLASS_EMPTY_SCALED (1 << 10)
57#define VCLASS_EMPTY_AXES (1 << 11)
58#define VCLASS_EMPTY_AXES_NAME (1 << 12)
59#define VCLASS_EMPTY_AXES_SHADOW (1 << 13)
60#define VCLASS_EMPTY_SIZE (1 << 14)
64#define DRW_SPHERE_SHAPE_LATITUDE_LOW 32
65#define DRW_SPHERE_SHAPE_LONGITUDE_LOW 24
67#define DRW_SPHERE_SHAPE_LATITUDE_MEDIUM 64
68#define DRW_SPHERE_SHAPE_LONGITUDE_MEDIUM 48
70#define DRW_SPHERE_SHAPE_LATITUDE_HIGH 80
71#define DRW_SPHERE_SHAPE_LONGITUDE_HIGH 60
84 operator const void *()
const
95 operator const void *()
const
172 uint i =
sizeof(
SHC) /
sizeof(blender::gpu::Batch *);
173 blender::gpu::Batch **
batch = (blender::gpu::Batch **)&
SHC;
304 if (
format.attr_len == 0) {
312 float v1[3] = {0.0, 0.0, 0.0};
313 float v2[3] = {0.0, 0.0, 0.0};
314 float vtmp1[3], vtmp2[3];
316 for (
int axis = 0; axis < 3; axis++) {
317 const int arrow_axis = (axis == 0) ? 1 : 0;
326 v1[arrow_axis] = -0.08f;
332 v1[arrow_axis] = 0.08f;
339 v1[arrow_axis] = v1[axis] =
v2[axis] = 0.0f;
360 p[i][0] = rad *
cosf(angle);
361 p[i][1] = rad *
sinf(angle);
364 for (
int axis = 0; axis < 3; axis++) {
366 for (
int j = 0; j < 2; j++) {
375 else if (axis == 1) {
396 const float pos[3][2] = {{-1.0f, -1.0f}, {3.0f, -1.0f}, {-1.0f, 3.0f}};
397 const float uvs[3][2] = {{0.0f, 0.0f}, {2.0f, 0.0f}, {0.0f, 2.0f}};
404 if (
format.attr_len == 0) {
414 for (
int i = 0; i < 3; i++) {
434 const float p[4][2] = {{-1.0f, 1.0f}, {1.0f, 1.0f}, {-1.0f, -1.0f}, {1.0f, -1.0f}};
435 for (
int a = 0; a < 4; a++) {
454 const float p[4][2] = {{-1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, -1.0f}};
455 for (
int a = 0; a < 5; a++) {
473 if (
format.attr_len == 0) {
481 for (
int i = 0; i < 8; i++) {
482 for (
int j = 0; j < 8; j++) {
483 float pos0[2] = {
float(i) / 8.0f,
float(j) / 8.0f};
484 float pos1[2] = {
float(i + 1) / 8.0f,
float(j) / 8.0f};
485 float pos2[2] = {
float(i) / 8.0f,
float(j + 1) / 8.0f};
486 float pos3[2] = {
float(i + 1) / 8.0f,
float(j + 1) / 8.0f};
526 switch (level_of_detail) {
547 int v_len = (lat_res - 1) * lon_res * 6;
550 const float lon_inc = 2 *
M_PI / lon_res;
551 const float lat_inc =
M_PI / lat_res;
556 for (
int i = 0; i < lon_res; i++, lon += lon_inc) {
558 for (
int j = 0; j < lat_res; j++, lat += lat_inc) {
559 if (j != lat_res - 1) {
587 for (
int a = 0; a < segments; a++) {
588 for (
int b = 0;
b < 2;
b++) {
589 float angle = (2.0f *
M_PI * (a +
b)) / segments;
590 float s =
sinf(angle) * radius;
591 float c =
cosf(angle) * radius;
602 for (
int a = 0; a < segments * 2; a += 2) {
603 for (
int b = 0;
b < 2;
b++) {
604 float angle = (2.0f *
M_PI * (a +
b)) / (segments * 2);
605 float s =
sinf(angle) * radius;
606 float c =
cosf(angle) * radius;
618 {-1.0f, 0.0f, -1.0f},
622 {-1.0f, 1.0f, -1.0f},
627 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7,
633static const uint bone_box_wire_adjacent_face[24] = {
634 0, 2, 0, 4, 1, 6, 1, 8, 3, 10, 5, 10, 7, 11, 9, 11, 3, 8, 2, 5, 4, 7, 6, 9,
678static const uint bone_box_solid_tris_adjacency[12][6] = {
680 {3, 26, 4, 20, 5, 1},
682 {6, 2, 7, 16, 8, 11},
683 {9, 7, 10, 32, 11, 24},
685 {12, 0, 13, 22, 14, 17},
686 {15, 13, 16, 30, 17, 6},
688 {18, 3, 19, 28, 20, 23},
689 {21, 19, 22, 33, 23, 12},
691 {24, 4, 25, 10, 26, 29},
692 {27, 25, 28, 34, 29, 18},
694 {30, 9, 31, 15, 32, 35},
695 {33, 31, 34, 21, 35, 27},
735 for (
int i = 0; i < vert_len; i++) {
742 for (
int i = 0; i < tri_len; i++) {
755#define CIRCLE_RESOL 64
800 if (
format.attr_len == 0) {
816 memset(vbo->
data<
uint8_t>().data(), 0xFF,
size_t(vert_len));
821 for (
int i = 0; i < vert_len; i++) {
891 return DRW_pointcloud_batch_cache_get_dots(ob);
893 return DRW_cache_volume_face_wireframe_get(ob);
895 return DRW_cache_grease_pencil_face_wireframe_get(scene, ob);
925 short type = (mesh !=
nullptr) ?
short(
OB_MESH) : ob->
type;
929 return DRW_mesh_batch_cache_pos_vertbuf_get(
930 *
static_cast<Mesh *
>((mesh !=
nullptr) ? mesh : ob->
data));
939 short type = ob->
type;
951 return DRW_mesh_material_count_get(
952 *ob, *
static_cast<const Mesh *
>((mesh !=
nullptr) ? mesh : ob->
data));
956 return DRW_curve_material_count_get(
static_cast<const Curve *
>(ob->
data));
958 return DRW_curves_material_count_get(
static_cast<const Curves *
>(ob->
data));
960 return DRW_pointcloud_material_count_get(
static_cast<const PointCloud *
>(ob->
data));
962 return DRW_volume_material_count_get(
static_cast<const Volume *
>(ob->
data));
971 uint gpumat_array_len)
1038 float p[3][3] = {{0}};
1044 p[1][2] = p[2][2] = 0.75f;
1045 for (
int sides = 0; sides < 4; sides++) {
1046 if (sides % 2 == 1) {
1054 for (
int i = 0, a = 1; i < 2; i++, a++) {
1090 p[i][0] =
cosf(angle);
1091 p[i][1] =
sinf(angle);
1129 p[i][0] =
cosf(angle);
1130 p[i][1] =
sinf(angle);
1159 const float pos[8][3] = {
1164 {-1.0f, 0.0f, 1.0f},
1165 {-1.0f, 0.0f, 0.0f},
1166 {0.0f, -1.0f, 1.0f},
1167 {0.0f, -1.0f, 0.0f},
1175 if (
format.attr_len == 0) {
1197 p[i][0] =
cosf(angle);
1198 p[i][1] =
sinf(angle);
1206 if (
format.attr_len == 0) {
1216 float v[3] = {0.0f, 0.0f, 0.0f};
1223 for (
int i = 0; i <
NSEGMENTS / 2; i++) {
1224 float v[3] = {0.0f, 0.0f, 0.0f};
1248#define CIRCLE_RESOL 32
1258 for (
int i = 0; i < 4; i++) {
1259 float z = 0.05f *
float(i);
1271#define CIRCLE_RESOL 32
1281 for (
int i = 0; i < 3; i++) {
1282 float radius = 1.0f + 0.5f * i;
1294#define SPIRAL_RESOL 32
1324#define CIRCLE_RESOL 32
1344#define CIRCLE_RESOL 32
1345#define SIDE_STIPPLE 32
1356 for (
int i = 0; i < 2; i++) {
1357 float z = i * 2.0f - 1.0f;
1361 for (
int a = 0; a < 4; a++) {
1362 float angle = (2.0f *
M_PI * a) / 4.0f;
1379#define CIRCLE_RESOL 32
1380#define SIDE_STIPPLE 32
1391 for (
int i = 0; i < 2; i++) {
1392 float z = i * 2.0f - 1.0f;
1396 for (
int a = 0; a < 4; a++) {
1397 float angle = (2.0f *
M_PI * a) / 4.0f;
1414#define CIRCLE_RESOL 32
1439#define DIAMOND_NSEGMENTS 4
1440#define INNER_NSEGMENTS 8
1441#define OUTER_NSEGMENTS 10
1442#define CIRCLE_NSEGMENTS 32
1448 return start ? 0.4f : 0.3f;
1450 return start ? 0.6f : 0.7f;
1452 return start ? 1.4f : 1.3f;
1454 return start ? 1.6f : 1.7f;
1456 return start ? 2.4f : 2.3f;
1458 return start ? 2.6f : 2.7f;
1493 const float r = 9.0f;
1514 const float r = 9.0f;
1530 const int num_rays = 8;
1531 int v_len = 4 * num_rays;
1536 const float r = 9.0f;
1541 for (
int a = 0; a < num_rays; a++) {
1542 float angle = (2.0f *
M_PI * a) /
float(num_rays);
1543 float s =
sinf(angle) * r;
1544 float c =
cosf(angle) * r;
1622 float s =
sinf(angle);
1623 float c =
cosf(angle);
1657 float s =
sinf(-angle);
1658 float c =
cosf(-angle);
1708 for (
int a = 0; a < 4; a++) {
1709 for (
int b = 0;
b < 2;
b++) {
1710 const float p[4][2] = {{-1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, -1.0f}};
1711 float x = p[(a +
b) % 4][0];
1712 float y = p[(a +
b) % 4][1];
1730#undef CIRCLE_NSEGMENTS
1731#undef OUTER_NSEGMENTS
1732#undef INNER_NSEGMENTS
1744 const int segments = 16;
1752 if (
format.attr_len == 0) {
1759 for (
int j = 0; j < 3; j++) {
1760 float z = 0.25f * j - 0.125f;
1761 float r = (j == 0 ? 0.5f : 0.25f);
1765 for (
int i = 1; i < segments; i++) {
1766 float x =
cosf(2.0f *
float(
M_PI) * i / segments) * r;
1767 float y =
sinf(2.0f *
float(
M_PI) * i / segments) * r;
1776 for (
int j = 0; j < 4; j++) {
1777 float x = (((j + 1) % 2) * (j - 1)) * 0.5f;
1778 float y = ((j % 2) * (j - 2)) * 0.5f;
1779 for (
int i = 0; i < 3; i++) {
1785 float z = 0.25f * i - 0.125f;
1814 const float r = 14.0f;
1818 const float sin_pi_3 = 0.86602540378f;
1819 const float cos_pi_3 = 0.5f;
1820 const float p[7][2] = {
1822 {sin_pi_3, cos_pi_3},
1823 {sin_pi_3, -cos_pi_3},
1825 {-sin_pi_3, -cos_pi_3},
1826 {-sin_pi_3, cos_pi_3},
1829 for (
int i = 0; i < 6; i++) {
1844 for (
int i = 0; i < 6; i++) {
1845 char axes[] =
"zZyYxX";
1869 const float r = 14.0f;
1873 const float sin_pi_3 = 0.86602540378f;
1874 const float cos_pi_3 = 0.5f;
1875 const float p[7][2] = {
1877 {sin_pi_3, cos_pi_3},
1878 {sin_pi_3, -cos_pi_3},
1880 {-sin_pi_3, -cos_pi_3},
1881 {-sin_pi_3, cos_pi_3},
1884 for (
int i = 0; i < 6; i++) {
1885 float t1[2], t2[2], tr[2];
1891 for (
int j = 1; j < 2; j++) {
1907 for (
int i = 0; i < 6; i++) {
1908 char axes[] =
"zZyYxX";
1932 const float r = 20.0f;
1935 const float sin_pi_3 = 0.86602540378f;
1936 const float p[4][2] = {
1942 for (
int i = 0; i < 4; i++) {
1943 for (
int a = 0; a < 2; a++) {
1944 float x = p[(i + a) % 4][0] * r;
1945 float y = p[(i + a) % 4][1] * r;
1965 {0.1f, 0.1f, -0.1f},
1966 {-0.1f, 0.1f, -0.1f},
1967 {-0.1f, 0.1f, 0.1f},
1973static const uint bone_octahedral_wire[24] = {
1974 0, 1, 1, 5, 5, 3, 3, 0, 0, 4, 4, 5, 5, 2, 2, 0, 1, 2, 2, 3, 3, 4, 4, 1,
1979static const uint bone_octahedral_wire_adjacent_face[24] = {
1980 0, 3, 4, 7, 5, 6, 1, 2, 2, 3, 6, 7, 4, 5, 0, 1, 0, 4, 1, 5, 2, 6, 3, 7,
2023static const uint bone_octahedral_solid_tris_adjacency[8][6] = {
2024 {0, 12, 1, 10, 2, 3},
2025 {3, 15, 4, 1, 5, 6},
2026 {6, 18, 7, 4, 8, 9},
2027 {9, 21, 10, 7, 11, 0},
2029 {12, 22, 13, 2, 14, 17},
2030 {15, 13, 16, 5, 17, 20},
2031 {18, 16, 19, 8, 20, 23},
2032 {21, 19, 22, 11, 23, 14},
2042 {0.99388373f, 0.11043154f, -0.00000000f},
2043 {0.00000000f, 0.11043154f, -0.99388373f},
2044 {-0.99388373f, 0.11043154f, 0.00000000f},
2045 {0.00000000f, 0.11043154f, 0.99388373f},
2057 if (
format.attr_len == 0) {
2066 for (
int i = 0; i < 8; i++) {
2067 for (
int j = 0; j < 3; j++) {
2085 for (
int i = 0; i < 12; i++) {
2097 pos_nor_batch->verts[0],
2113 if (
format.attr_len == 0) {
2122 for (
int i = 0; i < 12; i++) {
2123 for (
int j = 0; j < 3; j++) {
2140 for (
int i = 0; i < 12; i++) {
2152 pos_nor_batch->verts[0],
2165 r_nor[2] =
cosf(lat);
2171 const int lon_res = 24;
2172 const int lat_res = 24;
2173 const float lon_inc = 2.0f *
M_PI / lon_res;
2174 const float lat_inc =
M_PI / lat_res;
2181 if (
format.attr_len == 0) {
2190 for (
int i = 0; i < lon_res; i++, lon += lon_inc) {
2192 float co1[3], co2[3];
2197 for (
int j = 0; j < lat_res; j++, lat += lat_inc) {
2222#define CIRCLE_RESOL 64
2223 float v0[2], v1[2],
v2[2];
2224 const float radius = 1.0f;
2229 uint pos0, pos1, pos2;
2231 if (
format.attr_len == 0) {
2268 const int lon_res = 16;
2269 const int lat_res = 8;
2270 const float rad = 0.05f;
2271 const float lon_inc = 2 *
M_PI / lon_res;
2272 const float lat_inc =
M_PI / lat_res;
2279 if (
format.attr_len == 0) {
2289 for (
int i = 0; i < lon_res; i++, lon += lon_inc) {
2291 for (
int j = 0; j < lat_res; j++, lat += lat_inc) {
2292 if (j != lat_res - 1) {
2294 vbo,
attr_id.pos,
attr_id.nor, &v_idx, rad, lat + lat_inc, lon + lon_inc);
2295 add_lat_lon_vert(vbo,
attr_id.pos,
attr_id.nor, &v_idx, rad, lat + lat_inc, lon);
2296 add_lat_lon_vert(vbo,
attr_id.pos,
attr_id.nor, &v_idx, rad, lat, lon);
2300 add_lat_lon_vert(vbo,
attr_id.pos,
attr_id.nor, &v_idx, rad, lat, lon + lon_inc);
2302 vbo,
attr_id.pos,
attr_id.nor, &v_idx, rad, lat + lat_inc, lon + lon_inc);
2303 add_lat_lon_vert(vbo,
attr_id.pos,
attr_id.nor, &v_idx, rad, lat, lon);
2310# define CIRCLE_RESOL 64
2312 const float radius = 0.05f;
2319 if (
format.attr_len == 0) {
2347# define CIRCLE_RESOL 64
2348 const float radius = 0.05f;
2355 if (
format.attr_len == 0) {
2379#define COL_WIRE (1 << 0)
2380#define COL_HEAD (1 << 1)
2381#define COL_TAIL (1 << 2)
2382#define COL_BONE (1 << 3)
2384#define POS_HEAD (1 << 4)
2385#define POS_TAIL (1 << 5)
2386#define POS_BONE (1 << 6)
2391#define CIRCLE_RESOL 12
2394 const float radius = 2.0f;
2402 if (
format.attr_len == 0) {
2416 for (
int i = 0; i < 2; i++) {
2441 for (
int i = 0; i < 6; i++) {
2442 pos[1] =
ELEM(i, 0, 3) ? 0.0f : ((i < 3) ? 1.0f : -1.0f);
2462 {0.9f *
S_X, 1.0f *
S_Y},
2463 {-1.0f *
S_X, -1.0f *
S_Y},
2464 {-0.9f *
S_X, 1.0f *
S_Y},
2465 {1.0f *
S_X, -1.0f *
S_Y},
2467#define X_LEN ARRAY_SIZE(x_axis_name)
2474 {-1.0f *
S_X, 1.0f *
S_Y},
2475 {0.0f *
S_X, -0.1f *
S_Y},
2476 {1.0f *
S_X, 1.0f *
S_Y},
2477 {0.0f *
S_X, -0.1f *
S_Y},
2478 {0.0f *
S_X, -0.1f *
S_Y},
2479 {0.0f *
S_X, -1.0f *
S_Y},
2481#define Y_LEN ARRAY_SIZE(y_axis_name)
2488 {-0.95f *
S_X, 1.00f *
S_Y},
2489 {0.95f *
S_X, 1.00f *
S_Y},
2490 {0.95f *
S_X, 1.00f *
S_Y},
2491 {0.95f *
S_X, 0.90f *
S_Y},
2492 {0.95f *
S_X, 0.90f *
S_Y},
2493 {-1.00f *
S_X, -0.90f *
S_Y},
2494 {-1.00f *
S_X, -0.90f *
S_Y},
2495 {-1.00f *
S_X, -1.00f *
S_Y},
2496 {-1.00f *
S_X, -1.00f *
S_Y},
2497 {1.00f *
S_X, -1.00f *
S_Y},
2499#define Z_LEN ARRAY_SIZE(z_axis_name)
2507 {-1.0f *
S_X, 1.0f *
S_Y},
2508 {1.0f *
S_X, 1.0f *
S_Y},
2509 {1.0f *
S_X, 1.0f *
S_Y},
2510 {1.0f *
S_X, -1.0f *
S_Y},
2511 {1.0f *
S_X, -1.0f *
S_Y},
2512 {-1.0f *
S_X, -1.0f *
S_Y},
2513 {-1.0f *
S_X, -1.0f *
S_Y},
2514 {-1.0f *
S_X, 1.0f *
S_Y}
2526#define MARKER_LEN ARRAY_SIZE(axis_marker)
2527#define MARKER_FILL_LAYER 6
2540 for (
int axis = 0; axis < 3; axis++) {
2544 float p[3] = {0.0f, 0.0f,
float(axis)};
2559 p[2] = axis + 0.25f;
2560 for (
int i = 0; i < axis_v_len[axis]; i++) {
2590#define set_vert(a, b, quarter) \
2592 copy_v2_fl2(pos, (quarter % 2 == 0) ? -(a) : (a), (quarter < 2) ? -(b) : (b)); \
2593 GPU_vertbuf_attr_set(vbo, attr_id.pos, v++, pos); \
2601 float x,
z, px, pz,
pos[2];
2608 if (
format.attr_len == 0) {
2616 for (q = 0; q < 4; q++) {
2618 for (i = 1; i < n; i++) {
2621 for (j = 1; j <= (n - i); j++) {
2661 if (
format.attr_len == 0) {
2669 for (i = 0; i < n * 4; i++) {
2670 float a = (1.0f - (i /
float(n * 4))) * 2.0f *
M_PI;
2695 const int v_len = 2 * (4 + 4);
2700 const float p[4][2] = {{-1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, -1.0f}};
2702 for (
int a = 0; a < 4; a++) {
2703 for (
int b = 0;
b < 2;
b++) {
2704 float x = p[(a +
b) % 4][0];
2705 float y = p[(a +
b) % 4][1];
2710 for (
int a = 0; a < 4; a++) {
2734 for (
int a = 0; a < 3; a++) {
2776 const int v_len = 2 * 3;
2781 const float p[3][2] = {{-1.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}};
2782 for (
int a = 0; a < 3; a++) {
2783 for (
int b = 0;
b < 2;
b++) {
2784 float x = p[(a +
b) % 3][0];
2785 float y = p[(a +
b) % 3][1];
2801 const int v_len = 3;
2853 return DRW_mesh_batch_cache_get_all_verts(*
static_cast<Mesh *
>(ob->
data));
2860 return DRW_mesh_batch_cache_get_all_edges(*
static_cast<Mesh *
>(ob->
data));
2867 return DRW_mesh_batch_cache_get_loose_edges(*
static_cast<Mesh *
>(ob->
data));
2874 return DRW_mesh_batch_cache_get_edge_detection(*
static_cast<Mesh *
>(ob->
data), r_is_manifold);
2881 return DRW_mesh_batch_cache_get_surface(*
static_cast<Mesh *
>(ob->
data));
2888 return DRW_mesh_batch_cache_get_surface_edges(*ob, *
static_cast<Mesh *
>(ob->
data));
2893 uint gpumat_array_len)
2897 return DRW_mesh_batch_cache_get_surface_shaded(
2898 *ob, *
static_cast<Mesh *
>(ob->
data), gpumat_array, gpumat_array_len);
2905 return DRW_mesh_batch_cache_get_surface_texpaint(*ob, *
static_cast<Mesh *
>(ob->
data));
2912 return DRW_mesh_batch_cache_get_surface_texpaint_single(*ob, *
static_cast<Mesh *
>(ob->
data));
2919 return DRW_mesh_batch_cache_get_surface_vertpaint(*ob, *
static_cast<Mesh *
>(ob->
data));
2926 return DRW_mesh_batch_cache_get_surface_sculpt(*ob, *
static_cast<Mesh *
>(ob->
data));
2933 return DRW_mesh_batch_cache_get_surface_weights(*
static_cast<Mesh *
>(ob->
data));
2940 return DRW_mesh_batch_cache_get_wireframes_face(*
static_cast<Mesh *
>(ob->
data));
2947 return DRW_mesh_batch_cache_get_edit_mesh_analysis(*
static_cast<Mesh *
>(ob->
data));
2954 return DRW_mesh_batch_cache_get_surface_viewer_attribute(*
static_cast<Mesh *
>(ob->
data));
2968 return DRW_curve_batch_cache_get_wire_edge(cu);
2976 return DRW_curve_batch_cache_get_wire_edge_viewer_attribute(cu);
2984 return DRW_curve_batch_cache_get_normal_edge(cu);
2993 return DRW_curve_batch_cache_get_edit_edges(cu);
3002 return DRW_curve_batch_cache_get_edit_verts(cu);
3016 return DRW_curve_batch_cache_get_wire_edge(cu);
3030 return DRW_curve_batch_cache_get_wire_edge(cu);
3045 return DRW_lattice_batch_cache_get_all_verts(lt);
3060 return DRW_lattice_batch_cache_get_all_edges(lt, use_weight, actdef);
3069 return DRW_lattice_batch_cache_get_edit_verts(lt);
3111 return DRW_particles_batch_cache_get_hair(
object, psys, md);
3117 return DRW_particles_batch_cache_get_dots(
object, psys);
3126 return DRW_particles_batch_cache_get_edit_strands(
object, psys, edit, use_weight);
3134 return DRW_particles_batch_cache_get_edit_inner_points(
object, psys, edit);
3142 return DRW_particles_batch_cache_get_edit_tip_points(
object, psys, edit);
3190#define CIRCLE_RESOL 32
3200 float x =
sinf(angle);
3201 float y =
cosf(angle);
3221 blender::gpu::Batch **drw_cursor = crosshair_lines ? &
SHC.
drw_cursor :
3224 if (*drw_cursor ==
nullptr) {
3225 const float f5 = 0.25f;
3226 const float f10 = 0.5f;
3227 const float f20 = 1.0f;
3229 const int segments = 16;
3230 const int vert_len = segments + 8;
3231 const int index_len = vert_len + 5;
3234 const uchar white[3] = {255, 255, 255};
3240 if (
format.attr_len == 0) {
3253 for (
int i = 0; i < segments; i++) {
3255 float x = f10 *
cosf(angle);
3256 float y = f10 *
sinf(angle);
3265 if (crosshair_lines) {
3266 uchar crosshair_color[3];
3325 DRW_mesh_batch_cache_validate(*ob, *(
Mesh *)ob->
data);
3330 DRW_curve_batch_cache_validate((
Curve *)ob->
data);
3333 DRW_lattice_batch_cache_validate((
Lattice *)ob->
data);
3336 DRW_curves_batch_cache_validate((
Curves *)ob->
data);
3342 DRW_volume_batch_cache_validate((
Volume *)ob->
data);
3358 const bool is_paint_mode =
ELEM(
3362 ((is_paint_mode && (ob == draw_ctx->
obact) &&
3368 DRW_mesh_batch_cache_create_requested(
3374 DRW_curve_batch_cache_create_requested(ob, scene);
3377 DRW_curves_batch_cache_create_requested(ob);
3380 DRW_pointcloud_batch_cache_create_requested(ob);
3397 const bool is_paint_mode =
ELEM(
3401 ((is_paint_mode && (ob == draw_ctx->
obact) &&
3410 if (mesh !=
nullptr) {
3411 DRW_mesh_batch_cache_create_requested(
3412 *
DST.
task_graph, *ob, *mesh, *scene, is_paint_mode, use_hide);
3415 DRW_curve_batch_cache_create_requested(ob, scene);
3446 const char *base_name,
3447 const int data_type,
3448 const char *layer_name,
3449 bool is_active_render,
3450 bool is_active_layer)
3456 SNPRINTF(attr_name,
"%s%s", base_name, attr_safe_name);
3460 SNPRINTF(attr_name,
"a%s", attr_safe_name);
3464 if (is_active_render) {
3469 if (is_active_layer) {
3470 SNPRINTF(attr_name,
"a%s", base_name);
enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit, const Object *ob, eObjectMode object_mode)
General operations, lookup, etc. for blender objects.
Mesh * BKE_object_get_evaluated_mesh_no_subsurf_unchecked(const Object *object)
bool BLI_gset_add(GSet *gs, void *key)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f)
MINLINE void copy_v2_fl(float r[2], float f)
#define SNPRINTF(dst, format,...)
#define UNUSED_FUNCTION(x)
Object is a sort of wrapper for general info.
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, eGPUBatchFlag owns_flag)
#define GPU_BATCH_DISCARD_SAFE(batch)
bool GPU_crappy_amd_driver()
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder *)
blender::gpu::IndexBuf * GPU_indexbuf_build(GPUIndexBufBuilder *)
void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *, uint v)
void GPU_indexbuf_add_line_adj_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3, uint v4)
void GPU_indexbuf_init_ex(GPUIndexBufBuilder *, GPUPrimType, uint index_len, uint vertex_len)
void GPU_indexbuf_add_tri_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3)
void GPU_vertbuf_attr_get_raw_data(blender::gpu::VertBuf *, uint a_idx, GPUVertBufRaw *access)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
#define GPU_vertbuf_create_with_format(format)
void GPU_vertbuf_vert_set(blender::gpu::VertBuf *verts, uint v_idx, const void *data)
void GPU_vertbuf_data_resize(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_attr_fill(blender::gpu::VertBuf *, uint a_idx, const void *data)
void GPU_vertbuf_attr_set(blender::gpu::VertBuf *, uint a_idx, uint v_idx, const void *data)
#define GPU_vertbuf_init_with_format(verts, format)
const GPUVertFormat * GPU_vertbuf_get_format(const blender::gpu::VertBuf *verts)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its red
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
local_group_size(16, 16) .push_constant(Type b
blender::gpu::Batch * DRW_cache_groundline_get()
#define DRW_SPHERE_SHAPE_LONGITUDE_HIGH
blender::gpu::Batch * DRW_cache_bone_point_get()
#define VCLASS_LIGHT_AREA_SHAPE
blender::gpu::Batch * DRW_cache_object_surface_get(Object *ob)
#define set_vert(a, b, quarter)
blender::gpu::Batch * DRW_cache_field_sphere_limit_get()
static struct DRWShapeCache SHC
blender::gpu::Batch * DRW_cache_lightprobe_cube_get()
static const float bone_box_solid_normals[12][3]
blender::gpu::Batch * DRW_cache_light_icon_outer_lines_get()
blender::gpu::Batch * DRW_cache_mesh_surface_weights_get(Object *ob)
blender::gpu::Batch * DRW_cache_curve_edge_wire_viewer_attribute_get(Object *ob)
blender::gpu::Batch * DRW_cache_field_vortex_get()
blender::gpu::Batch * DRW_cache_camera_volume_get()
static const uint bone_octahedral_wire_lines_adjacency[12][4]
void drw_batch_cache_generate_requested_evaluated_mesh_or_curve(Object *ob)
static float y_axis_name[6][2]
blender::gpu::Batch * DRW_cache_mesh_surface_edges_get(Object *ob)
blender::gpu::Batch * DRW_cache_empty_cube_get()
void DRW_shape_cache_free()
static void circle_verts(blender::gpu::VertBuf *vbo, int *vert_idx, int segments, float radius, float z, int flag)
blender::gpu::Batch * DRW_cache_lightprobe_grid_get()
static float x_axis_name[4][2]
blender::gpu::Batch * DRW_cache_light_point_lines_get()
blender::gpu::Batch * DRW_cache_light_spot_lines_get()
blender::gpu::Batch * DRW_cache_lattice_verts_get(Object *ob)
blender::gpu::Batch * DRW_cache_normal_arrow_get()
blender::gpu::Batch * DRW_cache_curve_edge_wire_get(Object *ob)
static void circle_dashed_verts(blender::gpu::VertBuf *vbo, int *vert_idx, int segments, float radius, float z, int flag)
#define VCLASS_CAMERA_DIST
blender::gpu::Batch * DRW_cache_field_force_get()
static const float staticSine[16]
blender::gpu::Batch * DRW_cache_object_face_wireframe_get(const Scene *scene, Object *ob)
blender::gpu::Batch * DRW_cache_mesh_surface_get(Object *ob)
#define VCLASS_EMPTY_AXES_NAME
static blender::gpu::VertBuf * sphere_wire_vbo(const float rad, int flag)
#define VCLASS_LIGHT_SPOT_BLEND
blender::gpu::Batch * DRW_cache_particles_get_prim(int type)
blender::gpu::Batch * DRW_cache_circle_get()
blender::gpu::Batch * DRW_cache_mesh_edge_detection_get(Object *ob, bool *r_is_manifold)
blender::gpu::Batch * DRW_cache_sphere_get(const eDRWLevelOfDetail level_of_detail)
blender::gpu::Batch * DRW_cache_object_edge_detection_get(Object *ob, bool *r_is_manifold)
#define DRW_SPHERE_SHAPE_LONGITUDE_MEDIUM
static const uint bone_box_wire_lines_adjacency[12][4]
static const uint bone_box_wire[24]
blender::gpu::Batch * DRW_cache_curve_edge_overlay_get(Object *ob)
blender::gpu::Batch * DRW_cache_bone_point_wire_outline_get()
blender::gpu::Batch * DRW_cache_object_all_edges_get(Object *ob)
blender::gpu::Batch * DRW_cache_camera_volume_wire_get()
blender::gpu::Batch * DRW_cache_particles_get_dots(Object *object, ParticleSystem *psys)
#define DRW_SPHERE_SHAPE_LATITUDE_LOW
blender::gpu::Batch * DRW_cache_curve_vert_overlay_get(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_all_edges_get(Object *ob)
void DRW_cdlayer_attr_aliases_add(GPUVertFormat *format, const char *base_name, const int data_type, const char *layer_name, bool is_active_render, bool is_active_layer)
blender::gpu::Batch * DRW_cache_light_area_square_lines_get()
blender::gpu::Batch * DRW_cache_field_cone_limit_get()
blender::gpu::Batch * DRW_cache_surf_edge_wire_get(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_surface_sculptcolors_get(Object *ob)
#define VCLASS_EMPTY_AXES
blender::gpu::Batch * DRW_cache_particles_get_hair(Object *object, ParticleSystem *psys, ModifierData *md)
blender::gpu::Batch * DRW_cache_mesh_all_verts_get(Object *ob)
blender::gpu::Batch * DRW_cache_text_edge_wire_get(Object *ob)
blender::gpu::Batch ** DRW_cache_mesh_surface_shaded_get(Object *ob, GPUMaterial **gpumat_array, uint gpumat_array_len)
blender::gpu::Batch * drw_cache_procedural_lines_get()
blender::gpu::Batch * DRW_cache_lattice_vert_overlay_get(Object *ob)
blender::gpu::Batch * DRW_cache_light_sun_lines_get()
blender::gpu::Batch * DRW_cache_bone_envelope_solid_get()
blender::gpu::Batch * DRW_cache_mesh_surface_vertpaint_get(Object *ob)
#define VCLASS_EMPTY_SCALED
blender::gpu::Batch * DRW_cache_empty_sphere_get()
static const float bone_box_verts[8][3]
blender::gpu::Batch * DRW_cache_light_icon_sun_rays_get()
blender::gpu::Batch * DRW_cache_field_curve_get()
void drw_batch_cache_generate_requested(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_face_wireframe_get(Object *ob)
blender::gpu::VertBuf * DRW_cache_object_pos_vertbuf_get(Object *ob)
static const float bone_octahedral_verts[6][3]
blender::gpu::Batch * DRW_cache_field_wind_get()
blender::gpu::Batch * drw_cache_procedural_triangles_get()
static void UNUSED_FUNCTION add_fancy_edge(blender::gpu::VertBuf *vbo, uint pos_id, uint n1_id, uint n2_id, uint *v_idx, const float co1[3], const float co2[3], const float n1[3], const float n2[3])
blender::gpu::Batch * DRW_cache_cursor_get(bool crosshair_lines)
blender::gpu::Batch * DRW_cache_bone_arrows_get()
static const float bone_octahedral_solid_normals[8][3]
blender::gpu::Batch * DRW_cache_single_arrow_get()
#define VCLASS_LIGHT_DIST
blender::gpu::Batch * DRW_cache_light_icon_inner_lines_get()
#define DRW_SPHERE_SHAPE_LATITUDE_HIGH
void drw_batch_cache_validate(Object *ob)
#define DRW_SPHERE_SHAPE_LONGITUDE_LOW
blender::gpu::Batch * DRW_cache_bone_octahedral_wire_get()
#define VCLASS_LIGHT_SPOT_SHAPE
blender::gpu::Batch * DRW_cache_lightprobe_planar_get()
blender::gpu::Batch * DRW_cache_bone_octahedral_get()
blender::gpu::Batch * drw_cache_procedural_triangle_strips_get()
void drw_batch_cache_generate_requested_delayed(Object *ob)
blender::gpu::Batch * DRW_cache_particles_get_edit_strands(Object *object, ParticleSystem *psys, PTCacheEdit *edit, bool use_weight)
blender::gpu::Batch * DRW_cache_quad_get()
static GPUVertFormat extra_vert_format()
blender::gpu::Batch * DRW_cache_speaker_get()
blender::gpu::Batch * DRW_gpencil_dummy_buffer_get()
#define VCLASS_CAMERA_FRAME
#define VCLASS_CAMERA_VOLUME
blender::gpu::Batch ** DRW_cache_object_surface_material_get(Object *ob, GPUMaterial **gpumat_array, uint gpumat_array_len)
int DRW_cache_object_material_count_get(const Object *ob)
blender::gpu::Batch * DRW_cache_bone_envelope_outline_get()
blender::gpu::Batch * DRW_cache_bone_dof_lines_get()
#define VCLASS_LIGHT_SPOT_CONE
static float z_axis_name[10][2]
static const uint bone_octahedral_solid_tris[8][3]
blender::gpu::Batch * DRW_cache_particles_get_edit_tip_points(Object *object, ParticleSystem *psys, PTCacheEdit *edit)
blender::gpu::Batch * DRW_cache_fullscreen_quad_get()
blender::gpu::Batch * DRW_cache_bone_box_get()
blender::gpu::Batch * DRW_cache_camera_distances_get()
blender::gpu::Batch * DRW_cache_light_area_disk_lines_get()
blender::gpu::Batch * DRW_cache_particles_get_edit_inner_points(Object *object, ParticleSystem *psys, PTCacheEdit *edit)
blender::gpu::Batch * DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
#define VCLASS_SCREENALIGNED
blender::gpu::Batch * DRW_cache_camera_tria_wire_get()
#define DIAMOND_NSEGMENTS
blender::gpu::Batch * DRW_cache_quad_wires_get()
blender::gpu::Batch * DRW_cache_camera_frame_get()
#define VCLASS_SCREENSPACE
static const uint bone_box_solid_tris[12][3]
blender::gpu::Batch * DRW_cache_bone_stick_get()
blender::gpu::Batch * drw_cache_procedural_points_get()
blender::gpu::Batch * DRW_cache_grid_get()
blender::gpu::Batch * DRW_cache_mesh_surface_mesh_analysis_get(Object *ob)
blender::gpu::Batch * DRW_cache_bone_dof_sphere_get()
blender::gpu::Batch * DRW_cache_light_spot_volume_get()
blender::gpu::Batch * DRW_cache_empty_cylinder_get()
#define MARKER_FILL_LAYER
blender::gpu::Batch * DRW_cache_empty_capsule_body_get()
blender::gpu::Batch * DRW_cache_camera_tria_get()
static void benv_lat_lon_to_co(const float lat, const float lon, float r_nor[3])
#define DRW_SPHERE_SHAPE_LATITUDE_MEDIUM
blender::gpu::Batch * DRW_cache_mesh_loose_edges_get(Object *ob)
blender::gpu::Batch * DRW_cache_plain_axes_get()
static float axis_marker[8][2]
blender::gpu::Batch * DRW_cache_field_tube_limit_get()
blender::gpu::Batch * DRW_cache_bone_box_wire_get()
static void sphere_lat_lon_vert(blender::gpu::VertBuf *vbo, int *v_ofs, float lat, float lon)
blender::gpu::Batch * DRW_cache_mesh_surface_viewer_attribute_get(Object *ob)
blender::gpu::Batch * DRW_cache_lattice_wire_get(Object *ob, bool use_weight)
static float light_distance_z_get(char axis, const bool start)
blender::gpu::Batch * DRW_cache_empty_cone_get()
blender::gpu::Batch * DRW_cache_curve_edge_normal_get(Object *ob)
blender::gpu::Batch * DRW_cache_object_loose_edges_get(Object *ob)
#define VCLASS_EMPTY_SIZE
blender::gpu::Batch ** DRW_cache_mesh_surface_texpaint_get(Object *ob)
blender::gpu::Batch * DRW_cache_empty_capsule_cap_get()
blender::gpu::Batch * DRW_cache_cube_get()
bool DRW_object_is_in_edit_mode(const Object *ob)
bool DRW_object_use_hide_faces(const Object *ob)
const DRWContextState * DRW_context_state_get()
draw_view in_light_buf[] float
struct @620::@623 attr_id
void DRW_curves_batch_cache_free_old(Curves *curves, int ctime)
blender::gpu::Batch * DRW_cache_volume_face_wireframe_get(Object *ob)
blender::gpu::Batch * DRW_volume_batch_cache_get_selection_surface(Volume *volume)
void DRW_mesh_batch_cache_free_old(Mesh *mesh, int ctime)
void DRW_pointcloud_batch_cache_free_old(PointCloud *pointcloud, int ctime)
blender::gpu::Batch * DRW_volume_batch_cache_get_wireframes_face(Volume *volume)
blender::gpu::Batch * DRW_cache_volume_selection_surface_get(Object *ob)
void DRW_vertbuf_create_wiredata(blender::gpu::VertBuf *vbo, const int vert_len)
void DRW_batch_cache_free_old(Object *ob, int ctime)
Frequency::GEOMETRY nor[]
GSet * delayed_extraction
blender::gpu::Batch * drw_field_cone_limit
blender::gpu::Batch * drw_field_wind
blender::gpu::Batch * drw_fullscreen_quad
blender::gpu::Batch * drw_light_icon_outer_lines
blender::gpu::Batch * drw_light_icon_inner_lines
blender::gpu::Batch * drw_grid
blender::gpu::Batch * drw_light_spot_volume
blender::gpu::Batch * drw_procedural_lines
blender::gpu::Batch * drw_procedural_tris
blender::gpu::Batch * drw_camera_distances
blender::gpu::Batch * drw_camera_frame
blender::gpu::Batch * drw_particle_axis
blender::gpu::Batch * drw_field_force
blender::gpu::Batch * drw_particle_cross
blender::gpu::Batch * drw_bone_octahedral_wire
blender::gpu::Batch * drw_bone_arrows
blender::gpu::Batch * drw_cube
blender::gpu::Batch * drw_light_point_lines
blender::gpu::Batch * drw_field_tube_limit
blender::gpu::Batch * drw_empty_capsule_body
blender::gpu::Batch * drw_ground_line
blender::gpu::Batch * drw_bone_envelope_outline
blender::gpu::Batch * drw_bone_dof_lines
blender::gpu::Batch * drw_bone_box_wire
blender::gpu::Batch * drw_empty_cube
blender::gpu::Batch * drw_lightprobe_cube
blender::gpu::Batch * drw_camera_tria
blender::gpu::Batch * drw_light_icon_sun_rays
blender::gpu::Batch * drw_quad_wires
blender::gpu::Batch * drw_sphere_lod[DRW_LOD_MAX]
blender::gpu::Batch * drw_procedural_verts
blender::gpu::Batch * drw_gpencil_dummy_quad
blender::gpu::Batch * drw_procedural_tri_strips
blender::gpu::Batch * drw_camera_volume_wire
blender::gpu::Batch * drw_cursor_only_circle
blender::gpu::Batch * drw_empty_sphere
blender::gpu::Batch * drw_single_arrow
blender::gpu::Batch * drw_light_area_disk_lines
blender::gpu::Batch * drw_camera_volume
blender::gpu::Batch * drw_cursor
blender::gpu::Batch * drw_bone_box
blender::gpu::Batch * drw_normal_arrow
blender::gpu::Batch * drw_bone_point
blender::gpu::Batch * drw_bone_envelope
blender::gpu::Batch * drw_quad
blender::gpu::Batch * drw_particle_circle
blender::gpu::Batch * drw_bone_octahedral
blender::gpu::Batch * drw_lightprobe_grid
blender::gpu::Batch * drw_empty_cone
blender::gpu::Batch * drw_camera_tria_wire
blender::gpu::Batch * drw_speaker
blender::gpu::Batch * drw_bone_stick
blender::gpu::Batch * drw_field_vortex
blender::gpu::Batch * drw_empty_capsule_cap
blender::gpu::Batch * drw_field_sphere_limit
blender::gpu::Batch * drw_light_area_square_lines
blender::gpu::Batch * drw_lightprobe_planar
blender::gpu::Batch * drw_plain_axes
blender::gpu::Batch * drw_bone_dof_sphere
blender::gpu::Batch * drw_light_sun_lines
blender::gpu::Batch * drw_empty_cylinder
blender::gpu::Batch * drw_light_spot_lines
blender::gpu::Batch * drw_field_curve
blender::gpu::Batch * drw_circle
blender::gpu::Batch * drw_bone_point_wire
ListBase vertex_group_names
struct MDeformVert * dvert
int vertex_group_active_index
struct EditLatt * editlatt