diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-12-12 06:08:15 +0300 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-12-12 06:08:15 +0300 |
commit | 9a169f26333141b1f9e0ef4609c7ef3dba2f5835 (patch) | |
tree | 3c5ca488888a6befac6fe29e596d64115a4584ea /extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.h | |
parent | 237e7417e733f6942068131a612acb495a6742cf (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/btOptimizedBvh.h')
-rw-r--r-- | extern/bullet2/src/BulletCollision/CollisionShapes/btOptimizedBvh.h | 28 |
1 files changed, 24 insertions, 4 deletions
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); |