Revision: 16743
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16743
Author:   genscher
Date:     2008-09-26 10:58:15 +0200 (Fri, 26 Sep 2008)

Log Message:
-----------
svn merge -r 16667:16741 
https://svn.blender.org/svnroot/bf-blender/trunk/blender

Modified Paths:
--------------
    branches/sim_physics/extern/bullet2/CMakeLists.txt
    branches/sim_physics/extern/bullet2/Makefile
    
branches/sim_physics/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h
    
branches/sim_physics/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
    branches/sim_physics/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
    branches/sim_physics/extern/bullet2/src/BulletSoftBody/btSoftBody.h
    
branches/sim_physics/extern/bullet2/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp
    
branches/sim_physics/extern/bullet2/src/BulletSoftBody/btSoftRigidDynamicsWorld.h
    branches/sim_physics/extern/bullet2/src/LinearMath/btConvexHull.cpp
    branches/sim_physics/extern/bullet2/src/LinearMath/btConvexHull.h
    branches/sim_physics/extern/bullet2/src/SConscript
    branches/sim_physics/intern/SoundSystem/intern/SND_Utils.cpp
    branches/sim_physics/intern/elbeem/CMakeLists.txt
    branches/sim_physics/intern/elbeem/SConscript
    branches/sim_physics/intern/elbeem/extern/LBM_fluidsim.h
    branches/sim_physics/intern/elbeem/intern/controlparticles.cpp
    branches/sim_physics/intern/elbeem/intern/isosurface.cpp
    branches/sim_physics/intern/elbeem/intern/mvmcoords.h
    branches/sim_physics/intern/elbeem/intern/solver_class.h
    branches/sim_physics/intern/elbeem/intern/solver_control.h
    branches/sim_physics/intern/elbeem/intern/solver_init.cpp
    branches/sim_physics/intern/elbeem/intern/solver_main.cpp
    branches/sim_physics/intern/elbeem/intern/solver_relax.h
    branches/sim_physics/intern/ghost/intern/GHOST_SystemX11.cpp
    branches/sim_physics/intern/ghost/intern/GHOST_SystemX11.h
    branches/sim_physics/intern/ghost/intern/GHOST_WindowX11.cpp
    branches/sim_physics/intern/ghost/intern/GHOST_WindowX11.h
    
branches/sim_physics/projectfiles_vc7/gameengine/gameplayer/common/GP_common.vcproj
    
branches/sim_physics/projectfiles_vc7/gameengine/gameplayer/ghost/GP_ghost.vcproj
    branches/sim_physics/release/scripts/bpymodules/colladaImEx/collada.py
    branches/sim_physics/release/scripts/import_obj.py
    branches/sim_physics/release/text/blender.html
    branches/sim_physics/source/blender/blenkernel/BKE_blender.h
    branches/sim_physics/source/blender/blenkernel/BKE_curve.h
    branches/sim_physics/source/blender/blenkernel/intern/anim.c
    branches/sim_physics/source/blender/blenkernel/intern/curve.c
    branches/sim_physics/source/blender/blenkernel/intern/displist.c
    branches/sim_physics/source/blender/blenkernel/intern/modifier.c
    branches/sim_physics/source/blender/blenkernel/intern/multires.c
    branches/sim_physics/source/blender/blenkernel/intern/object.c
    branches/sim_physics/source/blender/blenkernel/intern/particle.c
    branches/sim_physics/source/blender/blenkernel/intern/particle_system.c
    branches/sim_physics/source/blender/blenlib/BLI_blenlib.h
    branches/sim_physics/source/blender/blenlib/intern/util.c
    branches/sim_physics/source/blender/blenloader/intern/readfile.c
    branches/sim_physics/source/blender/gpu/intern/gpu_draw.c
    branches/sim_physics/source/blender/makesdna/DNA_curve_types.h
    branches/sim_physics/source/blender/makesdna/DNA_modifier_types.h
    branches/sim_physics/source/blender/makesdna/DNA_object_types.h
    branches/sim_physics/source/blender/makesdna/DNA_particle_types.h
    branches/sim_physics/source/blender/render/intern/source/shadeinput.c
    branches/sim_physics/source/blender/render/intern/source/zbuf.c
    branches/sim_physics/source/blender/src/buttons_editing.c
    branches/sim_physics/source/blender/src/buttons_logic.c
    branches/sim_physics/source/blender/src/buttons_object.c
    branches/sim_physics/source/blender/src/buttons_shading.c
    branches/sim_physics/source/blender/src/drawaction.c
    branches/sim_physics/source/blender/src/drawnode.c
    branches/sim_physics/source/blender/src/drawobject.c
    branches/sim_physics/source/blender/src/editcurve.c
    branches/sim_physics/source/blender/src/editimasel.c
    branches/sim_physics/source/blender/src/editmesh_tools.c
    branches/sim_physics/source/blender/src/editobject.c
    branches/sim_physics/source/blender/src/editsima.c
    branches/sim_physics/source/blender/src/filelist.c
    branches/sim_physics/source/blender/src/filesel.c
    branches/sim_physics/source/blender/src/fluidsim.c
    branches/sim_physics/source/blender/src/view.c
    branches/sim_physics/source/creator/CMakeLists.txt
    branches/sim_physics/source/creator/Makefile
    
