[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46901] trunk/blender/source/blender/ modifiers/intern/MOD_skin.c: style cleanu: skin modifier
Campbell Barton
ideasman42 at gmail.com
Tue May 22 17:57:43 CEST 2012
Revision: 46901
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46901
Author: campbellbarton
Date: 2012-05-22 15:57:42 +0000 (Tue, 22 May 2012)
Log Message:
-----------
style cleanu: skin modifier
Modified Paths:
--------------
trunk/blender/source/blender/modifiers/intern/MOD_skin.c
Modified: trunk/blender/source/blender/modifiers/intern/MOD_skin.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_skin.c 2012-05-22 15:55:02 UTC (rev 46900)
+++ trunk/blender/source/blender/modifiers/intern/MOD_skin.c 2012-05-22 15:57:42 UTC (rev 46901)
@@ -83,7 +83,7 @@
typedef struct {
float mat[3][3];
/* Vert that edge is pointing away from, no relation to
- MEdge.v1 */
+ * MEdge.v1 */
int origin;
} EMat;
@@ -130,17 +130,17 @@
} SkinOutput;
static void add_poly(SkinOutput *so,
- BMVert *v1,
- BMVert *v2,
- BMVert *v3,
- BMVert *v4);
+ BMVert *v1,
+ BMVert *v2,
+ BMVert *v3,
+ BMVert *v4);
/***************************** Convex Hull ****************************/
static int is_quad_symmetric(BMVert *quad[4],
- const SkinModifierData *smd)
+ const SkinModifierData *smd)
{
- const float threshold = 0.0001;
+ const float threshold = 0.0001f;
int axis;
for (axis = 0; axis < 3; axis++) {
@@ -170,7 +170,7 @@
/* Returns true if the quad crosses the plane of symmetry, false otherwise */
static int quad_crosses_symmetry_plane(BMVert *quad[4],
- const SkinModifierData *smd)
+ const SkinModifierData *smd)
{
int axis;
@@ -196,7 +196,7 @@
/* Returns true if the frame is filled by precisely two faces (and
* outputs those faces to fill_faces), otherwise returns false. */
static int skin_frame_find_contained_faces(const Frame *frame,
- BMFace *fill_faces[2])
+ BMFace *fill_faces[2])
{
BMEdge *diag;
@@ -272,10 +272,10 @@
Frame *frame = frames[i];
if (!frame->detached &&
- (!BM_edge_exists(frame->verts[0], frame->verts[1]) ||
- !BM_edge_exists(frame->verts[1], frame->verts[2]) ||
- !BM_edge_exists(frame->verts[2], frame->verts[3]) ||
- !BM_edge_exists(frame->verts[3], frame->verts[0])))
+ (!BM_edge_exists(frame->verts[0], frame->verts[1]) ||
+ !BM_edge_exists(frame->verts[1], frame->verts[2]) ||
+ !BM_edge_exists(frame->verts[2], frame->verts[3]) ||
+ !BM_edge_exists(frame->verts[3], frame->verts[0])))
{
frame->detached = TRUE;
}
@@ -328,7 +328,7 @@
static float frame_len(const Frame *frame)
{
return (len_v3v3(frame->co[0], frame->co[1]) +
- len_v3v3(frame->co[1], frame->co[2])) * 0.5f;
+ len_v3v3(frame->co[1], frame->co[2])) * 0.5f;
}
static void merge_frame_corners(Frame **frames, int totframe)
@@ -373,11 +373,11 @@
* 'near' is based in the frames' minimum side
* length */
dist = len_v3v3(frames[i]->co[j],
- frames[k]->co[l]);
+ frames[k]->co[l]);
if (dist < thresh) {
mid_v3_v3v3(mid,
- frames[i]->co[j],
- frames[k]->co[l]);
+ frames[i]->co[j],
+ frames[k]->co[l]);
copy_v3_v3(frames[i]->co[j], mid);
copy_v3_v3(frames[k]->co[l], mid);
@@ -396,16 +396,16 @@
}
static Frame **collect_hull_frames(int v, SkinNode *frames,
- const MeshElemMap *emap, const MEdge *medge,
- int *tothullframe)
+ const MeshElemMap *emap, const MEdge *medge,
+ int *tothullframe)
{
SkinNode *f;
Frame **hull_frames;
int nbr, i;
(*tothullframe) = emap[v].count;
- hull_frames = MEM_callocN(sizeof(Frame **) * (*tothullframe),
- "hull_from_frames.hull_frames");
+ hull_frames = MEM_callocN(sizeof(Frame * *) * (*tothullframe),
+ "hull_from_frames.hull_frames");
i = 0;
for (nbr = 0; nbr < emap[v].count; nbr++) {
const MEdge *e = &medge[emap[v].indices[nbr]];
@@ -436,8 +436,8 @@
}
static void create_frame(Frame *frame, const float co[3],
- const float radius[2],
- float mat[3][3], float offset)
+ const float radius[2],
+ float mat[3][3], float offset)
{
float rx[3], ry[3], rz[3];
int i;
@@ -468,8 +468,8 @@
}
static void end_node_frames(int v, SkinNode *skin_nodes, const MVert *mvert,
- const MVertSkin *nodes, const MeshElemMap *emap,
- EMat *emat)
+ const MVertSkin *nodes, const MeshElemMap *emap,
+ EMat *emat)
{
const float *rad = nodes[v].radius;
float mat[3][3];
@@ -537,8 +537,8 @@
}
static void connection_node_frames(int v, SkinNode *skin_nodes, const MVert *mvert,
- const MVertSkin *nodes, const MeshElemMap *emap,
- EMat *emat)
+ const MVertSkin *nodes, const MeshElemMap *emap,
+ EMat *emat)
{
const float *rad = nodes[v].radius;
float mat[3][3];
@@ -575,8 +575,8 @@
}
static SkinNode *build_frames(const MVert *mvert, int totvert,
- const MVertSkin *nodes, const MeshElemMap *emap,
- EMat *emat)
+ const MVertSkin *nodes, const MeshElemMap *emap,
+ EMat *emat)
{
SkinNode *skin_nodes;
int v;
@@ -628,15 +628,15 @@
}
static void build_emats_rec(int *visited_e, EMat *emat,
- const MeshElemMap *emap, const MEdge *medge,
- const MVertSkin *vs, const MVert *mvert,
- int parent_v, float parent_mat[3][3])
+ const MeshElemMap *emap, const MEdge *medge,
+ const MVertSkin *vs, const MVert *mvert,
+ int parent_v, float parent_mat[3][3])
{
float axis[3], angle;
int i, e, v, parent_is_branch;
parent_is_branch = ((emap[parent_v].count > 2) ||
- (vs[parent_v].flag & MVERT_SKIN_ROOT));
+ (vs[parent_v].flag & MVERT_SKIN_ROOT));
for (i = 0; i < emap[parent_v].count; i++) {
e = emap[parent_v].indices[i];
@@ -651,7 +651,7 @@
/* If parent is a branch node, start a new edge chain */
if (parent_is_branch) {
calc_edge_mat(emat[e].mat, mvert[parent_v].co,
- mvert[v].co);
+ mvert[v].co);
}
else {
/* Build edge matrix guided by parent matrix */
@@ -665,12 +665,12 @@
}
build_emats_rec(visited_e, emat, emap, medge,
- vs, mvert, v, emat[e].mat);
+ vs, mvert, v, emat[e].mat);
}
}
static EMat *build_edge_mats(MVertSkin *vs, MVert *mvert, int totvert,
- MEdge *medge, MeshElemMap *emap, int totedge)
+ MEdge *medge, MeshElemMap *emap, int totedge)
{
EMat *emat;
float mat[3][3];
@@ -685,7 +685,7 @@
if (emap[v].count >= 1) {
const MEdge *e = &medge[emap[v].indices[0]];
calc_edge_mat(mat, mvert[v].co,
- mvert[BKE_mesh_edge_other_vert(e, v)].co);
+ mvert[BKE_mesh_edge_other_vert(e, v)].co);
build_emats_rec(visited_e, emat, emap, medge, vs, mvert, v, mat);
}
}
@@ -705,7 +705,7 @@
* having any special cases for dealing with sharing a frame between
* two hulls.) */
static int calc_edge_subdivisions(const MVert *mvert, const MVertSkin *nodes,
- const MEdge *e, int *degree)
+ const MEdge *e, int *degree)
{
const MVertSkin *evs[2] = {&nodes[e->v1], &nodes[e->v2]};
float edge_len, avg[2];
@@ -716,7 +716,7 @@
/* If either end is a branch node marked 'loose', don't subdivide
* the edge (or subdivide just twice if both are branches) */
if ((v1_branch && (evs[0]->flag & MVERT_SKIN_LOOSE)) ||
- (v2_branch && (evs[1]->flag & MVERT_SKIN_LOOSE))) {
+ (v2_branch && (evs[1]->flag & MVERT_SKIN_LOOSE))) {
if (v1_branch && v2_branch)
return 2;
else
@@ -769,7 +769,7 @@
edge_subd = MEM_callocN(sizeof(int) * totorigedge, "edge_subd");
for (i = 0, totsubd = 0; i < totorigedge; i++) {
edge_subd[i] += calc_edge_subdivisions(origvert, orignode,
- &origedge[i], degree);
+ &origedge[i], degree);
totsubd += edge_subd[i];
}
@@ -777,9 +777,9 @@
/* Allocate output derivedmesh */
dm = CDDM_from_template(orig,
- totorigvert + totsubd,
- totorigedge + totsubd,
- 0, 0, 0);
+ totorigvert + totsubd,
+ totorigedge + totsubd,
+ 0, 0, 0);
outvert = dm->getVertArray(dm);
outedge = dm->getEdgeArray(dm);
@@ -788,8 +788,8 @@
/* Copy original vertex data */
CustomData_copy_data(&orig->vertData,
- &dm->vertData,
- 0, 0, totorigvert);
+ &dm->vertData,
+ 0, 0, totorigvert);
/* Subdivide edges */
for (i = 0, v = totorigvert; i < totorigedge; i++) {
@@ -828,7 +828,7 @@
u = e->v1;
radrat = (half_v2(outnode[e->v2].radius) /
- half_v2(outnode[e->v1].radius));
+ half_v2(outnode[e->v1].radius));
radrat = (radrat + 1) / 2;
/* Add vertices and edge segments */
@@ -838,12 +838,12 @@
/* Interpolate vertex coord */
interp_v3_v3v3(outvert[v].co, outvert[e->v1].co,
- outvert[e->v2].co, t);
+ outvert[e->v2].co, t);
/* Interpolate skin radii */
interp_v3_v3v3(outnode[v].radius,
- orignode[e->v1].radius,
- orignode[e->v2].radius, t);
+ orignode[e->v1].radius,
+ orignode[e->v2].radius, t);
/* Interpolate vertex group weights */
for (k = 0; k < totvgroup; k++) {
@@ -879,10 +879,10 @@
/* Can be either quad or triangle */
static void add_poly(SkinOutput *so,
- BMVert *v1,
- BMVert *v2,
- BMVert *v3,
- BMVert *v4)
+ BMVert *v1,
+ BMVert *v2,
+ BMVert *v3,
+ BMVert *v4)
{
BMVert *verts[4] = {v1, v2, v3, v4};
BMEdge *edges[4];
@@ -911,8 +911,8 @@
}
static void connect_frames(SkinOutput *so,
- BMVert *frame1[4],
- BMVert *frame2[4])
+ BMVert *frame1[4],
+ BMVert *frame2[4])
{
BMVert *q[4][4] = {{frame2[0], frame2[1], frame1[1], frame1[0]},
{frame2[1], frame2[2], frame1[2], frame1[1]},
@@ -924,8 +924,8 @@
/* Check if frame normals need swap */
sub_v3_v3v3(p, q[3][0]->co, q[0][0]->co);
normal_quad_v3(no,
- q[0][0]->co, q[0][1]->co,
- q[0][2]->co, q[0][3]->co);
+ q[0][0]->co, q[0][1]->co,
+ q[0][2]->co, q[0][3]->co);
swap = dot_v3v3(no, p) > 0;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list