Cleanup: use ED_view3d_backbuf_* prefix
This commit is contained in:
@@ -267,14 +267,14 @@ float ED_view3d_radius_to_dist(
|
||||
void drawcircball(int mode, const float cent[3], float rad, float tmat[4][4]);
|
||||
|
||||
/* backbuffer select and draw support */
|
||||
void view3d_validate_backbuf(struct ViewContext *vc);
|
||||
struct ImBuf *view3d_read_backbuf(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
|
||||
unsigned int view3d_sample_backbuf_rect(
|
||||
void ED_view3d_backbuf_validate(struct ViewContext *vc);
|
||||
struct ImBuf *ED_view3d_backbuf_read(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
|
||||
unsigned int ED_view3d_backbuf_sample_rect(
|
||||
struct ViewContext *vc, const int mval[2], int size,
|
||||
unsigned int min, unsigned int max, float *dist, const bool is_strict,
|
||||
void *handle, bool (*indextest)(void *handle, unsigned int index));
|
||||
int view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist);
|
||||
unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
|
||||
int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist);
|
||||
unsigned int ED_view3d_backbuf_sample(struct ViewContext *vc, int x, int y);
|
||||
|
||||
/* draws and does a 4x4 sample */
|
||||
bool ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
|
||||
|
||||
@@ -446,7 +446,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool exten
|
||||
}
|
||||
}
|
||||
|
||||
view3d_validate_backbuf(vc);
|
||||
ED_view3d_backbuf_validate(vc);
|
||||
|
||||
ibuf = IMB_allocImBuf(sx, sy, 32, IB_rect);
|
||||
rt = ibuf->rect;
|
||||
|
||||
@@ -200,7 +200,7 @@ bool EDBM_backbuf_border_init(ViewContext *vc, short xmin, short ymin, short xma
|
||||
return false;
|
||||
}
|
||||
|
||||
buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
|
||||
buf = ED_view3d_backbuf_read(vc, xmin, ymin, xmax, ymax);
|
||||
if (buf == NULL) return false;
|
||||
if (bm_vertoffs == 0) return false;
|
||||
|
||||
@@ -275,7 +275,7 @@ bool EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short
|
||||
return false;
|
||||
}
|
||||
|
||||
buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
|
||||
buf = ED_view3d_backbuf_read(vc, xmin, ymin, xmax, ymax);
|
||||
if (buf == NULL) return false;
|
||||
if (bm_vertoffs == 0) return false;
|
||||
|
||||
@@ -326,7 +326,7 @@ bool EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads)
|
||||
|
||||
xmin = xs - rads; xmax = xs + rads;
|
||||
ymin = ys - rads; ymax = ys + rads;
|
||||
buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
|
||||
buf = ED_view3d_backbuf_read(vc, xmin, ymin, xmax, ymax);
|
||||
if (bm_vertoffs == 0) return false;
|
||||
if (buf == NULL) return false;
|
||||
|
||||
@@ -424,18 +424,18 @@ BMVert *EDBM_vert_find_nearest_ex(
|
||||
BMesh *bm = vc->em->bm;
|
||||
|
||||
if (V3D_IS_ZBUF(vc->v3d)) {
|
||||
const int dist_px = view3d_backbuf_sample_size_clamp(vc->ar, *r_dist);
|
||||
const int dist_px = ED_view3d_backbuf_sample_size_clamp(vc->ar, *r_dist);
|
||||
float distance;
|
||||
unsigned int index;
|
||||
BMVert *eve;
|
||||
|
||||
if (is_strict) {
|
||||
index = view3d_sample_backbuf_rect(
|
||||
index = ED_view3d_backbuf_sample_rect(
|
||||
vc, vc->mval, dist_px, bm_wireoffs, 0xFFFFFF, &distance,
|
||||
is_strict, vc->em, findnearestvert__backbufIndextest);
|
||||
}
|
||||
else {
|
||||
index = view3d_sample_backbuf_rect(
|
||||
index = ED_view3d_backbuf_sample_rect(
|
||||
vc, vc->mval, dist_px, bm_wireoffs, 0xFFFFFF, &distance,
|
||||
0, NULL, NULL);
|
||||
}
|
||||
@@ -538,14 +538,14 @@ BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist)
|
||||
BMesh *bm = vc->em->bm;
|
||||
|
||||
if (V3D_IS_ZBUF(vc->v3d)) {
|
||||
const int dist_px = view3d_backbuf_sample_size_clamp(vc->ar, *r_dist);
|
||||
const int dist_px = ED_view3d_backbuf_sample_size_clamp(vc->ar, *r_dist);
|
||||
float distance;
|
||||
unsigned int index;
|
||||
BMEdge *eed;
|
||||
|
||||
view3d_validate_backbuf(vc);
|
||||
ED_view3d_backbuf_validate(vc);
|
||||
|
||||
index = view3d_sample_backbuf_rect(vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &distance, 0, NULL, NULL);
|
||||
index = ED_view3d_backbuf_sample_rect(vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &distance, 0, NULL, NULL);
|
||||
eed = index ? BM_edge_at_index_find_or_table(bm, index - 1) : NULL;
|
||||
|
||||
if (eed && distance < *r_dist) {
|
||||
@@ -637,9 +637,9 @@ BMFace *EDBM_face_find_nearest_ex(
|
||||
unsigned int index;
|
||||
BMFace *efa;
|
||||
|
||||
view3d_validate_backbuf(vc);
|
||||
ED_view3d_backbuf_validate(vc);
|
||||
|
||||
index = view3d_sample_backbuf(vc, vc->mval[0], vc->mval[1]);
|
||||
index = ED_view3d_backbuf_sample(vc, vc->mval[0], vc->mval[1]);
|
||||
efa = index ? BM_face_at_index_find_or_table(bm, index - 1) : NULL;
|
||||
|
||||
if (r_efa_zbuf) {
|
||||
@@ -726,7 +726,7 @@ static int unified_findnearest(ViewContext *vc, BMVert **r_eve, BMEdge **r_eed,
|
||||
BMFace *efa = NULL;
|
||||
|
||||
/* no afterqueue (yet), so we check it now, otherwise the em_xxxofs indices are bad */
|
||||
view3d_validate_backbuf(vc);
|
||||
ED_view3d_backbuf_validate(vc);
|
||||
|
||||
if (em->selectmode & SCE_SELECT_VERTEX) {
|
||||
eve = EDBM_vert_find_nearest_ex(vc, &dist, true, false);
|
||||
@@ -1383,7 +1383,7 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de
|
||||
em = vc.em;
|
||||
|
||||
/* no afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad */
|
||||
view3d_validate_backbuf(&vc);
|
||||
ED_view3d_backbuf_validate(&vc);
|
||||
|
||||
eed = EDBM_edge_find_nearest(&vc, &dist);
|
||||
if (eed == NULL) {
|
||||
|
||||
@@ -1082,11 +1082,11 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int
|
||||
* on an edge in the backbuf, we can still select a face */
|
||||
|
||||
float dummy_dist;
|
||||
*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totpoly + 1, &dummy_dist, 0, NULL, NULL);
|
||||
*index = ED_view3d_backbuf_sample_rect(&vc, mval, size, 1, me->totpoly + 1, &dummy_dist, 0, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
/* sample only on the exact position */
|
||||
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
|
||||
*index = ED_view3d_backbuf_sample(&vc, mval[0], mval[1]);
|
||||
}
|
||||
|
||||
if ((*index) == 0 || (*index) > (unsigned int)me->totpoly)
|
||||
@@ -1248,11 +1248,11 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
|
||||
* on an face in the backbuf, we can still select a vert */
|
||||
|
||||
float dummy_dist;
|
||||
*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert + 1, &dummy_dist, 0, NULL, NULL);
|
||||
*index = ED_view3d_backbuf_sample_rect(&vc, mval, size, 1, me->totvert + 1, &dummy_dist, 0, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
/* sample only on the exact position */
|
||||
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
|
||||
*index = ED_view3d_backbuf_sample(&vc, mval[0], mval[1]);
|
||||
}
|
||||
|
||||
if ((*index) == 0 || (*index) > (unsigned int)me->totvert)
|
||||
|
||||
@@ -405,7 +405,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
|
||||
/* needed or else the draw matrix can be incorrect */
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
view3d_validate_backbuf(&data->vc);
|
||||
ED_view3d_backbuf_validate(&data->vc);
|
||||
/* we may need to force an update here by setting the rv3d as dirty
|
||||
* for now it seems ok, but take care!:
|
||||
* rv3d->depths->dirty = 1; */
|
||||
|
||||
@@ -379,7 +379,7 @@ static int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *
|
||||
return 0;
|
||||
|
||||
/* sample only on the exact position */
|
||||
*r_index = view3d_sample_backbuf(vc, mval[0], mval[1]);
|
||||
*r_index = ED_view3d_backbuf_sample(vc, mval[0], mval[1]);
|
||||
|
||||
if ((*r_index) == 0 || (*r_index) > (unsigned int)totpoly) {
|
||||
return 0;
|
||||
|
||||
@@ -878,7 +878,7 @@ static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x
|
||||
* brushes with size > 64, why is this here? */
|
||||
/*if (size > 64.0) size = 64.0;*/
|
||||
|
||||
ibuf = view3d_read_backbuf(vc, x - size, y - size, x + size, y + size);
|
||||
ibuf = ED_view3d_backbuf_read(vc, x - size, y - size, x + size, y + size);
|
||||
if (ibuf) {
|
||||
unsigned int *rt = ibuf->rect;
|
||||
|
||||
|
||||
@@ -1454,7 +1454,7 @@ static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h,
|
||||
glReadPixels(ar->winrct.xmin + x, ar->winrct.ymin + y, w, h, format, type, data);
|
||||
}
|
||||
|
||||
void view3d_validate_backbuf(ViewContext *vc)
|
||||
void ED_view3d_backbuf_validate(ViewContext *vc)
|
||||
{
|
||||
if (vc->v3d->flag & V3D_INVALID_BACKBUF)
|
||||
backdrawview3d(vc->scene, vc->ar, vc->v3d);
|
||||
@@ -1464,13 +1464,13 @@ void view3d_validate_backbuf(ViewContext *vc)
|
||||
* allow for small values [0.5 - 2.5],
|
||||
* and large values, FLT_MAX by clamping by the area size
|
||||
*/
|
||||
int view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist)
|
||||
int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist)
|
||||
{
|
||||
return (int)min_ff(ceilf(dist), (float)max_ii(ar->winx, ar->winx));
|
||||
}
|
||||
|
||||
/* samples a single pixel (copied from vpaint) */
|
||||
unsigned int view3d_sample_backbuf(ViewContext *vc, int x, int y)
|
||||
unsigned int ED_view3d_backbuf_sample(ViewContext *vc, int x, int y)
|
||||
{
|
||||
unsigned int col;
|
||||
|
||||
@@ -1478,7 +1478,7 @@ unsigned int view3d_sample_backbuf(ViewContext *vc, int x, int y)
|
||||
return 0;
|
||||
}
|
||||
|
||||
view3d_validate_backbuf(vc);
|
||||
ED_view3d_backbuf_validate(vc);
|
||||
|
||||
view3d_opengl_read_pixels(vc->ar, x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
|
||||
glReadBuffer(GL_BACK);
|
||||
@@ -1491,7 +1491,7 @@ unsigned int view3d_sample_backbuf(ViewContext *vc, int x, int y)
|
||||
}
|
||||
|
||||
/* reads full rect, converts indices */
|
||||
ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, short ymax)
|
||||
ImBuf *ED_view3d_backbuf_read(ViewContext *vc, short xmin, short ymin, short xmax, short ymax)
|
||||
{
|
||||
unsigned int *dr, *rd;
|
||||
struct ImBuf *ibuf, *ibuf1;
|
||||
@@ -1510,7 +1510,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
|
||||
|
||||
ibuf = IMB_allocImBuf((xmaxc - xminc + 1), (ymaxc - yminc + 1), 32, IB_rect);
|
||||
|
||||
view3d_validate_backbuf(vc);
|
||||
ED_view3d_backbuf_validate(vc);
|
||||
|
||||
view3d_opengl_read_pixels(vc->ar,
|
||||
xminc, yminc,
|
||||
@@ -1550,7 +1550,8 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
|
||||
}
|
||||
|
||||
/* smart function to sample a rect spiralling outside, nice for backbuf selection */
|
||||
unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int size,
|
||||
unsigned int ED_view3d_backbuf_sample_rect(
|
||||
ViewContext *vc, const int mval[2], int size,
|
||||
unsigned int min, unsigned int max, float *r_dist, const bool is_strict,
|
||||
void *handle, bool (*indextest)(void *handle, unsigned int index))
|
||||
{
|
||||
@@ -1566,7 +1567,7 @@ unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int
|
||||
|
||||
minx = mval[0] - (amount + 1);
|
||||
miny = mval[1] - (amount + 1);
|
||||
buf = view3d_read_backbuf(vc, minx, miny, minx + size - 1, miny + size - 1);
|
||||
buf = ED_view3d_backbuf_read(vc, minx, miny, minx + size - 1, miny + size - 1);
|
||||
if (!buf) return 0;
|
||||
|
||||
rc = 0;
|
||||
|
||||
@@ -1662,7 +1662,7 @@ static int do_paintvert_box_select(ViewContext *vc, rcti *rect, bool select, boo
|
||||
|
||||
if (use_zbuf) {
|
||||
selar = MEM_callocN(me->totvert + 1, "selar");
|
||||
view3d_validate_backbuf(vc);
|
||||
ED_view3d_backbuf_validate(vc);
|
||||
|
||||
ibuf = IMB_allocImBuf(sx, sy, 32, IB_rect);
|
||||
rt = ibuf->rect;
|
||||
|
||||
Reference in New Issue
Block a user