Commit: d500faca5f24cf5351e39daf9e3b4c5127687d91
Author: Campbell Barton
Date:   Sat Feb 28 01:28:08 2015 +1100
Branches: temp-mball-refactor
https://developer.blender.org/rBd500faca5f24cf5351e39daf9e3b4c5127687d91

cleanup: style & doxy comments

===================================================================

M       source/blender/blenkernel/BKE_mball.h
M       source/blender/blenkernel/BKE_mball_tessellate.h
M       source/blender/blenkernel/intern/mball_tessellate.c
M       source/blender/windowmanager/intern/wm_init_exit.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_mball.h 
b/source/blender/blenkernel/BKE_mball.h
index aa9ba45..c7bbb71 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -46,8 +46,6 @@ struct MetaBall *BKE_mball_copy(struct MetaBall *mb);
 
 void BKE_mball_make_local(struct MetaBall *mb);
 
-void BKE_mball_cubeTable_free(void);
-
 bool BKE_mball_is_basis_for(struct Object *ob1, struct Object *ob2);
 bool BKE_mball_is_basis(struct Object *ob);
 struct Object *BKE_mball_basis_find(struct Scene *scene, struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_mball_tessellate.h 
b/source/blender/blenkernel/BKE_mball_tessellate.h
index a3d3e19..361f31b 100644
--- a/source/blender/blenkernel/BKE_mball_tessellate.h
+++ b/source/blender/blenkernel/BKE_mball_tessellate.h
@@ -31,4 +31,6 @@ void BKE_mball_polygonize(
         struct EvaluationContext *eval_ctx, struct Scene *scene,
         struct Object *ob, struct ListBase *dispbase);
 
+void BKE_mball_cubeTable_free(void);
+
 #endif  /* __BKE_MBALL_TESSELLATE_H__ */
diff --git a/source/blender/blenkernel/intern/mball_tessellate.c 
b/source/blender/blenkernel/intern/mball_tessellate.c
index f8b6f73..868e3ba 100644
--- a/source/blender/blenkernel/intern/mball_tessellate.c
+++ b/source/blender/blenkernel/intern/mball_tessellate.c
@@ -93,13 +93,13 @@ typedef struct intlists {       /* list of list of integers 
*/
        struct intlists *next;      /* remaining elements */
 } INTLISTS;
 
-typedef struct Box{                            /* an AABB with pointer to 
metalelem */
+typedef struct Box {                   /* an AABB with pointer to metalelem */
        float min[3], max[3];
        MetaElem *ml;
 } Box;
 
-typedef struct MetaballBVHNode{        /* BVH node */
-       Box bb[2];                                      /* AABB of children */
+typedef struct MetaballBVHNode {       /* BVH node */
+       Box bb[2];                                              /* AABB of 
children */
        struct MetaballBVHNode *child[2];
 } MetaballBVHNode;
 
@@ -159,9 +159,11 @@ static void make_box_from_ml(Box *r, MetaElem *ml)
        r->ml = ml;
 }
 
-/* Partitions part of mainb array [start, end) along axis s. Returns i,
-* where centroids of elements in the [start, i) segment lie "on the right 
side" of div,
-* and elements in the [i, end) segment lie "on the left" */
+/**
+ * Partitions part of mainb array [start, end) along axis s. Returns i,
+ * where centroids of elements in the [start, i) segment lie "on the right 
side" of div,
+ * and elements in the [i, end) segment lie "on the left"
+ */
 static int partition_mainb(PROCESS *process, int start, int end, int s, float 
div)
 {
        int i = start, j = end - 1;
@@ -173,7 +175,7 @@ static int partition_mainb(PROCESS *process, int start, int 
end, int s, float di
 
                if (i >= j)     break;
 
-               SWAP(MetaElem*, process->mainb[i], process->mainb[j]);
+               SWAP(MetaElem *, process->mainb[i], process->mainb[j]);
                i++; j--;
        }
 
@@ -182,7 +184,9 @@ static int partition_mainb(PROCESS *process, int start, int 
end, int s, float di
        return i;
 }
 
-/* Recursively builds a BVH, dividing elements along the middle of the longest 
axis of allbox. */
+/**
+ * Recursively builds a BVH, dividing elements along the middle of the longest 
axis of allbox.
+ */
 static void build_bvh_spatial(PROCESS *process, MetaballBVHNode *node, int 
start, int end, Box allbox)
 {
        int part, j, s;
@@ -231,7 +235,8 @@ static void build_bvh_spatial(PROCESS *process, 
MetaballBVHNode *node, int start
 
 /* ******************** ARITH ************************* */
 
-/* BASED AT CODE (but mostly rewritten) :
+/**
+ * BASED AT CODE (but mostly rewritten) :
  * C code from the article
  * "An Implicit Surface Polygonizer"
  * by Jules Bloomenthal, [email protected]
@@ -240,7 +245,8 @@ static void build_bvh_spatial(PROCESS *process, 
MetaballBVHNode *node, int start
  * Authored by Jules Bloomenthal, Xerox PARC.
  * Copyright (c) Xerox Corporation, 1991.  All rights reserved.
  * Permission is granted to reproduce, use and distribute this code for
- * any and all purposes, provided that this notice appears in all copies. */
+ * any and all purposes, provided that this notice appears in all copies.
+ */
 
 #define L   0  /* left direction:      -x, -i */
 #define R   1  /* right direction:     +x, +i */
@@ -257,8 +263,10 @@ static void build_bvh_spatial(PROCESS *process, 
MetaballBVHNode *node, int start
 #define RTN 6  /* right top near corner    */
 #define RTF 7  /* right top far corner     */
 
-/* the LBN corner of cube (i, j, k), corresponds with location
- * (i-0.5)*size, (j-0.5)*size, (k-0.5)*size) */
+/**
+ * the LBN corner of cube (i, j, k), corresponds with location
+ * (i-0.5)*size, (j-0.5)*size, (k-0.5)*size)
+ */
 
 #define HASHBIT     (5)
 #define HASHSIZE    (size_t)(1 << (3 * HASHBIT))   /*! < hash table size 
(32768) */
@@ -266,16 +274,18 @@ static void build_bvh_spatial(PROCESS *process, 
MetaballBVHNode *node, int start
 #define HASH(i, j, k) ((((( (i) & 31) << 5) | ( (j) & 31)) << 5) | ( (k) & 31) 
)
 
 #define MB_BIT(i, bit) (((i) >> (bit)) & 1)
-#define FLIP(i, bit) ((i) ^ 1 << (bit)) /* flip the given bit of i */
+// #define FLIP(i, bit) ((i) ^ 1 << (bit)) /* flip the given bit of i */
 
 /* ******************** DENSITY COPMPUTATION ********************* */
 
-/* Computes density from given metaball at given position.
-* Metaball equation is: (1 - r^2 / R^2)^3 * s
-* r = distance from center
-* R = metaball radius
-* s - metaball stiffness
-**/
+/**
+ * Computes density from given metaball at given position.
+ * Metaball equation is: ``(1 - r^2 / R^2)^3 * s``
+ *
+ * r = distance from center
+ * R = metaball radius
+ * s - metaball stiffness
+ */
 static float densfunc(MetaElem *ball, float x, float y, float z)
 {
        float dist2;
@@ -334,8 +344,10 @@ static float densfunc(MetaElem *ball, float x, float y, 
float z)
        return (dist2 < 0.0f) ? 0.0f : (ball->s * dist2 * dist2 * dist2);
 }
 
-/* Computes density at given position form all metaballs which contain this 
point in their box.
-* Traverses BVH using a queue. */
+/**
+ * Computes density at given position form all metaballs which contain this 
point in their box.
+ * Traverses BVH using a queue.
+ */
 static float metaball(PROCESS *process, float x, float y, float z)
 {
        int i;
@@ -349,9 +361,9 @@ static float metaball(PROCESS *process, float x, float y, 
float z)
                node = process->bvh_queue[back++];
 
                for (i = 0; i < 2; i++) {
-                       if (node->bb[i].min[0] <= x && node->bb[i].max[0] >= x 
&&
-                               node->bb[i].min[1] <= y && node->bb[i].max[1] 
>= y &&
-                               node->bb[i].min[2] <= z && node->bb[i].max[2] 
>= z)
+                       if ((node->bb[i].min[0] <= x) && (node->bb[i].max[0] >= 
x) &&
+                           (node->bb[i].min[1] <= y) && (node->bb[i].max[1] >= 
y) &&
+                           (node->bb[i].min[2] <= z) && (node->bb[i].max[2] >= 
z))
                        {
                                if (node->child[i])     
process->bvh_queue[front++] = node->child[i];
                                else dens += densfunc(node->bb[i].ml, x, y, z);
@@ -362,7 +374,9 @@ static float metaball(PROCESS *process, float x, float y, 
float z)
        return process->thresh - dens;
 }
 
-/* Adds face to indices, expands memory if needed. */
+/**
+ * Adds face to indices, expands memory if needed.
+ */
 static void make_face(PROCESS *process, int i1, int i2, int i3, int i4)
 {
        int *newi, *cur;
@@ -400,13 +414,15 @@ static void make_face(PROCESS *process, int i1, int i2, 
int i3, int i4)
 #ifdef MB_ACCUM_NORMAL
        if (i4 == 0) {
                normal_tri_v3(n, &process->co[i1 * 3], &process->co[i2 * 3], 
&process->co[i3 * 3]);
-               accumulate_vertex_normals(&process->no[i1 * 3], &process->no[i2 
* 3], &process->no[i3 * 3], NULL, n,
-                                                                 
&process->co[i1 * 3], &process->co[i2 * 3], &process->co[i3 * 3], NULL);
+               accumulate_vertex_normals(
+                       &process->no[i1 * 3], &process->no[i2 * 3], 
&process->no[i3 * 3], NULL, n,
+                       &process->co[i1 * 3], &process->co[i2 * 3], 
&process->co[i3 * 3], NULL);
        }
        else {
                normal_quad_v3(n, &process->co[i1 * 3], &process->co[i2 * 3], 
&process->co[i3 * 3], &process->co[i4 * 3]);
-               accumulate_vertex_normals(&process->no[i1 * 3], &process->no[i2 
* 3], &process->no[i3 * 3], &process->no[i4 * 3], n,
-                                                                 
&process->co[i1 * 3], &process->co[i2 * 3], &process->co[i3 * 3], 
&process->co[i4 * 3]);
+               accumulate_vertex_normals(
+                       &process->no[i1 * 3], &process->no[i2 * 3], 
&process->no[i3 * 3], &process->no[i4 * 3], n,
+                       &process->co[i1 * 3], &process->co[i2 * 3], 
&process->co[i3 * 3], &process->co[i4 * 3]);
        }
 #endif
 
@@ -459,7 +475,9 @@ static int rightface[12] = {
 };
 /* face on right when going corner1 to corner2 */
 
-/* docube: triangulate the cube directly, without decomposition */
+/**
+ * triangulate the cube directly, without decomposition
+ */
 static void docube(PROCESS *process, CUBE *cube)
 {
        INTLISTS *polys;
@@ -539,8 +557,10 @@ static void docube(PROCESS *process, CUBE *cube)
        }
 }
 
-/* setcorner: return corner with the given lattice location
-* set (and cache) its function value */
+/**
+ * return corner with the given lattice location
+ * set (and cache) its function value
+ */
 static CORNER *setcorner(PROCESS *process, int i, int j, int k)
 {
        /* for speed, do corner value caching here */
@@ -557,7 +577,7 @@ static CORNER *setcorner(PROCESS *process, int i, int j, 
int k)
                }
        }
 
-       c = (CORNER *)BLI_memarena_alloc(process->pgn_elements, sizeof(CORNER));
+       c = BLI_memarena_alloc(process->pgn_elements, sizeof(CORNER));
 
        c->i = i;
        c->co[0] = ((float)i - 0.5f) * process->size;
@@ -574,7 +594,9 @@ static CORNER *setcorner(PROCESS *process, int i, int j, 
int k)
        return c;
 }
 
-/* nextcwedge: return next clockwise edge from given edge around given face */
+/**
+ * return next clockwise edge from given edge around given face
+ */
 static int nextcwedge(int edge, int face)
 {
        switch (edge) {
@@ -606,14 +628,18 @@ static int nextcwedge(int edge, int face)
        return 0;
 }
 
-/* otherface: return face adjoining edge that is not the given face */
+/**
+ * \return the face adjoining edge that is not the given face
+ */
 static int otherface(int edge, int face)
 {
        int other = leftface[edge];
        return face == other ? rightface[edge] : other;
 }
 
-/* makecubetable: create the 256 entry table for cubical polygonization */
+/**
+ * create the 256 entry table for cubical polygonization
+ */
 static void makecubetable(void)
 {
        static bool

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to