1#ifndef GIM_BOX_SET_H_INCLUDED
2#define GIM_BOX_SET_H_INCLUDED
189template <
typename _GIM_PRIMITIVE_MANAGER_PROTOTYPE,
typename _GIM_BOX_TREE_PROTOTYPE>
291 bool aabbOverlap =
bound.has_collision(
box);
425template <
typename _GIM_PRIMITIVE_MANAGER_PROTOTYPE>
432template <
typename BOX_SET_CLASS0,
typename BOX_SET_CLASS1>
513 if (!
result)
return false;
527 if (!
result)
return false;
542 if (!
result)
return false;
const T & btMax(const T &a, const T &b)
#define SIMD_FORCE_INLINE
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
bool collide_triangle_exact(const btVector3 &p1, const btVector3 &p2, const btVector3 &p3, const btVector4 &triangle_plane)
test for a triangle, with edges
void appy_transform(const btTransform &trans)
Apply a transform to an AABB.
void increment_margin(btScalar margin)
Generic Box Tree Template.
_GIM_PRIMITIVE_MANAGER_PROTOTYPE m_primitive_manager
GUINT getNodeData(GUINT nodeindex) const
GUINT getLeftNodeIndex(GUINT nodeindex) const
void setPrimitiveManager(const _GIM_PRIMITIVE_MANAGER_PROTOTYPE &primitive_manager)
const _GIM_PRIMITIVE_MANAGER_PROTOTYPE & getPrimitiveManager() const
GIM_BOX_TREE_TEMPLATE_SET()
_GIM_PRIMITIVE_MANAGER_PROTOTYPE & getPrimitiveManager()
void buildSet()
this rebuild the entire set
bool boxQuery(const GIM_AABB &box, gim_array< GUINT > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
bool isLeafNode(GUINT nodeindex) const
tells if the node is a leaf
bool hasHierarchy() const
tells if this set has hierarcht
GUINT getRightNodeIndex(GUINT nodeindex) const
void update()
node manager prototype functions
_GIM_BOX_TREE_PROTOTYPE m_box_tree
bool isTrimesh() const
tells if this set is a trimesh
GUINT getNodeCount() const
node count
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 setNodeBound(GUINT nodeindex, const GIM_AABB &bound)
GIM_AABB getGlobalBox() const
void getNodeBound(GUINT nodeindex, GIM_AABB &bound) 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
GUINT getScapeNodeIndex(GUINT nodeindex) const
Basic Box tree structure.
GUINT getScapeNodeIndex(GUINT nodeindex) const
void getNodeBound(GUINT nodeindex, GIM_AABB &bound) const
void setNodeBound(GUINT nodeindex, const GIM_AABB &bound)
GUINT _calc_splitting_axis(gim_array< GIM_AABB_DATA > &primitive_boxes, GUINT startIndex, GUINT endIndex)
gim_array< GIM_BOX_TREE_NODE > m_node_array
GUINT getLeftNodeIndex(GUINT nodeindex) const
GUINT getRightNodeIndex(GUINT nodeindex) const
GUINT getNodeData(GUINT nodeindex) const
bool isLeafNode(GUINT nodeindex) const
tells if the node is a leaf
GUINT _sort_and_calc_splitting_index(gim_array< GIM_AABB_DATA > &primitive_boxes, GUINT startIndex, GUINT endIndex, GUINT splitAxis)
GUINT getNodeCount() const
node count
void _build_sub_tree(gim_array< GIM_AABB_DATA > &primitive_boxes, GUINT startIndex, GUINT endIndex)
void build_tree(gim_array< GIM_AABB_DATA > &primitive_boxes)
prototype functions for box tree management
Prototype Base class for primitive classification.
virtual void get_primitive_box(GUINT prim_index, GIM_AABB &primbox)=0
virtual GUINT get_primitive_count()=0
virtual bool is_trimesh()=0
determines if this manager consist on only triangles, which special case will be optimized
virtual ~GIM_PRIMITIVE_MANAGER_PROTOTYPE()
virtual void get_primitive_triangle(GUINT prim_index, GIM_TRIANGLE &triangle)=0
GIM_BOX_SET collision methods.
bool node_collision(GUINT node0, GUINT node1)
BOX_SET_CLASS1 * m_boxset1
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 retrieve_node1_triangle(GUINT node1)
void retrieve_node0_triangle(GUINT node0)
GIM_BOX_BOX_TRANSFORM_CACHE trans_cache_1to0
void find_collision_pairs()
BOX_SET_CLASS0 * m_boxset0
void retrieve_node0_info(GUINT node0)
void retrieve_node1_info(GUINT node1)
btTransform trans_cache_0to1
gim_pair_set * m_collision_pairs
Class for colliding triangles.
void get_plane(btVector4 &plane) const
btVector3 can be used to represent 3D points and vectors.
Very simple array container with fast access and simd memory.
void push_back(const GIM_PAIR &obj)
bool reserve(GUINT size)
public operations
void resize(GUINT size, bool call_constructor=true, const T &fillData=T())
void push_pair(GUINT index1, GUINT index2)
void push_pair_inv(GUINT index1, GUINT index2)
#define G_UINT_INFINITY
A very very high value.
Node Structure for trees.
GUINT m_escapeIndex
Scape index for traversing.
GUINT m_left
Left subtree.
GUINT m_right
Right subtree.
GUINT m_data
primitive index if apply
bool is_leaf_node() const