Commit: f9a6780dc642ced8dc73f82d0d76cf928c33a094
Author: Campbell Barton
Date:   Wed Jul 22 15:49:53 2015 +1000
Branches: master
https://developer.blender.org/rBf9a6780dc642ced8dc73f82d0d76cf928c33a094

Cleanup: use struct for storing callback data

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

M       source/blender/editors/armature/meshlaplacian.c

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

diff --git a/source/blender/editors/armature/meshlaplacian.c 
b/source/blender/editors/armature/meshlaplacian.c
index 9273093..c420253 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1181,12 +1181,18 @@ static int meshdeform_tri_intersect(const float 
orig[3], const float end[3], con
        return 1;
 }
 
+struct MeshRayCallbackData {
+       MFace *mface;
+       MeshDeformBind *mdb;
+       MeshDeformIsect *isec;
+};
+
 static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay 
*ray, BVHTreeRayHit *hit)
 {
-       void **data = userdata;
-       MeshDeformBind *mdb = data[1];
-       MFace *mface = data[0], *mf;
-       MeshDeformIsect *isec = data[2];
+       struct MeshRayCallbackData *data = userdata;
+       MeshDeformBind *mdb = data->mdb;
+       MFace *mface = data->mface, *mf;
+       MeshDeformIsect *isec = data->isec;
        float no[3], co[3], end[3], uvw[3], dist, face[4][3];
        
        mf = mface + index;
@@ -1226,8 +1232,12 @@ static MDefBoundIsect 
*meshdeform_ray_tree_intersect(MeshDeformBind *mdb, const
        BVHTreeRayHit hit;
        MeshDeformIsect isect_mdef;
        float (*cagecos)[3];
-       void *data[3] = {mdb->cagedm->getTessFaceArray(mdb->cagedm), mdb, 
&isect_mdef};
-       MFace *mface1 = data[0], *mface;
+       struct MeshRayCallbackData data = {
+               mdb->cagedm->getTessFaceArray(mdb->cagedm),
+               mdb,
+               &isect_mdef,
+       };
+       MFace *mface1 = data.mface, *mface;
        float vert[4][3], len, end[3];
        // static float epsilon[3] = {1e-4, 1e-4, 1e-4};
 
@@ -1251,7 +1261,7 @@ static MDefBoundIsect 
*meshdeform_ray_tree_intersect(MeshDeformBind *mdb, const
        hit.index = -1;
        hit.dist = FLT_MAX;
        if (BLI_bvhtree_ray_cast(mdb->bvhtree, isect_mdef.start, isect_mdef.vec,
-                                0.0, &hit, harmonic_ray_callback, data) != -1)
+                                0.0, &hit, harmonic_ray_callback, &data) != -1)
        {
                len = isect_mdef.lambda;
                isect_mdef.face = mface = mface1 + hit.index;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to