Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c90
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c12
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c102
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c44
4 files changed, 124 insertions, 124 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index fbd12007c16..c5dccc14b03 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -42,7 +42,7 @@
#include "BKE_object.h"
#include "BKE_utildefines.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BIF_gl.h"
@@ -251,44 +251,44 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac
if(efa->v4) {
#if 0 /* Simple but slow, better reuse normalized vectors */
- uvang1 = RAD2DEG(Vec2Angle3(tf_uv[3], tf_uv[0], tf_uv[1]));
- ang1 = RAD2DEG(VecAngle3(efa->v4->co, efa->v1->co, efa->v2->co));
+ uvang1 = RAD2DEG(angle_v2v2v2(tf_uv[3], tf_uv[0], tf_uv[1]));
+ ang1 = RAD2DEG(angle_v3v3v3(efa->v4->co, efa->v1->co, efa->v2->co));
- uvang2 = RAD2DEG(Vec2Angle3(tf_uv[0], tf_uv[1], tf_uv[2]));
- ang2 = RAD2DEG(VecAngle3(efa->v1->co, efa->v2->co, efa->v3->co));
+ uvang2 = RAD2DEG(angle_v2v2v2(tf_uv[0], tf_uv[1], tf_uv[2]));
+ ang2 = RAD2DEG(angle_v3v3v3(efa->v1->co, efa->v2->co, efa->v3->co));
- uvang3 = RAD2DEG(Vec2Angle3(tf_uv[1], tf_uv[2], tf_uv[3]));
- ang3 = RAD2DEG(VecAngle3(efa->v2->co, efa->v3->co, efa->v4->co));
+ uvang3 = RAD2DEG(angle_v2v2v2(tf_uv[1], tf_uv[2], tf_uv[3]));
+ ang3 = RAD2DEG(angle_v3v3v3(efa->v2->co, efa->v3->co, efa->v4->co));
- uvang4 = RAD2DEG(Vec2Angle3(tf_uv[2], tf_uv[3], tf_uv[0]));
- ang4 = RAD2DEG(VecAngle3(efa->v3->co, efa->v4->co, efa->v1->co));
+ uvang4 = RAD2DEG(angle_v2v2v2(tf_uv[2], tf_uv[3], tf_uv[0]));
+ ang4 = RAD2DEG(angle_v3v3v3(efa->v3->co, efa->v4->co, efa->v1->co));
#endif
/* uv angles */
- VECSUB2D(av1, tf_uv[3], tf_uv[0]); Normalize2(av1);
- VECSUB2D(av2, tf_uv[0], tf_uv[1]); Normalize2(av2);
- VECSUB2D(av3, tf_uv[1], tf_uv[2]); Normalize2(av3);
- VECSUB2D(av4, tf_uv[2], tf_uv[3]); Normalize2(av4);
+ VECSUB2D(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1);
+ VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
+ VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
+ VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4);
/* This is the correct angle however we are only comparing angles
- * uvang1 = 90-((NormalizedVecAngle2_2D(av1, av2) * 180.0/M_PI)-90);*/
- uvang1 = NormalizedVecAngle2_2D(av1, av2)*180.0/M_PI;
- uvang2 = NormalizedVecAngle2_2D(av2, av3)*180.0/M_PI;
- uvang3 = NormalizedVecAngle2_2D(av3, av4)*180.0/M_PI;
- uvang4 = NormalizedVecAngle2_2D(av4, av1)*180.0/M_PI;
+ * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90);*/
+ uvang1 = angle_normalized_v2v2(av1, av2)*180.0/M_PI;
+ uvang2 = angle_normalized_v2v2(av2, av3)*180.0/M_PI;
+ uvang3 = angle_normalized_v2v2(av3, av4)*180.0/M_PI;
+ uvang4 = angle_normalized_v2v2(av4, av1)*180.0/M_PI;
/* 3d angles */
- VECSUB(av1, efa->v4->co, efa->v1->co); Normalize(av1);
- VECSUB(av2, efa->v1->co, efa->v2->co); Normalize(av2);
- VECSUB(av3, efa->v2->co, efa->v3->co); Normalize(av3);
- VECSUB(av4, efa->v3->co, efa->v4->co); Normalize(av4);
+ VECSUB(av1, efa->v4->co, efa->v1->co); normalize_v3(av1);
+ VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
+ VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
+ VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4);
/* This is the correct angle however we are only comparing angles
- * ang1 = 90-((NormalizedVecAngle2(av1, av2) * 180.0/M_PI)-90);*/
- ang1 = NormalizedVecAngle2(av1, av2)*180.0/M_PI;
- ang2 = NormalizedVecAngle2(av2, av3)*180.0/M_PI;
- ang3 = NormalizedVecAngle2(av3, av4)*180.0/M_PI;
- ang4 = NormalizedVecAngle2(av4, av1)*180.0/M_PI;
+ * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90);*/
+ ang1 = angle_normalized_v3v3(av1, av2)*180.0/M_PI;
+ ang2 = angle_normalized_v3v3(av2, av3)*180.0/M_PI;
+ ang3 = angle_normalized_v3v3(av3, av4)*180.0/M_PI;
+ ang4 = angle_normalized_v3v3(av4, av1)*180.0/M_PI;
glBegin(GL_QUADS);
@@ -315,36 +315,36 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac
}
else {
#if 0 /* Simple but slow, better reuse normalized vectors */
- uvang1 = RAD2DEG(Vec2Angle3(tf_uv[2], tf_uv[0], tf_uv[1]));
- ang1 = RAD2DEG(VecAngle3(efa->v3->co, efa->v1->co, efa->v2->co));
+ uvang1 = RAD2DEG(angle_v2v2v2(tf_uv[2], tf_uv[0], tf_uv[1]));
+ ang1 = RAD2DEG(angle_v3v3v3(efa->v3->co, efa->v1->co, efa->v2->co));
- uvang2 = RAD2DEG(Vec2Angle3(tf_uv[0], tf_uv[1], tf_uv[2]));
- ang2 = RAD2DEG(VecAngle3(efa->v1->co, efa->v2->co, efa->v3->co));
+ uvang2 = RAD2DEG(angle_v2v2v2(tf_uv[0], tf_uv[1], tf_uv[2]));
+ ang2 = RAD2DEG(angle_v3v3v3(efa->v1->co, efa->v2->co, efa->v3->co));
uvang3 = M_PI-(uvang1+uvang2);
ang3 = M_PI-(ang1+ang2);
#endif
/* uv angles */
- VECSUB2D(av1, tf_uv[2], tf_uv[0]); Normalize2(av1);
- VECSUB2D(av2, tf_uv[0], tf_uv[1]); Normalize2(av2);
- VECSUB2D(av3, tf_uv[1], tf_uv[2]); Normalize2(av3);
+ VECSUB2D(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1);
+ VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
+ VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
/* This is the correct angle however we are only comparing angles
- * uvang1 = 90-((NormalizedVecAngle2_2D(av1, av2) * 180.0/M_PI)-90); */
- uvang1 = NormalizedVecAngle2_2D(av1, av2)*180.0/M_PI;
- uvang2 = NormalizedVecAngle2_2D(av2, av3)*180.0/M_PI;
- uvang3 = NormalizedVecAngle2_2D(av3, av1)*180.0/M_PI;
+ * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90); */
+ uvang1 = angle_normalized_v2v2(av1, av2)*180.0/M_PI;
+ uvang2 = angle_normalized_v2v2(av2, av3)*180.0/M_PI;
+ uvang3 = angle_normalized_v2v2(av3, av1)*180.0/M_PI;
/* 3d angles */
- VECSUB(av1, efa->v3->co, efa->v1->co); Normalize(av1);
- VECSUB(av2, efa->v1->co, efa->v2->co); Normalize(av2);
- VECSUB(av3, efa->v2->co, efa->v3->co); Normalize(av3);
+ VECSUB(av1, efa->v3->co, efa->v1->co); normalize_v3(av1);
+ VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
+ VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
/* This is the correct angle however we are only comparing angles
- * ang1 = 90-((NormalizedVecAngle2(av1, av2) * 180.0/M_PI)-90); */
- ang1 = NormalizedVecAngle2(av1, av2)*180.0/M_PI;
- ang2 = NormalizedVecAngle2(av2, av3)*180.0/M_PI;
- ang3 = NormalizedVecAngle2(av3, av1)*180.0/M_PI;
+ * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90); */
+ ang1 = angle_normalized_v3v3(av1, av2)*180.0/M_PI;
+ ang2 = angle_normalized_v3v3(av2, av3)*180.0/M_PI;
+ ang3 = angle_normalized_v3v3(av3, av1)*180.0/M_PI;
/* This simple makes the angles display worse then they really are ;)
* 1.0-pow((1.0-a), 2) */
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index f9a849798be..0e5e283d109 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -41,7 +41,7 @@
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
@@ -359,9 +359,9 @@ void uv_center(float uv[][2], float cent[2], int quad)
float uv_area(float uv[][2], int quad)
{
if(quad)
- return AreaF2Dfl(uv[0], uv[1], uv[2]) + AreaF2Dfl(uv[0], uv[2], uv[3]);
+ return area_tri_v2(uv[0], uv[1], uv[2]) + area_tri_v2(uv[0], uv[2], uv[3]);
else
- return AreaF2Dfl(uv[0], uv[1], uv[2]);
+ return area_tri_v2(uv[0], uv[1], uv[2]);
}
void uv_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy)
@@ -473,7 +473,7 @@ static void find_nearest_uv_edge(Scene *scene, Image *ima, EditMesh *em, float c
nverts= efa->v4? 4: 3;
for(i=0; i<nverts; i++) {
- dist= PdistVL2Dfl(co, tf->uv[i], tf->uv[(i+1)%nverts]);
+ dist= dist_to_line_segment_v2(co, tf->uv[i], tf->uv[(i+1)%nverts]);
if(dist < mindist) {
hit->tf= tf;
@@ -534,8 +534,8 @@ static int nearest_uv_between(MTFace *tf, int nverts, int id, float co[2], float
m[0]= co[0]-uv[0];
m[1]= co[1]-uv[1];
- Vec2Subf(v1, tf->uv[id1], tf->uv[id]);
- Vec2Subf(v2, tf->uv[id2], tf->uv[id]);
+ sub_v2_v2v2(v1, tf->uv[id1], tf->uv[id]);
+ sub_v2_v2v2(v2, tf->uv[id2], tf->uv[id]);
/* m and v2 on same side of v-v1? */
c1= v1[0]*m[1] - v1[1]*m[0];
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 20f74085e52..85ccef5cd7d 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -2,7 +2,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_memarena.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_heap.h"
#include "BLI_boxpack2d.h"
@@ -333,8 +333,8 @@ static float p_vec_angle_cos(float *v1, float *v2, float *v3)
d2[1] = v3[1] - v2[1];
d2[2] = v3[2] - v2[2];
- Normalize(d1);
- Normalize(d2);
+ normalize_v3(d1);
+ normalize_v3(d2);
return d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2];
}
@@ -382,7 +382,7 @@ static float p_face_area(PFace *f)
PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
- return AreaT3Dfl(v1->co, v2->co, v3->co);
+ return area_tri_v3(v1->co, v2->co, v3->co);
}
static float p_area_signed(float *v1, float *v2, float *v3)
@@ -1099,7 +1099,7 @@ static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3)
static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys)
{
- float fac= VecLenf(co[0], co[2]) - VecLenf(co[1], co[3]);
+ float fac= len_v3v3(co[0], co[2]) - len_v3v3(co[1], co[3]);
PBool dir = (fac <= 0.0f);
/* the face exists check is there because of a special case: when
@@ -1414,16 +1414,16 @@ static float p_vert_cotan(float *v1, float *v2, float *v3)
{
float a[3], b[3], c[3], clen;
- VecSubf(a, v2, v1);
- VecSubf(b, v3, v1);
- Crossf(c, a, b);
+ sub_v3_v3v3(a, v2, v1);
+ sub_v3_v3v3(b, v3, v1);
+ cross_v3_v3v3(c, a, b);
- clen = VecLength(c);
+ clen = len_v3(c);
if (clen == 0.0f)
return 0.0f;
- return Inpf(a, b)/clen;
+ return dot_v3v3(a, b)/clen;
}
static PBool p_vert_flipped_wheel_triangle(PVert *v)
@@ -1752,15 +1752,15 @@ static PBool p_collapse_normal_flipped(float *v1, float *v2, float *vold, float
{
float nold[3], nnew[3], sub1[3], sub2[3];
- VecSubf(sub1, vold, v1);
- VecSubf(sub2, vold, v2);
- Crossf(nold, sub1, sub2);
+ sub_v3_v3v3(sub1, vold, v1);
+ sub_v3_v3v3(sub2, vold, v2);
+ cross_v3_v3v3(nold, sub1, sub2);
- VecSubf(sub1, vnew, v1);
- VecSubf(sub2, vnew, v2);
- Crossf(nnew, sub1, sub2);
+ sub_v3_v3v3(sub1, vnew, v1);
+ sub_v3_v3v3(sub2, vnew, v2);
+ cross_v3_v3v3(nnew, sub1, sub2);
- return (Inpf(nold, nnew) <= 0.0f);
+ return (dot_v3v3(nold, nnew) <= 0.0f);
}
static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
@@ -1866,7 +1866,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
oldf1 = (edge)? edge->face: NULL;
oldf2 = (pair)? pair->face: NULL;
- VecSubf(edgevec, keepv->co, oldv->co);
+ sub_v3_v3v3(edgevec, keepv->co, oldv->co);
e = oldv->edge;
do {
@@ -1878,16 +1878,16 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
float tetrav2[3], tetrav3[3], c[3];
/* tetrahedron volume = (1/3!)*|a.(b x c)| */
- VecSubf(tetrav2, co1, oldv->co);
- VecSubf(tetrav3, co2, oldv->co);
- Crossf(c, tetrav2, tetrav3);
+ sub_v3_v3v3(tetrav2, co1, oldv->co);
+ sub_v3_v3v3(tetrav3, co2, oldv->co);
+ cross_v3_v3v3(c, tetrav2, tetrav3);
- volumecost += fabs(Inpf(edgevec, c)/6.0f);
+ volumecost += fabs(dot_v3v3(edgevec, c)/6.0f);
#if 0
- shapecost += Inpf(co1, keepv->co);
+ shapecost += dot_v3v3(co1, keepv->co);
if (p_wheel_edge_next(e) == NULL)
- shapecost += Inpf(co2, keepv->co);
+ shapecost += dot_v3v3(co2, keepv->co);
#endif
p_triangle_angles(oldv->co, co1, co2, &a1, &a2, &a3);
@@ -1915,10 +1915,10 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
PVert *v1 = p_boundary_edge_prev(oldv->edge)->vert;
PVert *v2 = p_boundary_edge_next(oldv->edge)->vert;
- areacost = AreaT3Dfl(oldv->co, v1->co, v2->co);
+ areacost = area_tri_v3(oldv->co, v1->co, v2->co);
}
- elen = VecLength(edgevec);
+ elen = len_v3(edgevec);
weight = 1.0f; /* 0.2f */
cost = weight*volumecost*volumecost + elen*elen*areacost*areacost;
#if 0
@@ -2750,7 +2750,7 @@ static void p_chart_pin_positions(PChart *chart, PVert **pin1, PVert **pin2)
int diru, dirv, dirx, diry;
float sub[3];
- VecSubf(sub, (*pin1)->co, (*pin2)->co);
+ sub_v3_v3v3(sub, (*pin1)->co, (*pin2)->co);
sub[0] = fabs(sub[0]);
sub[1] = fabs(sub[1]);
sub[2] = fabs(sub[2]);
@@ -3185,35 +3185,35 @@ static float p_face_stretch(PFace *f)
w= 1.0f/(2.0f*area);
/* compute derivatives */
- VecCopyf(Ps, v1->co);
- VecMulf(Ps, (v2->uv[1] - v3->uv[1]));
+ copy_v3_v3(Ps, v1->co);
+ mul_v3_fl(Ps, (v2->uv[1] - v3->uv[1]));
- VecCopyf(tmp, v2->co);
- VecMulf(tmp, (v3->uv[1] - v1->uv[1]));
- VecAddf(Ps, Ps, tmp);
+ copy_v3_v3(tmp, v2->co);
+ mul_v3_fl(tmp, (v3->uv[1] - v1->uv[1]));
+ add_v3_v3v3(Ps, Ps, tmp);
- VecCopyf(tmp, v3->co);
- VecMulf(tmp, (v1->uv[1] - v2->uv[1]));
- VecAddf(Ps, Ps, tmp);
+ copy_v3_v3(tmp, v3->co);
+ mul_v3_fl(tmp, (v1->uv[1] - v2->uv[1]));
+ add_v3_v3v3(Ps, Ps, tmp);
- VecMulf(Ps, w);
+ mul_v3_fl(Ps, w);
- VecCopyf(Pt, v1->co);
- VecMulf(Pt, (v3->uv[0] - v2->uv[0]));
+ copy_v3_v3(Pt, v1->co);
+ mul_v3_fl(Pt, (v3->uv[0] - v2->uv[0]));
- VecCopyf(tmp, v2->co);
- VecMulf(tmp, (v1->uv[0] - v3->uv[0]));
- VecAddf(Pt, Pt, tmp);
+ copy_v3_v3(tmp, v2->co);
+ mul_v3_fl(tmp, (v1->uv[0] - v3->uv[0]));
+ add_v3_v3v3(Pt, Pt, tmp);
- VecCopyf(tmp, v3->co);
- VecMulf(tmp, (v2->uv[0] - v1->uv[0]));
- VecAddf(Pt, Pt, tmp);
+ copy_v3_v3(tmp, v3->co);
+ mul_v3_fl(tmp, (v2->uv[0] - v1->uv[0]));
+ add_v3_v3v3(Pt, Pt, tmp);
- VecMulf(Pt, w);
+ mul_v3_fl(Pt, w);
/* Sander Tensor */
- a= Inpf(Ps, Ps);
- c= Inpf(Pt, Pt);
+ a= dot_v3v3(Ps, Ps);
+ c= dot_v3v3(Pt, Pt);
T = sqrt(0.5f*(a + c));
if (f->flag & PFACE_FILLED)
@@ -3273,7 +3273,7 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
low = 0;
stretch_low = orig_stretch;
- Vec2Addf(v->uv, orig_uv, dir);
+ add_v2_v2v2(v->uv, orig_uv, dir);
high = 1;
stretch = stretch_high = p_stretch_compute_vertex(v);
@@ -3296,7 +3296,7 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
/* no luck, stretch has increased, reset to old values */
if(stretch >= orig_stretch)
- Vec2Copyf(v->uv, orig_uv);
+ copy_v2_v2(v->uv, orig_uv);
}
}
@@ -3404,7 +3404,7 @@ static float p_rectangle_area(float *p1, float *dir, float *p2, float *p3, float
if (!p_intersect_line_2d_dir(p3, dir, p4, orthodir, corner3))
return 1e10;
- return Vec2Lenf(corner1, corner2)*Vec2Lenf(corner2, corner3);
+ return len_v2v2(corner1, corner2)*len_v2v2(corner2, corner3);
}
static float p_chart_minimum_area_angle(PChart *chart)
@@ -3499,7 +3499,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
p3 = points[idx[(mini+2)%4]];
p4 = points[idx[(mini+3)%4]];
- len = Vec2Lenf(p1->uv, p1n->uv);
+ len = len_v2v2(p1->uv, p1n->uv);
if (len > 0.0f) {
len = 1.0/len;
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 29d9bb4864e..792026a798d 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -48,7 +48,7 @@
#include "BKE_mesh.h"
#include "BKE_utildefines.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
@@ -563,7 +563,7 @@ static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, Ob
if(efa->v4) DO_MINMAX(efa->v4->co, min, max);
}
}
- VecMidf(result, min, max);
+ mid_v3_v3v3(result, min, max);
break;
case V3D_CURSOR: /*cursor center*/
@@ -590,23 +590,23 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
/* get rotation of the current view matrix */
if(rv3d)
- Mat4CpyMat4(viewmatrix, rv3d->viewmat);
+ copy_m4_m4(viewmatrix, rv3d->viewmat);
else
- Mat4One(viewmatrix);
+ unit_m4(viewmatrix);
/* but shifting */
for(k=0; k<4; k++)
viewmatrix[3][k] =0.0f;
/* get rotation of the current object matrix */
- Mat4CpyMat4(rotobj,ob->obmat);
+ copy_m4_m4(rotobj,ob->obmat);
/* but shifting */
for(k=0; k<4; k++)
rotobj[3][k] =0.0f;
- Mat4Clr(*rotup);
- Mat4Clr(*rotside);
+ zero_m4(*rotup);
+ zero_m4(*rotside);
/* compensate front/side.. against opengl x,y,z world definition */
/* this is "kanonen gegen spatzen", a few plus minus 1 will do here */
@@ -626,7 +626,7 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
rotup[0][0]= (float)1.0f/radius;
/* calculate transforms*/
- Mat4MulSerie(result, rotup, rotside, viewmatrix, rotobj, NULL, NULL, NULL, NULL);
+ mul_serie_m4(result, rotup, rotside, viewmatrix, rotobj, NULL, NULL, NULL, NULL);
}
static void uv_map_transform(bContext *C, wmOperator *op, float center[3], float rotmat[4][4])
@@ -657,7 +657,7 @@ static void uv_map_transform(bContext *C, wmOperator *op, float center[3], float
/* be compatible to the "old" sphere/cylinder mode */
if(direction == ALIGN_TO_OBJECT)
- Mat4One(rotmat);
+ unit_m4(rotmat);
else
uv_map_rotation_matrix(rotmat, rv3d, obedit, upangledeg, sideangledeg, radius);
@@ -873,7 +873,7 @@ static void uv_from_view_bounds(float target[2], float source[3], float rotmat[4
{
float pv[3];
- Mat4MulVecfl(rotmat, pv);
+ mul_m4_v3(rotmat, pv);
/* ortho projection */
target[0] = -pv[0];
@@ -885,19 +885,19 @@ static void uv_from_view(ARegion *ar, float target[2], float source[3], float ro
RegionView3D *rv3d= ar->regiondata;
float pv[3], pv4[4], dx, dy, x= 0.0, y= 0.0;
- Mat4MulVecfl(rotmat, pv);
+ mul_m4_v3(rotmat, pv);
dx= ar->winx;
dy= ar->winy;
- VecCopyf(pv4, source);
+ copy_v3_v3(pv4, source);
pv4[3]= 1.0;
/* rotmat is the object matrix in this case */
- Mat4MulVec4fl(rotmat, pv4);
+ mul_m4_v4(rotmat, pv4);
/* almost project_short */
- Mat4MulVec4fl(rv3d->persmat, pv4);
+ mul_m4_v4(rv3d->persmat, pv4);
if(fabs(pv4[3]) > 0.00001) { /* avoid division by zero */
target[0] = dx/2.0 + (dx/2.0)*pv4[0]/pv4[3];
target[1] = dy/2.0 + (dy/2.0)*pv4[1]/pv4[3];
@@ -954,7 +954,7 @@ static int from_view_exec(bContext *C, wmOperator *op)
}
}
else {
- Mat4CpyMat4(rotmat, obedit->obmat);
+ copy_m4_m4(rotmat, obedit->obmat);
for(efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
@@ -1063,10 +1063,10 @@ static void uv_sphere_project(float target[2], float source[3], float center[3],
{
float pv[3];
- VecSubf(pv, source, center);
- Mat4MulVecfl(rotmat, pv);
+ sub_v3_v3v3(pv, source, center);
+ mul_m4_v3(rotmat, pv);
- spheremap(pv[0], pv[1], pv[2], &target[0], &target[1]);
+ map_to_sphere( &target[0], &target[1],pv[0], pv[1], pv[2]);
/* split line is always zero */
if(target[0] >= 1.0f)
@@ -1155,10 +1155,10 @@ static void uv_cylinder_project(float target[2], float source[3], float center[3
{
float pv[3];
- VecSubf(pv, source, center);
- Mat4MulVecfl(rotmat, pv);
+ sub_v3_v3v3(pv, source, center);
+ mul_m4_v3(rotmat, pv);
- tubemap(pv[0], pv[1], pv[2], &target[0], &target[1]);
+ map_to_tube( &target[0], &target[1],pv[0], pv[1], pv[2]);
/* split line is always zero */
if(target[0] >= 1.0f)
@@ -1248,7 +1248,7 @@ static int cube_project_exec(bContext *C, wmOperator *op)
for(efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, no);
+ normal_tri_v3( no,efa->v1->co, efa->v2->co, efa->v3->co);
no[0]= fabs(no[0]);
no[1]= fabs(no[1]);