Collaboration diagram for col::ColObj:
Public Member Functions | |
const char * | getName (void) const |
void | setActive (bool active) |
Set the activity-status of a Colobj Used to remove an object temporarily from collision checks. | |
bool | isActive () |
Returns the activity-status of a Colobj. | |
void | setFlexible (bool flexible) |
void | setStationary (bool stationary) |
void | SetGridObj (Grid *grid) |
Constructors, desctructors, assignment | |
ColObj () | |
The default ctor is not meant for "real" usage It is only there so that we can create vector's. | |
ColObj (osg::GeometryPtr &geom, osg::NodePtr &node, bool flexible, bool stationary, bool compute_hull, AlgoE algo, Grid *grid, bool show_hull=false, char *name=NULL) | |
The ctor you should use. | |
ColObj (const ColObj &source) | |
Copy a collision object. | |
void | operator= (const ColObj &source) |
Assignment. | |
Checks | |
void | updateBBox (void) |
Update current world bbox. | |
bool | bboxIntersects (ColObj *other) |
Check if the bboxes of two objects intersect. | |
bool | hasMoved (unsigned int global_cycle) |
Update toworld matrix and check whether or not an object has moved. | |
GridObj * | GetGridObj (void) |
Return GridObj. | |
void | updateGrid (void) |
Update GridObj if object has moved. | |
Static Public Member Functions | |
static ColObj * | find (vector< ColObj > *colobjs, osg::NodePtr obj) |
Find the colobjs[i] for which colobjs[i].m_node == obj; If not found, returns NULL. | |
Protected Attributes | |
bool | m_active |
Used to remove an object temporarily from collision checks. | |
bool | m_flexible |
Set if the object deforms. | |
bool | m_stationary |
Set if the object doesn't move. | |
const DopTree * | m_doptree |
DOP tree of this obj. | |
const Boxtree * | m_boxtree |
Boxtree of this obj. | |
osg::NodePtr | m_node |
The actual "collidable" object. | |
osg::Matrix | m_old_matr |
The toWorld matrix of node as of last frame. | |
osg::Matrix | m_curr_matr |
The current toWorld matrix as of start of current cycle. | |
vector< const osg::MFPnt3f * > | points |
char * | m_name |
The name of the colobj. | |
int | m_col_matr_idx |
row/column index into col. | |
bool | m_has_moved |
Flags whether or not obj has moved since last frame. | |
bool | m_first_moved_check |
unsigned int | m_cycle |
ConvexHull | m_hull |
the convex hull of geom | |
GridObj * | m_gridobj |
Friends | |
class | Matrix |
class | MatrixCell |
class | ColPair |
Holds various flags for one collidable object, including all auxiliary collision detection data (hierarchies, etc.).
col::ColObj::ColObj | ( | osg::GeometryPtr & | geom, | |
osg::NodePtr & | node, | |||
bool | flexible, | |||
bool | stationary, | |||
bool | compute_hull, | |||
AlgoE | algo, | |||
Grid * | grid, | |||
bool | show_hull = false , |
|||
char * | colname = NULL | |||
) |
The ctor you should use.
geom,node | the OSG object | |
flexible | tells the coll.det. module that this object might deform | |
stationary | tells the coll.det. module that this object won't move | |
compute_hull | a convex hull of m_geom will be computed and stored, | |
algo | determines what hierarchical data structure to build | |
show_hull | creates a geometry from the convex hull | |
colname | name of colobj |
If an object is not m_stationary, then hasMoved() will return true when called for the first time (whether or not the object really has moved).
If show_hull is true
, then the convex hull geometry will be attached to the m_node so that it will get rendered, too.
Colname is the name which will be printed with ColObj::print; if it is NULL, then the OSG name will be printed; if that does not exist, an automatically generated ID will be printed.
XDopTree | If geometry has no polygons, or no GeoPosition3f. | |
XColBug | If a bug in the doptree code occurs. | |
bad_alloc |
col::ColObj::ColObj | ( | const ColObj & | source | ) |
Copy a collision object.
void col::ColObj::operator= | ( | const ColObj & | source | ) |
Assignment.
void col::ColObj::updateBBox | ( | void | ) |
Update current world bbox.
Calculates the current bbox in world coordinates. It can be retrieved later by getBBox().
bool col::ColObj::bboxIntersects | ( | ColObj * | other | ) |
Check if the bboxes of two objects intersect.
other | another collision object |
bool col::ColObj::hasMoved | ( | unsigned int | global_cycle | ) |
Update toworld matrix and check whether or not an object has moved.
This is based on a toWorld matrix comparison. The check will be performed only once per collision cycle.
Whether or not the obj has moved, m_curr_matr will be copied into m_old_matr, and m_curr_matr will get the node's current toWorld matrix. This happens only if global_cycle has been incremented.
void col::ColObj::setActive | ( | bool | active | ) |
Set the activity-status of a Colobj Used to remove an object temporarily from collision checks.
active | true => object will be checked |
int col::ColObj::m_col_matr_idx [protected] |
bool col::ColObj::m_has_moved [protected] |
Flags whether or not obj has moved since last frame.
Is valid only if cycle == coll::Cycle