[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31159] branches/soc-2010-aligorith-2/ source/blender: Bullet SoC - GImpact is now used in place of BVH-Triangle Shapes for the " Mesh" collision shape
Joshua Leung
aligorith at gmail.com
Sun Aug 8 09:32:04 CEST 2010
Revision: 31159
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31159
Author: aligorith
Date: 2010-08-08 09:32:04 +0200 (Sun, 08 Aug 2010)
Log Message:
-----------
Bullet SoC - GImpact is now used in place of BVH-Triangle Shapes for the "Mesh" collision shape
This doesn't seem to have any impact on the chains setup, though will have to do more testing to check on other situations.
Modified Paths:
--------------
branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c
branches/soc-2010-aligorith-2/source/blender/rigidbody/RBI_api.h
branches/soc-2010-aligorith-2/source/blender/rigidbody/rb_bullet_api.cpp
Modified: branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c 2010-08-08 05:13:29 UTC (rev 31158)
+++ branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c 2010-08-08 07:32:04 UTC (rev 31159)
@@ -235,7 +235,8 @@
}
/* construct collision shape */
- shape = rbShapeNewTriMesh(mdata);
+ //shape = rbShapeNewTriMesh(mdata); /* BVH-Triangle Mesh */
+ shape = rbShapeNewGImpactMesh(mdata); /* GImpact */
/* cleanup temp data */
if (dm)
Modified: branches/soc-2010-aligorith-2/source/blender/rigidbody/RBI_api.h
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/rigidbody/RBI_api.h 2010-08-08 05:13:29 UTC (rev 31158)
+++ branches/soc-2010-aligorith-2/source/blender/rigidbody/RBI_api.h 2010-08-08 07:32:04 UTC (rev 31159)
@@ -217,8 +217,10 @@
/* 1 */
extern rbMeshData *rbTriMeshNewData();
extern void rbTriMeshAddTriangle(rbMeshData *mesh, const float v1[3], const float v2[3], const float v3[3]);
-/* 2*/
+/* 2a - Triangle Meshes */
extern rbCollisionShape *rbShapeNewTriMesh(rbMeshData *mesh);
+/* 2b - GImpact Meshes */
+extern rbCollisionShape *rbShapeNewGImpactMesh(rbMeshData *mesh);
/* Cleanup --------------------------- */
Modified: branches/soc-2010-aligorith-2/source/blender/rigidbody/rb_bullet_api.cpp
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/rigidbody/rb_bullet_api.cpp 2010-08-08 05:13:29 UTC (rev 31158)
+++ branches/soc-2010-aligorith-2/source/blender/rigidbody/rb_bullet_api.cpp 2010-08-08 07:32:04 UTC (rev 31159)
@@ -71,6 +71,7 @@
#include "LinearMath/btMatrix3x3.h"
#include "LinearMath/btTransform.h"
+#include "BulletCollision/Gimpact/btGImpactShape.h"
#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
/* ********************************** */
@@ -609,6 +610,20 @@
return (rbCollisionShape*) new(mem) btScaledBvhTriangleMeshShape(unscaledShape, btVector3(1.0f,1.0f,1.0f));
}
+rbCollisionShape *rbShapeNewGImpactMesh(rbMeshData *mesh)
+{
+ /* interpret mesh buffer as btTriangleIndexVertexArray (i.e. an impl of btStridingMeshInterface) */
+ btTriangleMesh *tmesh = reinterpret_cast<btTriangleMesh*>(mesh);
+ btTriangleIndexVertexArray *meshData = reinterpret_cast<btTriangleIndexVertexArray*>(tmesh);
+ void *mem;
+
+ mem = btAlignedAlloc(sizeof(btGImpactMeshShape), 16);
+ btGImpactMeshShape *gimpactShape = new(mem) btGImpactMeshShape(meshData);
+ gimpactShape->updateBound(); // TODO: add this to the update collision margin call?
+
+ return (rbCollisionShape *) gimpactShape;
+}
+
/* Cleanup --------------------------- */
void rbShapeDelete(rbCollisionShape *cshape)
More information about the Bf-blender-cvs
mailing list