branches/sim_physics/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
    
branches/sim_physics/source/gameengine/Converter/BL_BlenderDataConversion.cpp
    branches/sim_physics/source/gameengine/Converter/BL_DeformableGameObject.cpp
    branches/sim_physics/source/gameengine/Converter/BL_DeformableGameObject.h
    branches/sim_physics/source/gameengine/Converter/BL_MeshDeformer.h
    branches/sim_physics/source/gameengine/Converter/BL_ShapeActionActuator.cpp
    branches/sim_physics/source/gameengine/Converter/BL_ShapeActionActuator.h
    branches/sim_physics/source/gameengine/Converter/BL_ShapeDeformer.cpp
    branches/sim_physics/source/gameengine/Converter/BL_ShapeDeformer.h
    branches/sim_physics/source/gameengine/Converter/BL_SkinDeformer.cpp
    branches/sim_physics/source/gameengine/Converter/BL_SkinDeformer.h
    branches/sim_physics/source/gameengine/Converter/BL_SkinMeshObject.cpp
    branches/sim_physics/source/gameengine/Converter/KX_ConvertActuators.cpp
    branches/sim_physics/source/gameengine/Converter/KX_ConvertProperties.cpp
    branches/sim_physics/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
    branches/sim_physics/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
    branches/sim_physics/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
    branches/sim_physics/source/gameengine/Ketsji/KX_GameObject.h
    branches/sim_physics/source/gameengine/Ketsji/KX_IPO_SGController.cpp
    branches/sim_physics/source/gameengine/Ketsji/KX_IPO_SGController.h
    branches/sim_physics/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
    branches/sim_physics/source/gameengine/Ketsji/KX_PythonInit.cpp
    branches/sim_physics/source/gameengine/Ketsji/KX_Scene.cpp
    
branches/sim_physics/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
    branches/sim_physics/source/gameengine/Physics/Bullet/CcdPhysicsController.h
    
branches/sim_physics/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
    
branches/sim_physics/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
    branches/sim_physics/source/gameengine/PyDoc/BL_ActionActuator.py
    branches/sim_physics/source/gameengine/PyDoc/BL_ShapeActionActuator.py
    branches/sim_physics/source/gameengine/PyDoc/Rasterizer.py
    branches/sim_physics/source/gameengine/Rasterizer/RAS_Deformer.h
    branches/sim_physics/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
    branches/sim_physics/source/gameengine/Rasterizer/RAS_TexVert.cpp
    branches/sim_physics/source/gameengine/Rasterizer/RAS_TexVert.h

Added Paths:
-----------
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btBoxCollision.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btClipPolygon.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btContactProcessing.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btContactProcessing.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactBvh.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactBvh.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactMassUtil.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactShape.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactShape.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGenericPoolAllocator.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGenericPoolAllocator.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGeometryOperations.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btQuantization.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btTriangleShapeEx.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btTriangleShapeEx.h
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_array.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_bitset.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_box_collision.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_box_set.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_box_set.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_clip_polygon.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_contact.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_contact.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_geom_types.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_geometry.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_hash_table.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_linear_math.h
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_math.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_memory.cpp
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_memory.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_radixsort.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_tri_collision.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_tri_collision.h
    branches/sim_physics/release/scripts/ms3d_import_ascii.py

