forked from bartvdbraak/blender
style cleanup
This commit is contained in:
parent
6fef7f1c32
commit
c7988dc1ac
@ -24,7 +24,6 @@
|
|||||||
* \ingroup bli
|
* \ingroup bli
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h> /* for qsort */
|
#include <stdlib.h> /* for qsort */
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
@ -52,7 +51,7 @@ typedef struct boxVert {
|
|||||||
} boxVert;
|
} boxVert;
|
||||||
|
|
||||||
/* free vert flags */
|
/* free vert flags */
|
||||||
#define eps 0.0000001f
|
#define EPSILON 0.0000001f
|
||||||
#define BLF 1
|
#define BLF 1
|
||||||
#define TRF 2
|
#define TRF 2
|
||||||
#define TLF 4
|
#define TLF 4
|
||||||
@ -64,52 +63,54 @@ typedef struct boxVert {
|
|||||||
#define TL 2
|
#define TL 2
|
||||||
#define BR 3
|
#define BR 3
|
||||||
|
|
||||||
#define BOXLEFT(b) b->v[BL]->x
|
#define BOXLEFT(b) ((b)->v[BL]->x)
|
||||||
#define BOXRIGHT(b) b->v[TR]->x
|
#define BOXRIGHT(b) ((b)->v[TR]->x)
|
||||||
#define BOXBOTTOM(b) b->v[BL]->y
|
#define BOXBOTTOM(b) ((b)->v[BL]->y)
|
||||||
#define BOXTOP(b) b->v[TR]->y
|
#define BOXTOP(b) ((b)->v[TR]->y)
|
||||||
#define BOXAREA(b) (b->w * b->h)
|
#define BOXAREA(b) ((b)->w * (b)->h)
|
||||||
|
|
||||||
#define UPDATE_V34X(b) b->v[TL]->x = b->v[BL]->x;\
|
#define UPDATE_V34X(b) ((b)->v[TL]->x = (b)->v[BL]->x); \
|
||||||
b->v[BR]->x = b->v[TR]->x
|
((b)->v[BR]->x = (b)->v[TR]->x)
|
||||||
#define UPDATE_V34Y(b) b->v[TL]->y = b->v[TR]->y;\
|
#define UPDATE_V34Y(b) ((b)->v[TL]->y = (b)->v[TR]->y); \
|
||||||
b->v[BR]->y = b->v[BL]->y
|
((b)->v[BR]->y = (b)->v[BL]->y)
|
||||||
#define UPDATE_V34(b) UPDATE_V34X(b); UPDATE_V34Y(b)
|
#define UPDATE_V34(b) UPDATE_V34X(b); UPDATE_V34Y(b)
|
||||||
|
|
||||||
#define SET_BOXLEFT(b, f) b->v[TR]->x = f + b->w;\
|
#define SET_BOXLEFT(b, f) (b)->v[TR]->x = f + (b)->w; \
|
||||||
b->v[BL]->x = f;\
|
(b)->v[BL]->x = f; \
|
||||||
UPDATE_V34X(b)
|
UPDATE_V34X(b)
|
||||||
#define SET_BOXRIGHT(b, f) b->v[BL]->x = f - b->w;\
|
#define SET_BOXRIGHT(b, f) (b)->v[BL]->x = f - (b)->w; \
|
||||||
b->v[TR]->x = f;\
|
(b)->v[TR]->x = f; \
|
||||||
UPDATE_V34X(b)
|
UPDATE_V34X(b)
|
||||||
#define SET_BOXBOTTOM(b, f) b->v[TR]->y = f + b->h;\
|
#define SET_BOXBOTTOM(b, f) (b)->v[TR]->y = f + (b)->h; \
|
||||||
b->v[BL]->y = f;\
|
(b)->v[BL]->y = f; \
|
||||||
UPDATE_V34Y(b)
|
UPDATE_V34Y(b)
|
||||||
#define SET_BOXTOP(b, f) b->v[BL]->y = f - b->h;\
|
#define SET_BOXTOP(b, f) (b)->v[BL]->y = f - (b)->h; \
|
||||||
b->v[TR]->y = f;\
|
(b)->v[TR]->y = f; \
|
||||||
UPDATE_V34Y(b)
|
UPDATE_V34Y(b)
|
||||||
#define BOXINTERSECT(b1, b2)\
|
#define BOXINTERSECT(b1, b2) \
|
||||||
(!( BOXLEFT(b1)+eps>=BOXRIGHT(b2) ||\
|
!(BOXLEFT(b1) + EPSILON >= BOXRIGHT(b2) || \
|
||||||
BOXBOTTOM(b1)+eps>=BOXTOP(b2) ||\
|
BOXBOTTOM(b1) + EPSILON >= BOXTOP(b2) || \
|
||||||
BOXRIGHT(b1)-eps<=BOXLEFT(b2) ||\
|
BOXRIGHT(b1) - EPSILON <= BOXLEFT(b2) || \
|
||||||
BOXTOP(b1)-eps<=BOXBOTTOM(b2) ))
|
BOXTOP(b1) - EPSILON <= BOXBOTTOM(b2))
|
||||||
|
|
||||||
#define MIN2(x,y) ( (x)<(y) ? (x) : (y) )
|
#define MIN2(x,y) ((x) < (y) ? (x) : (y))
|
||||||
#define MAX2(x,y) ( (x)>(y) ? (x) : (y) )
|
#define MAX2(x,y) ((x) > (y) ? (x) : (y))
|
||||||
|
|
||||||
/* #define BOXDEBUG(b)\
|
#if 0
|
||||||
* printf("\tBox Debug i %i, w:%.3f h:%.3f x:%.3f y:%.3f\n",\
|
#define BOXDEBUG(b) \
|
||||||
* b->index, b->w, b->h, b->x, b->y) */
|
printf("\tBox Debug i %i, w:%.3f h:%.3f x:%.3f y:%.3f\n", \
|
||||||
|
b->index, b->w, b->h, b->x, b->y)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* qsort function - sort largest to smallest */
|
/* qsort function - sort largest to smallest */
|
||||||
static int box_areasort(const void *p1, const void *p2)
|
static int box_areasort(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const boxPack *b1= p1, *b2= p2;
|
const boxPack *b1 = p1, *b2 = p2;
|
||||||
const float a1= BOXAREA(b1);
|
const float a1 = BOXAREA(b1);
|
||||||
const float a2= BOXAREA(b2);
|
const float a2 = BOXAREA(b2);
|
||||||
|
|
||||||
if ( a1 < a2 ) return 1;
|
if (a1 < a2) return 1;
|
||||||
else if ( a1 > a2 ) return -1;
|
else if (a1 > a2) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,15 +128,15 @@ static int vertex_sort(const void *p1, const void *p2)
|
|||||||
boxVert *v1, *v2;
|
boxVert *v1, *v2;
|
||||||
float a1, a2;
|
float a1, a2;
|
||||||
|
|
||||||
v1 = vertarray + ((int *) p1)[0];
|
v1 = vertarray + ((int *)p1)[0];
|
||||||
v2 = vertarray + ((int *) p2)[0];
|
v2 = vertarray + ((int *)p2)[0];
|
||||||
|
|
||||||
a1 = MAX2(v1->x+box_width, v1->y+box_height);
|
a1 = MAX2(v1->x+box_width, v1->y+box_height);
|
||||||
a2 = MAX2(v2->x+box_width, v2->y+box_height);
|
a2 = MAX2(v2->x+box_width, v2->y+box_height);
|
||||||
|
|
||||||
/* sort largest to smallest */
|
/* sort largest to smallest */
|
||||||
if ( a1 > a2 ) return 1;
|
if (a1 > a2) return 1;
|
||||||
else if ( a1 < a2 ) return -1;
|
else if (a1 < a2) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Main boxpacking function accessed from other functions
|
/* Main boxpacking function accessed from other functions
|
||||||
@ -155,12 +156,12 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
{
|
{
|
||||||
boxVert *vert; /* the current vert */
|
boxVert *vert; /* the current vert */
|
||||||
int box_index, verts_pack_len, i, j, k, isect;
|
int box_index, verts_pack_len, i, j, k, isect;
|
||||||
int quad_flags[4]= {BLF,TRF,TLF,BRF}; /* use for looping */
|
int quad_flags[4] = {BLF, TRF, TLF, BRF}; /* use for looping */
|
||||||
boxPack *box, *box_test; /*current box and another for intersection tests*/
|
boxPack *box, *box_test; /*current box and another for intersection tests*/
|
||||||
int *vertex_pack_indices; /*an array of indices used for sorting verts*/
|
int *vertex_pack_indices; /*an array of indices used for sorting verts*/
|
||||||
|
|
||||||
if (!len) {
|
if (!len) {
|
||||||
*tot_width = 0.0f;
|
*tot_width = 0.0f;
|
||||||
*tot_height = 0.0f;
|
*tot_height = 0.0f;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -169,10 +170,10 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
qsort(boxarray, len, sizeof(boxPack), box_areasort);
|
qsort(boxarray, len, sizeof(boxPack), box_areasort);
|
||||||
|
|
||||||
/* add verts to the boxes, these are only used internally */
|
/* add verts to the boxes, these are only used internally */
|
||||||
vert = vertarray = MEM_mallocN( len*4*sizeof(boxVert), "boxPack Verts");
|
vert = vertarray = MEM_mallocN(len * 4 * sizeof(boxVert), "boxPack Verts");
|
||||||
vertex_pack_indices = MEM_mallocN( len*3*sizeof(int), "boxPack Indices");
|
vertex_pack_indices = MEM_mallocN(len * 3 * sizeof(int), "boxPack Indices");
|
||||||
|
|
||||||
for (box=boxarray, box_index=0, i=0; box_index < len; box_index++, box++) {
|
for (box = boxarray, box_index = 0, i = 0; box_index < len; box_index++, box++) {
|
||||||
|
|
||||||
vert->blb = vert->brb = vert->tlb =
|
vert->blb = vert->brb = vert->tlb =
|
||||||
vert->isect_cache[0] = vert->isect_cache[1] =
|
vert->isect_cache[0] = vert->isect_cache[1] =
|
||||||
@ -208,15 +209,14 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
}
|
}
|
||||||
vert = NULL;
|
vert = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Pack the First box!
|
/* Pack the First box!
|
||||||
* then enter the main box-packing loop */
|
* then enter the main box-packing loop */
|
||||||
|
|
||||||
box = boxarray; /* get the first box */
|
box = boxarray; /* get the first box */
|
||||||
/* First time, no boxes packed */
|
/* First time, no boxes packed */
|
||||||
box->v[BL]->free = 0; /* Can't use any if these */
|
box->v[BL]->free = 0; /* Can't use any if these */
|
||||||
box->v[BR]->free &= ~(BLF|BRF);
|
box->v[BR]->free &= ~(BLF | BRF);
|
||||||
box->v[TL]->free &= ~(BLF|TLF);
|
box->v[TL]->free &= ~(BLF | TLF);
|
||||||
|
|
||||||
*tot_width = box->w;
|
*tot_width = box->w;
|
||||||
*tot_height = box->h;
|
*tot_height = box->h;
|
||||||
@ -226,14 +226,14 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
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<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;
|
||||||
box++; /* next box, needed for the loop below */
|
box++; /* next box, needed for the loop below */
|
||||||
/* ...done packing the first box */
|
/* ...done packing the first box */
|
||||||
|
|
||||||
/* Main boxpacking loop */
|
/* Main boxpacking loop */
|
||||||
for (box_index=1; box_index < len; box_index++, box++) {
|
for (box_index = 1; box_index < len; box_index++, box++) {
|
||||||
|
|
||||||
/* These static floatds are used for sorting */
|
/* These static floatds are used for sorting */
|
||||||
box_width = box->w;
|
box_width = box->w;
|
||||||
@ -245,7 +245,7 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
/* sort the verts */
|
/* sort the verts */
|
||||||
isect = 1;
|
isect = 1;
|
||||||
|
|
||||||
for (i=0; i<verts_pack_len && isect; i++) {
|
for (i = 0; i < verts_pack_len && isect; i++) {
|
||||||
vert = vertarray + vertex_pack_indices[i];
|
vert = vertarray + vertex_pack_indices[i];
|
||||||
/* printf("\ttesting vert %i %i %i %f %f\n", i,
|
/* printf("\ttesting vert %i %i %i %f %f\n", i,
|
||||||
* vert->free, verts_pack_len, vert->x, vert->y); */
|
* vert->free, verts_pack_len, vert->x, vert->y); */
|
||||||
@ -255,25 +255,25 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
* vert->free & quad_flags[j] - Checks
|
* vert->free & quad_flags[j] - Checks
|
||||||
* */
|
* */
|
||||||
|
|
||||||
for (j=0; (j<4) && isect; j++) {
|
for (j = 0; (j < 4) && isect; j++) {
|
||||||
if (vert->free & quad_flags[j]) {
|
if (vert->free & quad_flags[j]) {
|
||||||
switch (j) {
|
switch (j) {
|
||||||
case BL:
|
case BL:
|
||||||
SET_BOXRIGHT(box, vert->x);
|
SET_BOXRIGHT(box, vert->x);
|
||||||
SET_BOXTOP(box, vert->y);
|
SET_BOXTOP(box, vert->y);
|
||||||
break;
|
break;
|
||||||
case TR:
|
case TR:
|
||||||
SET_BOXLEFT(box, vert->x);
|
SET_BOXLEFT(box, vert->x);
|
||||||
SET_BOXBOTTOM(box, vert->y);
|
SET_BOXBOTTOM(box, vert->y);
|
||||||
break;
|
break;
|
||||||
case TL:
|
case TL:
|
||||||
SET_BOXRIGHT(box, vert->x);
|
SET_BOXRIGHT(box, vert->x);
|
||||||
SET_BOXBOTTOM(box, vert->y);
|
SET_BOXBOTTOM(box, vert->y);
|
||||||
break;
|
break;
|
||||||
case BR:
|
case BR:
|
||||||
SET_BOXLEFT(box, vert->x);
|
SET_BOXLEFT(box, vert->x);
|
||||||
SET_BOXTOP(box, vert->y);
|
SET_BOXTOP(box, vert->y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we need to check that the box intersects
|
/* Now we need to check that the box intersects
|
||||||
@ -282,23 +282,24 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
isect = 0;
|
isect = 0;
|
||||||
|
|
||||||
if (/* Constrain boxes to positive X/Y values */
|
if (/* Constrain boxes to positive X/Y values */
|
||||||
BOXLEFT(box)<0.0f || BOXBOTTOM(box) < 0.0f ||
|
BOXLEFT(box) < 0.0f || BOXBOTTOM(box) < 0.0f ||
|
||||||
/* check for last intersected */
|
/* check for last intersected */
|
||||||
( vert->isect_cache[j] &&
|
( vert->isect_cache[j] &&
|
||||||
BOXINTERSECT(box, vert->isect_cache[j]) )
|
BOXINTERSECT(box, vert->isect_cache[j])))
|
||||||
) {
|
{
|
||||||
/* Here we check that the last intersected
|
/* Here we check that the last intersected
|
||||||
* box will intersect with this one using
|
* box will intersect with this one using
|
||||||
* isect_cache that can store a pointer to a
|
* isect_cache that can store a pointer to a
|
||||||
* box for each quadrant
|
* box for each quadrant
|
||||||
* big speedup */
|
* big speedup */
|
||||||
isect = 1;
|
isect = 1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* do a full search for colliding box
|
/* do a full search for colliding box
|
||||||
* this is really slow, some spatially divided
|
* this is really slow, some spatially divided
|
||||||
* data-structure would be better */
|
* data-structure would be better */
|
||||||
for (box_test=boxarray; box_test != box; box_test++) {
|
for (box_test = boxarray; box_test != box; box_test++) {
|
||||||
if BOXINTERSECT(box, box_test) {
|
if (BOXINTERSECT(box, box_test)) {
|
||||||
/* Store the last intersecting here as cache
|
/* Store the last intersecting here as cache
|
||||||
* for faster checking next time around */
|
* for faster checking next time around */
|
||||||
vert->isect_cache[j] = box_test;
|
vert->isect_cache[j] = box_test;
|
||||||
@ -318,22 +319,22 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
vert->free &= ~quad_flags[j];
|
vert->free &= ~quad_flags[j];
|
||||||
|
|
||||||
switch (j) {
|
switch (j) {
|
||||||
case TR:
|
case TR:
|
||||||
box->v[BL]= vert;
|
box->v[BL] = vert;
|
||||||
vert->trb = box;
|
vert->trb = box;
|
||||||
break;
|
break;
|
||||||
case TL:
|
case TL:
|
||||||
box->v[BR]= vert;
|
box->v[BR] = vert;
|
||||||
vert->tlb = box;
|
vert->tlb = box;
|
||||||
break;
|
break;
|
||||||
case BR:
|
case BR:
|
||||||
box->v[TL]= vert;
|
box->v[TL] = vert;
|
||||||
vert->brb = box;
|
vert->brb = box;
|
||||||
break;
|
break;
|
||||||
case BL:
|
case BL:
|
||||||
box->v[TR]= vert;
|
box->v[TR] = vert;
|
||||||
vert->blb = box;
|
vert->blb = box;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mask free flags for verts that are
|
/* Mask free flags for verts that are
|
||||||
@ -343,11 +344,12 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
* We can do an else/if here because only the first
|
* We can do an else/if here because only the first
|
||||||
* box can be at the very bottom left corner */
|
* box can be at the very bottom left corner */
|
||||||
if (BOXLEFT(box) <= 0) {
|
if (BOXLEFT(box) <= 0) {
|
||||||
box->v[TL]->free &= ~(TLF|BLF);
|
box->v[TL]->free &= ~(TLF | BLF);
|
||||||
box->v[BL]->free &= ~(TLF|BLF);
|
box->v[BL]->free &= ~(TLF | BLF);
|
||||||
} else if (BOXBOTTOM(box) <= 0) {
|
}
|
||||||
box->v[BL]->free &= ~(BRF|BLF);
|
else if (BOXBOTTOM(box) <= 0) {
|
||||||
box->v[BR]->free &= ~(BRF|BLF);
|
box->v[BL]->free &= ~(BRF | BLF);
|
||||||
|
box->v[BR]->free &= ~(BRF | BLF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following block of code does a logical
|
/* The following block of code does a logical
|
||||||
@ -355,56 +357,60 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
* flag verts on one or both of the boxes
|
* flag verts on one or both of the boxes
|
||||||
* as being used by checking the width or
|
* as being used by checking the width or
|
||||||
* height of both boxes */
|
* height of both boxes */
|
||||||
if (vert->tlb && vert->trb &&
|
if (vert->tlb && vert->trb && (box == vert->tlb || box == vert->trb)) {
|
||||||
(box == vert->tlb || box == vert->trb)) {
|
|
||||||
if (vert->tlb->h > vert->trb->h) {
|
if (vert->tlb->h > vert->trb->h) {
|
||||||
vert->trb->v[TL]->free &= ~(TLF|BLF);
|
vert->trb->v[TL]->free &= ~(TLF | BLF);
|
||||||
} else if (vert->tlb->h < vert->trb->h) {
|
}
|
||||||
vert->tlb->v[TR]->free &= ~(TRF|BRF);
|
else if (vert->tlb->h < vert->trb->h) {
|
||||||
} else { /*same*/
|
vert->tlb->v[TR]->free &= ~(TRF | BRF);
|
||||||
|
}
|
||||||
|
else { /*same*/
|
||||||
vert->tlb->v[TR]->free &= ~BLF;
|
vert->tlb->v[TR]->free &= ~BLF;
|
||||||
vert->trb->v[TL]->free &= ~BRF;
|
vert->trb->v[TL]->free &= ~BRF;
|
||||||
}
|
}
|
||||||
} else if (vert->blb && vert->brb &&
|
}
|
||||||
(box == vert->blb || box == vert->brb)) {
|
else if (vert->blb && vert->brb && (box == vert->blb || box == vert->brb)) {
|
||||||
if (vert->blb->h > vert->brb->h) {
|
if (vert->blb->h > vert->brb->h) {
|
||||||
vert->brb->v[BL]->free &= ~(TLF|BLF);
|
vert->brb->v[BL]->free &= ~(TLF | BLF);
|
||||||
} else if (vert->blb->h < vert->brb->h) {
|
}
|
||||||
vert->blb->v[BR]->free &= ~(TRF|BRF);
|
else if (vert->blb->h < vert->brb->h) {
|
||||||
} else { /*same*/
|
vert->blb->v[BR]->free &= ~(TRF | BRF);
|
||||||
|
}
|
||||||
|
else { /*same*/
|
||||||
vert->blb->v[BR]->free &= ~TRF;
|
vert->blb->v[BR]->free &= ~TRF;
|
||||||
vert->brb->v[BL]->free &= ~TLF;
|
vert->brb->v[BL]->free &= ~TLF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Horizontal */
|
/* Horizontal */
|
||||||
if (vert->tlb && vert->blb &&
|
if (vert->tlb && vert->blb && (box == vert->tlb || box == vert->blb)) {
|
||||||
(box == vert->tlb || box == vert->blb) ) {
|
|
||||||
if (vert->tlb->w > vert->blb->w) {
|
if (vert->tlb->w > vert->blb->w) {
|
||||||
vert->blb->v[TL]->free &= ~(TLF|TRF);
|
vert->blb->v[TL]->free &= ~(TLF | TRF);
|
||||||
} else if (vert->tlb->w < vert->blb->w) {
|
}
|
||||||
vert->tlb->v[BL]->free &= ~(BLF|BRF);
|
else if (vert->tlb->w < vert->blb->w) {
|
||||||
} else { /*same*/
|
vert->tlb->v[BL]->free &= ~(BLF | BRF);
|
||||||
|
}
|
||||||
|
else { /*same*/
|
||||||
vert->blb->v[TL]->free &= ~TRF;
|
vert->blb->v[TL]->free &= ~TRF;
|
||||||
vert->tlb->v[BL]->free &= ~BRF;
|
vert->tlb->v[BL]->free &= ~BRF;
|
||||||
}
|
}
|
||||||
} else if ( vert->trb && vert->brb &&
|
}
|
||||||
(box == vert->trb || box == vert->brb) ) {
|
else if (vert->trb && vert->brb && (box == vert->trb || box == vert->brb)) {
|
||||||
if (vert->trb->w > vert->brb->w) {
|
if (vert->trb->w > vert->brb->w) {
|
||||||
vert->brb->v[TR]->free &= ~(TLF|TRF);
|
vert->brb->v[TR]->free &= ~(TLF | TRF);
|
||||||
} else if (vert->trb->w < vert->brb->w) {
|
}
|
||||||
vert->trb->v[BR]->free &= ~(BLF|BRF);
|
else if (vert->trb->w < vert->brb->w) {
|
||||||
} else { /*same*/
|
vert->trb->v[BR]->free &= ~(BLF | BRF);
|
||||||
|
}
|
||||||
|
else { /*same*/
|
||||||
vert->brb->v[TR]->free &= ~TLF;
|
vert->brb->v[TR]->free &= ~TLF;
|
||||||
vert->trb->v[BR]->free &= ~BLF;
|
vert->trb->v[BR]->free &= ~BLF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 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] != vert) {
|
||||||
vertex_pack_indices[verts_pack_len] =
|
vertex_pack_indices[verts_pack_len] = box->v[k]->index;
|
||||||
box->v[k]->index;
|
|
||||||
verts_pack_len++;
|
verts_pack_len++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -421,8 +427,8 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
|
|||||||
|
|
||||||
/* free all the verts, not really needed because they shouldn't be
|
/* free all the verts, not really needed because they shouldn't be
|
||||||
* touched anymore but accessing the pointers would crash blender */
|
* touched anymore but accessing the pointers would crash blender */
|
||||||
for (box_index=0; box_index < len; box_index++) {
|
for (box_index = 0; box_index < len; box_index++) {
|
||||||
box = boxarray+box_index;
|
box = boxarray + box_index;
|
||||||
box->v[0] = box->v[1] = box->v[2] = box->v[3] = NULL;
|
box->v[0] = box->v[1] = box->v[2] = box->v[3] = NULL;
|
||||||
}
|
}
|
||||||
MEM_freeN(vertex_pack_indices);
|
MEM_freeN(vertex_pack_indices);
|
||||||
|
Loading…
Reference in New Issue
Block a user