replace bmesh specific macros with math functions, also some pedantic formatting edits.

This commit is contained in:
Campbell Barton
2011-11-07 09:02:10 +00:00
parent 7508540c53
commit b0a21add8a
38 changed files with 337 additions and 235 deletions

View File

@@ -341,14 +341,14 @@ static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransDa
if (compare_v3v3(vtd1->org,vtd2->org,0.000001f)) {
VECSUB(vec,v2->co,v1->co);
if (len_v3(vec) < 0.000001f) {
mul_v3_fl(vec,0);
zero_v3(vec);
}
return 0;
}
else {
VECSUB(vec,vtd2->org,vtd1->org);
if (len_v3(vec) < 0.000001f) {
mul_v3_fl(vec,0);
zero_v3(vec);
}
return 1;
}

View File

@@ -1939,7 +1939,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
for (i=0; eve; eve=BMIter_Step(&iter), i++, index++) {
MVert *mv = &mvert[i];
VECCOPY(mv->co, eve->co);
copy_v3_v3(mv->co, eve->co);
BM_SetIndex(eve, i);

View File

@@ -2336,7 +2336,8 @@ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *l
CustomData_add_layer_named(ldata, CD_MDISPS, CD_CALLOC, NULL, totloop, fdata->layers[i].name);
}
}
void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total){
void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total)
{
int i;
for(i=0; i < pdata->totlayer; i++){
if(pdata->layers[i].type == CD_MTEXPOLY)
@@ -2351,7 +2352,8 @@ void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData
}
void CustomData_bmesh_init_pool(CustomData *data, int allocsize){
void CustomData_bmesh_init_pool(CustomData *data, int allocsize)
{
/* Dispose old pools before calling here to avoid leaks */
BLI_assert(data->pool == NULL);

View File

@@ -542,21 +542,21 @@ static void bmDM__calcFaceCent(BMesh *bm, BMFace *efa, float cent[3],
BMIter iter;
BMLoop *l;
int tot = 0;
cent[0] = cent[1] = cent[2] = 0.0f;
zero_v3(cent);
/*simple (and stupid) median (average) based method :/ */
if (vertexCos) {
l = BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, efa);
for (; l; l=BMIter_Step(&iter)) {
VECADD(cent, cent, vertexCos[BM_GetIndex(l->v)]);
add_v3_v3(cent, vertexCos[BM_GetIndex(l->v)]);
tot++;
}
} else {
l = BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, efa);
for (; l; l=BMIter_Step(&iter)) {
VECADD(cent, cent, l->v->co);
add_v3_v3(cent, l->v->co);
tot++;
}
}

View File

@@ -52,8 +52,9 @@
#include "BLI_mempool.h"
BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk,
int use_sysmalloc, int allow_iter)
{ BLI_mempool *pool = NULL;
int use_sysmalloc, int allow_iter)
{
BLI_mempool *pool = NULL;
BLI_freenode *lasttail = NULL, *curnode = NULL;
int i,j, maxchunks;
char *addr;
@@ -119,7 +120,8 @@ BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk,
return pool;
}
#if 0
void *BLI_mempool_alloc(BLI_mempool *pool){
void *BLI_mempool_alloc(BLI_mempool *pool)
{
void *retval=NULL;
BLI_freenode *curnode=NULL;
char *addr=NULL;
@@ -165,7 +167,8 @@ void *BLI_mempool_alloc(BLI_mempool *pool){
}
#endif
void *BLI_mempool_calloc(BLI_mempool *pool){
void *BLI_mempool_calloc(BLI_mempool *pool)
{
void *retval=NULL;
retval = BLI_mempool_alloc(pool);
BMEMSET(retval, 0, pool->esize);
@@ -173,7 +176,8 @@ void *BLI_mempool_calloc(BLI_mempool *pool){
}
void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against double frees, dont be stupid!
void BLI_mempool_free(BLI_mempool *pool, void *addr) //doesnt protect against double frees, dont be stupid!
{
BLI_freenode *newhead = addr;
BLI_freenode *curnode=NULL;
char *tmpaddr=NULL;

View File

@@ -786,7 +786,7 @@ void spin_mesh(int steps, float degr, float *dvec, int mode)
invert_m3_m3(imat,bmat);
curs= give_cursor();
VECCOPY(cent, curs);
copy_v3_v3(cent, curs);
cent[0]-= G.obedit->obmat[3][0];
cent[1]-= G.obedit->obmat[3][1];
cent[2]-= G.obedit->obmat[3][2];
@@ -908,7 +908,7 @@ void screw_mesh(int steps, int turns)
dvec[1]= ( (v1->co[1]- v2->co[1]) )/(steps);
dvec[2]= ( (v1->co[2]- v2->co[2]) )/(steps);
VECCOPY(nor, G.obedit->obmat[2]);
copy_v3_v3(nor, G.obedit->obmat[2]);
if(nor[0]*dvec[0]+nor[1]*dvec[1]+nor[2]*dvec[2]>0.000) {
dvec[0]= -dvec[0];
@@ -1230,8 +1230,8 @@ static void alter_co(float *co, EditEdge *edge, float rad, int beauty, float per
sub_v3_v3v3(nor, edge->v1->co, edge->v2->co);
len= 0.5f*normalize_v3(nor);
VECCOPY(nor1, edge->v1->no);
VECCOPY(nor2, edge->v2->no);
copy_v3_v3(nor1, edge->v1->no);
copy_v3_v3(nor2, edge->v2->no);
/* cosine angle */
fac= nor[0]*nor1[0] + nor[1]*nor1[1] + nor[2]*nor1[2] ;
@@ -2259,7 +2259,8 @@ static void fill_tri_triple(EditFace *efa, struct GHash *gh, int numcuts, float
//Next two fill types are for knife exact only and are provided to allow for knifing through vertices
//This means there is no multicut!
static void fill_quad_doublevert(EditFace *efa, int v1, int v2){
static void fill_quad_doublevert(EditFace *efa, int v1, int v2)
{
EditFace *hold;
/*
Depending on which two vertices have been knifed through (v1 and v2), we
@@ -2484,10 +2485,10 @@ void esubdivideflag(int flag, float rad, int beauty, int numcuts, int seltype)
continue;
}
if(ef->f & SELECT) {
VECCOPY(v1mat, ef->v1->co);
VECCOPY(v2mat, ef->v2->co);
VECCOPY(v3mat, ef->v3->co);
VECCOPY(v4mat, ef->v4->co);
copy_v3_v3(v1mat, ef->v1->co);
copy_v3_v3(v2mat, ef->v2->co);
copy_v3_v3(v3mat, ef->v3->co);
copy_v3_v3(v4mat, ef->v4->co);
mul_mat3_m4_v3(G.obedit->obmat, v1mat);
mul_mat3_m4_v3(G.obedit->obmat, v2mat);
mul_mat3_m4_v3(G.obedit->obmat, v3mat);
@@ -3150,7 +3151,8 @@ void beauty_fill(void)
/* ******************** BEGIN TRIANGLE TO QUAD ************************************* */
static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, float limit){
static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, float limit)
{
/*gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make*/
/*Note: this is more complicated than it needs to be and should be cleaned up...*/
@@ -3909,48 +3911,48 @@ static void fix_bevel_quad_wrap(float *o_v1, float *o_v2, float *o_v3, float *o_
// Edge 1 inverted
if (wrap[0] == 1 && wrap[1] == 0 && wrap[2] == 0 && wrap[3] == 0) {
fix_bevel_wrap(vec, o_v2, o_v3, o_v4, o_v1, d, no);
VECCOPY(v1, vec);
VECCOPY(v2, vec);
copy_v3_v3(v1, vec);
copy_v3_v3(v2, vec);
}
// Edge 2 inverted
else if (wrap[0] == 0 && wrap[1] == 1 && wrap[2] == 0 && wrap[3] == 0) {
fix_bevel_wrap(vec, o_v3, o_v4, o_v1, o_v2, d, no);
VECCOPY(v2, vec);
VECCOPY(v3, vec);
copy_v3_v3(v2, vec);
copy_v3_v3(v3, vec);
}
// Edge 3 inverted
else if (wrap[0] == 0 && wrap[1] == 0 && wrap[2] == 1 && wrap[3] == 0) {
fix_bevel_wrap(vec, o_v4, o_v1, o_v2, o_v3, d, no);
VECCOPY(v3, vec);
VECCOPY(v4, vec);
copy_v3_v3(v3, vec);
copy_v3_v3(v4, vec);
}
// Edge 4 inverted
else if (wrap[0] == 0 && wrap[1] == 0 && wrap[2] == 0 && wrap[3] == 1) {
fix_bevel_wrap(vec, o_v1, o_v2, o_v3, o_v4, d, no);
VECCOPY(v4, vec);
VECCOPY(v1, vec);
copy_v3_v3(v4, vec);
copy_v3_v3(v1, vec);
}
// Edge 2 and 4 inverted
else if (wrap[0] == 0 && wrap[1] == 1 && wrap[2] == 0 && wrap[3] == 1) {
add_v3_v3v3(vec, v2, v3);
mul_v3_fl(vec, 0.5);
VECCOPY(v2, vec);
VECCOPY(v3, vec);
copy_v3_v3(v2, vec);
copy_v3_v3(v3, vec);
add_v3_v3v3(vec, v1, v4);
mul_v3_fl(vec, 0.5);
VECCOPY(v1, vec);
VECCOPY(v4, vec);
copy_v3_v3(v1, vec);
copy_v3_v3(v4, vec);
}
// Edge 1 and 3 inverted
else if (wrap[0] == 1 && wrap[1] == 0 && wrap[2] == 1 && wrap[3] == 0) {
add_v3_v3v3(vec, v1, v2);
mul_v3_fl(vec, 0.5);
VECCOPY(v1, vec);
VECCOPY(v2, vec);
copy_v3_v3(v1, vec);
copy_v3_v3(v2, vec);
add_v3_v3v3(vec, v3, v4);
mul_v3_fl(vec, 0.5);
VECCOPY(v3, vec);
VECCOPY(v4, vec);
copy_v3_v3(v3, vec);
copy_v3_v3(v4, vec);
}
// Totally inverted
else if (wrap[0] == 1 && wrap[1] == 1 && wrap[2] == 1 && wrap[3] == 1) {
@@ -3958,10 +3960,10 @@ static void fix_bevel_quad_wrap(float *o_v1, float *o_v2, float *o_v3, float *o_
add_v3_v3v3(vec, vec, v3);
add_v3_v3v3(vec, vec, v4);
mul_v3_fl(vec, 0.25);
VECCOPY(v1, vec);
VECCOPY(v2, vec);
VECCOPY(v3, vec);
VECCOPY(v4, vec);
copy_v3_v3(v1, vec);
copy_v3_v3(v2, vec);
copy_v3_v3(v3, vec);
copy_v3_v3(v4, vec);
}
}
@@ -3976,9 +3978,9 @@ static void fix_bevel_tri_wrap(float *o_v1, float *o_v2, float *o_v3, float *v1,
add_v3_v3v3(vec, o_v1, o_v2);
add_v3_v3v3(vec, vec, o_v3);
mul_v3_fl(vec, 1.0f/3.0f);
VECCOPY(v1, vec);
VECCOPY(v2, vec);
VECCOPY(v3, vec);
copy_v3_v3(v1, vec);
copy_v3_v3(v2, vec);
copy_v3_v3(v3, vec);
}
}
@@ -3992,29 +3994,29 @@ static void bevel_shrink_faces(float d, int flag)
efa= em->faces.first;
while (efa) {
if (efa->f1 & flag) {
VECCOPY(v1, efa->v1->co);
VECCOPY(v2, efa->v2->co);
VECCOPY(v3, efa->v3->co);
VECCOPY(no, efa->n);
copy_v3_v3(v1, efa->v1->co);
copy_v3_v3(v2, efa->v2->co);
copy_v3_v3(v3, efa->v3->co);
copy_v3_v3(no, efa->n);
if (efa->v4 == NULL) {
bevel_displace_vec(vec, v1, v2, v3, d, no);
VECCOPY(efa->v2->co, vec);
copy_v3_v3(efa->v2->co, vec);
bevel_displace_vec(vec, v2, v3, v1, d, no);
VECCOPY(efa->v3->co, vec);
copy_v3_v3(efa->v3->co, vec);
bevel_displace_vec(vec, v3, v1, v2, d, no);
VECCOPY(efa->v1->co, vec);
copy_v3_v3(efa->v1->co, vec);
fix_bevel_tri_wrap(v1, v2, v3, efa->v1->co, efa->v2->co, efa->v3->co, no);
} else {
VECCOPY(v4, efa->v4->co);
copy_v3_v3(v4, efa->v4->co);
bevel_displace_vec(vec, v1, v2, v3, d, no);
VECCOPY(efa->v2->co, vec);
copy_v3_v3(efa->v2->co, vec);
bevel_displace_vec(vec, v2, v3, v4, d, no);
VECCOPY(efa->v3->co, vec);
copy_v3_v3(efa->v3->co, vec);
bevel_displace_vec(vec, v3, v4, v1, d, no);
VECCOPY(efa->v4->co, vec);
copy_v3_v3(efa->v4->co, vec);
bevel_displace_vec(vec, v4, v1, v2, d, no);
VECCOPY(efa->v1->co, vec);
copy_v3_v3(efa->v1->co, vec);
fix_bevel_quad_wrap(v1, v2, v3, v4, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, d, no);
}
@@ -4032,17 +4034,17 @@ static void bevel_shrink_draw(float d, int flag)
/* move edges of all faces with efa->f1 & flag closer towards their centers */
efa= em->faces.first;
while (efa) {
VECCOPY(v1, efa->v1->co);
VECCOPY(v2, efa->v2->co);
VECCOPY(v3, efa->v3->co);
VECCOPY(no, efa->n);
copy_v3_v3(v1, efa->v1->co);
copy_v3_v3(v2, efa->v2->co);
copy_v3_v3(v3, efa->v3->co);
copy_v3_v3(no, efa->n);
if (efa->v4 == NULL) {
bevel_displace_vec(vec, v1, v2, v3, d, no);
VECCOPY(fv2, vec);
copy_v3_v3(fv2, vec);
bevel_displace_vec(vec, v2, v3, v1, d, no);
VECCOPY(fv3, vec);
copy_v3_v3(fv3, vec);
bevel_displace_vec(vec, v3, v1, v2, d, no);
VECCOPY(fv1, vec);
copy_v3_v3(fv1, vec);
fix_bevel_tri_wrap(v1, v2, v3, fv1, fv2, fv3, no);
@@ -4059,15 +4061,15 @@ static void bevel_shrink_draw(float d, int flag)
glVertex3fv(fv3);
glEnd();
} else {
VECCOPY(v4, efa->v4->co);
copy_v3_v3(v4, efa->v4->co);
bevel_displace_vec(vec, v4, v1, v2, d, no);
VECCOPY(fv1, vec);
copy_v3_v3(fv1, vec);
bevel_displace_vec(vec, v1, v2, v3, d, no);
VECCOPY(fv2, vec);
copy_v3_v3(fv2, vec);
bevel_displace_vec(vec, v2, v3, v4, d, no);
VECCOPY(fv3, vec);
copy_v3_v3(fv3, vec);
bevel_displace_vec(vec, v3, v4, v1, d, no);
VECCOPY(fv4, vec);
copy_v3_v3(fv4, vec);
fix_bevel_quad_wrap(v1, v2, v3, v4, fv1, fv2, fv3, fv4, d, no);
@@ -4488,7 +4490,8 @@ static void bevel_mesh_recurs(float bsize, short recurs, int allfaces)
}
}
void bevel_menu(void) {
void bevel_menu(void)
{
BME_Mesh *bm;
BME_TransData_Head *td;
TransInfo *t;
@@ -4667,7 +4670,8 @@ typedef struct SlideVert {
EditVert origvert;
} SlideVert;
int EdgeLoopDelete(void) {
int EdgeLoopDelete(void)
{
/* temporal flag setting so we keep UVs when deleting edge loops,
* this is a bit of a hack but it works how you would want in almost all cases */
@@ -5828,7 +5832,8 @@ void mesh_rip(void)
G.scene->proportional = prop;
}
void shape_propagate(){
void shape_propagate(void)
{
EditMesh *em = G.editMesh;
EditVert *ev = NULL;
Mesh* me = (Mesh*)G.obedit->data;
@@ -5850,7 +5855,7 @@ void shape_propagate(){
for(kb=ky->block.first;kb;kb = kb->next){
float *data;
data = kb->data;
VECCOPY(data+(ev->keyindex*3),ev->co);
copy_v3_v3(data+(ev->keyindex*3),ev->co);
}
}
}
@@ -5948,7 +5953,7 @@ void shape_copy_from_lerp(KeyBlock* thisBlock, KeyBlock* fromBlock)
else
for(ev = em->verts.first; ev ; ev = ev->next){
if(ev->f & SELECT){
VECCOPY(ev->co, odata+(ev->keyindex*3));
copy_v3_v3(ev->co, odata+(ev->keyindex*3));
}
}
return;
@@ -6495,8 +6500,8 @@ int collapseEdges(void)
avgcount[0] /= vcount; avgcount[1] /=vcount; avgcount[2] /= vcount;
for(curredge = edgecollection->collectionbase.first; curredge; curredge = curredge->next){
VECCOPY(((EditEdge*)curredge->eed)->v1->co,avgcount);
VECCOPY(((EditEdge*)curredge->eed)->v2->co,avgcount);
copy_v3_v3(((EditEdge*)curredge->eed)->v1->co,avgcount);
copy_v3_v3(((EditEdge*)curredge->eed)->v2->co,avgcount);
}
if (EM_texFaceCheck()) {
@@ -6543,7 +6548,7 @@ int merge_firstlast(int first, int uvmerge)
if(mergevert->f&SELECT){
for (eve=G.editMesh->verts.first; eve; eve=eve->next){
if (eve->f&SELECT)
VECCOPY(eve->co,mergevert->co);
copy_v3_v3(eve->co,mergevert->co);
}
}
@@ -6828,7 +6833,8 @@ static int validate_loop(Collection *edgecollection)
return(1);
}
static int loop_bisect(Collection *edgecollection){
static int loop_bisect(Collection *edgecollection)
{
EditFace *efa, *sf1, *sf2;
EditEdge *eed, *sed;

View File

@@ -137,7 +137,7 @@ BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge *example, int nod
*/
BMFace *BM_Make_QuadTri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3,
BMVert *v4, const BMFace *example, int nodouble)
BMVert *v4, const BMFace *example, int nodouble)
{
BMEdge *edar[4];
BMVert *vtar[4];
@@ -219,7 +219,8 @@ BMFace *BM_Make_Quadtriangle(BMesh *bm, BMVert **verts, BMEdge **edges, int len,
/*copies face data from shared adjacent faces*/
void BM_Face_CopyShared(BMesh *bm, BMFace *f) {
void BM_Face_CopyShared(BMesh *bm, BMFace *f)
{
BMIter iter;
BMLoop *l, *l2;

View File

@@ -107,9 +107,10 @@
* A BMVert pointer.
*/
BMVert *bmesh_mv(BMesh *bm, float *vec){
BMVert *bmesh_mv(BMesh *bm, float *vec)
{
BMVert *v = bmesh_addvertlist(bm, NULL);
VECCOPY(v->co,vec);
copy_v3_v3(v->co,vec);
return v;
}
@@ -355,7 +356,8 @@ BMFace *bmesh_mf(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **elist, int len)
* 1 for success, 0 for failure.
*/
int bmesh_kv(BMesh *bm, BMVert *v){
int bmesh_kv(BMesh *bm, BMVert *v)
{
if(v->e == NULL){
if (BM_TestHFlag(v, BM_SELECT)) bm->totvertsel--;
@@ -377,7 +379,8 @@ int bmesh_kv(BMesh *bm, BMVert *v){
* 1 for success, 0 for failure.
*/
int bmesh_ke(BMesh *bm, BMEdge *e){
int bmesh_ke(BMesh *bm, BMEdge *e)
{
int edok;
/*Make sure that no faces!*/
@@ -412,7 +415,8 @@ int bmesh_ke(BMesh *bm, BMEdge *e){
* 1 for success, 0 for failure.
*/
int bmesh_kf(BMesh *bm, BMFace *bply){
int bmesh_kf(BMesh *bm, BMFace *bply)
{
BMLoop *newbase,*oldbase, *curloop;
int i,len=0;
@@ -838,7 +842,8 @@ int bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv)
* 1 for success, 0 for failure.
*/
int bmesh_loop_reverse(BMesh *bm, BMFace *f){
int bmesh_loop_reverse(BMesh *bm, BMFace *f)
{
BMLoop *l = f->loopbase, *curloop, *oldprev, *oldnext;
int i, j, edok, len = 0;

View File

@@ -97,7 +97,8 @@ static void BM_Data_Vert_Average(BMesh *UNUSED(bm), BMFace *UNUSED(f))
* Nothing
*/
void BM_Data_Facevert_Edgeinterp(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BMVert *v, BMEdge *e1, float fac){
void BM_Data_Facevert_Edgeinterp(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BMVert *v, BMEdge *e1, float fac)
{
void *src[2];
float w[2];
BMLoop *l=NULL, *v1loop = NULL, *vloop = NULL, *v2loop = NULL;

View File

@@ -624,7 +624,8 @@ void BM_clear_flag_all(BMesh *bm, const char hflag)
#define SETHIDE(ele) hide ? BM_SetHFlag(ele, BM_HIDDEN) : BM_ClearHFlag(ele, BM_HIDDEN);
static void vert_flush_hide(BMesh *bm, BMVert *v) {
static void vert_flush_hide(BMesh *bm, BMVert *v)
{
BMIter iter;
BMEdge *e;
int hide = 1;
@@ -636,7 +637,8 @@ static void vert_flush_hide(BMesh *bm, BMVert *v) {
SETHIDE(v);
}
static void edge_flush_hide(BMesh *bm, BMEdge *e) {
static void edge_flush_hide(BMesh *bm, BMEdge *e)
{
BMIter iter;
BMFace *f;
int hide = 1;

View File

@@ -295,7 +295,8 @@ void BM_Compute_Normals(BMesh *bm)
*/
//keep in sycn with utils.c!
#define FACE_FLIP 8
static void bmesh_rationalize_normals(BMesh *bm, int undo) {
static void bmesh_rationalize_normals(BMesh *bm, int undo)
{
BMOperator bmop;
BMFace *f;
BMIter iter;
@@ -388,7 +389,8 @@ static void bmesh_set_mdisps_space(BMesh *bm, int from, int to)
* Nothing
*
*/
void bmesh_begin_edit(BMesh *bm, int flag) {
void bmesh_begin_edit(BMesh *bm, int flag)
{
bm->opflag = flag;
/* Most operators seem to be using BMOP_UNTAN_MULTIRES to change the MDisps to
@@ -414,7 +416,8 @@ void bmesh_begin_edit(BMesh *bm, int flag) {
#endif
}
void bmesh_end_edit(BMesh *bm, int flag){
void bmesh_end_edit(BMesh *bm, int flag)
{
/* BMOP_UNTAN_MULTIRES disabled for now, see comment above in bmesh_begin_edit. */
#if BMOP_UNTAN_MULTIRES_ENABLED
/*switch multires data into tangent space*/

View File

@@ -44,7 +44,8 @@
*
*/
#if 1
int BM_Dissolve_Vert(BMesh *bm, BMVert *v) {
int BM_Dissolve_Vert(BMesh *bm, BMVert *v)
{
BMIter iter;
BMEdge *e;
int len=0;
@@ -76,7 +77,8 @@ int BM_Dissolve_Vert(BMesh *bm, BMVert *v) {
return BM_Dissolve_Disk(bm, v);
}
int BM_Dissolve_Disk(BMesh *bm, BMVert *v) {
int BM_Dissolve_Disk(BMesh *bm, BMVert *v)
{
BMFace *f, *f2;
BMEdge *e, *keepedge=NULL, *baseedge=NULL;
int len= 0;
@@ -178,7 +180,8 @@ int BM_Dissolve_Disk(BMesh *bm, BMVert *v) {
return 1;
}
#else
void BM_Dissolve_Disk(BMesh *bm, BMVert *v){
void BM_Dissolve_Disk(BMesh *bm, BMVert *v)
{
BMFace *f;
BMEdge *e;
BMIter iter;
@@ -277,7 +280,8 @@ BMFace *BM_Join_TwoFaces(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
the two verts belong to for splitting (e.g. the subdivision operator).
*/
BMEdge *BM_Connect_Verts(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **nf) {
BMEdge *BM_Connect_Verts(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **nf)
{
BMIter iter, iter2;
BMVert *v;
BMLoop *nl;
@@ -373,7 +377,8 @@ BMFace *BM_Split_Face(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **nl,
* Nothing
*/
BMEdge* BM_Collapse_Vert(BMesh *bm, BMEdge *ke, BMVert *kv, float fac){
BMEdge* BM_Collapse_Vert(BMesh *bm, BMEdge *ke, BMVert *kv, float fac)
{
BMFace **faces = NULL, *f;
BLI_array_staticdeclare(faces, 8);
BMIter iter;
@@ -513,7 +518,8 @@ BMEdge* BM_Collapse_Vert(BMesh *bm, BMEdge *ke, BMVert *kv, float fac){
* the new vert
*/
BMVert *BM_Split_Edge(BMesh *bm, BMVert *v, BMEdge *e, BMEdge **ne, float percent) {
BMVert *BM_Split_Edge(BMesh *bm, BMVert *v, BMEdge *e, BMEdge **ne, float percent)
{
BMVert *nv, *v2;
BMFace **oldfaces = NULL;
BMEdge *dummy;
@@ -548,8 +554,8 @@ BMVert *BM_Split_Edge(BMesh *bm, BMVert *v, BMEdge *e, BMEdge **ne, float percen
nv = bmesh_semv(bm,v,e,ne);
if (nv == NULL) return NULL;
sub_v3_v3v3(nv->co,v2->co,v->co);
VECADDFAC(nv->co,v->co,nv->co,percent);
sub_v3_v3v3(nv->co, v2->co, v->co);
madd_v3_v3v3fl(nv->co, v->co, nv->co, percent);
if (ne) {
(*ne)->head.hflag = e->head.hflag;

View File

@@ -19,7 +19,8 @@
#include "bmesh_iterators.h"
#include "bmesh_private.h"
BMVert *BM_Make_Vert(BMesh *bm, float co[3], const struct BMVert *example) {
BMVert *BM_Make_Vert(BMesh *bm, float co[3], const struct BMVert *example)
{
BMVert *v = BLI_mempool_calloc(bm->vpool);
bm->totvert += 1;
@@ -67,7 +68,8 @@ BMEdge *BM_Edge_Exist(BMVert *v1, BMVert *v2)
return NULL;
}
BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble) {
BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble)
{
BMEdge *e;
if (nodouble && (e= BM_Edge_Exist(v1, v2)))
@@ -97,7 +99,8 @@ BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, i
return (BMEdge*) e;
}
static BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, const BMLoop *example){
static BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, const BMLoop *example)
{
BMLoop *l=NULL;
l = BLI_mempool_calloc(bm->lpool);
@@ -119,7 +122,8 @@ static BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, con
return l;
}
static BMLoop *BM_Add_FaceBoundary(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte) {
static BMLoop *BM_Add_FaceBoundary(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte)
{
BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool);
BMLoop *l = bmesh_create_loop(bm, startv, starte, f, NULL);
@@ -194,7 +198,8 @@ BMFace *BM_Copy_Face(BMesh *bm, BMFace *f, int copyedges, int copyverts)
return f2;
}
BMFace *BM_Make_Face(BMesh *bm, BMVert **verts, BMEdge **edges, int len, int nodouble) {
BMFace *BM_Make_Face(BMesh *bm, BMVert **verts, BMEdge **edges, int len, int nodouble)
{
BMFace *f = NULL;
BMLoop *l, *startl, *lastl;
int i, overlap;
@@ -367,7 +372,8 @@ int bmesh_check_element(BMesh *UNUSED(bm), void *element, const char htype)
return err;
}
static void bmesh_kill_loop(BMesh *bm, BMLoop *l) {
static void bmesh_kill_loop(BMesh *bm, BMLoop *l)
{
bm->totloop--;
if (l->head.data)
CustomData_bmesh_free_block(&bm->ldata, &l->head.data);
@@ -377,7 +383,8 @@ static void bmesh_kill_loop(BMesh *bm, BMLoop *l) {
BLI_mempool_free(bm->lpool, l);
}
void BM_Kill_Face_Edges(BMesh *bm, BMFace *f) {
void BM_Kill_Face_Edges(BMesh *bm, BMFace *f)
{
BMEdge **edges = NULL;
BLI_array_staticdeclare(edges, 256);
BMLoop *l;
@@ -396,7 +403,8 @@ void BM_Kill_Face_Edges(BMesh *bm, BMFace *f) {
BLI_array_free(edges);
}
void BM_Kill_Face_Verts(BMesh *bm, BMFace *f) {
void BM_Kill_Face_Verts(BMesh *bm, BMFace *f)
{
BMVert**verts = NULL;
BLI_array_staticdeclare(verts, 256);
BMLoop *l;
@@ -415,7 +423,8 @@ void BM_Kill_Face_Verts(BMesh *bm, BMFace *f) {
BLI_array_free(verts);
}
void BM_Kill_Face(BMesh *bm, BMFace *f) {
void BM_Kill_Face(BMesh *bm, BMFace *f)
{
BMLoopList *ls, *lsnext;
BM_CHECK_ELEMENT(bm, f);
@@ -450,7 +459,8 @@ void BM_Kill_Face(BMesh *bm, BMFace *f) {
BLI_mempool_free(bm->fpool, f);
}
void BM_Kill_Edge(BMesh *bm, BMEdge *e) {
void BM_Kill_Edge(BMesh *bm, BMEdge *e)
{
bmesh_disk_remove_edge(e, e->v1);
bmesh_disk_remove_edge(e, e->v2);
@@ -482,7 +492,8 @@ void BM_Kill_Edge(BMesh *bm, BMEdge *e) {
BLI_mempool_free(bm->epool, e);
}
void BM_Kill_Vert(BMesh *bm, BMVert *v) {
void BM_Kill_Vert(BMesh *bm, BMVert *v)
{
if (v->e) {
BMEdge *e, *nexte;
@@ -533,7 +544,8 @@ static int bmesh_loop_length(BMLoop *l)
return i;
}
static int bmesh_loop_reverse_loop(BMesh *bm, BMFace *f, BMLoopList *lst){
static int bmesh_loop_reverse_loop(BMesh *bm, BMFace *f, BMLoopList *lst)
{
BMLoop *l = lst->first, *curloop, *oldprev, *oldnext;
BMEdge **edar = NULL;
MDisps *md;
@@ -887,7 +899,8 @@ error:
return NULL;
}
static BMFace *bmesh_addpolylist(BMesh *bm, BMFace *UNUSED(example)) {
static BMFace *bmesh_addpolylist(BMesh *bm, BMFace *UNUSED(example))
{
BMFace *f;
BMLoopList *lst;

View File

@@ -415,7 +415,8 @@ int BMO_CountFlag(BMesh *bm, int flag, const char htype)
return count;
}
void BMO_Clear_Flag_All(BMesh *bm, BMOperator *UNUSED(op), const char htype, int flag) {
void BMO_Clear_Flag_All(BMesh *bm, BMOperator *UNUSED(op), const char htype, int flag)
{
BMIter iter;
BMHeader *ele;
int i=0, types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
@@ -457,7 +458,8 @@ int BMO_CountSlotMap(BMesh *UNUSED(bm), BMOperator *op, const char *slotname)
}
#if 0
void *BMO_Grow_Array(BMesh *bm, BMOperator *op, int slotcode, int totadd) {
void *BMO_Grow_Array(BMesh *bm, BMOperator *op, int slotcode, int totadd)
{
BMOpSlot *slot = &op->slots[slotcode];
void *tmp;
@@ -506,7 +508,8 @@ void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
}
}
static void *alloc_slot_buffer(BMOperator *op, const char *slotname, int len){
static void *alloc_slot_buffer(BMOperator *op, const char *slotname, int len)
{
BMOpSlot *slot = BMO_GetSlot(op, slotname);
/*check if its actually a buffer*/
@@ -1086,7 +1089,8 @@ static int bmesh_name_to_slotcode_check(BMOpDefine *def, const char *name)
return i;
}
static int bmesh_opname_to_opcode(const char *opname) {
static int bmesh_opname_to_opcode(const char *opname)
{
int i;
for (i=0; i<bmesh_total_ops; i++) {
@@ -1265,7 +1269,8 @@ error:
}
int BMO_InitOpf(BMesh *bm, BMOperator *op, const char *fmt, ...) {
int BMO_InitOpf(BMesh *bm, BMOperator *op, const char *fmt, ...)
{
va_list list;
va_start(list, fmt);
@@ -1279,7 +1284,8 @@ int BMO_InitOpf(BMesh *bm, BMOperator *op, const char *fmt, ...) {
return 1;
}
int BMO_CallOpf(BMesh *bm, const char *fmt, ...) {
int BMO_CallOpf(BMesh *bm, const char *fmt, ...)
{
va_list list;
BMOperator op;

View File

@@ -106,8 +106,8 @@ static void compute_poly_normal(float normal[3], float (*verts)[3], int nverts)
copy_v3_v3(w, verts[(i+2) % nverts]);
#if 0
VECSUB(v1, w, v);
VECSUB(v2, v, u);
sub_v3_v3v3(v1, w, v);
sub_v3_v3v3(v2, v, u);
Normalize_d(v1);
Normalize_d(v2);
@@ -643,7 +643,8 @@ int BM_Point_In_Face(BMesh *bm, BMFace *f, float co[3])
}
static int goodline(float (*projectverts)[3], BMFace *f, int v1i,
int v2i, int v3i, int UNUSED(nvert)) {
int v2i, int v3i, int UNUSED(nvert))
{
BMLoop *l = bm_firstfaceloop(f);
double v1[3], v2[3], v3[3], pv1[3], pv2[3];
int i;

View File

@@ -218,7 +218,8 @@ int BM_Edge_FaceCount(BMEdge *e)
* Returns the number of faces around this vert
*/
int BM_Vert_FaceCount(BMVert *v){
int BM_Vert_FaceCount(BMVert *v)
{
int count = 0;
BMLoop *l;
BMIter iter;
@@ -295,7 +296,8 @@ int BM_Wire_Edge(BMesh *UNUSED(bm), BMEdge *e)
* 1 for true, 0 for false.
*/
int BM_Nonmanifold_Vert(BMesh *UNUSED(bm), BMVert *v) {
int BM_Nonmanifold_Vert(BMesh *UNUSED(bm), BMVert *v)
{
BMEdge *e, *oe;
BMLoop *l;
int len, count, flag;
@@ -401,7 +403,8 @@ int BM_Boundary_Edge(BMEdge *e)
* Integer
*/
int BM_Face_Sharededges(BMFace *f1, BMFace *f2){
int BM_Face_Sharededges(BMFace *f1, BMFace *f2)
{
BMLoop *l;
int count = 0;

View File

@@ -47,11 +47,13 @@
*
*/
int bmesh_vert_in_edge(BMEdge *e, BMVert *v){
int bmesh_vert_in_edge(BMEdge *e, BMVert *v)
{
if(e->v1 == v || e->v2 == v) return 1;
return 0;
}
int bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e){
int bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
{
if(e->v1 == v1 && e->v2 == v2) return 1;
else if(e->v1 == v2 && e->v2 == v1) return 1;
return 0;
@@ -63,7 +65,8 @@ BMVert *bmesh_edge_getothervert(BMEdge *e, BMVert *v){
return NULL;
}
int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv){
int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
{
if(e->v1 == orig){
e->v1 = newv;
e->dlink1.next = e->dlink1.prev = NULL;
@@ -456,7 +459,8 @@ int bmesh_radial_length(BMLoop *l)
return i;
}
void bmesh_radial_append(BMEdge *e, BMLoop *l){
void bmesh_radial_append(BMEdge *e, BMLoop *l)
{
if(e->l == NULL) {
e->l = l;
l->radial_next = l->radial_prev = l;
@@ -572,7 +576,8 @@ void bmesh_cycle_append(void *h, void *nt)
* Integer
*/
int bmesh_cycle_length(BMEdge *e, BMVert *v) {
int bmesh_cycle_length(BMEdge *e, BMVert *v)
{
BMEdge *next, *prev, *cur;
int len, vi = v == e->v1 ? 0 : 1;
@@ -642,7 +647,8 @@ int bmesh_cycle_remove(void *h, void *remn)
* 1 for success, 0 for failure.
*/
int bmesh_cycle_validate(int len, void *h){
int bmesh_cycle_validate(int len, void *h)
{
int i;
BMNode *curnode, *head;
head = (BMNode*)h;
@@ -820,7 +826,8 @@ int bmesh_disk_count_edgeflag(BMVert *v, int eflag, int tflag)
}
int bmesh_disk_hasedge(BMVert *v, BMEdge *e){
int bmesh_disk_hasedge(BMVert *v, BMEdge *e)
{
BMNode *diskbase;
BMEdge *curedge;
int i, len=0;
@@ -859,7 +866,8 @@ BMLoop *bmesh_radial_nextloop(BMLoop *l){
return l->radial_next;
}
void bmesh_radial_append(BMEdge *e, BMLoop *l){
void bmesh_radial_append(BMEdge *e, BMLoop *l)
{
if(e->l == NULL) e->l = l;
bmesh_cycle_append(&(e->l->radial), &(l->radial));
}
@@ -1011,7 +1019,8 @@ BMEdge *bmesh_disk_find_next_faceedge(BMEdge *e, BMVert *v)
struct BMLoop *bmesh_loop_find_loop(struct BMFace *f, struct BMVert *v) {
struct BMLoop *bmesh_loop_find_loop(struct BMFace *f, struct BMVert *v)
{
BMLoop *l;
int i, len;

View File

@@ -40,7 +40,8 @@
*
*/
static void loops_to_editmesh_corners(BMesh *bm, CustomData *facedata, void *face_block, BMFace *f,int numCol, int numTex){
static void loops_to_editmesh_corners(BMesh *bm, CustomData *facedata, void *face_block, BMFace *f,int numCol, int numTex)
{
int i, j;
BMLoop *l;
MTFace *texface;

View File

@@ -65,7 +65,8 @@
for if walkers fail.
*/
void *BMW_Begin(BMWalker *walker, void *start) {
void *BMW_Begin(BMWalker *walker, void *start)
{
walker->begin(walker, start);
return BMW_currentstate(walker) ? walker->step(walker) : NULL;
@@ -250,7 +251,8 @@ void* BMW_addstate(BMWalker *walker)
*
*/
void BMW_reset(BMWalker *walker) {
void BMW_reset(BMWalker *walker)
{
while (BMW_currentstate(walker)) {
BMW_removestate(walker);
}

View File

@@ -53,7 +53,8 @@
*
*/
static void shellWalker_visitEdge(BMWalker *walker, BMEdge *e) {
static void shellWalker_visitEdge(BMWalker *walker, BMEdge *e)
{
shellWalker *shellWalk = NULL;
if (BLI_ghash_haskey(walker->visithash, e)) {
@@ -69,7 +70,8 @@ static void shellWalker_visitEdge(BMWalker *walker, BMEdge *e) {
BLI_ghash_insert(walker->visithash, e, NULL);
}
static void shellWalker_begin(BMWalker *walker, void *data){
static void shellWalker_begin(BMWalker *walker, void *data)
{
BMIter eiter;
BMHeader *h = data;
BMEdge *e;
@@ -240,7 +242,8 @@ static void *connectedVertexWalker_step(BMWalker *walker)
*
*/
static void islandboundWalker_begin(BMWalker *walker, void *data){
static void islandboundWalker_begin(BMWalker *walker, void *data)
{
BMLoop *l = data;
islandboundWalker *iwalk = NULL;
@@ -330,7 +333,8 @@ static void *islandboundWalker_step(BMWalker *walker)
*
*/
static void islandWalker_begin(BMWalker *walker, void *data){
static void islandWalker_begin(BMWalker *walker, void *data)
{
islandWalker *iwalk = NULL;
if (walker->restrictflag && !BMO_TestFlag(walker->bm, data, walker->restrictflag)) {
@@ -386,7 +390,8 @@ static void *islandWalker_step(BMWalker *walker)
*
*/
static void loopWalker_begin(BMWalker *walker, void *data){
static void loopWalker_begin(BMWalker *walker, void *data)
{
loopWalker *lwalk = NULL, owalk;
BMEdge *e = data;
BMVert *v;

View File

@@ -41,7 +41,8 @@
*
*/
static void editmesh_corners_to_loops(BMesh *bm, CustomData *facedata, void *face_block, BMFace *f,int numCol, int numTex){
static void editmesh_corners_to_loops(BMesh *bm, CustomData *facedata, void *face_block, BMFace *f,int numCol, int numTex)
{
int i, j;
BMLoop *l;
MTFace *texface;
@@ -349,7 +350,8 @@ static BM_fgonconvert(BMesh *bm, BMOperator *op, EditMesh *em, int numCol, int n
*
*/
static void tag_wire_edges(EditMesh *em){
static void tag_wire_edges(EditMesh *em)
{
EditFace *efa;
EditEdge *eed;
for(eed = em->edges.first; eed; eed = eed->next) eed->f1 = 1;

View File

@@ -334,7 +334,7 @@ BMMesh *derivedmesh_to_bmesh(DerivedMesh *dm)
static void bmeshvert_to_mvert(BMMesh *bm, BMVert *v, MVert *mv, int index, CustomData *data)
{
VECCOPY(mv->co,v->co);
copy_v3_v3(mv->co,v->co);
if(bmesh_test_flag(v, BMESH_SELECT)) mv->flag |= 1;
if(bmesh_test_flag(v, BMESH_HIDDEN)) mv->flag |= ME_HIDE;
mv->bweight = (char)(255.0*v1->bweight);

View File

@@ -455,7 +455,8 @@ static void delete_verts(BMesh *bm)
BM_remove_tagged_verts(bm, DEL_INPUT);
}
static void delete_edges(BMesh *bm){
static void delete_edges(BMesh *bm)
{
BMEdge *e;
BMFace *f;

View File

@@ -805,7 +805,8 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
return path;
}
static int count_edge_faces(BMesh *bm, BMEdge *e) {
static int count_edge_faces(BMesh *bm, BMEdge *e)
{
int i=0;
BMLoop *l = e->l;

View File

@@ -19,7 +19,8 @@
#define VERT_MARK 1
static int check_hole_in_region(BMesh *bm, BMFace *f) {
static int check_hole_in_region(BMesh *bm, BMFace *f)
{
BMWalker regwalker;
BMIter liter2;
BMLoop *l2, *l3;

View File

@@ -43,7 +43,8 @@
*
*/
void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) {
void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
{
Object *ob = BMO_Get_Pnt(op, "object");
Mesh *me = BMO_Get_Pnt(op, "mesh");
MVert *mvert;
@@ -364,7 +365,8 @@ static void loops_to_corners(BMesh *bm, Mesh *me, int findex,
}
}
void object_load_bmesh_exec(BMesh *bm, BMOperator *op) {
void object_load_bmesh_exec(BMesh *bm, BMOperator *op)
{
Object *ob = BMO_Get_Pnt(op, "object");
/* Scene *scene = BMO_Get_Pnt(op, "scene"); */
Mesh *me = ob->data;
@@ -412,7 +414,8 @@ static BMVert **bmesh_to_mesh_vertex_map(BMesh *bm, int ototvert)
return vertMap;
}
void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) {
void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
{
Mesh *me = BMO_Get_Pnt(op, "mesh");
/* Object *ob = BMO_Get_Pnt(op, "object"); */
MLoop *mloop;
@@ -806,7 +809,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) {
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
if(keyi && *keyi != ORIGINDEX_NONE) {
VECSUB(ofs[i], mvert->co, fp[*keyi]);
sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]);
}
i++;
mvert++;
@@ -895,7 +898,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) {
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
if(keyi && *keyi != ORIGINDEX_NONE) {
VECSUB(ofs[i], mvert->co, fp[*keyi]);
sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]);
}
i++;
mvert++;

View File

@@ -38,7 +38,8 @@
#define ELE_NEW 1
void bmesh_mirror_exec(BMesh *bm, BMOperator *op) {
void bmesh_mirror_exec(BMesh *bm, BMOperator *op)
{
BMOperator dupeop, weldop;
BMOIter siter;
BMIter iter;

View File

@@ -369,8 +369,8 @@ void bmesh_collapse_exec(BMesh *bm, BMOperator *op)
/*snap edges to a point. for initial testing purposes anyway.*/
for (i=0; i<tot; i++) {
VECCOPY(edges[i]->v1->co, min);
VECCOPY(edges[i]->v2->co, min);
copy_v3_v3(edges[i]->v1->co, min);
copy_v3_v3(edges[i]->v2->co, min);
if (edges[i]->v1 != edges[0]->v1)
BMO_Insert_MapPointer(bm, &weldop, "targetmap", edges[i]->v1, edges[0]->v1);

View File

@@ -47,7 +47,8 @@
/* ------- Bevel code starts here -------- */
BME_TransData_Head *BME_init_transdata(int bufsize) {
BME_TransData_Head *BME_init_transdata(int bufsize)
{
BME_TransData_Head *td;
td = MEM_callocN(sizeof(BME_TransData_Head), "BM transdata header");
@@ -58,15 +59,18 @@ BME_TransData_Head *BME_init_transdata(int bufsize) {
return td;
}
void BME_free_transdata(BME_TransData_Head *td) {
void BME_free_transdata(BME_TransData_Head *td)
{
BLI_ghash_free(td->gh,NULL,NULL);
BLI_memarena_free(td->ma);
MEM_freeN(td);
}
BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BMVert *v,
float *co, float *org, float *vec, float *loc,
float factor, float weight, float maxfactor, float *max) {
BME_TransData *BME_assign_transdata(
BME_TransData_Head *td, BMesh *bm, BMVert *v,
float *co, float *org, float *vec, float *loc,
float factor, float weight, float maxfactor, float *max)
{
BME_TransData *vtd;
int is_new = 0;
@@ -81,11 +85,11 @@ BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BMVert *v
vtd->bm = bm;
vtd->v = v;
if (co != NULL) VECCOPY(vtd->co,co);
if (org == NULL && is_new) { VECCOPY(vtd->org,v->co); } /* default */
else if (org != NULL) VECCOPY(vtd->org,org);
if (co != NULL) copy_v3_v3(vtd->co,co);
if (org == NULL && is_new) { copy_v3_v3(vtd->org,v->co); } /* default */
else if (org != NULL) copy_v3_v3(vtd->org,org);
if (vec != NULL) {
VECCOPY(vtd->vec,vec);
copy_v3_v3(vtd->vec,vec);
normalize_v3(vtd->vec);
}
vtd->loc = loc;
@@ -98,18 +102,21 @@ BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BMVert *v
return vtd;
}
BME_TransData *BME_get_transdata(BME_TransData_Head *td, BMVert *v) {
BME_TransData *BME_get_transdata(BME_TransData_Head *td, BMVert *v)
{
BME_TransData *vtd;
vtd = BLI_ghash_lookup(td->gh, v);
return vtd;
}
/* a hack (?) to use the transdata memarena to allocate floats for use with the max limits */
float *BME_new_transdata_float(BME_TransData_Head *td) {
float *BME_new_transdata_float(BME_TransData_Head *td)
{
return BLI_memarena_alloc(td->ma, sizeof(float));
}
static int BME_bevel_is_split_vert(BMLoop *l) {
static int BME_bevel_is_split_vert(BMLoop *l)
{
/* look for verts that have already been added to the edge when
* beveling other polys; this can be determined by testing the
* vert and the edges around it for originality
@@ -127,7 +134,8 @@ static int BME_bevel_is_split_vert(BMLoop *l) {
* the bevel operation as a whole based on the relationship between v1 and v2
* (won't necessarily be a vec from v1->co to v2->co, though it probably will be);
* the return value is -1 for failure, 0 if we used vert co's, and 1 if we used transform origins */
static int BME_bevel_get_vec(float *vec, BMVert *v1, BMVert *v2, BME_TransData_Head *td) {
static int BME_bevel_get_vec(float *vec, BMVert *v1, BMVert *v2, BME_TransData_Head *td)
{
BME_TransData *vtd1, *vtd2;
vtd1 = BME_get_transdata(td,v1);
@@ -141,16 +149,16 @@ static int BME_bevel_get_vec(float *vec, BMVert *v1, BMVert *v2, BME_TransData_H
* if they belong to different origins, then we will use the origins to determine
* the vector */
if (compare_v3v3(vtd1->org,vtd2->org,0.000001f)) {
VECSUB(vec,v2->co,v1->co);
sub_v3_v3v3(vec, v2->co, v1->co);
if (len_v3(vec) < 0.000001f) {
mul_v3_fl(vec,0);
zero_v3(vec);
}
return 0;
}
else {
VECSUB(vec,vtd2->org,vtd1->org);
sub_v3_v3v3(vec,vtd2->org,vtd1->org);
if (len_v3(vec) < 0.000001f) {
mul_v3_fl(vec,0);
zero_v3(vec);
}
return 1;
}
@@ -165,7 +173,8 @@ static int BME_bevel_get_vec(float *vec, BMVert *v1, BMVert *v2, BME_TransData_H
* vec2 is the direction of projection (pointing away from vec1)
* up_vec is used for orientation (expected to be normalized)
* returns the length of the projected vector that lies along vec1 */
static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *td) {
static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *td)
{
float factor, vec3[3], tmp[3],c1,c2;
cross_v3_v3v3(tmp,vec1,vec2);
@@ -194,7 +203,8 @@ static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int
* using the vert and the loop passed, get or make the split vert, set its coordinates
* and transform properties, and set the max limits.
* Finally, return the split vert. */
static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, float *up_vec, float value, BME_TransData_Head *td) {
static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, float *up_vec, float value, BME_TransData_Head *td)
{
BME_TransData *vtd, *vtd1, *vtd2;
BMVert *sv, *v2, *v3, *ov;
BMLoop *lv1, *lv2;
@@ -328,8 +338,8 @@ static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l,
if (is_edge || dis > maxfactor*value) {
dis = maxfactor*value;
}
VECADDFAC(sv->co,v->co,vec1,dis);
VECSUB(vec1,sv->co,vtd1->org);
madd_v3_v3v3fl(sv->co, v->co, vec1, dis);
sub_v3_v3v3(vec1, sv->co, vtd1->org);
dis = len_v3(vec1);
normalize_v3(vec1);
BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, maxfactor, vtd->max);
@@ -337,7 +347,8 @@ static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l,
return sv;
}
static float BME_bevel_set_max(BMVert *v1, BMVert *v2, float value, BME_TransData_Head *td) {
static float BME_bevel_set_max(BMVert *v1, BMVert *v2, float value, BME_TransData_Head *td)
{
BME_TransData *vtd1, *vtd2;
float max, fac1, fac2, vec1[3], vec2[3], vec3[3];
@@ -349,7 +360,7 @@ static float BME_bevel_set_max(BMVert *v1, BMVert *v2, float value, BME_TransDat
fac1 = 0;
}
else {
VECCOPY(vec2,vtd1->vec);
copy_v3_v3(vec2,vtd1->vec);
mul_v3_fl(vec2,vtd1->factor);
if (dot_v3v3(vec1, vec1)) {
project_v3_v3v3(vec2,vec2,vec1);
@@ -364,7 +375,7 @@ static float BME_bevel_set_max(BMVert *v1, BMVert *v2, float value, BME_TransDat
fac2 = 0;
}
else {
VECCOPY(vec3,vtd2->vec);
copy_v3_v3(vec3,vtd2->vec);
mul_v3_fl(vec3,vtd2->factor);
if (dot_v3v3(vec1, vec1)) {
project_v3_v3v3(vec2,vec3,vec1);
@@ -391,7 +402,8 @@ static float BME_bevel_set_max(BMVert *v1, BMVert *v2, float value, BME_TransDat
return max;
}
static BMVert *BME_bevel_wire(BMesh *bm, BMVert *v, float value, int res, int options, BME_TransData_Head *td) {
static BMVert *BME_bevel_wire(BMesh *bm, BMVert *v, float value, int res, int options, BME_TransData_Head *td)
{
BMVert *ov1, *ov2, *v1, *v2;
ov1 = BM_OtherEdgeVert(v->e, v);
@@ -421,7 +433,8 @@ static BMVert *BME_bevel_wire(BMesh *bm, BMVert *v, float value, int res, int op
return v1;
}
static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int options, float *up_vec, BME_TransData_Head *td) {
static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int options, float *up_vec, BME_TransData_Head *td)
{
BMVert *v1, *v2, *kv;
BMLoop *kl=NULL, *nl;
BMEdge *e;
@@ -522,7 +535,8 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int options, fl
return l;
}
static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int options, float *up_vec, BME_TransData_Head *td) {
static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int options, float *up_vec, BME_TransData_Head *td)
{
BMVert *v1, *v2;
BMFace *f;
@@ -555,7 +569,8 @@ static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int options, fl
* Returns -
* A BMFace pointer to the resulting inner face.
*/
static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BME_TransData_Head *td) {
static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BME_TransData_Head *td)
{
BMLoop *l, *ol;
BME_TransData *vtd1, *vtd2;
float up_vec[3], vec1[3], vec2[3], vec3[3], fac1, fac2, max = -1;
@@ -570,8 +585,8 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM
for (i=0,ol=f->loopbase,l=ol->next; l->next!=ol; l=l->next) {
BME_bevel_get_vec(vec1,l->next->v,ol->v,td);
BME_bevel_get_vec(vec2,l->v,ol->v,td);
cross_v3_v3v3(vec3,vec2,vec1);
VECADD(up_vec,up_vec,vec3);
cross_v3_v3v3(vec3, vec2, vec1);
add_v3_v3(up_vec, vec3);
i++;
}
mul_v3_fl(up_vec,1.0f/i);
@@ -601,7 +616,7 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM
fac1 = 0;
}
else {
VECCOPY(vec2,vtd1->vec);
copy_v3_v3(vec2,vtd1->vec);
mul_v3_fl(vec2,vtd1->factor);
if (dot_v3v3(vec1, vec1)) {
project_v3_v3v3(vec2,vec2,vec1);
@@ -615,7 +630,7 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM
fac2 = 0;
}
else {
VECCOPY(vec3,vtd2->vec);
copy_v3_v3(vec3,vtd2->vec);
mul_v3_fl(vec3,vtd2->factor);
if (dot_v3v3(vec1, vec1)) {
project_v3_v3v3(vec2,vec3,vec1);
@@ -641,7 +656,8 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM
return l->f;
}
static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, float weight, float factor, int options) {
static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, float weight, float factor, int options)
{
BME_TransData *vtd;
if (v->tflag1 & BME_BEVEL_NONMAN) return;
@@ -675,7 +691,8 @@ static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v,
}
static bevel_init_verts(BMesh *bm, int options, BME_TransData_Head *td){
static bevel_init_verts(BMesh *bm, int options, BME_TransData_Head *td)
{
BMVert *v;
float weight;
for(v=bm->verts.first; v; v=v->next){
@@ -693,7 +710,8 @@ static bevel_init_verts(BMesh *bm, int options, BME_TransData_Head *td){
}
}
}
static bevel_init_edges(BMesh *bm, int options, BME_TransData_Head *td){
static bevel_init_edges(BMesh *bm, int options, BME_TransData_Head *td)
{
BMEdge *e;
int count;
float weight;
@@ -727,8 +745,8 @@ static bevel_init_edges(BMesh *bm, int options, BME_TransData_Head *td){
}
}
}
static BMesh *BME_bevel_initialize(BMesh *bm, int options, int defgrp_index, float angle, BME_TransData_Head *td){
static BMesh *BME_bevel_initialize(BMesh *bm, int options, int defgrp_index, float angle, BME_TransData_Head *td)
{
BMVert *v, *v2;
BMEdge *e, *curedge;
BMFace *f;
@@ -802,7 +820,8 @@ static BMesh *BME_bevel_reinitialize(BMesh *bm)
* A BMesh pointer to the BM passed as a parameter.
*/
static BMMesh *BME_bevel_mesh(BMMesh *bm, float value, int res, int options, int defgrp_index, BME_TransData_Head *td) {
static BMMesh *BME_bevel_mesh(BMMesh *bm, float value, int res, int options, int defgrp_index, BME_TransData_Head *td)
{
BMVert *v, *nv;
BMEdge *e, *curedge, *ne;
BMLoop *l, *l2;
@@ -856,7 +875,8 @@ static BMMesh *BME_bevel_mesh(BMMesh *bm, float value, int res, int options, int
return bm;
}
BMesh *BME_bevel(BMMesh *bm, float value, int res, int options, int defgrp_index, float angle, BME_TransData_Head **rtd) {
BMesh *BME_bevel(BMMesh *bm, float value, int res, int options, int defgrp_index, float angle, BME_TransData_Head **rtd)
{
BMVert *v;
BMEdge *e;
BMIter *verts;
@@ -904,7 +924,7 @@ BMesh *BME_bevel(BMMesh *bm, float value, int res, int options, int defgrp_index
else {
d = value;
}
VECADDFAC(v->co,vtd->org,vtd->vec,vtd->factor*d);
madd_v3_v3v3fl(v->co,vtd->org,vtd->vec,vtd->factor*d);
}
v->tflag1 = 0;
}

View File

@@ -275,8 +275,8 @@ BMMesh *bmesh_make_mesh_from_mesh(BMMesh *bm, int allocsize[4])
*
*/
void bmesh_split_mesh(BMMesh *bm, int flag){
void bmesh_split_mesh(BMMesh *bm, int flag)
{
BMVert *v;
BMEdge *e;
BMFace *f;

View File

@@ -14,7 +14,8 @@
* -Fit this into the new 'easy' API.
*/
void BME_extrude_verts(BME_Mesh *bm, GHash *vhash){
void BME_extrude_verts(BME_Mesh *bm, GHash *vhash)
{
BMVert *v, *nv = NULL;
BMEdge *ne = NULL;
float vec[3];
@@ -22,7 +23,7 @@ void BME_extrude_verts(BME_Mesh *bm, GHash *vhash){
//extrude the vertices
for(v=BME_first(bm,BME_VERT);v;v=BME_next(bm,BME_VERT,v)){
if(BME_SELECTED(v)){
VECCOPY(vec,v->co);
copy_v3_v3(vec,v->co);
nv = BME_MV(bm,vec);
nv->tflag2 =1; //mark for select
ne = BME_ME(bm,v,nv);
@@ -33,8 +34,8 @@ void BME_extrude_verts(BME_Mesh *bm, GHash *vhash){
}
}
void BME_extrude_skirt(BME_Mesh *bm, GHash *ehash){
void BME_extrude_skirt(BME_Mesh *bm, GHash *ehash)
{
BMFace *nf=NULL;
BMEdge *e, *l=NULL, *r=NULL, *edar[4], *ne;
BMVert *v, *v1, *v2, *lv, *rv, *nv;
@@ -73,7 +74,8 @@ void BME_extrude_skirt(BME_Mesh *bm, GHash *ehash){
}
}
void BME_cap_skirt(BME_Mesh *bm, GHash *vhash, GHash *ehash){
void BME_cap_skirt(BME_Mesh *bm, GHash *vhash, GHash *ehash)
{
BMVert *v, *nv, *v1, *v2;
BMEdge *e, **edar, *ne;
BME_Loop *l;
@@ -90,7 +92,7 @@ void BME_cap_skirt(BME_Mesh *bm, GHash *vhash, GHash *ehash){
do{
if(!(BME_ISVISITED(l->v))){ //interior vertex
//dupe vert
VECCOPY(vec,l->v->co);
copy_v3_v3(vec,l->v->co);
nv = BME_MV(bm,vec);
BLI_ghash_insert(vhash,l->v,nv);
//mark for delete

View File

@@ -292,8 +292,8 @@ void BME_collapse_edges(BME_Mesh *bm){
/*now loop through the hash table twice, once to calculate bounding box, second time to do the actual collapse*/
size = BLI_ghash_size(collected);
/*initial values*/
VECCOPY(min,v->co);
VECCOPY(max,v->co);
copy_v3_v3(min,v->co);
copy_v3_v3(max,v->co);
cent[0] = cent[1] = cent[2]=0;
for(i=0; i<size; i++){
cvert = BLI_ghash_lookup(collected,i);
@@ -308,7 +308,7 @@ void BME_collapse_edges(BME_Mesh *bm){
for(i=0; i<size; i++){
cvert = BLI_ghash_lookup(collected,i);
VECCOPY(cvert->co,cent);
copy_v3_v3(cvert->co,cent);
num++;
}
/*free the hash table*/
@@ -330,4 +330,4 @@ void BME_collapse_edges(BME_Mesh *bm){
BME_remove_doubles(bm,0.0000001);
}
BME_selectmode_flush(bm);
}
}

View File

@@ -2075,7 +2075,7 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob,
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
if (!BM_TestHFlag(v, BM_SELECT))
continue;
VECADD(cent, cent, v->co);
add_v3_v3(cent, v->co);
i++;
}

View File

@@ -143,7 +143,8 @@ int EDBM_InitOpf(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *f
/*returns 0 on error, 1 on success. executes and finishes a bmesh operator*/
int EDBM_FinishOp(BMEditMesh *em, BMOperator *bmop, wmOperator *op, int report) {
int EDBM_FinishOp(BMEditMesh *em, BMOperator *bmop, wmOperator *op, int report)
{
const char *errmsg;
BMO_Finish_Op(em->bm, bmop);

View File

@@ -111,8 +111,8 @@ static float new_primitive_matrix(bContext *C, float *loc, float *rot, float pri
copy_m4_m3(primmat, imat);
/* center */
VECCOPY(primmat[3], loc);
VECSUB(primmat[3], primmat[3], obedit->obmat[3]);
copy_v3_v3(primmat[3], loc);
sub_v3_v3(primmat[3], obedit->obmat[3]);
invert_m3_m3(imat, mat);
mul_m3_v3(imat, primmat[3]);

View File

@@ -232,7 +232,7 @@ static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTre
hit->dist = dist;
hit->index = index;
VECCOPY(hit->no, ls[0]->v->no);
copy_v3_v3(hit->no, ls[0]->v->no);
copy_v3_v3(hit->co, ray->direction);
normalize_v3(hit->co);
@@ -301,8 +301,8 @@ static void vertsearchcallback(void *userdata, int index, const float *UNUSED(co
dist = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
if (dist < hit->dist && dist < maxdist) {
VECCOPY(hit->co, ls[i]->v->co);
VECCOPY(hit->no, ls[i]->v->no);
copy_v3_v3(hit->co, ls[i]->v->co);
copy_v3_v3(hit->no, ls[i]->v->no);
hit->dist = dist;
hit->index = index;
}
@@ -313,7 +313,7 @@ BMVert *BMBVH_FindClosestVert(BMBVHTree *tree, float *co, float maxdist)
{
BVHTreeNearest hit;
VECCOPY(hit.co, co);
copy_v3_v3(hit.co, co);
hit.dist = maxdist*5;
hit.index = -1;
@@ -522,7 +522,7 @@ static float topo_compare(BMesh *bm, BMVert *v1, BMVert *v2)
normal_tri_v3(no2, s2->v->co, s2->lastv->co, l2->v->co);
/*enforce identical winding as no1*/
mul_v3_fl(no2, -1.0);
negate_v3(no2);
angle = angle_v3v3(no1, no2);
if (angle > M_PI/2 - FLT_EPSILON*2)
@@ -667,8 +667,8 @@ BMVert *BMBVH_FindClosestVertTopo(BMBVHTree *tree, float *co, float maxdist, BMV
memset(&hit, 0, sizeof(hit));
VECCOPY(hit.co, co);
VECCOPY(tree->co, co);
copy_v3_v3(hit.co, co);
copy_v3_v3(tree->co, co);
hit.index = -1;
hit.dist = maxdist;
@@ -736,10 +736,10 @@ int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Obje
invert_m4_m4(invmat, obedit->obmat);
mul_m4_v3(invmat, origin);
VECCOPY(co1, e->v1->co);
copy_v3_v3(co1, e->v1->co);
add_v3_v3v3(co2, e->v1->co, e->v2->co);
mul_v3_fl(co2, 0.5f);
VECCOPY(co3, e->v2->co);
copy_v3_v3(co3, e->v2->co);
scale_point(co1, co2, 0.99);
scale_point(co3, co2, 0.99);

View File

@@ -445,7 +445,7 @@ int paintface_minmax(Object *ob, float *min, float *max)
MPoly *mf;
MTexPoly *tf;
MLoop *ml;
MVert *mv;
MVert *mvert;
int a, b, ok=0;
float vec[3], bmat[3][3];
@@ -454,7 +454,7 @@ int paintface_minmax(Object *ob, float *min, float *max)
copy_m3_m4(bmat, ob->obmat);
mv= me->mvert;
mvert= me->mvert;
mf= me->mpoly;
tf= me->mtpoly;
for (a=me->totpoly; a>0; a--, mf++, tf++) {
@@ -463,7 +463,7 @@ int paintface_minmax(Object *ob, float *min, float *max)
ml = me->mloop + mf->totloop;
for (b=0; b<mf->totloop; b++, ml++) {
VECCOPY(vec, (mv+ml->v)->co);
copy_v3_v3(vec, (mvert[ml->v].co));
mul_m3_v3(bmat, vec);
add_v3_v3v3(vec, vec, ob->obmat[3]);
DO_MINMAX(vec, min, max);

View File

@@ -704,8 +704,8 @@ static void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *
static void GPU_buffer_copy_color3(DerivedMesh *dm, float *varray_, int *index, int *mat_orig_to_new, void *user)
{
int i, totface;
unsigned char *varray = (unsigned char *)varray_;
unsigned char *mcol = (unsigned char *)user;
char *varray = (char *)varray_;
char *mcol = (char *)user;
MFace *f = dm->getTessFaceArray(dm);
totface= dm->getNumTessFaces(dm);
@@ -713,16 +713,16 @@ static void GPU_buffer_copy_color3(DerivedMesh *dm, float *varray_, int *index,
int start = index[mat_orig_to_new[f->mat_nr]];
/* v1 v2 v3 */
VECCOPY(&varray[start], &mcol[i*12]);
VECCOPY(&varray[start+3], &mcol[i*12+3]);
VECCOPY(&varray[start+6], &mcol[i*12+6]);
copy_v3_v3_char(&varray[start], &mcol[i*12]);
copy_v3_v3_char(&varray[start+3], &mcol[i*12+3]);
copy_v3_v3_char(&varray[start+6], &mcol[i*12+6]);
index[mat_orig_to_new[f->mat_nr]] += 9;
if(f->v4) {
/* v3 v4 v1 */
VECCOPY(&varray[start+9], &mcol[i*12+6]);
VECCOPY(&varray[start+12], &mcol[i*12+9]);
VECCOPY(&varray[start+15], &mcol[i*12]);
copy_v3_v3_char(&varray[start+9], &mcol[i*12+6]);
copy_v3_v3_char(&varray[start+12], &mcol[i*12+9]);
copy_v3_v3_char(&varray[start+15], &mcol[i*12]);
index[mat_orig_to_new[f->mat_nr]] += 9;
}
}