Removed Paths:
-------------
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btBoxCollision.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btClipPolygon.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btContactProcessing.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btContactProcessing.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactBvh.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactBvh.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactMassUtil.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactShape.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGImpactShape.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGenericPoolAllocator.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGenericPoolAllocator.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btGeometryOperations.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btQuantization.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btTriangleShapeEx.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btTriangleShapeEx.h
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_array.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_bitset.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_box_collision.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_box_set.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_box_set.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_clip_polygon.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_contact.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_contact.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_geom_types.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_geometry.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_hash_table.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_linear_math.h
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_math.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_memory.cpp
    branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_memory.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_radixsort.h
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_tri_collision.cpp
    
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/gim_tri_collision.h
    branches/sim_physics/source/blender/include/license_key.h
    branches/sim_physics/source/blender/src/cre/license.jpeg.c
    branches/sim_physics/source/blender/src/cre/license_key.c
    branches/sim_physics/source/blender/src/pub/license_key.c

Modified: branches/sim_physics/extern/bullet2/CMakeLists.txt
===================================================================
--- branches/sim_physics/extern/bullet2/CMakeLists.txt  2008-09-26 08:51:05 UTC 
(rev 16742)
+++ branches/sim_physics/extern/bullet2/CMakeLists.txt  2008-09-26 08:58:15 UTC 
(rev 16743)
@@ -31,6 +31,7 @@
   src/BulletCollision/BroadphaseCollision/*.cpp
   src/BulletCollision/CollisionShapes/*.cpp
   src/BulletCollision/NarrowPhaseCollision/*.cpp
+  src/BulletCollision/Gimpact/*.cpp
   src/BulletCollision//CollisionDispatch/*.cpp
   src/BulletDynamics/ConstraintSolver/*.cpp
   src/BulletDynamics/Vehicle/*.cpp

Modified: branches/sim_physics/extern/bullet2/Makefile
===================================================================
--- branches/sim_physics/extern/bullet2/Makefile        2008-09-26 08:51:05 UTC 
(rev 16742)
+++ branches/sim_physics/extern/bullet2/Makefile        2008-09-26 08:58:15 UTC 
(rev 16743)
@@ -37,6 +37,7 @@
 BulletCollision/BroadphaseCollision \
 BulletCollision/CollisionShapes \
 BulletCollision/NarrowPhaseCollision \
+BulletCollision/Gimpact \
 BulletCollision//CollisionDispatch \
 BulletDynamics/ConstraintSolver \
 BulletDynamics/Vehicle \

Modified: 
branches/sim_physics/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
===================================================================
--- 
branches/sim_physics/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
     2008-09-26 08:51:05 UTC (rev 16742)
+++ 
branches/sim_physics/extern/bullet2/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
     2008-09-26 08:58:15 UTC (rev 16743)
@@ -46,6 +46,7 @@
 CONCAVE_SHAPES_START_HERE,
        //keep all the convex shapetype below here, for the check IsConvexShape 
in broadphase proxy!
        TRIANGLE_MESH_SHAPE_PROXYTYPE,
+       SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE,
        ///used for demo integration FAST/Swift collision library and Bullet
        FAST_CONCAVE_MESH_PROXYTYPE,
        //terrain

Modified: 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
===================================================================
--- 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
     2008-09-26 08:51:05 UTC (rev 16742)
+++ 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
     2008-09-26 08:58:15 UTC (rev 16743)
@@ -105,7 +105,7 @@
                for (i=0;i<colWorld->getCollisionObjectArray().size();i++)
                {
                        btCollisionObject* collisionObject= 
colWorld->getCollisionObjectArray()[i];
-                       if (collisionObject->mergesSimulationIslands())
+                       if (!collisionObject->isStaticOrKinematicObject())
                        {
                                collisionObject->setIslandTag( 
m_unionFind.find(index) );
                                collisionObject->setCompanionId(-1);

Modified: 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
===================================================================
--- 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
    2008-09-26 08:51:05 UTC (rev 16742)
+++ 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
    2008-09-26 08:58:15 UTC (rev 16743)
@@ -117,5 +117,5 @@
 void   btScaledBvhTriangleMeshShape::calculateLocalInertia(btScalar 
mass,btVector3& inertia) const
 {
        ///don't make this a movable object!
-       btAssert(0);
+//     btAssert(0);
 }

Modified: 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
===================================================================
--- 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
      2008-09-26 08:51:05 UTC (rev 16742)
+++ 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
      2008-09-26 08:58:15 UTC (rev 16743)
@@ -39,7 +39,7 @@
        virtual int     getShapeType() const
        {
                //use un-used 'FAST_CONCAVE_MESH_PROXYTYPE' for now, later add 
SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE to btBroadphaseProxy.h
-               return FAST_CONCAVE_MESH_PROXYTYPE;
+               return SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE;
        }
 
        virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& 
aabbMax) const;
@@ -49,6 +49,16 @@
 
        virtual void    processAllTriangles(btTriangleCallback* callback,const 
btVector3& aabbMin,const btVector3& aabbMax) const;
 
+       btBvhTriangleMeshShape* getChildShape()
+       {
+               return m_bvhTriMeshShape;
+       }
+
+       const btBvhTriangleMeshShape*   getChildShape() const
+       {
+               return m_bvhTriMeshShape;
+       }
+
        //debugging
        virtual const char*     getName()const {return "SCALEDBVHTRIANGLEMESH";}
 

Modified: 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp
===================================================================
--- 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp
  2008-09-26 08:51:05 UTC (rev 16742)
+++ 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp
  2008-09-26 08:58:15 UTC (rev 16743)
@@ -19,7 +19,8 @@
 
 btTriangleMesh::btTriangleMesh (bool use32bitIndices,bool 
use4componentVertices)
 :m_use32bitIndices(use32bitIndices),
-m_use4componentVertices(use4componentVertices)
+m_use4componentVertices(use4componentVertices),
+m_weldingThreshold(0.0)
 {
        btIndexedMesh meshIndex;
        meshIndex.m_numTriangles = 0;
@@ -60,50 +61,67 @@
 
 }
 
-               
-void   btTriangleMesh::addTriangle(const btVector3& vertex0,const btVector3& 
vertex1,const btVector3& vertex2)
+void   btTriangleMesh::addIndex(int index)
 {
-       m_indexedMeshes[0].m_numTriangles++;
-       m_indexedMeshes[0].m_numVertices+=3;
+       if (m_use32bitIndices)
+       {
+               m_32bitIndices.push_back(index);
+               m_indexedMeshes[0].m_triangleIndexBase = (unsigned char*) 
&m_32bitIndices[0];
+       } else
+       {
+               m_16bitIndices.push_back(index);
+               m_indexedMeshes[0].m_triangleIndexBase = (unsigned char*) 
&m_16bitIndices[0];
+       }
+}
 
+int    btTriangleMesh::findOrAddVertex(const btVector3& vertex)
+{
+       //return index of new/existing vertex
+       //todo: could use acceleration structure for this
        if (m_use4componentVertices)
        {
-               m_4componentVertices.push_back(vertex0);
-               m_4componentVertices.push_back(vertex1);
-               m_4componentVertices.push_back(vertex2);
+               for (int i=0;i< m_4componentVertices.size();i++)
+               {
+                       if ((m_4componentVertices[i]-vertex).length2() <= 
m_weldingThreshold)
+                       {
+                               return i;
+                       }
+               }
+               m_indexedMeshes[0].m_numVertices++;
+               m_4componentVertices.push_back(vertex);
                m_indexedMeshes[0].m_vertexBase = (unsigned 
char*)&m_4componentVertices[0];
+
+               return m_4componentVertices.size()-1;
+               
        } else
        {
-               m_3componentVertices.push_back(vertex0.getX());
-               m_3componentVertices.push_back(vertex0.getY());
-               m_3componentVertices.push_back(vertex0.getZ());
-
-               m_3componentVertices.push_back(vertex1.getX());
-               m_3componentVertices.push_back(vertex1.getY());
-               m_3componentVertices.push_back(vertex1.getZ());
-
-               m_3componentVertices.push_back(vertex2.getX());
-               m_3componentVertices.push_back(vertex2.getY());
-               m_3componentVertices.push_back(vertex2.getZ());
+               
+               for (int i=0;i< m_3componentVertices.size();i+=3)
+               {
+                       btVector3 
vtx(m_3componentVertices[i],m_3componentVertices[i+1],m_3componentVertices[i+2]);
+                       if ((vtx-vertex).length2() <= m_weldingThreshold)
+                       {
+                               return i/3;
+                       }
+               }
+               m_3componentVertices.push_back(vertex.getX());
+               m_3componentVertices.push_back(vertex.getY());
+               m_3componentVertices.push_back(vertex.getZ());
+               m_indexedMeshes[0].m_numVertices++;
                m_indexedMeshes[0].m_vertexBase = (unsigned 
char*)&m_3componentVertices[0];
+               return (m_3componentVertices.size()/3)-1;
        }
 
-       if (m_use32bitIndices)
-       {
-               int curIndex = m_32bitIndices.size();
-               m_32bitIndices.push_back(curIndex++);
-               m_32bitIndices.push_back(curIndex++);
-               m_32bitIndices.push_back(curIndex++);
-               m_indexedMeshes[0].m_triangleIndexBase = (unsigned char*) 
&m_32bitIndices[0];
-       } else
-       {
-               short curIndex = static_cast<short>(m_16bitIndices.size());
-               m_16bitIndices.push_back(curIndex++);
-               m_16bitIndices.push_back(curIndex++);
-               m_16bitIndices.push_back(curIndex++);
-               m_indexedMeshes[0].m_triangleIndexBase = (unsigned char*) 
&m_16bitIndices[0];
-       }
 }
+               
+void   btTriangleMesh::addTriangle(const btVector3& vertex0,const btVector3& 
vertex1,const btVector3& vertex2)
+{
+       m_indexedMeshes[0].m_numTriangles++;
+               
+       addIndex(findOrAddVertex(vertex0));
+       addIndex(findOrAddVertex(vertex1));
+       addIndex(findOrAddVertex(vertex2));
+}
 
 int btTriangleMesh::getNumTriangles() const
 {

Modified: 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h
===================================================================
--- 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h
    2008-09-26 08:51:05 UTC (rev 16742)
+++ 
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h
    2008-09-26 08:58:15 UTC (rev 16743)
@@ -25,6 +25,7 @@
 ///It allows either 32bit or 16bit indices, and 4 (x-y-z-w) or 3 (x-y-z) 
component vertices.
 ///If you want to share triangle/index data between graphics mesh and 
collision mesh (btBvhTriangleMeshShape), you can directly use 
btTriangleIndexVertexArray or derive your own class from 
btStridingMeshInterface.
 ///Performance of btTriangleMesh and btTriangleIndexVertexArray used in a 
btBvhTriangleMeshShape is the same.
+///It has a brute-force option to weld together closeby vertices.
 class btTriangleMesh : public btTriangleIndexVertexArray
 {
        btAlignedObjectArray<btVector3> m_4componentVertices;
@@ -34,11 +35,16 @@
        btAlignedObjectArray<unsigned short int>                m_16bitIndices;
        bool    m_use32bitIndices;
        bool    m_use4componentVertices;
+       
 
+       public:
+               btScalar        m_weldingThreshold;
 
-       public:
                btTriangleMesh (bool use32bitIndices=true,bool 
use4componentVertices=true);
 
+               int             findOrAddVertex(const btVector3& vertex);
+               void    addIndex(int index);
+
                bool    getUse32bitIndices() const
                {
                        return m_use32bitIndices;

Copied: branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact (from 
rev 16741, trunk/blender/extern/bullet2/src/BulletCollision/Gimpact)

Deleted: 
branches/sim_physics/extern/bullet2/src/BulletCollision/Gimpact/btBoxCollision.h
===================================================================

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to