123 #define PROJ_BUCKET_BRUSH_DIV 4
125 #define PROJ_BUCKET_RECT_MIN 4
126 #define PROJ_BUCKET_RECT_MAX 256
128 #define PROJ_BOUNDBOX_DIV 8
129 #define PROJ_BOUNDBOX_SQUARED (PROJ_BOUNDBOX_DIV * PROJ_BOUNDBOX_DIV)
134 #define PROJ_DEBUG_WINCLIP 1
136 #ifndef PROJ_DEBUG_NOSEAMBLEED
142 # define PROJ_FACE_SEAM0 (1 << 0)
143 # define PROJ_FACE_SEAM1 (1 << 1)
144 # define PROJ_FACE_SEAM2 (1 << 2)
146 # define PROJ_FACE_NOSEAM0 (1 << 4)
147 # define PROJ_FACE_NOSEAM1 (1 << 5)
148 # define PROJ_FACE_NOSEAM2 (1 << 6)
151 # define PROJ_FACE_SEAM_INIT0 (1 << 8)
152 # define PROJ_FACE_SEAM_INIT1 (1 << 9)
153 # define PROJ_FACE_SEAM_INIT2 (1 << 10)
155 # define PROJ_FACE_DEGENERATE (1 << 12)
158 # define PROJ_FACE_WINDING_INIT 1
159 # define PROJ_FACE_WINDING_CW 2
164 # define PROJ_FACE_SCALE_SEAM 0.99f
167 #define PROJ_SRC_VIEW 1
168 #define PROJ_SRC_IMAGE_CAM 2
169 #define PROJ_SRC_IMAGE_VIEW 3
170 #define PROJ_SRC_VIEW_FILL 4
172 #define PROJ_VIEW_DATA_ID "view_data"
174 #define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3)
176 #define PROJ_BUCKET_NULL 0
177 #define PROJ_BUCKET_INIT (1 << 0)
181 #define PROJ_GEOM_TOLERANCE 0.00075f
182 #define PROJ_PIXEL_TOLERANCE 0.01f
185 #define PROJ_VERT_CULL 1
188 #define TILE_PENDING POINTER_FROM_INT(-1)
339 #ifndef PROJ_DEBUG_NOSEAMBLEED
379 #define PROJ_PAINT_STATE_SHARED_MEMCPY(ps_dst, ps_src) \
380 MEMCPY_STRUCT_AFTER(ps_dst, ps_src, is_shared_user)
382 #define PROJ_PAINT_STATE_SHARED_CLEAR(ps) MEMSET_STRUCT_AFTER(ps, 0, is_shared_user)
390 #ifndef PROJ_DEBUG_NOSEAMBLEED
512 #define PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) \
513 ps->mloop_eval[lt->tri[0]].v, ps->mloop_eval[lt->tri[1]].v, ps->mloop_eval[lt->tri[2]].v,
515 #define PS_LOOPTRI_AS_UV_3(uvlayer, lt) \
516 uvlayer[lt->poly][lt->tri[0]].uv, uvlayer[lt->poly][lt->tri[1]].uv, \
517 uvlayer[lt->poly][lt->tri[2]].uv,
519 #define PS_LOOPTRI_ASSIGN_UV_3(uv_tri, uvlayer, lt) \
521 (uv_tri)[0] = uvlayer[lt->poly][lt->tri[0]].uv; \
522 (uv_tri)[1] = uvlayer[lt->poly][lt->tri[1]].uv; \
523 (uv_tri)[2] = uvlayer[lt->poly][lt->tri[2]].uv; \
540 return 1001 + 10 * ty + tx;
608 const float pt[2],
const float v1[3],
const float v2[3],
const float v3[3],
float w[3])
611 return (
v1[2] *
w[0]) + (
v2[2] *
w[1]) + (v3[2] *
w[2]);
615 const float pt[2],
const float v1[4],
const float v2[4],
const float v3[4],
float w[3])
617 float wtot_inv, wtot;
627 w_tmp[0] =
w[0] *
v1[3];
628 w_tmp[1] =
w[1] *
v2[3];
629 w_tmp[2] =
w[2] * v3[3];
631 wtot = w_tmp[0] + w_tmp[1] + w_tmp[2];
634 wtot_inv = 1.0f / wtot;
636 w_tmp[0] = w_tmp[0] * wtot_inv;
637 w_tmp[1] = w_tmp[1] * wtot_inv;
638 w_tmp[2] = w_tmp[2] * wtot_inv;
641 w_tmp[0] = w_tmp[1] = w_tmp[2] = 1.0f / 3.0f;
645 return (
v1[2] * w_tmp[0]) + (
v2[2] * w_tmp[1]) + (v3[2] * w_tmp[2]);
654 int best_tri_index = -1;
655 float z_depth_best = FLT_MAX, z_depth;
658 if (bucket_index == -1) {
668 const float *vtri_ss[3] = {
682 if (z_depth < z_depth_best) {
683 best_tri_index = tri_index;
684 z_depth_best = z_depth;
691 return best_tri_index;
708 *
x = *
x * ibuf_x - 0.5f;
709 *
y = *
y * ibuf_y - 0.5f;
718 const float *lt_tri_uv[3];
727 if (tri_index == -1) {
742 iuser.
tile = tile_number;
780 xi =
mod_i((
int)(
uv[0] * ibuf->
x), ibuf->
x);
781 yi =
mod_i((
int)(
uv[1] * ibuf->
y), ibuf->
y);
785 const float *rgba_tmp_fp = ibuf->
rect_float + (xi + yi * ibuf->
x * 4);
823 if (
v1[2] > pt[2] &&
v2[2] > pt[2] && v3[2] > pt[2]) {
834 if (
v1[2] < pt[2] &&
v2[2] < pt[2] && v3[2] < pt[2]) {
857 const float v1_3d[3],
858 const float v2_3d[3],
859 const float v3_3d[3],
897 const float pixelScreenCo[4])
905 for (; bucketFace; bucketFace = bucketFace->
next) {
908 if (orig_face != tri_index) {
910 const float *vtri_ss[3] = {
918 const float *vtri_co[3] = {
930 if (isect_ret >= 1) {
943 #define ISECT_TRUE_P1 2
944 #define ISECT_TRUE_P2 3
945 static int line_isect_y(
const float p1[2],
const float p2[2],
const float y_level,
float *x_isect)
950 if (y_level == p1[1]) {
955 if (y_level == p2[1]) {
961 y_diff =
fabsf(p1[1] - p2[1]);
963 if (y_diff < 0.000001f) {
964 *x_isect = (p1[0] + p2[0]) * 0.5f;
968 if (p1[1] > y_level && p2[1] < y_level) {
970 *x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff;
973 if (p1[1] < y_level && p2[1] > y_level) {
975 *x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff;
981 static int line_isect_x(
const float p1[2],
const float p2[2],
const float x_level,
float *y_isect)
985 if (x_level == p1[0]) {
989 if (x_level == p2[0]) {
995 x_diff =
fabsf(p1[0] - p2[0]);
998 if (x_diff < 0.000001f) {
999 *y_isect = (p1[0] + p2[0]) * 0.5f;
1003 if (p1[0] > x_level && p2[0] < x_level) {
1005 *y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff;
1008 if (p1[0] < x_level && p2[0] > x_level) {
1010 *y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff;
1020 #ifndef PROJ_DEBUG_NOSEAMBLEED
1021 static bool cmp_uv(
const float vec2a[2],
const float vec2b[2])
1024 float xa =
fmodf(vec2a[0], 1.0f);
1025 float ya =
fmodf(vec2a[1], 1.0f);
1027 float xb =
fmodf(vec2b[0], 1.0f);
1028 float yb =
fmodf(vec2b[1], 1.0f);
1052 #ifndef PROJ_DEBUG_NOSEAMBLEED
1059 float min_uv[2], max_uv[2];
1068 bounds_px->
xmin = (int)(ibuf_x * min_uv[0]);
1069 bounds_px->
ymin = (int)(ibuf_y * min_uv[1]);
1071 bounds_px->
xmax = (int)(ibuf_x * max_uv[0]) + 1;
1072 bounds_px->
ymax = (int)(ibuf_y * max_uv[1]) + 1;
1077 return (bounds_px->
xmin == bounds_px->
xmax || bounds_px->
ymin == bounds_px->
ymax) ? false :
true;
1082 float (*
uv)[2],
rcti *bounds_px,
const int ibuf_x,
const int ibuf_y,
int tot)
1085 float min_uv[2], max_uv[2];
1098 bounds_px->
xmin = (int)(ibuf_x * min_uv[0]);
1099 bounds_px->
ymin = (int)(ibuf_y * min_uv[1]);
1101 bounds_px->
xmax = (int)(ibuf_x * max_uv[0]) + 1;
1102 bounds_px->
ymax = (int)(ibuf_y * max_uv[1]) + 1;
1107 return (bounds_px->
xmin == bounds_px->
xmax || bounds_px->
ymin == bounds_px->
ymax) ? false :
true;
1110 #ifndef PROJ_DEBUG_NOSEAMBLEED
1117 float winding =
cross_tri_v2(lt_tri_uv[0], lt_tri_uv[1], lt_tri_uv[2]);
1129 const int orig_face,
1130 const int orig_i1_fidx,
1131 const int orig_i2_fidx,
1142 int i1_fidx = -1, i2_fidx = -1;
1147 if (tri_index != orig_face) {
1160 if (i2_fidx != -1) {
1172 *other_face = tri_index;
1175 *orig_fidx = (i1_fidx < i2_fidx && (i2_fidx - i1_fidx == 1)) ? i1_fidx : i2_fidx;
1183 if ((orig_tpage == tpage) && (orig_tile ==
tile) &&
1184 cmp_uv(orig_lt_tri_uv[orig_i1_fidx], lt_tri_uv[i1_fidx]) &&
1185 cmp_uv(orig_lt_tri_uv[orig_i2_fidx], lt_tri_uv[i2_fidx])) {
1215 while (seam->
loop != loop_index) {
1251 const float PI_2 =
M_PI * 2.0f;
1253 float angle_rel, angle_no;
1266 if (angle_rel < 0.0f) {
1272 angle_no = angle_rel +
angle[0];
1274 if (angle_no >
M_PI) {
1278 r_no[0] =
cosf(angle_no);
1279 r_no[1] =
sinf(angle_no);
1288 float (*orig_uv)[2],
1301 ibuf_inv[0] = 1.0f / (
float)ibuf_x;
1302 ibuf_inv[1] = 1.0f / (
float)ibuf_y;
1304 for (fidx[0] = 0; fidx[0] < 3; fidx[0]++) {
1306 float(*seam_uvs)[2];
1313 loop_index = ltri->
tri[fidx[0]];
1318 if (seam_uvs[0][0] != FLT_MAX) {
1322 fidx[1] = (fidx[0] == 2) ? 0 : fidx[0] + 1;
1327 for (
uint i = 0; i < 2; i++) {
1335 tri_ang = ang[i] -
M_PI_2;
1337 if (tri_ang > 0.0f) {
1345 len_fact =
cosf(tri_ang);
1346 len_fact =
UNLIKELY(len_fact < FLT_EPSILON) ? FLT_MAX : (1.0f / len_fact);
1349 len_fact =
MIN2(len_fact, 10.0f);
1359 if ((ang[0] + ang[1]) <
M_PI) {
1364 orig_uv[fidx[0]], seam_uvs[0], orig_uv[fidx[1]], seam_uvs[1], isect_co);
1375 const int tri_index,
1382 const int fidx[2] = {fidx1, ((fidx1 + 1) % 3)};
1390 vseam->
tri = tri_index;
1391 vseam->
loop = lt->
tri[fidx[0]];
1393 sub_v2_v2v2(vec, lt_tri_uv[fidx[1]], lt_tri_uv[fidx[0]]);
1404 vseam[1] = vseam[0];
1409 for (
uint i = 0; i < 2; i++) {
1414 while (item && item->
angle < vseam[i].
angle) {
1430 const int tri_index,
1431 const uint vert_index,
1437 int other_face, other_fidx;
1439 int fidx[2] = {2, 0};
1449 if (init_all || (ps->
mloop_eval[lt->
tri[fidx[0]]].
v == vert_index) ||
1453 if (
check_seam(ps, tri_index, fidx[0], fidx[1], &other_face, &other_fidx)) {
1457 if (other_face != -1) {
1470 if (other_face != -1) {
1480 }
while (fidx[0]--);
1483 char checked_verts = 0;
1490 for (
uint i = 0; i < 2; i++) {
1493 if ((checked_verts & (1 << fidx[i])) != 0) {
1505 checked_verts |= 1 << fidx[i];
1512 }
while (fidx[0]--);
1522 const float v1co[3],
1523 const float v2co[3],
1524 const float v3co[3],
1525 const float uv1co[2],
1526 const float uv2co[2],
1527 const float uv3co[2],
1528 float pixelScreenCo[4],
1538 const float v1co[4],
1539 const float v2co[4],
1540 const float v3co[4],
1541 const float uv1co[2],
1542 const float uv2co[2],
1543 const float uv3co[2],
1544 float pixelScreenCo[4],
1548 float wtot_inv, wtot;
1552 w_int[0] =
w[0] * v1co[3];
1553 w_int[1] =
w[1] * v2co[3];
1554 w_int[2] =
w[2] * v3co[3];
1556 wtot = w_int[0] + w_int[1] + w_int[2];
1559 wtot_inv = 1.0f / wtot;
1560 w_int[0] *= wtot_inv;
1561 w_int[1] *= wtot_inv;
1562 w_int[2] *= wtot_inv;
1566 w[0] =
w[1] =
w[2] = w_int[0] = w_int[1] = w_int[2] = 1.0f / 3.0f;
1584 const float projmat_inv[4][4],
1585 const float view_pos[3],
1586 const float co_px[2],
1589 r_dir[0] = 2.0f * (co_px[0] / winx) - 1.0f;
1590 r_dir[1] = 2.0f * (co_px[1] / winy) - 1.0f;
1609 const float zero[3] = {0};
1610 float v1_proj[3], v2_proj[3];
1630 float uv_other[2],
x,
y;
1647 const int tri_index,
1671 mask = ((rgba_f[0] + rgba_f[1] + rgba_f[2]) * (1.0f / 3.0f)) * rgba_f[3];
1674 mask = ((rgba_ub[0] + rgba_ub[1] + rgba_ub[2]) * (1.0f / (255.0f * 3.0f))) *
1675 (rgba_ub[3] * (1.0f / 255.0f));
1700 float ca1, ca2, ca3, ca_mask;
1705 ca_mask =
w[0] * ca1 +
w[1] * ca2 +
w[2] * ca3;
1707 CLAMP(ca_mask, 0.0f, 1.0f);
1716 float no[3], angle_cos;
1719 const float *no1, *no2, *no3;
1724 no[0] =
w[0] * no1[0] +
w[1] * no2[0] +
w[2] * no3[0];
1725 no[1] =
w[0] * no1[1] +
w[1] * no2[1] +
w[2] * no3[1];
1726 no[2] =
w[0] * no1[2] +
w[1] * no2[2] +
w[2] * no3[2];
1748 float viewDirPersp[3];
1749 const float *co1, *co2, *co3;
1755 viewDirPersp[0] = (ps->
viewPos[0] - (
w[0] * co1[0] +
w[1] * co2[0] +
w[2] * co3[0]));
1756 viewDirPersp[1] = (ps->
viewPos[1] - (
w[0] * co1[1] +
w[1] * co2[1] +
w[2] * co3[1]));
1757 viewDirPersp[2] = (ps->
viewPos[2] - (
w[0] * co1[2] +
w[1] * co2[2] +
w[2] * co3[2]));
1763 angle_cos =
dot_v3v3(viewDirPersp, no);
1768 angle_cos =
fabsf(angle_cos);
1771 if (angle_cos <= ps->normal_angle__cos) {
1775 if (angle_cos < ps->normal_angle_inner__cos) {
1799 bool generate_tile =
false;
1808 generate_tile =
true;
1815 if (generate_tile) {
1817 volatile void *undorect;
1867 const int tri_index,
1868 const float pixelScreenCo[4],
1869 const float world_spaceCo[3],
1874 int x_round, y_round;
1883 x_px =
mod_i(x_px, ibuf->
x);
1884 y_px =
mod_i(y_px, ibuf->
y);
1930 projPixel->
x_px = x_px;
1931 projPixel->
y_px = y_px;
1954 const float *lt_other_tri_uv[3] = {
2028 #ifdef PROJ_DEBUG_PAINT
2053 if (l1[1] < rect->
ymin || l1[1] > rect->
ymax) {
2057 if ((l1[0] < rect->
xmin && l2[0] < rect->
xmin) || (l1[0] > rect->
xmax && l2[0] > rect->
xmax)) {
2079 if (l1[0] < rect->
xmin || l1[0] > rect->
xmax) {
2084 if ((l1[1] < rect->
ymin && l2[1] < rect->
ymin) || (l1[1] > rect->
ymax && l2[1] > rect->
ymax)) {
2129 (isect <= cliprect->xmax)) {
2130 if (l1[1] < l2[1]) {
2132 l1_clip[1] = rect->
ymin;
2137 l2_clip[1] = rect->
ymin;
2147 (isect <= cliprect->xmax)) {
2148 if (l1[1] > l2[1]) {
2150 l1_clip[1] = rect->
ymax;
2155 l2_clip[1] = rect->
ymax;
2166 (isect <= cliprect->ymax)) {
2167 if (l1[0] < l2[0]) {
2168 l1_clip[0] = rect->
xmin;
2173 l2_clip[0] = rect->
xmin;
2184 (isect <= cliprect->ymax)) {
2185 if (l1[0] > l2[0]) {
2186 l1_clip[0] = rect->
xmax;
2191 l2_clip[0] = rect->
xmax;
2208 #ifndef PROJ_DEBUG_NOSEAMBLEED
2210 static void scale_tri(
float insetCos[3][3],
const float *origCos[3],
const float inset)
2213 cent[0] = (origCos[0][0] + origCos[1][0] + origCos[2][0]) * (1.0f / 3.0f);
2214 cent[1] = (origCos[0][1] + origCos[1][1] + origCos[2][1]) * (1.0f / 3.0f);
2215 cent[2] = (origCos[0][2] + origCos[1][2] + origCos[2][2]) * (1.0f / 3.0f);
2237 return x *
x +
y *
y;
2247 const float radius_squared,
2248 const rctf *bucket_bounds)
2262 if ((bucket_bounds->
xmin <= cent[0] && bucket_bounds->
xmax >= cent[0]) ||
2263 (bucket_bounds->
ymin <= cent[1] && bucket_bounds->
ymax >= cent[1])) {
2268 if (cent[0] < bucket_bounds->
xmin) {
2270 if (cent[1] < bucket_bounds->
ymin) {
2277 if (cent[1] > bucket_bounds->
ymax) {
2284 else if (cent[0] > bucket_bounds->
xmax) {
2286 if (cent[1] < bucket_bounds->
ymin) {
2293 if (cent[1] > bucket_bounds->
ymax) {
2314 const float *v1coSS,
2315 const float *v2coSS,
2316 const float *v3coSS,
2320 float bucket_bounds_uv[4][2],
2327 uv[0] = bucket_bounds->
xmax;
2328 uv[1] = bucket_bounds->
ymin;
2333 uv[1] = bucket_bounds->
ymax;
2337 uv[0] = bucket_bounds->
xmin;
2343 uv[1] = bucket_bounds->
ymin;
2350 const float *v1coSS,
2351 const float *v2coSS,
2352 const float *v3coSS,
2356 float bucket_bounds_uv[4][2],
2363 uv[0] = bucket_bounds->
xmax;
2364 uv[1] = bucket_bounds->
ymin;
2369 uv[1] = bucket_bounds->
ymax;
2373 uv[0] = bucket_bounds->
xmin;
2379 uv[1] = bucket_bounds->
ymin;
2387 static float angle_2d_clockwise(
const float p1[2],
const float p2[2],
const float p3[2])
2391 v1[0] = p1[0] - p2[0];
2392 v1[1] = p1[1] - p2[1];
2393 v2[0] = p3[0] - p2[0];
2394 v2[1] = p3[1] - p2[1];
2401 #define ISECT_2 (1 << 1)
2402 #define ISECT_3 (1 << 2)
2403 #define ISECT_4 (1 << 3)
2404 #define ISECT_ALL3 ((1 << 3) - 1)
2405 #define ISECT_ALL4 ((1 << 4) - 1)
2409 const float pt[2],
const float v1[2],
const float v2[2],
const float v3[2],
const float limit)
2421 return (((
float *)p1)[2] < ((
float *)p2)[2] ? 1 : -1);
2426 return (((
float *)p1)[2] < ((
float *)p2)[2] ? -1 : 1);
2438 float min = FLT_MAX, tmp;
2439 float xlen = l2[0] - l1[0];
2440 float ylen = l2[1] - l1[1];
2444 if ((l1[0] - rect->
xmin) * (l2[0] - rect->
xmin) <= 0) {
2448 else if ((l1[0] - rect->
xmax) * (l2[0] - rect->
xmax) < 0) {
2455 if ((l1[1] - rect->
ymin) * (l2[1] - rect->
ymin) <= 0) {
2459 else if ((l1[1] - rect->
ymax) * (l2[1] - rect->
ymax) < 0) {
2465 if (
min == FLT_MAX) {
2469 tmp = (is_ortho) ? 1.0f : (l1[3] +
min * (l2[3] - l1[3]));
2471 uv[0] = (uv1[0] +
min / tmp * (uv2[0] - uv1[0]));
2472 uv[1] = (uv1[1] +
min / tmp * (uv2[1] - uv1[1]));
2478 const bool is_flip_object,
2479 const rctf *cliprect,
2480 const rctf *bucket_bounds,
2481 const float *v1coSS,
2482 const float *v2coSS,
2483 const float *v3coSS,
2487 float bucket_bounds_uv[8][2],
2491 int inside_bucket_flag = 0;
2492 int inside_face_flag = 0;
2494 bool collinear =
false;
2496 float bucket_bounds_ss[4][2];
2544 if (inside_bucket_flag &
ISECT_1) {
2552 bucket_bounds, v1coSS, v2coSS, uv1co, uv2co, bucket_bounds_uv[*tot], is_ortho)) {
2557 if (inside_bucket_flag &
ISECT_2) {
2565 bucket_bounds, v2coSS, v3coSS, uv2co, uv3co, bucket_bounds_uv[*tot], is_ortho)) {
2570 if (inside_bucket_flag &
ISECT_3) {
2578 bucket_bounds, v3coSS, v1coSS, uv3co, uv1co, bucket_bounds_uv[*tot], is_ortho)) {
2603 bucket_bounds_ss[0][0] = bucket_bounds->
xmax;
2604 bucket_bounds_ss[0][1] = bucket_bounds->
ymin;
2610 bucket_bounds_ss[1][0] = bucket_bounds->
xmax;
2611 bucket_bounds_ss[1][1] = bucket_bounds->
ymax;
2617 bucket_bounds_ss[2][0] = bucket_bounds->
xmin;
2618 bucket_bounds_ss[2][1] = bucket_bounds->
ymax;
2624 bucket_bounds_ss[3][0] = bucket_bounds->
xmin;
2625 bucket_bounds_ss[3][1] = bucket_bounds->
ymin;
2639 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
2643 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
2670 float isectVCosSS[8][3];
2671 float v1_clipSS[2], v2_clipSS[2];
2675 float cent[2] = {0.0f, 0.0f};
2681 if (inside_face_flag &
ISECT_1) {
2682 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]);
2685 if (inside_face_flag &
ISECT_2) {
2686 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]);
2689 if (inside_face_flag &
ISECT_3) {
2690 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]);
2693 if (inside_face_flag &
ISECT_4) {
2694 copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]);
2698 if (inside_bucket_flag &
ISECT_1) {
2702 if (inside_bucket_flag &
ISECT_2) {
2706 if (inside_bucket_flag &
ISECT_3) {
2712 if (
line_clip_rect2f(cliprect, bucket_bounds, v1coSS, v2coSS, v1_clipSS, v2_clipSS)) {
2713 if ((inside_bucket_flag &
ISECT_1) == 0) {
2717 if ((inside_bucket_flag &
ISECT_2) == 0) {
2725 if (
line_clip_rect2f(cliprect, bucket_bounds, v2coSS, v3coSS, v1_clipSS, v2_clipSS)) {
2726 if ((inside_bucket_flag &
ISECT_2) == 0) {
2730 if ((inside_bucket_flag &
ISECT_3) == 0) {
2738 if (
line_clip_rect2f(cliprect, bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) {
2739 if ((inside_bucket_flag &
ISECT_3) == 0) {
2743 if ((inside_bucket_flag &
ISECT_1) == 0) {
2757 for (
int i = 0; i < (*tot); i++) {
2758 cent[0] += isectVCosSS[i][0];
2759 cent[1] += isectVCosSS[i][1];
2761 cent[0] = cent[0] / (
float)(*tot);
2762 cent[1] = cent[1] / (
float)(*tot);
2767 for (
int i = 0; i < (*tot); i++) {
2768 isectVCosSS[i][2] = angle_2d_clockwise(up, cent, isectVCosSS[i]);
2773 v1_clipSS[0] = cent[0];
2774 v1_clipSS[1] = cent[1] + 1.0f;
2776 for (
int i = 0; i < (*tot); i++) {
2777 v2_clipSS[0] = isectVCosSS[i][0] - cent[0];
2778 v2_clipSS[1] = isectVCosSS[i][1] - cent[1];
2779 isectVCosSS[i][2] =
atan2f(v1_clipSS[0] * v2_clipSS[1] - v1_clipSS[1] * v2_clipSS[0],
2780 v1_clipSS[0] * v2_clipSS[0] + v1_clipSS[1] * v2_clipSS[1]);
2787 qsort(isectVCosSS, *tot,
sizeof(
float[3]),
float_z_sort);
2791 while (doubles ==
true) {
2794 for (
int i = 0; i < (*tot); i++) {
2797 for (
int j = i; j < (*tot) - 1; j++) {
2798 isectVCosSS[j][0] = isectVCosSS[j + 1][0];
2799 isectVCosSS[j][1] = isectVCosSS[j + 1][1];
2816 for (
int i = 0; i < (*tot); i++) {
2822 for (
int i = 0; i < (*tot); i++) {
2829 #ifdef PROJ_DEBUG_PRINT_CLIP
2834 float test_uv[4][2];
2838 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
2842 bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
2844 printf(
"( [(%f,%f), (%f,%f), (%f,%f), (%f,%f)], ",
2854 printf(
" [(%f,%f), (%f,%f), (%f,%f)], ",
2863 for (
int i = 0; i < (*tot); i++) {
2864 printf(
"(%f, %f),", bucket_bounds_uv[i][0], bucket_bounds_uv[i][1]);
2926 static bool IsectPoly2Df(
const float pt[2],
const float uv[][2],
const int tot)
2933 for (i = 1; i < tot; i++) {
2945 for (
int i = 1; i < tot; i++) {
2960 const int thread_index,
2961 const int bucket_index,
2962 const int tri_index,
2963 const int image_index,
2964 const rctf *clip_rect,
2965 const rctf *bucket_bounds,
2995 const float *v1coSS, *v2coSS, *v3coSS;
2998 const float *vCo[3];
3003 float *uv1co, *uv2co, *uv3co;
3004 float pixelScreenCo[4];
3012 float lt_uv_pxoffset[3][2];
3013 float xhalfpx, yhalfpx;
3014 const float ibuf_xf = (
float)ibuf->
x, ibuf_yf = (
float)ibuf->
y;
3017 int has_x_isect = 0, has_isect = 0;
3019 float uv_clip[8][2];
3021 const bool is_ortho = ps->
is_ortho;
3045 lt_uv_pxoffset[0][0] = lt_tri_uv[0][0] - xhalfpx;
3046 lt_uv_pxoffset[0][1] = lt_tri_uv[0][1] - yhalfpx;
3048 lt_uv_pxoffset[1][0] = lt_tri_uv[1][0] - xhalfpx;
3049 lt_uv_pxoffset[1][1] = lt_tri_uv[1][1] - yhalfpx;
3051 lt_uv_pxoffset[2][0] = lt_tri_uv[2][0] - xhalfpx;
3052 lt_uv_pxoffset[2][1] = lt_tri_uv[2][1] - yhalfpx;
3055 uv1co = lt_uv_pxoffset[0];
3056 uv2co = lt_uv_pxoffset[1];
3057 uv3co = lt_uv_pxoffset[2];
3081 if (uv_clip_tot > 6) {
3082 printf(
"this should never happen! %d\n", uv_clip_tot);
3088 project_paint_undo_tiles_init(
3094 for (
y = bounds_px.
ymin;
y < bounds_px.
ymax;
y++) {
3097 uv[1] = (
float)
y / ibuf_yf;
3100 for (
x = bounds_px.
xmin;
x < bounds_px.
xmax;
x++) {
3103 uv[0] = (
float)
x / ibuf_xf;
3107 if ((do_backfacecull ==
true &&
IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
3110 has_x_isect = has_isect = 1;
3114 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3118 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3123 if (do_clip || do_3d_mapping) {
3146 ps, arena, &tinf,
x,
y,
mask, tri_index, pixelScreenCo, wco,
w),
3152 else if (has_x_isect) {
3162 if (has_x_isect == 0 && has_isect) {
3170 #ifndef PROJ_DEBUG_NOSEAMBLEED
3188 printf(
"seams - %d %d %d %d\n",
3209 float insetCos[3][3];
3212 const float *vCoSS[3];
3216 float bucket_clip_edges[2][2];
3217 float edge_verts_inset_clip[2][3];
3222 float seam_subsection[4][2];
3228 lt_puv[0][0] = lt_uv_pxoffset[0][0] * ibuf->
x;
3229 lt_puv[0][1] = lt_uv_pxoffset[0][1] * ibuf->
y;
3231 lt_puv[1][0] = lt_uv_pxoffset[1][0] * ibuf->
x;
3232 lt_puv[1][1] = lt_uv_pxoffset[1][1] * ibuf->
y;
3234 lt_puv[2][0] = lt_uv_pxoffset[2][0] * ibuf->
x;
3235 lt_puv[2][1] = lt_uv_pxoffset[2][1] * ibuf->
y;
3261 for (fidx1 = 0; fidx1 < 3; fidx1++) {
3263 fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1;
3265 if ((face_seam_flag & (1 << fidx1)) &&
3270 bucket_clip_edges[0],
3271 bucket_clip_edges[1])) {
3284 ps, bucket_clip_edges[0], vCo[fidx1], vCo[fidx2]);
3286 ps, bucket_clip_edges[1], vCo[fidx1], vCo[fidx2]);
3289 interp_v2_v2v2(seam_subsection[0], lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], fac1);
3290 interp_v2_v2v2(seam_subsection[1], lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], fac2);
3292 interp_v2_v2v2(seam_subsection[2], seam_uvs[0], seam_uvs[1], fac2);
3293 interp_v2_v2v2(seam_subsection[3], seam_uvs[0], seam_uvs[1], fac1);
3297 interp_v3_v3v3(edge_verts_inset_clip[0], insetCos[fidx1], insetCos[fidx2], fac1);
3298 interp_v3_v3v3(edge_verts_inset_clip[1], insetCos[fidx1], insetCos[fidx2], fac2);
3304 for (
y = bounds_px.
ymin;
y < bounds_px.
ymax;
y++) {
3307 uv[1] = (
float)
y / ibuf_yf;
3310 for (
x = bounds_px.
xmin;
x < bounds_px.
xmax;
x++) {
3311 const float puv[2] = {(
float)
x, (
float)
y};
3315 uv[0] = (
float)
x / ibuf_xf;
3341 float pixel_on_edge[4];
3346 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3350 uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo,
w);
3356 pixel_on_edge, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac);
3359 pixel_on_edge[3] = 1.0f;
3362 pixel_on_edge[0] = (
float)(ps->
winx * 0.5f) +
3363 (ps->
winx * 0.5f) * pixel_on_edge[0] / pixel_on_edge[3];
3364 pixel_on_edge[1] = (
float)(ps->
winy * 0.5f) +
3365 (ps->
winy * 0.5f) * pixel_on_edge[1] / pixel_on_edge[3];
3367 pixel_on_edge[2] = pixel_on_edge[2] / pixel_on_edge[3];
3372 ps, bucketFaceNodes, tri_index, pixel_on_edge)) {
3375 if (do_clip || do_3d_mapping) {
3391 ps, arena, &tinf,
x,
y,
mask, tri_index, pixelScreenCo, wco,
w),
3396 else if (has_x_isect) {
3406 if (has_x_isect == 0 && has_isect) {
3462 rctf *bucket_bounds)
3480 const int thread_index,
3481 const int bucket_index,
3482 const rctf *clip_rect,
3483 const rctf *bucket_bounds)
3486 int tri_index, image_index = 0;
3520 if (tpage_last != tpage || tile_last !=
tile) {
3525 for (image_index = 0; image_index < ps->
image_tot; image_index++) {
3528 ibuf = projIma->
ibuf;
3570 float p1[2], p2[2], p3[2], p4[2];
3571 const float *
v, *
v1, *
v2, *v3;
3590 p1[0] = bucket_bounds.
xmin;
3591 p1[1] = bucket_bounds.
ymin;
3592 p2[0] = bucket_bounds.
xmin;
3593 p2[1] = bucket_bounds.
ymax;
3594 p3[0] = bucket_bounds.
xmax;
3595 p3[1] = bucket_bounds.
ymax;
3596 p4[0] = bucket_bounds.
xmax;
3597 p4[1] = bucket_bounds.
ymin;
3617 const int tri_index)
3620 float min[2],
max[2], *vCoSS;
3622 int bucketMin[2], bucketMax[2];
3623 int fidx, bucket_x, bucket_y;
3625 int has_x_isect = -1, has_isect = 0;
3639 for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) {
3641 for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) {
3643 int bucket_index = bucket_x + (bucket_y * ps->
buckets_x);
3649 has_x_isect = has_isect = 1;
3651 else if (has_x_isect) {
3659 if (has_x_isect == 0 && has_isect) {
3664 #ifndef PROJ_DEBUG_NOSEAMBLEED
3677 float viewmat[4][4];
3678 float viewinv[4][4];
3686 if (symmetry_flag) {
3688 for (i = 0; i < 3; i++) {
3689 if ((symmetry_flag >> i) & 1) {
3727 memcpy(winmat,
array,
sizeof(winmat));
3728 array +=
sizeof(winmat) /
sizeof(
float);
3729 memcpy(viewmat,
array,
sizeof(viewmat));
3730 array +=
sizeof(viewmat) /
sizeof(
float);
3789 float *projScreenCo;
3799 for (
a = 0,
mv = ps->
mvert_eval; a < ps->totvert_eval;
a++,
mv++, projScreenCo += 4) {
3803 projScreenCo[0] = (
float)(ps->
winx * 0.5f) + (ps->
winx * 0.5f) * projScreenCo[0];
3804 projScreenCo[1] = (
float)(ps->
winy * 0.5f) + (ps->
winy * 0.5f) * projScreenCo[1];
3809 for (
a = 0,
mv = ps->
mvert_eval; a < ps->totvert_eval;
a++,
mv++, projScreenCo += 4) {
3811 projScreenCo[3] = 1.0f;
3817 projScreenCo[0] = (
float)(ps->
winx * 0.5f) +
3818 (ps->
winx * 0.5f) * projScreenCo[0] / projScreenCo[3];
3819 projScreenCo[1] = (
float)(ps->
winy * 0.5f) +
3820 (ps->
winy * 0.5f) * projScreenCo[1] / projScreenCo[3];
3822 projScreenCo[2] = projScreenCo[2] / projScreenCo[3];
3830 projScreenCo[0] = FLT_MAX;
3846 #ifdef PROJ_DEBUG_WINCLIP
3877 for (
a = 0, me = ps->
medge_eval; a < ps->totedge_eval;
a++, me++) {
3902 #ifndef PROJ_DEBUG_NOSEAMBLEED
3909 "paint-faceWindindFlags");
3928 if (reset_threads) {
3949 float viewDirPersp[3];
3986 #ifndef PROJ_DEBUG_NOSEAMBLEED
3990 const int tri_index)
4025 if (scene_eval ==
NULL || ob_eval ==
NULL) {
4046 const int totmat = ob->
totcol + 1;
4051 for (
int i = 0; i < totmat - 1; i++) {
4092 "proj_paint_mtfaces");
4094 if (layer_num != -1) {
4098 if (mloopuv_clone_base ==
NULL) {
4104 memset(layer_clone, 0,
sizeof(*layer_clone));
4112 const int tri_index)
4151 memset(face_lookup, 0,
sizeof(*face_lookup));
4200 if (coSS->
v1[0] == FLT_MAX || coSS->
v2[0] == FLT_MAX || coSS->
v3[0] == FLT_MAX) {
4207 #ifdef PROJ_DEBUG_WINCLIP
4244 for (entry = used_images->
first, i = 0; entry; entry = entry->
next, i++, projIma++) {
4247 projIma->
ima = entry->
ima;
4274 const bool is_multi_view)
4282 int tile_last = -1,
tile;
4284 int image_index = -1, tri_index;
4289 for (tri_index = 0, lt = ps->
mlooptri_eval; tri_index < ps->totlooptri_eval; tri_index++, lt++) {
4291 bool skip_tri =
false;
4303 if (slot != slot_last) {
4333 #ifndef PROJ_DEBUG_NOSEAMBLEED
4343 if (is_face_sel && tpage) {
4347 if (is_multi_view ==
false) {
4352 #ifdef PROJ_DEBUG_WINCLIP
4362 if (prev_poly != lt->
poly) {
4366 int poly_loops = poly->
totloop;
4367 prev_poly = lt->
poly;
4368 for (iloop = 0; iloop < poly_loops; iloop++) {
4378 int poly_tri = poly_loops - 3;
4379 tri_index += poly_tri;
4393 if (tpage_last != tpage || tile_last !=
tile) {
4396 if (
e->ima == tpage &&
e->iuser.tile ==
tile) {
4423 if (image_index != -1) {
4443 const bool is_multi_view,
4444 const char symmetry_flag)
4455 bool reset_threads =
false;
4480 if (layer_num != -1) {
4517 reset_threads =
true;
4526 "paint-bucketRect");
4528 "paint-bucketFaces");
4531 #ifndef PROJ_DEBUG_NOSEAMBLEED
4543 ps, arena, &face_lookup, &layer_clone, mloopuv_base, is_multi_view);
4557 ((
float)(ps->
winx * 0.5f) + (ps->
winx * 0.5f) * projCo[0] / projCo[3]);
4559 ((
float)(ps->
winy * 0.5f) + (ps->
winy * 0.5f) * projCo[1] / projCo[3]);
4570 for (
a = 0, projIma = ps->
projImages; a < ps->image_tot;
a++, projIma++) {
4610 #ifndef PROJ_DEBUG_NOSEAMBLEED
4680 bool redraw =
false;
4682 for (
a = 0, projIma = ps->
projImages; a < ps->image_tot;
a++, projIma++) {
4683 if (projIma->
touch) {
4708 float min_brush[2], max_brush[2];
4714 if (radius < 1.0f) {
4719 min_brush[0] = mval_f[0] - radius;
4720 min_brush[1] = mval_f[1] - radius;
4722 max_brush[0] = mval_f[0] + radius;
4723 max_brush[1] = mval_f[1] + radius;
4747 rctf *bucket_bounds,
4748 const float mval[2])
4756 const int bucket_y = bidx / ps->
buckets_x;
4757 const int bucket_x = bidx - (bucket_y * ps->
buckets_x);
4760 if (bucket_x >= ps->
bucketMin[0] && bucket_x < ps->bucketMax[0]) {
4766 *bucket_index = bidx;
4800 uchar clone_rgba[4];
4802 clone_rgba[0] = clone_pt[0];
4803 clone_rgba[1] = clone_pt[1];
4804 clone_rgba[2] = clone_pt[2];
4805 clone_rgba[3] = (
uchar)(clone_pt[3] *
mask);
4819 const float *clone_pt = ((
ProjPixelClone *)projPixel)->clonepx.f;
4822 float clone_rgba[4];
4883 float accum_tot = 0.0f;
4891 for (yk = 0; yk <
kernel->side; yk++) {
4892 for (xk = 0; xk <
kernel->side; xk++) {
4894 float co_ofs[2] = {2.0f * xk - 1.0f, 2.0f * yk - 1.0f};
4902 accum_tot += weight;
4907 if (
LIKELY(accum_tot != 0)) {
4943 float accum_tot = 0;
4952 for (yk = 0; yk <
kernel->side; yk++) {
4953 for (xk = 0; xk <
kernel->side; xk++) {
4955 float co_ofs[2] = {2.0f * xk - 1.0f, 2.0f * yk - 1.0f};
4963 accum_tot += weight;
4968 if (
LIKELY(accum_tot != 0)) {
4974 float rgba_pixel[4];
4984 float alpha = rgba_pixel[3];
5007 const float texrgb[3],
5030 if (dither > 0.0f) {
5048 const float texrgb[3],
5073 rgba_ub[0] = rgba_ub[1] = rgba_ub[2] = ps->
stencil_value * 255.0f;
5103 &rect_to_add, projPixel->
x_px, projPixel->
x_px + 1, projPixel->
y_px, projPixel->
y_px + 1);
5113 float rgb_straight[4];
5131 const int thread_index = ((
ProjectHandle *)ph_v)->thread_index;
5139 int last_index = -1;
5143 float dist_sq, dist;
5147 bool is_floatbuf =
false;
5148 const short tool = ps->
tool;
5152 float pos_ofs[2] = {0};
5158 const float brush_radius_sq = brush_radius * brush_radius;
5175 pos_ofs[0] =
pos[0] - lastpos[0];
5176 pos_ofs[1] =
pos[1] - lastpos[1];
5191 rctf clip_rect = bucket_bounds;
5210 last_projIma = projImages + last_index;
5212 last_projIma->
touch = 1;
5222 float line_len_sq_inv, line_len;
5225 const float p[2] = {
5226 projPixel->
projCoSS[0] - lastpos[0],
5227 projPixel->
projCoSS[1] - lastpos[1],
5232 line_len_sq_inv = 1.0f / line_len;
5233 line_len =
sqrtf(line_len);
5237 f =
dot_v2v2(p, tangent) * line_len_sq_inv;
5242 f =
len_v2(p) / line_len;
5247 color_f[3] *= ((
float)projPixel->
mask) * (1.0f / 65535.0f) * brush_alpha;
5274 float newColor_f[4];
5275 newColor_f[3] = ((
float)projPixel->
mask) * (1.0f / 65535.0f) * brush_alpha;
5347 if (dist_sq <= brush_radius_sq) {
5348 dist =
sqrtf(dist_sq);
5352 if (falloff > 0.0f) {
5357 float custom_mask = ((
float)projPixel->
mask) * (1.0f / 65535.0f);
5363 CLAMP(texmask, 0.0f, 1.0f);
5364 custom_mask *= texmask;
5380 samplecos[2] = 0.0f;
5388 custom_mask *= texrgba[3];
5402 float max_mask = brush_alpha * custom_mask * falloff * 65535.0f;
5405 mask = mask_accum + max_mask;
5408 mask = mask_accum + (max_mask - mask_accum * falloff);
5416 mask = mask_short * (1.0f / 65535.0f);
5424 mask = brush_alpha * custom_mask * falloff;
5432 last_projIma = projImages + last_index;
5434 last_projIma->
touch = 1;
5440 *projPixel->
valid =
true;
5507 projPixel =
node->link;
5515 projPixel =
node->link;
5527 projPixel =
node->link;
5535 projPixel =
node->link;
5550 bool touch_any =
false;
5571 bool float_dest =
false;
5572 bool uchar_dest =
false;
5616 memcpy(
handles[
a].projImages[i].partRedrawRect,
5643 handles[
a].projImages[i].partRedrawRect,
5660 if (tri_index != -1) {
5684 const float prev_pos[2],
5737 const float prev_pos[2],
5754 const int mval_i[2] = {(int)
pos[0], (
int)
pos[1]};
5853 #ifndef PROJ_DEBUG_NOSEAMBLEED
5925 BLI_assert(index <= ps_handle->ps_views_tot);
6038 int orig_brush_size;
6077 if (view_data !=
NULL &&
6121 const float pos[2] = {0.0, 0.0};
6122 const float lastpos[2] = {0.0, 0.0};
6149 ot->
name =
"Project Image";
6150 ot->
idname =
"PAINT_OT_project_image";
6151 ot->
description =
"Project an edited render from the active camera back onto the object";
6192 char err_out[256] =
"unknown";
6280 array[2] = is_ortho ? 1.0f : 0.0f;
6291 ot->
name =
"Image from View";
6292 ot->
idname =
"PAINT_OT_image_from_view";
6293 ot->
description =
"Make an image from biggest 3D view for reprojection";
6313 "Missing%s%s%s%s detected!",
6314 !uvs ?
" UVs," :
"",
6315 !mat ?
" Materials," :
"",
6316 !
tex ?
" Textures," :
"",
6317 !stencil ?
" Stencil," :
"");
6329 bool hasstencil =
true;
6347 for (
int i = 1; i < ob->
totcol + 1; i++) {
6376 if (layernum == 0) {
6412 *stencil = hasstencil;
6415 return hasuvs && hasmat && hastex && hasstencil;
6454 float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6455 char imagename[
MAX_ID_NAME - 2] =
"Material Diffuse Color";
6458 bool use_float =
false;
6491 float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6529 switch (layer_type) {
6543 switch (in_sock->
type) {
6616 switch (slot_type) {
6620 new_node->
id = &ima->
id;
6639 bNode *out_node = new_node;
6641 if (in_node !=
NULL) {
6658 out_node = nor_node;
6670 out_node = bump_node;
6676 if (in_node !=
NULL) {
6686 if (in_sock !=
NULL && link ==
NULL) {
6742 const char *base_name = ma ? &ma->
id.
name[2] : &ob->
id.
name[2];
6783 switch (slot_type) {
6806 #define IMA_DEF_NAME N_("Untitled")
6811 static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6832 ot->
name =
"Add Paint Slot";
6834 ot->
idname =
"PAINT_OT_add_texture_paint_slot";
6850 "Material Layer Type",
6851 "Material layer type of new paint slot");
6855 ot->
srna,
"slot_type", slot_type_items, 0,
"Slot Type",
"Type of new paint slot");
6862 ot->
srna,
"color", 4,
NULL, 0.0f, FLT_MAX,
"Color",
"Default fill color", 0.0f, 1.0f);
6867 prop =
RNA_def_int(
ot->
srna,
"width", 1024, 1, INT_MAX,
"Width",
"Image width", 1, 16384);
6870 prop =
RNA_def_int(
ot->
srna,
"height", 1024, 1, INT_MAX,
"Height",
"Image height", 1, 16384);
6880 "Fill the image with a grid for UV map testing");
6883 ot->
srna,
"float", 0,
"32-bit Float",
"Create image with 32-bit floating-point bit depth");
6891 "Type of element that attribute is stored on");
6895 attribute_type_items,
6898 "Type of data stored in attribute");
6931 ot->
name =
"Add Simple UVs";
6933 ot->
idname =
"PAINT_OT_add_simple_uvs";
typedef float(TangentPoint)[2]
Generic geometry attributes built on CustomData.
void BKE_id_attributes_active_color_set(struct ID *id, struct CustomDataLayer *active_layer)
void BKE_id_attributes_render_color_set(struct ID *id, struct CustomDataLayer *active_layer)
struct CustomDataLayer * BKE_id_attribute_new(struct ID *id, const char *name, int type, eAttrDomain domain, struct ReportList *reports)
struct CustomDataLayer * BKE_id_attributes_render_color_get(const struct ID *id)
float BKE_brush_sample_masktex(const struct Scene *scene, struct Brush *br, const float point[2], int thread, struct ImagePool *pool)
float BKE_brush_curve_strength_clamped(const struct Brush *br, float p, float len)
void BKE_brush_size_set(struct Scene *scene, struct Brush *brush, int size)
float BKE_brush_sample_tex_3d(const struct Scene *scene, const struct Brush *br, const float point[3], float rgba[4], int thread, struct ImagePool *pool)
float BKE_brush_alpha_get(const struct Scene *scene, const struct Brush *brush)
int BKE_brush_size_get(const struct Scene *scene, const struct Brush *brush)
Camera data-block and utility functions.
void BKE_camera_params_init(CameraParams *params)
void BKE_camera_params_from_object(CameraParams *params, const struct Object *cam_ob)
void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy)
void BKE_camera_params_compute_matrix(CameraParams *params)
bool BKE_colorband_evaluate(const struct ColorBand *coba, float in, float out[4])
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct bScreen * CTX_wm_screen(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg)
struct Main * CTX_data_main(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_number_of_layers(const struct CustomData *data, int type)
int CustomData_get_clone_layer(const struct CustomData *data, int type)
bool CustomData_has_layer(const struct CustomData *data, int type)
void * CustomData_get_layer_named(const struct CustomData *data, int type, const char *name)
int CustomData_get_stencil_layer(const struct CustomData *data, int type)
void * CustomData_get_layer_n(const struct CustomData *data, int type, int n)
void * CustomData_get_layer(const struct CustomData *data, int type)
struct IDProperty * IDP_GetProperties(struct ID *id, bool create_if_needed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
struct IDProperty * IDP_New(char type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
struct IDProperty * IDP_GetPropertyTypeFromGroup(const struct IDProperty *prop, const char *name, char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL()
struct IDProperty * IDP_GetPropertyFromGroup(const struct IDProperty *prop, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
bool BKE_image_has_ibuf(struct Image *ima, struct ImageUser *iuser)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
struct ImagePool * BKE_image_pool_new(void)
struct Image * BKE_image_add_generated(struct Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, const float color[4], bool stereo3d, bool is_data, bool tiled)
void BKE_image_free_gputextures(struct Image *ima)
void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf)
#define IMA_SIGNAL_USER_NEW_IMAGE
void BKE_image_signal(struct Main *bmain, struct Image *ima, struct ImageUser *iuser, int signal)
struct Image * BKE_image_add_from_imbuf(struct Main *bmain, struct ImBuf *ibuf, const char *name)
void BKE_imageuser_default(struct ImageUser *iuser)
void BKE_image_pool_free(struct ImagePool *pool)
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
void BKE_texpaint_slot_refresh_cache(struct Scene *scene, struct Material *ma, const struct Object *ob)
void BKE_object_material_assign(struct Main *bmain, struct Object *ob, struct Material *ma, short act, int assign_type)
struct Material * BKE_material_add(struct Main *bmain, const char *name)
@ BKE_MAT_ASSIGN_USERPREF
struct Mesh * BKE_mesh_from_object(struct Object *ob)
const float(* BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3]
#define BKE_MESH_TESSTRI_VINDEX_ORDER(_tri, _v)
const struct MLoopTri * BKE_mesh_runtime_looptri_ensure(const struct Mesh *mesh)
struct Mesh * mesh_get_eval_final(struct Depsgraph *depsgraph, const struct Scene *scene, struct Object *ob, const struct CustomData_MeshMasks *dataMask)
struct bNode * ntreeFindType(const struct bNodeTree *ntree, int type)
#define SH_NODE_BSDF_PRINCIPLED
void nodePositionPropagate(struct bNode *node)
void ntreeFreeTree(struct bNodeTree *ntree)
void nodePositionRelative(struct bNode *from_node, struct bNode *to_node, struct bNodeSocket *from_sock, struct bNodeSocket *to_sock)
#define SH_NODE_OUTPUT_MATERIAL
struct bNodeLink * nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock)
struct bNodeSocket * nodeFindSocket(const struct bNode *node, eNodeSocketInOut in_out, const char *identifier)
struct bNodeTree * ntreeAddTree(struct Main *bmain, const char *name, const char *idname)
struct bNode * nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type)
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
#define SH_NODE_ATTRIBUTE
bool BKE_object_attributes_active_color_fill(struct Object *ob, const float fill_color[4], bool only_selected)
struct Brush * BKE_paint_brush(struct Paint *paint)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
int BKE_scene_num_threads(const struct Scene *scene)
bool BKE_scene_check_color_management_enabled(const struct Scene *scene)
struct ARegion * BKE_area_find_region_active_win(struct ScrArea *area)
struct ARegion struct ARegion struct ScrArea struct ScrArea * BKE_screen_find_big_area(struct bScreen *screen, int spacetype, short min)
#define BLI_assert_unreachable()
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, struct MemArena *ma) ATTR_NONNULL(1
#define LISTBASE_CIRCULAR_FORWARD_BEGIN(lb, lb_iter, lb_init)
#define LISTBASE_CIRCULAR_FORWARD_END(lb, lb_iter, lb_init)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
#define LISTBASE_CIRCULAR_BACKWARD_BEGIN(lb, lb_iter, lb_init)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_CIRCULAR_BACKWARD_END(lb, lb_iter, lb_init)
MINLINE float saacos(float fac)
int pow_i(int base, int exp)
MINLINE float min_ff(float a, float b)
MINLINE int mod_i(int i, int n)
MINLINE float square_f(float a)
MINLINE float min_fff(float a, float b, float c)
MINLINE int square_s(short a)
MINLINE int count_bits_i(unsigned int n)
MINLINE void straight_to_premul_v4_v4(float premul[4], const float straight[4])
MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void rgba_float_args_set(float col[4], float r, float g, float b, float a)
MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4])
MINLINE void premul_to_straight_v4(float color[4])
MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4])
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
MINLINE void float_to_byte_dither_v3(unsigned char b[3], const float f[3], float dither, float s, float t)
MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4])
MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3])
void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4])
MINLINE void blend_color_add_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_interpolate_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4], float t)
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mix_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_interpolate_float(float dst[4], const float src1[4], const float src2[4], float t)
int isect_seg_seg_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
int isect_point_quad_v2(const float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2])
MINLINE float area_tri_v2(const float v1[2], const float v2[2], const float v3[2])
void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3])
MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2])
bool isect_seg_seg_v2_simple(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
float resolve_quad_u_v2(const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2])
int isect_seg_seg_v2_point(const float v0[2], const float v1[2], const float v2[2], const float v3[2], float vi[2])
void barycentric_weights_v2_persp(const float v1[4], const float v2[4], const float v3[4], const float co[2], float w[3])
float dist_squared_to_line_v2(const float p[2], const float l1[2], const float l2[2])
int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void mul_project_m4_v3(const float M[4][4], float vec[3])
void mul_m3_v3(const float M[3][3], float r[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void mul_m4_v4(const float M[4][4], float r[4])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void normalize_m4(float R[4][4]) ATTR_NONNULL()
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void mul_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v2_fl(float r[2], float f)
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void mul_v4_v4fl(float r[4], const float a[4], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v2_v2v2v2(float r[2], const float a[2], const float b[2], const float c[2], const float t[3])
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
MINLINE void add_v2_v2(float r[2], const float a[2])
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v3(float r[3])
MINLINE void zero_v4(float r[4])
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void BLI_rcti_init_minmax(struct rcti *rect)
bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2])
bool BLI_rcti_is_valid(const struct rcti *rect)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
bool BLI_rcti_is_empty(const struct rcti *rect)
void BLI_rcti_do_minmax_rcti(struct rcti *rect, const struct rcti *other)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
void BLI_task_pool_work_and_wait(TaskPool *pool)
TaskPool * BLI_task_pool_create_suspended(void *userdata, eTaskPriority priority)
void BLI_task_pool_free(TaskPool *pool)
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
pthread_spinlock_t SpinLock
void BLI_thread_unlock(int type)
void BLI_thread_lock(int type)
#define BLENDER_MAX_THREADS
void BLI_spin_init(SpinLock *spin)
void BLI_spin_unlock(SpinLock *spin)
void BLI_spin_lock(SpinLock *spin)
void BLI_spin_end(SpinLock *spin)
#define INIT_MINMAX2(min, max)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
Compatibility-like things for windows.
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ ID_RECALC_COPY_ON_WRITE
#define ID_IS_LINKED(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define CD_MASK_ORIGINDEX
Object is a sort of wrapper for general info.
#define IMAGEPAINT_PROJECT_FLAT
#define IMAGEPAINT_PROJECT_LAYER_STENCIL
#define IMAGEPAINT_MODE_IMAGE
#define IMAGEPAINT_PROJECT_XRAY
#define IMAGEPAINT_PROJECT_LAYER_CLONE
#define IMAGEPAINT_MODE_MATERIAL
#define OBACT(_view_layer)
#define IMAGEPAINT_PROJECT_LAYER_STENCIL_INV
@ PAINT_CANVAS_SOURCE_COLOR_ATTRIBUTE
@ PAINT_CANVAS_SOURCE_IMAGE
@ PAINT_CANVAS_SOURCE_MATERIAL
#define IMAGEPAINT_DRAWING
#define IMAGEPAINT_MISSING_STENCIL
#define IMAGEPAINT_PROJECT_BACKFACE
#define IMAGEPAINT_MISSING_MATERIAL
#define IMAGEPAINT_MISSING_UVS
#define IMAGEPAINT_MISSING_TEX
@ V3D_OVERLAY_HIDE_OBJECT_ORIGINS
@ V3D_OVERLAY_HIDE_MOTION_PATHS
@ V3D_OVERLAY_HIDE_OBJECT_XTRAS
@ V3D_OVERLAY_HIDE_CURSOR
#define V3D_HIDE_HELPLINES
#define RV3D_CLIPPING_ENABLED(v3d, rv3d)
void ED_node_shader_default(const struct bContext *C, struct ID *id)
void ED_node_tree_propagate_change(const struct bContext *C, struct Main *bmain, struct bNodeTree *ntree)
struct Object * ED_object_active_context(const struct bContext *C)
#define ED_IMAGE_UNDO_TILE_NUMBER(size)
void ED_image_undo_push_begin(const char *name, int paint_mode)
void ED_image_paint_tile_lock_end(void)
void ED_image_paint_tile_lock_init(void)
#define ED_IMAGE_UNDO_TILE_SIZE
struct PaintTileMap * ED_image_paint_tile_map_get(void)
void ED_image_undo_push_end(void)
void * ED_image_paint_tile_push(PaintTileMap *paint_tile_map, struct Image *image, struct ImBuf *ibuf, struct ImBuf **tmpibuf, struct ImageUser *iuser, int x_tile, int y_tile, unsigned short **r_mask, bool **r_valid, bool use_thread_lock, bool find_prev)
#define ED_IMAGE_UNDO_TILE_BITS
void ED_area_tag_redraw(ScrArea *area)
bool ED_operator_object_active_editable_mesh(struct bContext *C)
void ED_region_tag_redraw(struct ARegion *region)
void ED_uvedit_add_simple_uvs(struct Main *bmain, const struct Scene *scene, struct Object *ob)
bool ED_view3d_clip_range_get(const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, float *r_clipsta, float *r_clipend, bool use_ortho_factor)
void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d, const float obmat[4][4], float r_pmat[4][4])
bool ED_view3d_clipping_test(const struct RegionView3D *rv3d, const float co[3], bool is_local)
void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4])
void view3d_operator_needs_opengl(const struct bContext *C)
bool ED_view3d_autodist(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride, const float fallback_depth_pt[3])
struct ImBuf * ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph, struct Scene *scene, eDrawType drawtype, struct View3D *v3d, struct ARegion *region, int sizex, int sizey, eImBufFlags imbuf_flag, int alpha_mode, const char *viewname, bool restore_rv3d_mats, struct GPUOffScreen *ofs, char err_out[256])
int GPU_max_texture_size(void)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint i1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
void IMB_float_from_rect(struct ImBuf *ibuf)
void imb_freerectfloatImBuf(struct ImBuf *ibuf)
void IMB_rect_from_float(struct ImBuf *ibuf)
void imb_freerectImBuf(struct ImBuf *ibuf)
void IMB_blend_color_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4], IMB_BlendMode mode)
void bicubic_interpolation_color(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
void IMB_blend_color_float(float dst[4], const float src1[4], const float src2[4], IMB_BlendMode mode)
void bilinear_interpolation_color_wrap(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define MEM_SIZE_OPTIMAL(size)
struct bNodeTreeType * ntreeType_Shader
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 Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block SH_NODE_TEX_IMAGE
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 Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input 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 a color
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value SH_NODE_NORMAL_MAP
const EnumPropertyItem * RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE int32_t atomic_fetch_and_add_int32(int32_t *p, int32_t x)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes SyclQueue void const char void *memory_device_pointer KernelContext int kernel
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
ccl_gpu_kernel_postfix ccl_global int * counter
ccl_global const KernelWorkTile * tile
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
#define unit_float_to_uchar_clamp_v3(v1, v2)
ccl_device_inline float2 interp(const float2 &a, const float2 &b, float t)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static void area(int d1, int d2, int e1, int e2, float weights[2])
T distance(const T &a, const T &b)
static const pxr::TfToken rgba("rgba", pxr::TfToken::Immortal)
static const pxr::TfToken rgb("rgb", pxr::TfToken::Immortal)
void paint_delete_blur_kernel(BlurKernel *kernel)
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, ImageUser *iuser, short texpaint)
void paint_brush_init_tex(Brush *brush)
void set_imapaintpartial(struct ImagePaintPartialRedraw *ippr)
bool paint_use_opacity_masking(Brush *brush)
void paint_brush_color_get(struct Scene *scene, struct Brush *br, bool color_correction, bool invert, float distance, float pressure, float color[3], struct ColorManagedDisplay *display)
void paint_brush_exit_tex(Brush *brush)
static void do_projectpaint_soften(ProjPaintState *ps, ProjPixel *projPixel, float mask, MemArena *softenArena, LinkNode **softenPixels)
void * paint_proj_new_stroke(bContext *C, Object *ob, const float mouse[2], int mode)
static bool project_paint_clone_face_skip(ProjPaintState *ps, ProjPaintLayerClone *lc, const TexPaintSlot *slot, const int tri_index)
static bool project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *bucketFace, const int orig_face, const float pixelScreenCo[4])
static void screen_px_from_ortho(const float uv[2], const float v1co[3], const float v2co[3], const float v3co[3], const float uv1co[2], const float uv2co[2], const float uv3co[2], float pixelScreenCo[4], float w[3])
static int project_paint_face_paint_tile(Image *ima, const float *uv)
static int project_paint_PickFace(const ProjPaintState *ps, const float pt[2], float w[3])
static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MLoopTri *lt)
static int project_bucket_offset(const ProjPaintState *ps, const float projCoSS[2])
static bool project_paint_PickColor(const ProjPaintState *ps, const float pt[2], float *rgba_fp, uchar *rgba, const bool interp)
static void image_paint_partial_redraw_expand(ImagePaintPartialRedraw *cell, const ProjPixel *projPixel)
static void project_paint_begin(const bContext *C, ProjPaintState *ps, const bool is_multi_view, const char symmetry_flag)
#define PROJ_SRC_VIEW_FILL
static int project_bucket_offset_safe(const ProjPaintState *ps, const float projCoSS[2])
static bool project_paint_winclip(const ProjPaintState *ps, const ProjPaintFaceCoSS *coSS)
static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *ps)
static void paint_proj_stroke_ps(const bContext *UNUSED(C), void *ps_handle_p, const float prev_pos[2], const float pos[2], const bool eraser, float pressure, float distance, float size, ProjPaintState *ps)
static Image * project_paint_face_clone_image(const ProjPaintState *ps, int tri_index)
static void proj_paint_state_screen_coords_init(ProjPaintState *ps, const int diameter)
static int texture_paint_add_texture_paint_slot_exec(bContext *C, wmOperator *op)
static Image * proj_paint_image_create(wmOperator *op, Main *bmain, bool is_data)
struct ProjectHandle ProjectHandle
struct ProjPixelClone ProjPixelClone
static void rect_to_uvspace_ortho(const rctf *bucket_bounds, const float *v1coSS, const float *v2coSS, const float *v3coSS, const float *uv1co, const float *uv2co, const float *uv3co, float bucket_bounds_uv[4][2], const int flip)
static bool add_simple_uvs_poll(bContext *C)
#define PROJ_VIEW_DATA_SIZE
static void project_paint_bleed_add_face_user(const ProjPaintState *ps, MemArena *arena, const MLoopTri *lt, const int tri_index)
static Material * get_or_create_current_material(bContext *C, Object *ob)
static bool IsectPT2Df_limit(const float pt[2], const float v1[2], const float v2[2], const float v3[2], const float limit)
static int add_simple_uvs_exec(bContext *C, wmOperator *UNUSED(op))
static int get_texture_layer_type(wmOperator *op, const char *prop_name)
void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot)
static bool texture_paint_image_from_view_poll(bContext *C)
#define PROJ_BOUNDBOX_DIV
struct PrepareImageEntry PrepareImageEntry
static void do_projectpaint_mask(ProjPaintState *ps, ProjPixel *projPixel, float mask)
static void uvco_to_wrapped_pxco(const float uv[2], int ibuf_x, int ibuf_y, float *x, float *y)
static void project_face_pixel(const float *lt_tri_uv[3], ImBuf *ibuf_other, const float w[3], uchar rgba_ub[4], float rgba_f[4])
static void screen_px_from_persp(const float uv[2], const float v1co[4], const float v2co[4], const float v3co[4], const float uv1co[2], const float uv2co[2], const float uv3co[2], float pixelScreenCo[4], float w[3])
static int project_paint_undo_subtiles(const TileInfo *tinf, int tx, int ty)
static void project_paint_prepare_all_faces(ProjPaintState *ps, MemArena *arena, const ProjPaintFaceLookup *face_lookup, ProjPaintLayerClone *layer_clone, const MLoopUV *mloopuv_base, const bool is_multi_view)
static void project_bucket_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, const rctf *clip_rect, const rctf *bucket_bounds)
static bool line_rect_clip(const rctf *rect, const float l1[4], const float l2[4], const float uv1[2], const float uv2[2], float uv[2], bool is_ortho)
static void proj_paint_face_lookup_init(const ProjPaintState *ps, ProjPaintFaceLookup *face_lookup)
static bool cmp_uv(const float vec2a[2], const float vec2b[2])
#define PS_LOOPTRI_AS_UV_3(uvlayer, lt)
#define PROJ_GEOM_TOLERANCE
static void partial_redraw_array_init(ImagePaintPartialRedraw *pr)
static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, const float texrgb[3], float mask)
static void project_paint_build_proj_ima(ProjPaintState *ps, MemArena *arena, ListBase *used_images)
BLI_INLINE const MPoly * ps_tri_index_to_mpoly(const ProjPaintState *ps, int tri_index)
void ED_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil)
#define PROJ_SRC_IMAGE_CAM
static void proj_paint_layer_clone_init(ProjPaintState *ps, ProjPaintLayerClone *layer_clone)
#define PROJ_FACE_NOSEAM0
static int line_isect_x(const float p1[2], const float p2[2], const float x_level, float *y_isect)
#define PROJ_BUCKET_BRUSH_DIV
#define PROJ_FACE_SEAM_INIT2
#define PROJ_BUCKET_RECT_MAX
BLI_INLINE uchar f_to_char(const float val)
struct ProjPaintState ProjPaintState
static int float_z_sort_flip(const void *p1, const void *p2)
#define PROJ_SRC_IMAGE_VIEW
static bool project_bucket_isect_circle(const float cent[2], const float radius_squared, const rctf *bucket_bounds)
static ProjPixel * project_paint_uvpixel_init(const ProjPaintState *ps, MemArena *arena, const TileInfo *tinf, int x_px, int y_px, const float mask, const int tri_index, const float pixelScreenCo[4], const float world_spaceCo[3], const float w[3])
static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float mask, MemArena *smearArena, LinkNode **smearPixels, const float co[2])
#define PROJ_FACE_WINDING_INIT
static CustomDataLayer * proj_paint_color_attribute_create(wmOperator *op, Object *ob)
void PAINT_OT_add_simple_uvs(wmOperatorType *ot)
static bool project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf *bucket_bounds, const float mval[2])
#define PROJ_BUCKET_RECT_MIN
static bool project_paint_check_face_sel(const ProjPaintState *ps, const ProjPaintFaceLookup *face_lookup, const MLoopTri *lt)
static bool project_image_refresh_tagged(ProjPaintState *ps)
#define PROJ_FACE_WINDING_CW
static bool check_seam(const ProjPaintState *ps, const int orig_face, const int orig_i1_fidx, const int orig_i2_fidx, int *other_face, int *orig_fidx)
static int float_z_sort(const void *p1, const void *p2)
static void scale_tri(float insetCos[3][3], const float *origCos[3], const float inset)
static void proj_paint_state_cavity_init(ProjPaintState *ps)
static bool partial_redraw_array_merge(ImagePaintPartialRedraw *pr, ImagePaintPartialRedraw *pr_other, int tot)
static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *lt, const int tri_index)
void paint_proj_stroke(const bContext *C, void *ps_handle_p, const float prev_pos[2], const float pos[2], const bool eraser, float pressure, float distance, float size)
static int project_paint_occlude_ptv(const float pt[3], const float v1[4], const float v2[4], const float v3[4], float w[3], const bool is_ortho)
bool ED_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil)
static void project_paint_end(ProjPaintState *ps)
static void get_default_texture_layer_name_for_object(Object *ob, int texture_type, char *dst, int dst_length)
void paint_proj_redraw(const bContext *C, void *ps_handle_p, bool final)
static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
static void project_face_winding_init(const ProjPaintState *ps, const int tri_index)
static int line_isect_y(const float p1[2], const float p2[2], const float y_level, float *x_isect)
struct ProjStrokeHandle ProjStrokeHandle
static void default_paint_slot_color_get(int layer_type, Material *ma, float color[4])
static bool pixel_bounds_array(float(*uv)[2], rcti *bounds_px, const int ibuf_x, const int ibuf_y, int tot)
static void partial_redraw_single_init(ImagePaintPartialRedraw *pr)
static void insert_seam_vert_array(const ProjPaintState *ps, MemArena *arena, const int tri_index, const int fidx1, const int ibuf_x, const int ibuf_y)
static float project_paint_uvpixel_mask(const ProjPaintState *ps, const int tri_index, const float w[3])
static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, float mask, MemArena *softenArena, LinkNode **softenPixels)
static void project_paint_bucket_bounds(const ProjPaintState *ps, const float min[2], const float max[2], int bucketMin[2], int bucketMax[2])
static const EnumPropertyItem layer_type_items[]
#define PROJ_PIXEL_TOLERANCE
static int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
static Image * project_paint_face_paint_image(const ProjPaintState *ps, int tri_index)
static void do_projectpaint_mask_f(ProjPaintState *ps, ProjPixel *projPixel, float mask)
union pixelStore PixelStore
static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool), void *ph_v)
static void paint_proj_begin_clone(ProjPaintState *ps, const float mouse[2])
static void proj_paint_state_seam_bleed_init(ProjPaintState *ps)
static VertSeam * find_adjacent_seam(const ProjPaintState *ps, uint loop_index, uint vert_index, VertSeam **r_seam)
struct ProjPaintImage ProjPaintImage
static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float mask)
#define PROJ_VIEW_DATA_ID
static void project_bucket_bounds(const ProjPaintState *ps, const int bucket_x, const int bucket_y, rctf *bucket_bounds)
static float len_squared_v2v2_alt(const float v1[2], const float v2_1, const float v2_2)
static int project_paint_pixel_sizeof(const short tool)
#define PROJ_PAINT_STATE_SHARED_CLEAR(ps)
#define PROJ_PAINT_STATE_SHARED_MEMCPY(ps_dst, ps_src)
static bool pixel_bounds_uv(const float uv_quad[4][2], rcti *bounds_px, const int ibuf_x, const int ibuf_y)
void PAINT_OT_project_image(wmOperatorType *ot)
static bool project_paint_op(void *state, const float lastpos[2], const float pos[2])
static float screen_px_line_point_factor_v2_persp(const ProjPaintState *ps, const float p[2], const float v1[3], const float v2[3])
union pixelPointer PixelPointer
static bool project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
static bool proj_paint_add_slot(bContext *C, wmOperator *op)
static void do_projectpaint_draw(ProjPaintState *ps, ProjPixel *projPixel, const float texrgb[3], float mask, float dither, float u, float v)
static void copy_original_alpha_channel(ProjPixel *pixel, bool is_floatbuf)
static float VecZDepthOrtho(const float pt[2], const float v1[3], const float v2[3], const float v3[3], float w[3])
#define PROJ_BOUNDBOX_SQUARED
void paint_proj_stroke_done(void *ps_handle_p)
struct ProjPixel ProjPixel
static bool IsectPoly2Df(const float pt[2], const float uv[][2], const int tot)
static void project_face_seams_init(const ProjPaintState *ps, MemArena *arena, const int tri_index, const uint vert_index, bool init_all, const int ibuf_x, const int ibuf_y)
static TexPaintSlot * project_paint_face_paint_slot(const ProjPaintState *ps, int tri_index)
#define PROJ_FACE_SEAM_INIT0
static bool line_clip_rect2f(const rctf *cliprect, const rctf *rect, const float l1[2], const float l2[2], float l1_clip[2], float l2_clip[2])
static float VecZDepthPersp(const float pt[2], const float v1[4], const float v2[4], const float v3[4], float w[3])
static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
#define PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt)
static TexPaintSlot * project_paint_face_clone_slot(const ProjPaintState *ps, int tri_index)
#define PROJ_FACE_DEGENERATE
static int project_paint_occlude_ptv_clip(const float pt[3], const float v1[4], const float v2[4], const float v3[4], const float v1_3d[3], const float v2_3d[3], const float v3_3d[3], float w[3], const bool is_ortho, RegionView3D *rv3d)
static void proj_paint_face_coSS_init(const ProjPaintState *ps, const MLoopTri *lt, ProjPaintFaceCoSS *coSS)
static float compute_seam_normal(VertSeam *seam, VertSeam *adj, float r_no[2])
static bool IsectPoly2Df_twoside(const float pt[2], const float uv[][2], const int tot)
static void proj_paint_state_thread_init(ProjPaintState *ps, const bool reset_threads)
#define PS_LOOPTRI_ASSIGN_UV_3(uv_tri, uvlayer, lt)
static void screen_px_to_vector_persp(int winx, int winy, const float projmat_inv[4][4], const float view_pos[3], const float co_px[2], float r_dir[3])
static void project_bucket_clip_face(const bool is_ortho, const bool is_flip_object, const rctf *cliprect, const rctf *bucket_bounds, const float *v1coSS, const float *v2coSS, const float *v3coSS, const float *uv1co, const float *uv2co, const float *uv3co, float bucket_bounds_uv[8][2], int *tot, bool cull)
static void texture_paint_add_texture_paint_slot_ui(bContext *C, wmOperator *op)
static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmetry_flag)
static void project_paint_face_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, const int tri_index, const int image_index, const rctf *clip_rect, const rctf *bucket_bounds, ImBuf *ibuf, ImBuf **tmpibuf)
static bool project_paint_flt_max_cull(const ProjPaintState *ps, const ProjPaintFaceCoSS *coSS)
#define PROJ_FACE_SCALE_SEAM
void PAINT_OT_image_from_view(wmOperatorType *ot)
static void uv_image_outset(const ProjPaintState *ps, float(*orig_uv)[2], float(*puv)[2], uint tri_index, const int ibuf_x, const int ibuf_y)
static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int mode)
struct LoopSeamData LoopSeamData
static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float mask)
#define PROJ_FACE_SEAM_INIT1
static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float mask, MemArena *smearArena, LinkNode **smearPixels_f, const float co[2])
static void rect_to_uvspace_persp(const rctf *bucket_bounds, const float *v1coSS, const float *v2coSS, const float *v3coSS, const float *uv1co, const float *uv2co, const float *uv3co, float bucket_bounds_uv[4][2], const int flip)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
int RNA_enum_from_value(const EnumPropertyItem *item, const int value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
const EnumPropertyItem rna_enum_image_generated_type_items[]
const EnumPropertyItem DummyRNA_NULL_items[]
struct ColorBand * gradient
short screen_grab_size[2]
struct bNodeTree * nodetree
struct TexPaintSlot * texpaintslot
struct MLoopTri_Store looptris
struct CurveMapping * cavity_curve
struct PrepareImageEntry * next
struct PrepareImageEntry * prev
const int * index_mp_to_orig
ImagePaintPartialRedraw * partRedrawRect
volatile void ** undoRect
const TexPaintSlot * slot_last_clone
const TexPaintSlot * slot_clone
const MLoopUV * mloopuv_clone_base
LoopSeamData * loopSeamData
const float(* vert_normals)[3]
const MLoopUV ** poly_to_loop_uv_clone
const MLoopUV ** poly_to_loop_uv
float paint_color_linear[3]
bool reproject_ibuf_free_float
struct CurveMapping * cavity_curve
float projectMatInv[4][4]
const MLoopUV * mloopuv_stencil_eval
ProjPaintImage * projImages
MemArena * arena_mt[BLENDER_MAX_THREADS]
const MLoopTri * mlooptri_eval
bool do_layer_stencil_inv
bool reproject_ibuf_free_uchar
float normal_angle_inner__cos
bool is_clone_cursor_pick
struct ProjPaintState * ps_views[8]
ProjPaintImage * projImages
struct CustomData_MeshMasks customdata_mask
struct ToolSettings * toolsettings
float average_stroke_accum[3]
int average_stroke_counter
float texture_paint_mode_opacity
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* ui)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type
struct IDPropertyTemplate::@27 array
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)
int WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))