diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-30 23:27:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-30 23:27:15 +0400 |
commit | 76ba8f017eed5abed2f187764a81d3e2bd762d88 (patch) | |
tree | 4f9db836f88a292102d6a265c96b94d4b830d345 /source | |
parent | 00acdb629254b680992f1863a1d62cd2985198af (diff) |
code cleanup: remove unused transform snapping code (only use the BVH accelerated version now).
and quiet narrowing conversion warning between signed/unsigned int.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 129 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 6 |
2 files changed, 3 insertions, 132 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index baca4629883..a6fb7e7ed00 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -78,8 +78,6 @@ #include "transform.h" -#define USE_BVH_FACE_SNAP - #define TRANSFORM_DIST_MAX_PX 1000 /********************* PROTOTYPES ***********************/ @@ -1136,58 +1134,6 @@ static void TargetSnapClosest(TransInfo *t) t->tsnap.status |= TARGET_INIT; } } -/*================================================================*/ -#ifndef USE_BVH_FACE_SNAP -static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float loc[3], float no[3], int *dist, float *depth) -{ - float lambda; - int result; - int retval = 0; - - result = isect_ray_tri_threshold_v3(ray_start_local, ray_normal_local, v1co, v2co, v3co, &lambda, NULL, 0.001); - - if (result) { - float location[3], normal[3]; - float intersect[3]; - float new_depth; - int screen_loc[2]; - int new_dist; - - copy_v3_v3(intersect, ray_normal_local); - mul_v3_fl(intersect, lambda); - add_v3_v3(intersect, ray_start_local); - - copy_v3_v3(location, intersect); - - if (v4co) - normal_quad_v3(normal, v1co, v2co, v3co, v4co); - else - normal_tri_v3(normal, v1co, v2co, v3co); - - mul_m4_v3(obmat, location); - - new_depth = len_v3v3(location, ray_start); - - ED_view3d_project_int(ar, location, screen_loc); - new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]); - - if (new_dist <= *dist && new_depth < *depth) { - *depth = new_depth; - retval = 1; - - copy_v3_v3(loc, location); - copy_v3_v3(no, normal); - - mul_m3_v3(timat, no); - normalize_v3(no); - - *dist = new_dist; - } - } - - return retval; -} -#endif static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float obmat[][4], float timat[][3], const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2], @@ -1426,7 +1372,6 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh switch (snap_mode) { case SCE_SNAP_MODE_FACE: { -#ifdef USE_BVH_FACE_SNAP // Added for durian BVHTreeRayHit hit; BVHTreeFromMesh treeData; @@ -1456,80 +1401,6 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh } } break; - -#else - MVert *verts = dm->getVertArray(dm); - MFace *faces = dm->getTessFaceArray(dm); - int *index_array = NULL; - int index = 0; - int i; - - if (em != NULL) { - index_array = dm->getTessFaceDataArray(dm, CD_ORIGINDEX); - EDBM_index_arrays_init(em, 0, 0, 1); - } - - for (i = 0; i < totface; i++) { - BMFace *efa = NULL; - MFace *f = faces + i; - - test = 1; /* reset for every face */ - - if (em != NULL) { - if (index_array) { - index = index_array[i]; - } - else { - index = i; - } - - if (index == ORIGINDEX_NONE) { - test = 0; - } - else { - efa = EDBM_face_at_index(em, index); - - if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { - test = 0; - } - else if (efa) { - BMIter iter; - BMLoop *l; - - l = BM_iter_new(&iter, em->bm, BM_LOOPS_OF_FACE, efa); - for (; l; l = BM_iter_step(&iter)) { - if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)) { - test = 0; - break; - } - } - } - } - } - - - if (test) { - int result; - float *v4co = NULL; - - if (f->v4) { - v4co = verts[f->v4].co; - } - - result = snapFace(ar, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, v4co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth); - retval |= result; - - if (f->v4 && result == 0) { - retval |= snapFace(ar, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, verts[f->v2].co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth); - } - } - } - - if (em != NULL) { - EDBM_index_arrays_free(em); - } -#endif - break; } case SCE_SNAP_MODE_VERTEX: { diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index ce0e0dd2c5c..8d587cf39f6 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -232,9 +232,9 @@ bool CcdPhysicsController::CreateSoftbody() psb = new btSoftBody(&worldInfo, (int)hres.mNumOutputVertices, &hres.m_OutputVertices[0], 0); for (int i = 0; i < (int)hres.mNumFaces; ++i) { - const int idx[3] = {hres.m_Indices[i * 3 + 0], - hres.m_Indices[i * 3 + 1], - hres.m_Indices[i * 3 + 2]}; + const unsigned int idx[3] = {hres.m_Indices[i * 3 + 0], + hres.m_Indices[i * 3 + 1], + hres.m_Indices[i * 3 + 2]}; if (idx[0] < idx[1]) psb->appendLink(idx[0], idx[1]); if (idx[1] < idx[2]) psb->appendLink(idx[1], idx[2]); if (idx[2] < idx[0]) psb->appendLink(idx[2], idx[0]); |