1 #ifndef GIM_QUANTIZED_SET_H_INCLUDED
2 #define GIM_QUANTIZED_SET_H_INCLUDED
39 unsigned short int m_quantizedAabbMin[3];
40 unsigned short int m_quantizedAabbMax[3];
46 m_escapeIndexOrDataIndex = 0;
52 return (m_escapeIndexOrDataIndex>=0);
58 return -m_escapeIndexOrDataIndex;
63 m_escapeIndexOrDataIndex = -index;
70 return m_escapeIndexOrDataIndex;
75 m_escapeIndexOrDataIndex = index;
79 unsigned short * quantizedMin,
unsigned short * quantizedMax)
const
81 if(m_quantizedAabbMin[0] > quantizedMax[0] ||
82 m_quantizedAabbMax[0] < quantizedMin[0] ||
83 m_quantizedAabbMin[1] > quantizedMax[1] ||
84 m_quantizedAabbMax[1] < quantizedMin[1] ||
85 m_quantizedAabbMin[2] > quantizedMax[2] ||
86 m_quantizedAabbMax[2] < quantizedMin[2])
117 int startIndex,
int endIndex,
int splitAxis);
133 unsigned short * quantizedpoint,
const btVector3 & point)
const
141 unsigned short * quantizedMin,
unsigned short * quantizedMax)
const
143 return m_node_array[node_index].testQuantizedBoxOverlapp(quantizedMin,quantizedMax);
203 return nodeindex+1 +
m_node_array[nodeindex+1].getEscapeIndex();
288 return boxQuery(transbox,collided_results);
362 #ifdef TRI_COLLISION_PROFILING
363 static float getAverageTreeCollisionTime();
364 #endif //TRI_COLLISION_PROFILING
372 #endif // GIM_BOXPRUNING_H_INCLUDED
int getRightNode(int nodeindex) const
bool testQuantizedBoxOverlapp(unsigned short *quantizedMin, unsigned short *quantizedMax) const
void build_tree(GIM_BVH_DATA_ARRAY &primitive_boxes)
prototype functions for box tree management
int getEscapeIndex() const
void calc_quantization(GIM_BVH_DATA_ARRAY &primitive_boxes, btScalar boundMargin=btScalar(1.0))
int _calc_splitting_axis(GIM_BVH_DATA_ARRAY &primitive_boxes, int startIndex, int endIndex)
btGImpactQuantizedBvh()
this constructor doesn't build the tree. you must call buildSet
bool testQuantizedBoxOverlapp(int node_index, unsigned short *quantizedMin, unsigned short *quantizedMax) const
btVector3 m_bvhQuantization
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int getRightNode(int nodeindex) const
int getNodeData(int nodeindex) const
#define SIMD_FORCE_INLINE
btVector3 bt_unquantize(const unsigned short *vecIn, const btVector3 &offset, const btVector3 &bvhQuantization)
bool rayQuery(const btVector3 &ray_dir, const btVector3 &ray_origin, btAlignedObjectArray< int > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
int getNodeData(int nodeindex) const
bool isTrimesh() const
tells if this set is a trimesh
void setEscapeIndex(int index)
btQuantizedBvhTree m_box_tree
Prototype Base class for primitive classification.
bool isLeafNode(int nodeindex) const
tells if the node is a leaf
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations.
void bt_quantize_clamp(unsigned short *out, const btVector3 &point, const btVector3 &min_bound, const btVector3 &max_bound, const btVector3 &bvhQuantization)
bool boxQueryTrans(const btAABB &box, const btTransform &transform, btAlignedObjectArray< int > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
void setNodeBound(int nodeindex, const btAABB &bound)
int getLeftNode(int nodeindex) const
void update()
node manager prototype functions
int getNodeCount() const
node count
void setPrimitiveManager(btPrimitiveManagerBase *primitive_manager)
void appy_transform(const btTransform &trans)
Apply a transform to an AABB.
virtual bool is_trimesh() const =0
determines if this manager consist on only triangles, which special case will be optimized ...
GIM_QUANTIZED_BVH_NODE_ARRAY m_node_array
int m_escapeIndexOrDataIndex
btPrimitiveManagerBase * getPrimitiveManager() const
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
virtual void get_primitive_triangle(int prim_index, btPrimitiveTriangle &triangle) const =0
retrieves only the points of the triangle, and the collision margin
Basic Box tree structure.
void getNodeBound(int nodeindex, btAABB &bound) const
int getLeftNode(int nodeindex) const
void getNodeTriangle(int nodeindex, btPrimitiveTriangle &triangle) const
btPrimitiveManagerBase * m_primitive_manager
bool hasHierarchy() const
tells if this set has hierarcht
void setDataIndex(int index)
btGImpactQuantizedBvh(btPrimitiveManagerBase *primitive_manager)
this constructor doesn't build the tree. you must call buildSet
int getNodeCount() const
node count
bool boxQuery(const btAABB &box, btAlignedObjectArray< int > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
bool isLeafNode(int nodeindex) const
tells if the node is a leaf
int getEscapeNodeIndex(int nodeindex) const
int _sort_and_calc_splitting_index(GIM_BVH_DATA_ARRAY &primitive_boxes, int startIndex, int endIndex, int splitAxis)
btQuantizedBvhNode is a compressed aabb node, 16 bytes.
void quantizePoint(unsigned short *quantizedpoint, const btVector3 &point) const
static void find_collision(const btGImpactQuantizedBvh *boxset1, const btTransform &trans1, const btGImpactQuantizedBvh *boxset2, const btTransform &trans2, btPairSet &collision_pairs)
void getNodeBound(int nodeindex, btAABB &bound) const
btAABB getGlobalBox() const
const BT_QUANTIZED_BVH_NODE * get_node_pointer(int index=0) const
Structure for containing Boxes.
void setNodeBound(int nodeindex, const btAABB &bound)
int getEscapeNodeIndex(int nodeindex) const
const BT_QUANTIZED_BVH_NODE * get_node_pointer(int index=0) const
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
void buildSet()
this rebuild the entire set
void _build_sub_tree(GIM_BVH_DATA_ARRAY &primitive_boxes, int startIndex, int endIndex)