[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51774] trunk/blender/source: code cleanup : remove unused transform snapping code ( only use the BVH accelerated version now).
Campbell Barton
ideasman42 at gmail.com
Tue Oct 30 20:27:15 CET 2012
Revision: 51774
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51774
Author: campbellbarton
Date: 2012-10-30 19:27:15 +0000 (Tue, 30 Oct 2012)
Log Message:
-----------
code cleanup: remove unused transform snapping code (only use the BVH accelerated version now).
and quiet narrowing conversion warning between signed/unsigned int.
Modified Paths:
--------------
trunk/blender/source/blender/editors/transform/transform_snap.c
trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
Modified: trunk/blender/source/blender/editors/transform/transform_snap.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_snap.c 2012-10-30 19:20:17 UTC (rev 51773)
+++ trunk/blender/source/blender/editors/transform/transform_snap.c 2012-10-30 19:27:15 UTC (rev 51774)
@@ -78,8 +78,6 @@
#include "transform.h"
-#define USE_BVH_FACE_SNAP
-
#define TRANSFORM_DIST_MAX_PX 1000
/********************* PROTOTYPES ***********************/
@@ -1136,59 +1134,7 @@
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],
float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
@@ -1426,7 +1372,6 @@
switch (snap_mode) {
case SCE_SNAP_MODE_FACE:
{
-#ifdef USE_BVH_FACE_SNAP // Added for durian
BVHTreeRayHit hit;
BVHTreeFromMesh treeData;
@@ -1456,80 +1401,6 @@
}
}
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:
{
Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp 2012-10-30 19:20:17 UTC (rev 51773)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp 2012-10-30 19:27:15 UTC (rev 51774)
@@ -232,9 +232,9 @@
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]);
More information about the Bf-blender-cvs
mailing list