Bullet Collision Detection & Physics Library
|
Go to the documentation of this file. 1 #ifndef GIM_BOX_SET_H_INCLUDED
2 #define GIM_BOX_SET_H_INCLUDED
210 template <
typename _GIM_PRIMITIVE_MANAGER_PROTOTYPE,
typename _GIM_BOX_TREE_PROTOTYPE>
290 for (
GUINT i = 0; i < primitive_boxes.
size(); i++)
293 primitive_boxes[i].
m_data = i;
305 while (curIndex < numNodes)
315 if (isleafnode && aabbOverlap)
320 if (aabbOverlap || isleafnode)
331 if (collided_results.
size() > 0)
return true;
341 return boxQuery(transbox, collided_results);
352 while (curIndex < numNodes)
359 bool aabbOverlap = bound.
collide_ray(ray_origin, ray_dir);
362 if (isleafnode && aabbOverlap)
367 if (aabbOverlap || isleafnode)
378 if (collided_results.
size() > 0)
return true;
423 return m_box_tree.getLeftNodeIndex(nodeindex);
428 return m_box_tree.getRightNodeIndex(nodeindex);
433 return m_box_tree.getScapeNodeIndex(nodeindex);
446 template <
typename _GIM_PRIMITIVE_MANAGER_PROTOTYPE>
453 template <
typename BOX_SET_CLASS0,
typename BOX_SET_CLASS1>
534 if (!result)
return false;
548 if (!result)
return false;
563 if (!result)
return false;
578 while (stack_collisions.
size())
617 stack_collisions.
push_pair(left0, left1);
619 stack_collisions.
push_pair(left0, right1);
621 stack_collisions.
push_pair(right0, left1);
623 stack_collisions.
push_pair(right0, right1);
634 BOX_SET_CLASS1* boxset2,
const btTransform& trans2,
635 gim_pair_set& collision_pairs,
bool complete_primitive_tests =
true)
646 if (complete_primitive_tests)
661 #endif // GIM_BOXPRUNING_H_INCLUDED
bool hasHierarchy() const
tells if this set has hierarcht
Node Structure for trees.
void merge(const GIM_AABB &box)
Merges a Box.
gim_pair_set * m_collision_pairs
void _build_sub_tree(gim_array< GIM_AABB_DATA > &primitive_boxes, GUINT startIndex, GUINT endIndex)
void retrieve_node1_triangle(GUINT node1)
void build_tree(gim_array< GIM_AABB_DATA > &primitive_boxes)
prototype functions for box tree management
GIM_BOX_TREE_TEMPLATE_SET()
GUINT getScapeNodeIndex(GUINT nodeindex) const
Very simple array container with fast access and simd memory.
GIM_PAIR(GUINT index1, GUINT index2)
GIM_AABB getGlobalBox() const
Basic Box tree structure.
GUINT m_left
Left subtree.
bool collide_triangle_exact(const btVector3 &p1, const btVector3 &p2, const btVector3 &p3, const btVector4 &triangle_plane)
test for a triangle, with edges
virtual void get_primitive_triangle(GUINT prim_index, GIM_TRIANGLE &triangle)=0
void retrieve_node0_info(GUINT node0)
GUINT getRightNodeIndex(GUINT nodeindex) const
GUINT getNodeCount() const
node count
bool reserve(GUINT size)
public operations
void buildSet()
this rebuild the entire set
bool is_leaf_node() const
void getNodeBound(GUINT nodeindex, GIM_AABB &bound) const
virtual void get_primitive_box(GUINT prim_index, GIM_AABB &primbox)=0
bool overlapping_trans_cache(const GIM_AABB &box, const GIM_BOX_BOX_TRANSFORM_CACHE &transcache, bool fulltest)
transcache is the transformation cache from box to this AABB
GUINT m_data
primitive index if apply
const _GIM_PRIMITIVE_MANAGER_PROTOTYPE & getPrimitiveManager() const
bool has_collision(const GIM_AABB &other) const
GIM_BOX_BOX_TRANSFORM_CACHE trans_cache_1to0
bool rayQuery(const btVector3 &ray_dir, const btVector3 &ray_origin, gim_array< GUINT > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
void getNodeTriangle(GUINT nodeindex, GIM_TRIANGLE &triangle) const
void getNodeBound(GUINT nodeindex, GIM_AABB &bound) const
GUINT _sort_and_calc_splitting_index(gim_array< GIM_AABB_DATA > &primitive_boxes, GUINT startIndex, GUINT endIndex, GUINT splitAxis)
Class for colliding triangles.
BOX_SET_CLASS1 * m_boxset1
GUINT m_right
Right subtree.
GUINT getNodeData(GUINT nodeindex) const
void increment_margin(btScalar margin)
void setPrimitiveManager(const _GIM_PRIMITIVE_MANAGER_PROTOTYPE &primitive_manager)
GUINT getNodeCount() const
node count
void get_plane(btVector4 &plane) const
GIM_BOX_SET collision methods.
GUINT getLeftNodeIndex(GUINT nodeindex) const
_GIM_PRIMITIVE_MANAGER_PROTOTYPE & getPrimitiveManager()
void retrieve_node0_triangle(GUINT node0)
GUINT m_escapeIndex
Scape index for traversing.
bool isTrimesh() const
tells if this set is a trimesh
_GIM_BOX_TREE_PROTOTYPE m_box_tree
GUINT getRightNodeIndex(GUINT nodeindex) const
BOX_SET_CLASS0 * m_boxset0
bool node_collision(GUINT node0, GUINT node1)
btVector3 can be used to represent 3D points and vectors.
void push_back(const GIM_PAIR &obj)
bool isLeafNode(GUINT nodeindex) const
tells if the node is a leaf
virtual ~GIM_PRIMITIVE_MANAGER_PROTOTYPE()
bool isLeafNode(GUINT nodeindex) const
tells if the node is a leaf
void setNodeBound(GUINT nodeindex, const GIM_AABB &bound)
void update()
node manager prototype functions
bool collide_ray(const btVector3 &vorigin, const btVector3 &vdir)
Finds the Ray intersection parameter.
#define SIMD_FORCE_INLINE
Generic Box Tree Template.
GUINT _calc_splitting_axis(gim_array< GIM_AABB_DATA > &primitive_boxes, GUINT startIndex, GUINT endIndex)
GIM_PAIR(const GIM_PAIR &p)
void find_collision_pairs()
void retrieve_node1_info(GUINT node1)
btTransform trans_cache_0to1
GUINT getNodeData(GUINT nodeindex) const
GUINT getScapeNodeIndex(GUINT nodeindex) const
bool boxQueryTrans(const GIM_AABB &box, const btTransform &transform, gim_array< GUINT > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
void find_collision(BOX_SET_CLASS0 *boxset1, const btTransform &trans1, BOX_SET_CLASS1 *boxset2, const btTransform &trans2, gim_pair_set &collision_pairs, bool complete_primitive_tests=true)
void resize(GUINT size, bool call_constructor=true, const T &fillData=T())
_GIM_PRIMITIVE_MANAGER_PROTOTYPE m_primitive_manager
void push_pair_inv(GUINT index1, GUINT index2)
#define G_UINT_INFINITY
A very very high value.
void setNodeBound(GUINT nodeindex, const GIM_AABB &bound)
void push_pair(GUINT index1, GUINT index2)
void appy_transform(const btTransform &trans)
Apply a transform to an AABB.
bool boxQuery(const GIM_AABB &box, gim_array< GUINT > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
GUINT getLeftNodeIndex(GUINT nodeindex) const
Prototype Base class for primitive classification.
virtual GUINT get_primitive_count()=0
gim_array< GIM_BOX_TREE_NODE > m_node_array
virtual bool is_trimesh()=0
determines if this manager consist on only triangles, which special case will be optimized