From e62c0ea835534acf2500ab0b4efcbb7b1eaa3cdd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Jul 2010 06:34:56 +0000 Subject: replace macros VECCOPY and QUATCOPY with inline math functions no functional changes also replace mul_m4_v3() with mul_v3_m4v3() in a few places. --- source/blender/blenkernel/intern/constraint.c | 5 +- source/blender/blenkernel/intern/effect.c | 5 +- source/blender/blenkernel/intern/font.c | 8 +- source/blender/blenkernel/intern/object.c | 6 +- source/blender/editors/armature/editarmature.c | 88 ++++++++++------------ source/blender/editors/space_view3d/view3d_draw.c | 6 +- source/blender/editors/space_view3d/view3d_edit.c | 29 ++++--- .../blender/editors/space_view3d/view3d_select.c | 18 ++--- source/blender/editors/space_view3d/view3d_view.c | 70 ++++++++--------- source/blender/render/intern/source/occlusion.c | 3 +- 10 files changed, 106 insertions(+), 132 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 171276d118e..aae70c055d0 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1127,10 +1127,9 @@ static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstra else { float vec[3]; /* move grabtarget into world space */ - VECCOPY(vec, data->grabtarget); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, data->grabtarget); copy_m4_m4(ct->matrix, ob->obmat); - VECCOPY(ct->matrix[3], vec); + copy_v3_v3(ct->matrix[3], vec); } } else diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index e9283ea867e..5f55814341b 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -433,9 +433,8 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect if(!colls) return visibility; - - VECCOPY(norm, efd->vec_to_point); - negate_v3(norm); + + negate_v3_v3(norm, efd->vec_to_point); len = normalize_v3(norm); // check all collision objects diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index a99f2599f66..7ebd0c3f457 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1194,18 +1194,14 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) ascii = mem[i]; info = &(custrinfo[i]); if (cu->sepchar == (i+1)) { - float vecyo[3]; + float vecyo[3]= {ct->xof, ct->yof, 0.0f}; mem[0] = ascii; mem[1] = 0; custrinfo[0]= *info; cu->pos = 1; cu->len = 1; - vecyo[0] = ct->xof; - vecyo[1] = ct->yof; - vecyo[2] = 0; - mul_m4_v3(ob->obmat, vecyo); - VECCOPY(ob->loc, vecyo); + mul_v3_m4v3(ob->loc, ob->obmat, vecyo); outta = 1; cu->sepchar = 0; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index efff3d138e6..01724b7e9fd 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2324,11 +2324,9 @@ void minmax_object(Object *ob, float *min, float *max) if(ob->pose) { bPoseChannel *pchan; for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { - VECCOPY(vec, pchan->pose_head); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan->pose_head); DO_MINMAX(vec, min, max); - VECCOPY(vec, pchan->pose_tail); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail); DO_MINMAX(vec, min, max); } break; diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index f8e793bd178..5386dbc8b98 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2328,12 +2328,10 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) Object *obedit= scene->obedit; // XXX get from context float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3]; EditBone *bone; - - VECCOPY(curs, give_cursor(scene, v3d)); /* Get inverse point for head and orientation for tail */ invert_m4_m4(obedit->imat, obedit->obmat); - mul_m4_v3(obedit->imat, curs); + mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d)); if (rv3d && (U.flag & USER_ADD_VIEWALIGNED)) copy_m3_m4(obmat, rv3d->viewmat); @@ -2348,7 +2346,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) /* Create a bone */ bone= ED_armature_edit_bone_add(obedit->data, "Bone"); - VECCOPY(bone->head, curs); + copy_v3_v3(bone->head, curs); if (rv3d && (U.flag & USER_ADD_VIEWALIGNED)) add_v3_v3v3(bone->tail, bone->head, imat[1]); // bone with unit length 1 @@ -2941,17 +2939,14 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op) } else if (count == 1) { EditBonePoint *ebp; - float *fp, curs[3]; + float curs[3]; /* Get Points - selected joint */ ebp= (EditBonePoint *)points.first; /* Get points - cursor (tail) */ - fp= give_cursor(scene, v3d); - VECCOPY (curs, fp); - invert_m4_m4(obedit->imat, obedit->obmat); - mul_m4_v3(obedit->imat, curs); + mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d)); /* Create a bone */ newbone= add_points_bone(obedit, ebp->vec, curs); @@ -2979,15 +2974,13 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op) /* find which one should be the 'head' */ if ((ebp->head_owner && ebp2->head_owner) || (ebp->tail_owner && ebp2->tail_owner)) { /* rule: whichever one is closer to 3d-cursor */ - float curs[3], *fp= give_cursor(scene, v3d); + float curs[3]; float vecA[3], vecB[3]; float distA, distB; /* get cursor location */ - VECCOPY(curs, fp); - invert_m4_m4(obedit->imat, obedit->obmat); - mul_m4_v3(obedit->imat, curs); + mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d)); /* get distances */ sub_v3_v3v3(vecA, ebp->vec, curs); @@ -3007,12 +3000,12 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op) /* assign head/tail combinations */ if (headtail == 2) { - VECCOPY(head, ebp->vec); - VECCOPY(tail, ebp2->vec); + copy_v3_v3(head, ebp->vec); + copy_v3_v3(tail, ebp2->vec); } else if (headtail == 1) { - VECCOPY(head, ebp2->vec); - VECCOPY(tail, ebp->vec); + copy_v3_v3(head, ebp2->vec); + copy_v3_v3(tail, ebp->vec); } /* add new bone and parent it to the appropriate end */ @@ -3095,16 +3088,16 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone * - parent = parent of start */ if ((start->flag & BONE_TIPSEL) && ((start->flag & BONE_SELECTED) || start==arm->act_edbone)==0) { - VECCOPY(head, start->tail); + copy_v3_v3(head, start->tail); } else { - VECCOPY(head, start->head); + copy_v3_v3(head, start->head); } if ((end->flag & BONE_ROOTSEL) && ((end->flag & BONE_SELECTED) || end==arm->act_edbone)==0) { - VECCOPY(tail, end->head); + copy_v3_v3(tail, end->head); } else { - VECCOPY(tail, end->tail); + copy_v3_v3(tail, end->tail); } newbone= add_points_bone(obedit, head, tail); newbone->parent = start->parent; @@ -3376,8 +3369,8 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) newbone = MEM_callocN(sizeof(EditBone), "extrudebone"); if (do_extrude==1) { - VECCOPY (newbone->head, ebone->tail); - VECCOPY (newbone->tail, newbone->head); + copy_v3_v3(newbone->head, ebone->tail); + copy_v3_v3(newbone->tail, newbone->head); newbone->parent = ebone; newbone->flag = ebone->flag & BONE_TIPSEL; // copies it, in case mirrored bone @@ -3385,8 +3378,8 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) if (newbone->parent) newbone->flag |= BONE_CONNECTED; } else { - VECCOPY(newbone->head, ebone->head); - VECCOPY(newbone->tail, ebone->head); + copy_v3_v3(newbone->head, ebone->head); + copy_v3_v3(newbone->tail, ebone->head); newbone->parent= ebone->parent; newbone->flag= BONE_TIPSEL; @@ -3476,7 +3469,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "name", name); - VECCOPY(curs, give_cursor(CTX_data_scene(C),CTX_wm_view3d(C))); + copy_v3_v3(curs, give_cursor(CTX_data_scene(C),CTX_wm_view3d(C))); /* Get inverse point for head and orientation for tail */ invert_m4_m4(obedit->imat, obedit->obmat); @@ -3495,7 +3488,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op) /* Create a bone */ bone= ED_armature_edit_bone_add(obedit->data, name); - VECCOPY(bone->head, curs); + copy_v3_v3(bone->head, curs); if(rv3d && (U.flag & USER_ADD_VIEWALIGNED)) add_v3_v3v3(bone->tail, bone->head, imat[1]); // bone with unit length 1 @@ -3565,17 +3558,17 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) BLI_addtail(arm->edbo, newbone); /* calculate location of newbone->head */ - VECCOPY(val1, ebone->head); - VECCOPY(val2, ebone->tail); - VECCOPY(val3, newbone->head); + copy_v3_v3(val1, ebone->head); + copy_v3_v3(val2, ebone->tail); + copy_v3_v3(val3, newbone->head); val3[0]= val1[0]*cutratio + val2[0]*cutratioI; val3[1]= val1[1]*cutratio + val2[1]*cutratioI; val3[2]= val1[2]*cutratio + val2[2]*cutratioI; - VECCOPY(newbone->head, val3); - VECCOPY(newbone->tail, ebone->tail); - VECCOPY(ebone->tail, newbone->head); + copy_v3_v3(newbone->head, val3); + copy_v3_v3(newbone->tail, ebone->tail); + copy_v3_v3(ebone->tail, newbone->head); newbone->rad_head= 0.5f * (ebone->rad_head + ebone->rad_tail); ebone->rad_tail= newbone->rad_head; @@ -3793,7 +3786,7 @@ void ARMATURE_OT_switch_direction(wmOperatorType *ot) static void bone_connect_to_existing_parent(EditBone *bone) { bone->flag |= BONE_CONNECTED; - VECCOPY(bone->head, bone->parent->tail); + copy_v3_v3(bone->head, bone->parent->tail); bone->rad_head = bone->parent->rad_tail; } @@ -3821,7 +3814,7 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo selbone->flag |= BONE_CONNECTED; sub_v3_v3v3(offset, actbone->tail, selbone->head); - VECCOPY(selbone->head, actbone->tail); + copy_v3_v3(selbone->head, actbone->tail); selbone->rad_head= actbone->rad_tail; add_v3_v3(selbone->tail, offset); @@ -4594,7 +4587,7 @@ static void add_vgroups__mapFunc(void *userData, int index, float *co, float *no /* DerivedMesh mapFunc for getting final coords in weight paint mode */ float (*verts)[3] = userData; - VECCOPY(verts[index], co); + copy_v3_v3(verts[index], co); } static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], int numbones, Bone **bonelist, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected, float scale) @@ -4721,18 +4714,17 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m /* compute root and tip */ if (bbone) { - VECCOPY(root[j], bbone[segments].mat[3]); - mul_m4_v3(bone->arm_mat, root[j]); + mul_v3_m4v3(root[j], bone->arm_mat, bbone[segments].mat[3]); if ((segments+1) < bone->segments) { - VECCOPY(tip[j], bbone[segments+1].mat[3]) - mul_m4_v3(bone->arm_mat, tip[j]); + mul_v3_m4v3(tip[j], bone->arm_mat, bbone[segments+1].mat[3]); + } + else { + copy_v3_v3(tip[j], bone->arm_tail); } - else - VECCOPY(tip[j], bone->arm_tail) } else { - VECCOPY(root[j], bone->arm_head); - VECCOPY(tip[j], bone->arm_tail); + copy_v3_v3(root[j], bone->arm_head); + copy_v3_v3(tip[j], bone->arm_tail); } mul_m4_v3(par->obmat, root[j]); @@ -4789,7 +4781,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m /* transform verts to global space */ for (i=0; i < mesh->totvert; i++) { if (!vertsfilled) - VECCOPY(verts[i], mesh->mvert[i].co) + copy_v3_v3(verts[i], mesh->mvert[i].co); mul_m4_v3(ob->obmat, verts[i]); } @@ -5027,14 +5019,14 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) float eul[3], oldeul[3], quat1[4] = {0}; if (pchan->rotmode == ROT_MODE_QUAT) { - QUATCOPY(quat1, pchan->quat); + copy_qt_qt(quat1, pchan->quat); quat_to_eul( oldeul,pchan->quat); } else if (pchan->rotmode == ROT_MODE_AXISANGLE) { axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,pchan->rotAxis, pchan->rotAngle); } else { - VECCOPY(oldeul, pchan->eul); + copy_v3_v3(oldeul, pchan->eul); } eul[0]= eul[1]= eul[2]= 0.0f; @@ -5057,7 +5049,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,eul, EULER_ORDER_DEFAULT); } else { - VECCOPY(pchan->eul, eul); + copy_v3_v3(pchan->eul, eul); } } } // Duplicated in source/blender/editors/object/object_transform.c diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a23a4952b49..38e763e6f88 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -189,7 +189,7 @@ void view3d_clr_clipping(void) static int test_clipping(float *vec, float clip[][4]) { float view[3]; - VECCOPY(view, vec); + copy_v3_v3(view, vec); if(0.0f < clip[0][3] + INPR(view, clip[0])) if(0.0f < clip[1][3] + INPR(view, clip[1])) @@ -1937,9 +1937,9 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar, { float len1, len2, vec[3]; - VECCOPY(vec, rv3d->persinv[0]); + copy_v3_v3(vec, rv3d->persinv[0]); len1= normalize_v3(vec); - VECCOPY(vec, rv3d->persinv[1]); + copy_v3_v3(vec, rv3d->persinv[1]); len2= normalize_v3(vec); rv3d->pixsize= 2.0f*(len1>len2?len1:len2); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index aee4b2515ec..1385482212e 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -206,7 +206,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar) if(rv3dtest->viewlock) { rv3dtest->dist= rv3d->dist; - VECCOPY(rv3dtest->ofs, rv3d->ofs); + copy_v3_v3(rv3dtest->ofs, rv3d->ofs); ED_region_tag_redraw(artest); } } @@ -310,14 +310,14 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) vod->ar= CTX_wm_region(C); vod->rv3d= rv3d= vod->ar->regiondata; vod->dist0= rv3d->dist; - QUATCOPY(vod->oldquat, rv3d->viewquat); + copy_qt_qt(vod->oldquat, rv3d->viewquat); vod->origx= vod->oldx= event->x; vod->origy= vod->oldy= event->y; vod->origkey= event->type; /* the key that triggered the operator. */ vod->use_dyn_ofs= (U.uiflag & USER_ORBIT_SELECTION) ? 1:0; if (vod->use_dyn_ofs) { - VECCOPY(vod->ofs, rv3d->ofs); + copy_v3_v3(vod->ofs, rv3d->ofs); /* If there's no selection, lastofs is unmodified and last value since static */ calculateTransformCenter(C, V3D_CENTROID, lastofs); negate_v3_v3(vod->dyn_ofs, lastofs); @@ -336,8 +336,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) float mat[3][3]; float upvec[3]; - VECCOPY(my_origin, rv3d->ofs); - negate_v3(my_origin); /* ofs is flipped */ + negate_v3_v3(my_origin, rv3d->ofs); /* ofs is flipped */ /* Set the dist value to be the distance from this 3d point */ /* this means youll always be able to zoom into it and panning wont go bad when dist was zero */ @@ -358,7 +357,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) negate_v3_v3(rv3d->ofs, dvec); } negate_v3(vod->dyn_ofs); - VECCOPY(vod->ofs, rv3d->ofs); + copy_v3_v3(vod->ofs, rv3d->ofs); } else { vod->ofs[0] = vod->ofs[1] = vod->ofs[2] = 0.0f; } @@ -538,12 +537,12 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) if (vod->use_dyn_ofs) { /* compute the post multiplication quat, to rotate the offset correctly */ - QUATCOPY(q1, vod->oldquat); + copy_qt_qt(q1, vod->oldquat); conjugate_qt(q1); mul_qt_qtqt(q1, q1, rv3d->viewquat); conjugate_qt(q1); /* conj == inv for unit quat */ - VECCOPY(rv3d->ofs, vod->ofs); + copy_v3_v3(rv3d->ofs, vod->ofs); sub_v3_v3(rv3d->ofs, vod->dyn_ofs); mul_qt_v3(q1, rv3d->ofs); add_v3_v3(rv3d->ofs, vod->dyn_ofs); @@ -1024,7 +1023,7 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my) /* Offset to target position and dolly */ new_dist = rv3d->dist * dfac; - VECCOPY(rv3d->ofs, tvec); + copy_v3_v3(rv3d->ofs, tvec); rv3d->dist = new_dist; /* Calculate final offset */ @@ -1432,11 +1431,9 @@ static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview wi if(pchan->bone->layer & arm->layer) { bPoseChannel *pchan_tx= pchan->custom_tx ? pchan->custom_tx : pchan; ok= 1; - VECCOPY(vec, pchan_tx->pose_head); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_head); DO_MINMAX(vec, min, max); - VECCOPY(vec, pchan_tx->pose_tail); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_tail); DO_MINMAX(vec, min, max); } } @@ -2084,7 +2081,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op) } else if(orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) { /* horizontal axis */ - VECCOPY(q1+1, rv3d->viewinv[0]); + copy_v3_v3(q1+1, rv3d->viewinv[0]); normalize_v3(q1+1); phi= (float)(M_PI/360.0)*U.pad_rot_angle; @@ -2397,7 +2394,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event) fp= give_cursor(scene, v3d); // if(obedit && ctrl) lr_click= 1; - VECCOPY(oldcurs, fp); + copy_v3_v3(oldcurs, fp); mx= event->x - ar->winrct.xmin; my= event->y - ar->winrct.ymin; @@ -2982,7 +2979,7 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode) obofs[2] = -ob->obmat[3][2]; } else { - VECCOPY(obofs, rv3d->ofs); + copy_v3_v3(obofs, rv3d->ofs); } /* calc an adjustment based on distance from camera diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 714297b7807..fc3dea5fd22 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -356,11 +356,9 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, short mcords[][2], if(ob->type!=OB_ARMATURE || ob->pose==NULL) return; for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { - VECCOPY(vec, pchan->pose_head); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan->pose_head); project_short(vc->ar, vec, sco1); - VECCOPY(vec, pchan->pose_tail); - mul_m4_v3(ob->obmat, vec); + mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail); project_short(vc->ar, vec, sco2); if(lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) { @@ -644,11 +642,9 @@ static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short m for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { - VECCOPY(vec, ebone->head); - mul_m4_v3(vc->obedit->obmat, vec); + mul_v3_m4v3(vec, vc->obedit->obmat, ebone->head); project_short(vc->ar, vec, sco1); - VECCOPY(vec, ebone->tail); - mul_m4_v3(vc->obedit->obmat, vec); + mul_v3_m4v3(vec, vc->obedit->obmat, ebone->tail); project_short(vc->ar, vec, sco2); didpoint= 0; @@ -2010,13 +2006,11 @@ static void armature_circle_select(ViewContext *vc, int selecting, short *mval, float vec[3]; /* project head location to screenspace */ - VECCOPY(vec, ebone->head); - mul_m4_v3(vc->obedit->obmat, vec); + mul_v3_m4v3(vec, vc->obedit->obmat, ebone->head); project_short(vc->ar, vec, sco1); /* project tail location to screenspace */ - VECCOPY(vec, ebone->tail); - mul_m4_v3(vc->obedit->obmat, vec); + mul_v3_m4v3(vec, vc->obedit->obmat, ebone->tail); project_short(vc->ar, vec, sco2); /* check if the head and/or tail is in the circle diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index d8982fb68ca..6b1f5736f03 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -194,15 +194,15 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo /* initialize sms */ memset(&sms,0,sizeof(struct SmoothViewStore)); - VECCOPY(sms.new_ofs, rv3d->ofs); - QUATCOPY(sms.new_quat, rv3d->viewquat); + copy_v3_v3(sms.new_ofs, rv3d->ofs); + copy_qt_qt(sms.new_quat, rv3d->viewquat); sms.new_dist= rv3d->dist; sms.new_lens= v3d->lens; sms.to_camera= 0; /* store the options we want to end with */ - if(ofs) VECCOPY(sms.new_ofs, ofs); - if(quat) QUATCOPY(sms.new_quat, quat); + if(ofs) copy_v3_v3(sms.new_ofs, ofs); + if(quat) copy_qt_qt(sms.new_quat, quat); if(dist) sms.new_dist= *dist; if(lens) sms.new_lens= *lens; @@ -243,8 +243,8 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo if (quat && !ofs && !dist) { float vec1[3], vec2[3]; - VECCOPY(vec1, sms.new_quat); - VECCOPY(vec2, sms.orig_quat); + copy_v3_v3(vec1, sms.new_quat); + copy_v3_v3(vec2, sms.orig_quat); normalize_v3(vec1); normalize_v3(vec2); /* scale the time allowed by the rotation */ @@ -257,8 +257,8 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo view3d_settings_from_ob(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens); } else { - VECCOPY(sms.orig_ofs, rv3d->ofs); - QUATCOPY(sms.orig_quat, rv3d->viewquat); + copy_v3_v3(sms.orig_ofs, rv3d->ofs); + copy_qt_qt(sms.orig_quat, rv3d->viewquat); sms.orig_dist= rv3d->dist; sms.orig_lens= v3d->lens; } @@ -289,8 +289,8 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo /* if we get here nothing happens */ if(sms.to_camera==0) { - VECCOPY(rv3d->ofs, sms.new_ofs); - QUATCOPY(rv3d->viewquat, sms.new_quat); + copy_v3_v3(rv3d->ofs, sms.new_ofs); + copy_qt_qt(rv3d->viewquat, sms.new_quat); rv3d->dist = sms.new_dist; v3d->lens = sms.new_lens; } @@ -317,14 +317,14 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event) /* if we went to camera, store the original */ if(sms->to_camera) { rv3d->persp= RV3D_CAMOB; - VECCOPY(rv3d->ofs, sms->orig_ofs); - QUATCOPY(rv3d->viewquat, sms->orig_quat); + copy_v3_v3(rv3d->ofs, sms->orig_ofs); + copy_qt_qt(rv3d->viewquat, sms->orig_quat); rv3d->dist = sms->orig_dist; v3d->lens = sms->orig_lens; } else { - VECCOPY(rv3d->ofs, sms->new_ofs); - QUATCOPY(rv3d->viewquat, sms->new_quat); + copy_v3_v3(rv3d->ofs, sms->new_ofs); + copy_qt_qt(rv3d->viewquat, sms->new_quat); rv3d->dist = sms->new_dist; v3d->lens = sms->new_lens; } @@ -571,9 +571,9 @@ void viewvector(RegionView3D *rv3d, float coord[3], float vec[3]) { float p1[4], p2[4]; - VECCOPY(p1, coord); + copy_v3_v3(p1, coord); p1[3] = 1.0f; - VECCOPY(p2, p1); + copy_v3_v3(p2, p1); p2[3] = 1.0f; mul_m4_v4(rv3d->viewmat, p2); @@ -584,7 +584,7 @@ void viewvector(RegionView3D *rv3d, float coord[3], float vec[3]) sub_v3_v3v3(vec, p1, p2); } else { - VECCOPY(vec, rv3d->viewinv[2]); + copy_v3_v3(vec, rv3d->viewinv[2]); } normalize_v3(vec); } @@ -686,7 +686,7 @@ void view3d_project_float(ARegion *ar, float *vec, float *adr, float mat[4][4]) float vec4[4]; adr[0]= IS_CLIPPED; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(mat, vec4); @@ -713,7 +713,7 @@ int boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) mul_m4_m4m4(mat, obmat, rv3d->persmat); for(a=0; a<8; a++) { - VECCOPY(vec, bb->vec[a]); + copy_v3_v3(vec, bb->vec[a]); vec[3]= 1.0; mul_m4_v4(mat, vec); max= vec[3]; @@ -746,7 +746,7 @@ void project_short(ARegion *ar, float *vec, short *adr) /* clips */ return; } - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -771,7 +771,7 @@ void project_int(ARegion *ar, float *vec, int *adr) float fx, fy, vec4[4]; adr[0]= (int)2140000000.0f; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -795,7 +795,7 @@ void project_int_noclip(ARegion *ar, float *vec, int *adr) RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -820,7 +820,7 @@ void project_short_noclip(ARegion *ar, float *vec, short *adr) float fx, fy, vec4[4]; adr[0]= IS_CLIPPED; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -846,7 +846,7 @@ void project_float(ARegion *ar, float *vec, float *adr) float vec4[4]; adr[0]= IS_CLIPPED; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -862,7 +862,7 @@ void project_float_noclip(ARegion *ar, float *vec, float *adr) RegionView3D *rv3d= ar->regiondata; float vec4[4]; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmat, vec4); @@ -1109,7 +1109,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short float orig_ofs[3]; float orig_dist= rv3d->dist; float orig_lens= v3d->lens; - VECCOPY(orig_ofs, rv3d->ofs); + copy_v3_v3(orig_ofs, rv3d->ofs); /* Switch from camera view */ mat3_to_quat( new_quat,tmat); @@ -1205,11 +1205,11 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) Object *ob= v3d->ob_centre; float vec[3]; - VECCOPY(vec, ob->obmat[3]); + copy_v3_v3(vec, ob->obmat[3]); if(ob->type==OB_ARMATURE && v3d->ob_centre_bone[0]) { bPoseChannel *pchan= get_pose_channel(ob->pose, v3d->ob_centre_bone); if(pchan) { - VECCOPY(vec, pchan->pose_mat[3]); + copy_v3_v3(vec, pchan->pose_mat[3]); mul_m4_v3(ob->obmat, vec); } } @@ -1543,8 +1543,8 @@ static void restore_localviewdata(ScrArea *sa, int free) if(rv3d->localvd) { rv3d->dist= rv3d->localvd->dist; - VECCOPY(rv3d->ofs, rv3d->localvd->ofs); - QUATCOPY(rv3d->viewquat, rv3d->localvd->viewquat); + copy_v3_v3(rv3d->ofs, rv3d->localvd->ofs); + copy_qt_qt(rv3d->viewquat, rv3d->localvd->viewquat); rv3d->view= rv3d->localvd->view; rv3d->persp= rv3d->localvd->persp; rv3d->camzoom= rv3d->localvd->camzoom; @@ -2057,7 +2057,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even /* perspective or ortho */ if (fly->rv3d->persp==RV3D_ORTHO) fly->rv3d->persp= RV3D_PERSP; /*if ortho projection, make perspective */ - QUATCOPY(fly->rot_backup, fly->rv3d->viewquat); + copy_qt_qt(fly->rot_backup, fly->rv3d->viewquat); copy_v3_v3(fly->ofs_backup, fly->rv3d->ofs); fly->rv3d->dist= 0.0f; @@ -2101,8 +2101,8 @@ static int flyEnd(bContext *C, FlyInfo *fly) DAG_id_flush_update(&ob_back->id, OB_RECALC_OB); } else { /* Non Camera we need to reset the view back to the original location bacause the user canceled*/ - QUATCOPY(rv3d->viewquat, fly->rot_backup); - VECCOPY(rv3d->ofs, fly->ofs_backup); + copy_qt_qt(rv3d->viewquat, fly->rot_backup); + copy_v3_v3(rv3d->ofs, fly->ofs_backup); rv3d->persp= fly->persp_backup; } } @@ -2590,7 +2590,7 @@ static int flyApply(bContext *C, FlyInfo *fly) /*were not redrawing but we need to update the time else the view will jump */ fly->time_lastdraw= PIL_check_seconds_timer(); /* end drawing */ - VECCOPY(fly->dvec_prev, dvec); + copy_v3_v3(fly->dvec_prev, dvec); } /* moved to flyEnd() */ @@ -2703,7 +2703,7 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f float orig_dist= rv3d->dist; float orig_lens= v3d->lens; - VECCOPY(orig_ofs, rv3d->ofs); + copy_v3_v3(orig_ofs, rv3d->ofs); rv3d->persp= RV3D_PERSP; rv3d->dist= 0.0; view3d_settings_from_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index ff718359a3e..fb69519236a 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1390,8 +1390,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f if(onlyshadow) envcolor= WO_AOPLAIN; - VECCOPY(nn, n); - negate_v3(nn); + negate_v3_v3(nn, n); occ_lookup(tree, thread, exclude, co, nn, &occ, (tree->doindirect)? rad: NULL, (env && envcolor)? bn: NULL); -- cgit v1.2.3