| Bullet Collision Detection & Physics Library
    | 
 
 
 
Go to the documentation of this file.
   39                 NodeTriangleCallback& operator=(NodeTriangleCallback& other)
 
   45                 NodeTriangleCallback(
NodeArray& triangleNodes)
 
   46                         : m_triangleNodes(triangleNodes)
 
   50                 virtual void internalProcessTriangleIndex(
btVector3* triangle, 
int partId, 
int triangleIndex)
 
   56                         aabbMin.
setMin(triangle[0]);
 
   57                         aabbMax.
setMax(triangle[0]);
 
   58                         aabbMin.
setMin(triangle[1]);
 
   59                         aabbMax.
setMax(triangle[1]);
 
   60                         aabbMin.
setMin(triangle[2]);
 
   61                         aabbMax.
setMax(triangle[2]);
 
   80                 QuantizedNodeTriangleCallback& operator=(QuantizedNodeTriangleCallback& other)
 
   83                         m_optimizedTree = other.m_optimizedTree;
 
   88                         : m_triangleNodes(triangleNodes), m_optimizedTree(tree)
 
   92                 virtual void internalProcessTriangleIndex(
btVector3* triangle, 
int partId, 
int triangleIndex)
 
  104                         aabbMin.
setMin(triangle[0]);
 
  105                         aabbMax.
setMax(triangle[0]);
 
  106                         aabbMin.
setMin(triangle[1]);
 
  107                         aabbMax.
setMax(triangle[1]);
 
  108                         aabbMin.
setMin(triangle[2]);
 
  109                         aabbMax.
setMax(triangle[2]);
 
  114                         if (aabbMax.
x() - aabbMin.
x() < MIN_AABB_DIMENSION)
 
  116                                 aabbMax.
setX(aabbMax.
x() + MIN_AABB_HALF_DIMENSION);
 
  117                                 aabbMin.
setX(aabbMin.
x() - MIN_AABB_HALF_DIMENSION);
 
  119                         if (aabbMax.
y() - aabbMin.
y() < MIN_AABB_DIMENSION)
 
  121                                 aabbMax.
setY(aabbMax.
y() + MIN_AABB_HALF_DIMENSION);
 
  122                                 aabbMin.
setY(aabbMin.
y() - MIN_AABB_HALF_DIMENSION);
 
  124                         if (aabbMax.
z() - aabbMin.
z() < MIN_AABB_DIMENSION)
 
  126                                 aabbMax.
setZ(aabbMax.
z() + MIN_AABB_HALF_DIMENSION);
 
  127                                 aabbMin.
setZ(aabbMin.
z() - MIN_AABB_HALF_DIMENSION);
 
  139         int numLeafNodes = 0;
 
  229         unsigned short quantizedQueryAabbMin[3];
 
  230         unsigned short quantizedQueryAabbMax[3];
 
  232         quantize(&quantizedQueryAabbMin[0], aabbMin, 0);
 
  233         quantize(&quantizedQueryAabbMax[0], aabbMax, 1);
 
  257         int curNodeSubPart = -1;
 
  260         const unsigned char* vertexbase = 0;
 
  264         const unsigned char* indexbase = 0;
 
  274         for (i = endNode - 1; i >= firstNode; i--)
 
  282                         if (nodeSubPart != curNodeSubPart)
 
  284                                 if (curNodeSubPart >= 0)
 
  288                                 curNodeSubPart = nodeSubPart;
 
  293                         unsigned int* gfxbase = (
unsigned int*)(indexbase + nodeTriangleIndex * indexstride);
 
  295                         for (
int j = 2; j >= 0; j--)
 
  297                                 int graphicsindex = indicestype == 
PHY_SHORT ? ((
unsigned short*)gfxbase)[j] : gfxbase[j];
 
  300                                         float* graphicsbase = (
float*)(vertexbase + graphicsindex * stride);
 
  302                                                 graphicsbase[0] * meshScaling.
getX(),
 
  303                                                 graphicsbase[1] * meshScaling.
getY(),
 
  304                                                 graphicsbase[2] * meshScaling.
getZ());
 
  308                                         double* graphicsbase = (
double*)(vertexbase + graphicsindex * stride);
 
  315                         aabbMin.
setMin(triangleVerts[0]);
 
  316                         aabbMax.
setMax(triangleVerts[0]);
 
  317                         aabbMin.
setMin(triangleVerts[1]);
 
  318                         aabbMax.
setMax(triangleVerts[1]);
 
  319                         aabbMin.
setMin(triangleVerts[2]);
 
  320                         aabbMax.
setMax(triangleVerts[2]);
 
  334                                 for (
int i = 0; i < 3; i++)
 
  348         if (curNodeSubPart >= 0)
 
  358         return static_cast<btOptimizedBvh*>(bvh);
 
  
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes,...
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
unsigned testQuantizedAabbAgainstQuantizedAabb(const unsigned short int *aabbMin1, const unsigned short int *aabbMax1, const unsigned short int *aabbMin2, const unsigned short int *aabbMax2)
void setZ(btScalar _z)
Set the z value.
void copyFromArray(const btAlignedObjectArray &otherArray)
btQuantizedBvhNode is a compressed aabb node, 16 bytes.
void updateBvhNodes(btStridingMeshInterface *meshInterface, int firstNode, int endNode, int index)
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU.
virtual void InternalProcessAllTriangles(btInternalTriangleIndexCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
#define MAX_NUM_PARTS_IN_BITS
const btScalar & y() const
Return the y value.
NodeArray m_contiguousNodes
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
const btScalar & getX() const
Return the x value.
int getEscapeIndex() const
void build(btStridingMeshInterface *triangles, bool useQuantizedAabbCompression, const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax)
void setX(btScalar _x)
Set the x value.
btBvhSubtreeInfo provides info to gather a subtree of limited size
unsigned short int m_quantizedAabbMax[3]
void resize(int newsize, const T &fillData=T())
void setMax(const btVector3 &other)
Set each element to the max of the current values and the values of another btVector3.
PHY_ScalarType
PHY_ScalarType enumerates possible scalar types.
void setY(btScalar _y)
Set the y value.
unsigned short int m_quantizedAabbMin[3]
QuantizedNodeArray m_quantizedLeafNodes
static btQuantizedBvh * deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian)
deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
btVector3 can be used to represent 3D points and vectors.
void refit(btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, const unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0) const =0
void setQuantizationValues(const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax, btScalar quantizationMargin=btScalar(1.0))
***************************************** expert/internal use only *************************
virtual ~btOptimizedBvh()
BvhSubtreeInfoArray m_SubtreeHeaders
const btScalar & getZ() const
Return the z value.
const btVector3 & getScaling() const
const btScalar & getY() const
Return the y value.
void setMin(const btVector3 &other)
Set each element to the min of the current values and the values of another btVector3.
const btScalar & x() const
Return the x value.
T & expand(const T &fillValue=T())
void quantize(unsigned short *out, const btVector3 &point, int isMax) const
btOptimizedBvhNode contains both internal and leaf node information.
void refitPartial(btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
void setAabbFromQuantizeNode(const btQuantizedBvhNode &quantizedNode)
int m_escapeIndexOrTriangleIndex
int getTriangleIndex() const
void push_back(const T &_Val)
virtual void unLockReadOnlyVertexBase(int subpart) const =0
void buildTree(int startIndex, int endIndex)
unsigned short int m_quantizedAabbMax[3]
static btOptimizedBvh * deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian)
deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
QuantizedNodeArray m_quantizedContiguousNodes
const btScalar & z() const
Return the z value.
int size() const
return the number of elements in the array
unsigned short int m_quantizedAabbMin[3]