Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2008-09-24 07:12:10 +0400
committerErwin Coumans <blender@erwincoumans.com>2008-09-24 07:12:10 +0400
commit3b09c0b0d5a5bea78f0832532f8c206280ae6456 (patch)
tree42b036ffaa18d7ddf3b65a581ed49bb73130551f /extern/bullet2/src/LinearMath
parent7eae8d0c7ba8d352faca05e6de4886f3ebd3f169 (diff)
Created a KX_SoftBodyDeformer for real-time soft bodies.
Added SetDeformer/GetDeformer() to KX_GameObject. Store mapping between graphics/soft body vertices (work-in-progress) Real-time soft body integration is still very premature, but for a quick preview, see this testfile: http://bulletphysics.com/ftp/pub/test/index.php?dir=blender/&file=soft_test.blend
Diffstat (limited to 'extern/bullet2/src/LinearMath')
-rw-r--r--extern/bullet2/src/LinearMath/btConvexHull.cpp23
-rw-r--r--extern/bullet2/src/LinearMath/btConvexHull.h3
2 files changed, 25 insertions, 1 deletions
diff --git a/extern/bullet2/src/LinearMath/btConvexHull.cpp b/extern/bullet2/src/LinearMath/btConvexHull.cpp
index a20b2059ae9..b8929a86808 100644
--- a/extern/bullet2/src/LinearMath/btConvexHull.cpp
+++ b/extern/bullet2/src/LinearMath/btConvexHull.cpp
@@ -869,6 +869,8 @@ bool HullLibrary::CleanupVertices(unsigned int svcount,
{
if ( svcount == 0 ) return false;
+ m_vertexIndexMapping.resize(0);
+
#define EPSILON btScalar(0.000001) /* close enough to consider two btScalaring point numbers to be 'the same'. */
@@ -1027,6 +1029,7 @@ bool HullLibrary::CleanupVertices(unsigned int svcount,
v[0] = px;
v[1] = py;
v[2] = pz;
+
}
break;
@@ -1041,6 +1044,7 @@ bool HullLibrary::CleanupVertices(unsigned int svcount,
dest[2] = pz;
vcount++;
}
+ m_vertexIndexMapping.push_back(j);
}
}
@@ -1116,13 +1120,22 @@ bool HullLibrary::CleanupVertices(unsigned int svcount,
void HullLibrary::BringOutYourDead(const btVector3* verts,unsigned int vcount, btVector3* overts,unsigned int &ocount,unsigned int *indices,unsigned indexcount)
{
+ btAlignedObjectArray<int>tmpIndices;
+ tmpIndices.resize(m_vertexIndexMapping.size());
+ int i;
+
+ for (i=0;i<m_vertexIndexMapping.size();i++)
+ {
+ tmpIndices[i] = m_vertexIndexMapping[i];
+ }
+
TUIntArray usedIndices;
usedIndices.resize(static_cast<int>(vcount));
memset(&usedIndices[0],0,sizeof(unsigned int)*vcount);
ocount = 0;
- for (unsigned int i=0; i<indexcount; i++)
+ for (i=0; i<indexcount; i++)
{
unsigned int v = indices[i]; // original array index
@@ -1141,11 +1154,19 @@ void HullLibrary::BringOutYourDead(const btVector3* verts,unsigned int vcount, b
overts[ocount][1] = verts[v][1];
overts[ocount][2] = verts[v][2];
+ for (int k=0;k<m_vertexIndexMapping.size();k++)
+ {
+ if (tmpIndices[k]==v)
+ m_vertexIndexMapping[k]=ocount;
+ }
+
ocount++; // increment output vert count
btAssert( ocount >=0 && ocount <= vcount );
usedIndices[static_cast<int>(v)] = ocount; // assign new index remapping
+
+
}
}
diff --git a/extern/bullet2/src/LinearMath/btConvexHull.h b/extern/bullet2/src/LinearMath/btConvexHull.h
index 8bb80de0225..8c36307dfd6 100644
--- a/extern/bullet2/src/LinearMath/btConvexHull.h
+++ b/extern/bullet2/src/LinearMath/btConvexHull.h
@@ -192,6 +192,9 @@ class HullLibrary
public:
+ btAlignedObjectArray<int> m_vertexIndexMapping;
+
+
HullError CreateConvexHull(const HullDesc& desc, // describes the input request
HullResult& result); // contains the resulst
HullError ReleaseResult(HullResult &result); // release memory allocated for this result, we are done with it.