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>2006-12-12 06:08:15 +0300
committerErwin Coumans <blender@erwincoumans.com>2006-12-12 06:08:15 +0300
commit9a169f26333141b1f9e0ef4609c7ef3dba2f5835 (patch)
tree3c5ca488888a6befac6fe29e596d64115a4584ea /extern/bullet2/src/BulletCollision/CollisionShapes
parent237e7417e733f6942068131a612acb495a6742cf (diff)
added some new Bullet files, and upgraded to latest Bullet 2.x
Please make sure to have extern/bullet/src/LinearMath/btAlignedAllocator.cpp in your build, if you add the files by name, instead of wildcard *.cpp
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes')
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.h5
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp1
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h5
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp5
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.h28
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleBuffer.h5
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h4
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h6
8 files changed, 43 insertions, 16 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.h
index c810a654834..84188bc8b76 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.h
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.h
@@ -23,6 +23,7 @@ subject to the following restrictions:
#include "LinearMath/btMatrix3x3.h"
#include <vector>
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
+#include "LinearMath/btAlignedObjectArray.h"
class btOptimizedBvh;
@@ -30,8 +31,8 @@ class btOptimizedBvh;
/// This allows for concave collision objects. This is more general then the Static Concave btTriangleMeshShape.
class btCompoundShape : public btCollisionShape
{
- std::vector<btTransform> m_childTransforms;
- std::vector<btCollisionShape*> m_childShapes;
+ btAlignedObjectArray<btTransform> m_childTransforms;
+ btAlignedObjectArray<btCollisionShape*> m_childShapes;
btVector3 m_localAabbMin;
btVector3 m_localAabbMax;
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
index 7a4c7ebf5c0..5af6e5f03d9 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
@@ -22,6 +22,7 @@ subject to the following restrictions:
btConvexHullShape ::btConvexHullShape (const float* points,int numPoints,int stride)
{
m_points.resize(numPoints);
+
unsigned char* pointsBaseAddress = (unsigned char*)points;
for (int i=0;i<numPoints;i++)
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h
index afe7dd8f7a9..beea0e63201 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.h
@@ -19,7 +19,8 @@ subject to the following restrictions:
#include "btPolyhedralConvexShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
-#include <vector>
+
+#include "LinearMath/btAlignedObjectArray.h"
///ConvexHullShape implements an implicit (getSupportingVertex) Convex Hull of a Point Cloud (vertices)
///No connectivity is needed. localGetSupportingVertex iterates linearly though all vertices.
@@ -27,7 +28,7 @@ subject to the following restrictions:
///(memory is much slower then the cpu)
class btConvexHullShape : public btPolyhedralConvexShape
{
- std::vector<btPoint3> m_points;
+ btAlignedObjectArray<btPoint3> m_points;
public:
///this constructor optionally takes in a pointer to points. Each point is assumed to be 3 consecutive float (x,y,z), the striding defines the number of bytes between each point, in memory.
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp
index 18b796b39b5..37f15e1dcc4 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp
@@ -18,6 +18,11 @@ subject to the following restrictions:
#include "LinearMath/btAabbUtil2.h"
+btOptimizedBvh::btOptimizedBvh() :m_rootNode1(0), m_numNodes(0)
+{
+
+}
+
void btOptimizedBvh::build(btStridingMeshInterface* triangles)
{
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.h
index 96172c4e298..cb76cb23340 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.h
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.h
@@ -15,9 +15,17 @@ subject to the following restrictions:
#ifndef OPTIMIZED_BVH_H
#define OPTIMIZED_BVH_H
+
+
#include "LinearMath/btVector3.h"
+
+
+//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vclrf__m128.asp
+
+
#include <vector>
+
class btStridingMeshInterface;
/// btOptimizedBvhNode contains both internal and leaf node information.
@@ -26,7 +34,7 @@ class btStridingMeshInterface;
/// and storing aabbmin/max as quantized integers.
/// 'subpart' doesn't need an integer either. It allows to re-use graphics triangle
/// meshes stored in a non-uniform way (like batches/subparts of triangle-fans
-struct btOptimizedBvhNode
+ATTRIBUTE_ALIGNED16 (struct btOptimizedBvhNode)
{
btVector3 m_aabbMin;
@@ -52,12 +60,23 @@ public:
virtual void processNode(const btOptimizedBvhNode* node) = 0;
};
-typedef std::vector<btOptimizedBvhNode> NodeArray;
+#include "LinearMath/btAlignedAllocator.h"
+#include "LinearMath/btAlignedObjectArray.h"
+
+//typedef std::vector< unsigned , allocator_type > container_type;
+const unsigned size = (1 << 20);
+typedef btAlignedAllocator< btOptimizedBvhNode , size > allocator_type;
+
+//typedef btAlignedObjectArray<btOptimizedBvhNode, allocator_type> NodeArray;
+
+typedef btAlignedObjectArray<btOptimizedBvhNode> NodeArray;
///OptimizedBvh store an AABB tree that can be quickly traversed on CPU (and SPU,GPU in future)
class btOptimizedBvh
{
+ NodeArray m_leafNodes;
+
btOptimizedBvhNode* m_rootNode1;
btOptimizedBvhNode* m_contiguousNodes;
@@ -65,10 +84,11 @@ class btOptimizedBvh
int m_numNodes;
- NodeArray m_leafNodes;
+
public:
- btOptimizedBvh() :m_rootNode1(0), m_numNodes(0) { }
+ btOptimizedBvh();
+
virtual ~btOptimizedBvh();
void build(btStridingMeshInterface* triangles);
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleBuffer.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleBuffer.h
index d04341aa809..9a623403846 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleBuffer.h
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleBuffer.h
@@ -17,7 +17,8 @@ subject to the following restrictions:
#define BT_TRIANGLE_BUFFER_H
#include "btTriangleCallback.h"
-#include <vector>
+//#include <vector>
+#include "LinearMath/btAlignedObjectArray.h"
struct btTriangle
{
@@ -32,7 +33,7 @@ struct btTriangle
class btTriangleBuffer : public btTriangleCallback
{
- std::vector<btTriangle> m_triangleBuffer;
+ btAlignedObjectArray<btTriangle> m_triangleBuffer;
public:
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h
index 638c8b87fb1..3ec827c03d9 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h
@@ -17,7 +17,7 @@ subject to the following restrictions:
#define BT_TRIANGLE_INDEX_VERTEX_ARRAY_H
#include "btStridingMeshInterface.h"
-#include <vector>
+#include <LinearMath/btAlignedObjectArray.h>
///IndexedMesh indexes into existing vertex and index arrays, in a similar way OpenGL glDrawElements
///instead of the number of indices, we pass the number of triangles
@@ -38,7 +38,7 @@ struct btIndexedMesh
///So keep those arrays around during the lifetime of this btTriangleIndexVertexArray.
class btTriangleIndexVertexArray : public btStridingMeshInterface
{
- std::vector<btIndexedMesh> m_indexedMeshes;
+ btAlignedObjectArray<btIndexedMesh> m_indexedMeshes;
public:
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h
index 171dcf33b15..1be03d70436 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleMesh.h
@@ -18,9 +18,8 @@ subject to the following restrictions:
#define TRIANGLE_MESH_H
#include "BulletCollision/CollisionShapes/btStridingMeshInterface.h"
-#include <vector>
#include <LinearMath/btVector3.h>
-
+#include "LinearMath/btAlignedObjectArray.h"
struct btMyTriangle
{
btVector3 m_vert0;
@@ -31,8 +30,7 @@ struct btMyTriangle
///TriangleMesh provides storage for a concave triangle mesh. It can be used as data for the btTriangleMeshShape.
class btTriangleMesh : public btStridingMeshInterface
{
- std::vector<btMyTriangle> m_triangles;
-
+ btAlignedObjectArray<btMyTriangle> m_triangles;
public:
btTriangleMesh ();