[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52230] trunk/blender/source/blender: code cleanup: move local math functions into math_geom.c, math_vector.c, no functional changes.
Campbell Barton
ideasman42 at gmail.com
Thu Nov 15 14:24:15 CET 2012
Revision: 52230
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52230
Author: campbellbarton
Date: 2012-11-15 13:24:14 +0000 (Thu, 15 Nov 2012)
Log Message:
-----------
code cleanup: move local math functions into math_geom.c, math_vector.c, no functional changes.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_geom.h
trunk/blender/source/blender/blenlib/BLI_math_vector.h
trunk/blender/source/blender/blenlib/intern/math_geom.c
trunk/blender/source/blender/blenlib/intern/math_vector.c
trunk/blender/source/blender/bmesh/operators/bmo_bevel.c
trunk/blender/source/blender/editors/object/object_bake.c
trunk/blender/source/blender/makesdna/DNA_text_types.h
Modified: trunk/blender/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_geom.h 2012-11-15 13:11:12 UTC (rev 52229)
+++ trunk/blender/source/blender/blenlib/BLI_math_geom.h 2012-11-15 13:24:14 UTC (rev 52230)
@@ -187,6 +187,10 @@
void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]);
void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]);
+/* use to find the point of a UV on a face */
+void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3]);
+void interp_barycentric_tri_v3(float data[3][3], float u, float v, float res[3]);
+
/***************************** View & Projection *****************************/
void lookat_m4(float mat[4][4], float vx, float vy,
Modified: trunk/blender/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_vector.h 2012-11-15 13:11:12 UTC (rev 52229)
+++ trunk/blender/source/blender/blenlib/BLI_math_vector.h 2012-11-15 13:24:14 UTC (rev 52230)
@@ -169,6 +169,7 @@
void mid_v3_v3v3(float r[3], const float a[3], const float b[3]);
void mid_v2_v2v2(float r[2], const float a[2], const float b[2]);
+void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3]);
/********************************* Comparison ********************************/
Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c 2012-11-15 13:11:12 UTC (rev 52229)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c 2012-11-15 13:24:14 UTC (rev 52230)
@@ -2399,6 +2399,33 @@
#undef IS_ZERO
+/* reverse of the functions above */
+void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3])
+{
+ float vec[3];
+
+ copy_v3_v3(res, data[0]);
+ mul_v3_fl(res, (1 - u) * (1 - v));
+ copy_v3_v3(vec, data[1]);
+ mul_v3_fl(vec, u * (1 - v)); add_v3_v3(res, vec);
+ copy_v3_v3(vec, data[2]);
+ mul_v3_fl(vec, u * v); add_v3_v3(res, vec);
+ copy_v3_v3(vec, data[3]);
+ mul_v3_fl(vec, (1 - u) * v); add_v3_v3(res, vec);
+}
+
+void interp_barycentric_tri_v3(float data[3][3], float u, float v, float res[3])
+{
+ float vec[3];
+
+ copy_v3_v3(res, data[0]);
+ mul_v3_fl(res, u);
+ copy_v3_v3(vec, data[1]);
+ mul_v3_fl(vec, v); add_v3_v3(res, vec);
+ copy_v3_v3(vec, data[2]);
+ mul_v3_fl(vec, 1.0f - u - v); add_v3_v3(res, vec);
+}
+
/***************************** View & Projection *****************************/
void orthographic_m4(float matrix[][4], const float left, const float right, const float bottom, const float top,
Modified: trunk/blender/source/blender/blenlib/intern/math_vector.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_vector.c 2012-11-15 13:11:12 UTC (rev 52229)
+++ trunk/blender/source/blender/blenlib/intern/math_vector.c 2012-11-15 13:24:14 UTC (rev 52230)
@@ -115,6 +115,13 @@
v[1] = 0.5f * (v1[1] + v2[1]);
}
+void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3])
+{
+ v[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
+ v[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
+ v[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
+}
+
/********************************** Angles ***********************************/
/* Return the angle in radians between vecs 1-2 and 2-3 in radians
Modified: trunk/blender/source/blender/bmesh/operators/bmo_bevel.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_bevel.c 2012-11-15 13:11:12 UTC (rev 52229)
+++ trunk/blender/source/blender/bmesh/operators/bmo_bevel.c 2012-11-15 13:24:14 UTC (rev 52230)
@@ -115,7 +115,7 @@
/* Make a new BoundVert of the given kind, insert it at the end of the circular linked
* list with entry point bv->boundstart, and return it. */
-static BoundVert *add_new_bound_vert(MemArena *mem_arena, VMesh *vm, float co[3])
+static BoundVert *add_new_bound_vert(MemArena *mem_arena, VMesh *vm, const float co[3])
{
BoundVert *ans = (BoundVert *)BLI_memarena_alloc(mem_arena, sizeof(BoundVert));
@@ -383,7 +383,8 @@
if (fabs(angle_v3v3(dir1, dir2)) < BEVEL_EPSILON) {
/* lines are parallel; off1a is a good meet point */
copy_v3_v3(meetco, off1a);
- } else if (!isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2)) {
+ }
+ else if (!isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2)) {
/* another test says they are parallel */
copy_v3_v3(meetco, off1a);
}
@@ -392,7 +393,7 @@
/* Offset by e->offset in plane with normal plane_no, on left if left==TRUE,
* else on right. If no is NULL, choose an arbitrary plane different
* from eh's direction. */
-static void offset_in_plane(EdgeHalf *e, float plane_no[3], int left, float r[3])
+static void offset_in_plane(EdgeHalf *e, const float plane_no[3], int left, float r[3])
{
float dir[3], no[3];
BMVert *v;
@@ -434,7 +435,7 @@
}
/* Calculate the point on e where line (co_a, co_b) comes closest to and return it in projco */
-static void project_to_edge(BMEdge *e, float co_a[3], float co_b[3], float projco[3])
+static void project_to_edge(BMEdge *e, const float co_a[3], const float co_b[3], float projco[3])
{
float otherco[3];
@@ -471,7 +472,7 @@
* of that segment in r.
*/
static void get_point_on_round_profile(float r[3], float offset, int i, int count,
- float va[3], float v[3], float vb[3])
+ const float va[3], const float v[3], const float vb[3])
{
float vva[3], vvb[3], angle, center[3], rv[3], axis[3], co[3];
@@ -514,7 +515,8 @@
* If va, vmid, and vb are all on the same plane, just interpolate between va and vb.
*/
static void get_point_on_round_edge(EdgeHalf *e, int i,
- float va[3], float vmid[3], float vb[3], float profileco[3])
+ const float va[3], const float vmid[3], const float vb[3],
+ float profileco[3])
{
float vva[3], vvb[3], point[3], dir[3], vaadj[3], vbadj[3], p2[3], pn[3];
int n = e->seg;
@@ -547,13 +549,6 @@
}
}
-static void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3])
-{
- v[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
- v[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
- v[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
-}
-
/* Make a circular list of BoundVerts for bv, each of which has the coordinates
* of a vertex on the the boundary of the beveled vertex bv->v.
* Also decide on the mesh pattern that will be used inside the boundary.
Modified: trunk/blender/source/blender/editors/object/object_bake.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_bake.c 2012-11-15 13:11:12 UTC (rev 52229)
+++ trunk/blender/source/blender/editors/object/object_bake.c 2012-11-15 13:24:14 UTC (rev 52230)
@@ -451,32 +451,6 @@
}
}
-static void interp_bilinear_quad_data(float data[4][3], float u, float v, float res[3])
-{
- float vec[3];
-
- copy_v3_v3(res, data[0]);
- mul_v3_fl(res, (1 - u) * (1 - v));
- copy_v3_v3(vec, data[1]);
- mul_v3_fl(vec, u * (1 - v)); add_v3_v3(res, vec);
- copy_v3_v3(vec, data[2]);
- mul_v3_fl(vec, u * v); add_v3_v3(res, vec);
- copy_v3_v3(vec, data[3]);
- mul_v3_fl(vec, (1 - u) * v); add_v3_v3(res, vec);
-}
-
-static void interp_barycentric_tri_data(float data[3][3], float u, float v, float res[3])
-{
- float vec[3];
-
- copy_v3_v3(res, data[0]);
- mul_v3_fl(res, u);
- copy_v3_v3(vec, data[1]);
- mul_v3_fl(vec, v); add_v3_v3(res, vec);
- copy_v3_v3(vec, data[2]);
- mul_v3_fl(vec, 1.0f - u - v); add_v3_v3(res, vec);
-}
-
/* mode = 0: interpolate normals,
* mode = 1: interpolate coord */
static void interp_bilinear_grid(CCGKey *key, CCGElem *grid, float crn_x, float crn_y, int mode, float res[3])
@@ -507,7 +481,7 @@
copy_v3_v3(data[3], CCG_grid_elem_co(key, grid, x0, y1));
}
- interp_bilinear_quad_data(data, u, v, res);
+ interp_bilinear_quad_v3(data, u, v, res);
}
static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm,
@@ -579,7 +553,7 @@
dm->getVertCo(dm, mface->v4, data[3]);
}
- interp_bilinear_quad_data(data, u, v, res);
+ interp_bilinear_quad_v3(data, u, v, res);
}
/* mode = 0: interpolate normals,
@@ -599,7 +573,7 @@
dm->getVertCo(dm, mface->v3, data[2]);
}
- interp_barycentric_tri_data(data, u, v, res);
+ interp_barycentric_tri_v3(data, u, v, res);
}
static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
Modified: trunk/blender/source/blender/makesdna/DNA_text_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_text_types.h 2012-11-15 13:11:12 UTC (rev 52229)
+++ trunk/blender/source/blender/makesdna/DNA_text_types.h 2012-11-15 13:24:14 UTC (rev 52230)
@@ -78,7 +78,6 @@
/* text flags */
#define TXT_ISDIRTY 0x0001
-#define TXT_DEPRECATED 0x0004 /* deprecated ISTMP flag */
#define TXT_ISMEM 0x0004
#define TXT_ISEXT 0x0008
#define TXT_ISSCRIPT 0x0010 /* used by space handler scriptlinks */
More information about the Bf-blender-cvs
mailing list