forked from bartvdbraak/blender
BoxPack: flag verts used in packed boxes
This commit is contained in:
parent
72e9052713
commit
d5647a37b4
@ -45,8 +45,9 @@ typedef struct BoxVert {
|
|||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
|
|
||||||
int free : 8; /* vert status */
|
int free : 8; /* vert status */
|
||||||
int pad : 24;
|
unsigned int used : 1;
|
||||||
|
unsigned int _pad : 23;
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
|
|
||||||
struct BoxPack *trb; /* top right box */
|
struct BoxPack *trb; /* top right box */
|
||||||
@ -199,6 +200,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *tot_width
|
|||||||
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
|
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
|
||||||
vert->free = CORNERFLAGS & ~TRF;
|
vert->free = CORNERFLAGS & ~TRF;
|
||||||
vert->trb = box;
|
vert->trb = box;
|
||||||
|
vert->used = false;
|
||||||
vert->index = i++;
|
vert->index = i++;
|
||||||
box->v[BL] = vert; vert++;
|
box->v[BL] = vert; vert++;
|
||||||
|
|
||||||
@ -207,6 +209,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *tot_width
|
|||||||
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
|
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
|
||||||
vert->free = CORNERFLAGS & ~BLF;
|
vert->free = CORNERFLAGS & ~BLF;
|
||||||
vert->blb = box;
|
vert->blb = box;
|
||||||
|
vert->used = false;
|
||||||
vert->index = i++;
|
vert->index = i++;
|
||||||
box->v[TR] = vert; vert++;
|
box->v[TR] = vert; vert++;
|
||||||
|
|
||||||
@ -215,6 +218,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *tot_width
|
|||||||
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
|
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
|
||||||
vert->free = CORNERFLAGS & ~BRF;
|
vert->free = CORNERFLAGS & ~BRF;
|
||||||
vert->brb = box;
|
vert->brb = box;
|
||||||
|
vert->used = false;
|
||||||
vert->index = i++;
|
vert->index = i++;
|
||||||
box->v[TL] = vert; vert++;
|
box->v[TL] = vert; vert++;
|
||||||
|
|
||||||
@ -222,7 +226,8 @@ void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *tot_width
|
|||||||
vert->isect_cache[0] = vert->isect_cache[1] =
|
vert->isect_cache[0] = vert->isect_cache[1] =
|
||||||
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
|
vert->isect_cache[2] = vert->isect_cache[3] = NULL;
|
||||||
vert->free = CORNERFLAGS & ~TLF;
|
vert->free = CORNERFLAGS & ~TLF;
|
||||||
vert->tlb = box;
|
vert->tlb = box;
|
||||||
|
vert->used = false;
|
||||||
vert->index = i++;
|
vert->index = i++;
|
||||||
box->v[BR] = vert; vert++;
|
box->v[BR] = vert; vert++;
|
||||||
}
|
}
|
||||||
@ -245,6 +250,10 @@ void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *tot_width
|
|||||||
SET_BOXBOTTOM(box, 0.0f);
|
SET_BOXBOTTOM(box, 0.0f);
|
||||||
box->x = box->y = 0.0f;
|
box->x = box->y = 0.0f;
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
box->v[i]->used = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
vertex_pack_indices[i] = box->v[i + 1]->index;
|
vertex_pack_indices[i] = box->v[i + 1]->index;
|
||||||
verts_pack_len = 3;
|
verts_pack_len = 3;
|
||||||
@ -428,7 +437,8 @@ void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *tot_width
|
|||||||
/* End logical check */
|
/* End logical check */
|
||||||
|
|
||||||
for (k = 0; k < 4; k++) {
|
for (k = 0; k < 4; k++) {
|
||||||
if (box->v[k] != vert) {
|
if (box->v[k]->used == false) {
|
||||||
|
box->v[k]->used = true;
|
||||||
vertex_pack_indices[verts_pack_len] = box->v[k]->index;
|
vertex_pack_indices[verts_pack_len] = box->v[k]->index;
|
||||||
verts_pack_len++;
|
verts_pack_len++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user