#include <collisionEntry.h>
Inheritance diagram for CollisionEntry:
Public Member Functions | |
CollisionEntry () | |
CollisionEntry (const CollisionEntry ©) | |
void | operator= (const CollisionEntry ©) |
const CollisionSolid * | get_from () const |
Returns the CollisionSolid pointer for the particular solid that triggered this collision. | |
bool | has_into () const |
Returns true if the "into" solid is, in fact, a CollisionSolid, and its pointer is known (in which case get_into() may be called to retrieve it). | |
const CollisionSolid * | get_into () const |
Returns the CollisionSolid pointer for the particular solid was collided into. | |
CollisionNode * | get_from_node () const |
Returns the node that contains the CollisionSolid that triggered this collision. | |
PandaNode * | get_into_node () const |
Returns the node that contains the CollisionSolid that was collided into. | |
const NodePath & | get_into_node_path () const |
Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. | |
const LMatrix4f & | get_from_space () const |
Returns the global coordinate space of the CollisionNode returned by get_from_node(), as of the time of the collision. | |
const LMatrix4f & | get_into_space () const |
Returns the global coordinate space of the CollisionNode or GeomNode returned by get_into_node(), as of the time of the collision. | |
const LMatrix4f & | get_wrt_space () const |
const LMatrix4f & | get_inv_wrt_space () const |
void | set_from_velocity (const LVector3f &vel) |
Indicates the velocity associated with the "from" object, in the object's coordinate space. | |
bool | has_from_velocity () const |
Returns true if the "from" object had an indicated velocity, false otherwise. | |
const LVector3f & | get_from_velocity () const |
Returns the instantaneous velocity of the "from" object, in its own coordinate space. | |
void | set_into_intersection_point (const LPoint3f &point) |
bool | has_into_intersection_point () const |
Returns true if the detected collision knows its intersection point in the coordinate space of the collided-into object, false otherwise. | |
const LPoint3f & | get_into_intersection_point () const |
Returns the intersection point in the coordinate space of the collided-into object. | |
bool | has_from_intersection_point () const |
Returns true if the detected collision knows its intersection point in the coordinate space of the colliding object, false otherwise. | |
LPoint3f | get_from_intersection_point () const |
Returns the intersection point in the coordinate space of the colliding object. | |
void | set_into_surface_normal (const LVector3f &normal) |
bool | has_into_surface_normal () const |
Returns true if the detected collision knows the surface normal of the collided-into object at the point of the collision, false otherwise. | |
const LVector3f & | get_into_surface_normal () const |
Returns the surface normal of the collided-into object at the point of the collision. | |
void | set_from_surface_normal (const LVector3f &normal) |
bool | has_from_surface_normal () const |
Returns true if the detected collision knows the surface normal of the collided-into object at the point of the collision, false otherwise. | |
const LVector3f & | get_from_surface_normal () const |
Returns the surface normal of the collided-into object at the point of the collision, in the space of the collided-from object. | |
void | set_into_depth (float depth) |
bool | has_into_depth () const |
Returns true if the collision entry knows how "deep" the collision was into the collided-into object; that is, how far into the surface of the collided-into object the colliding object has penetrated. | |
float | get_into_depth () const |
Returns how "deep" the collision was into the collided-into object; that is, how far into the surface of the collided-into object the colliding object has penetrated. | |
void | set_from_depth (float depth) |
bool | has_from_depth () const |
Returns true if the collision entry knows how "deep" the collision was from the collided-from object; that is, how far from the surface of the collided-from object the colliding object has penetrated. | |
float | get_from_depth () const |
Returns how "deep" the collision was from the collided-from object; that is, how far from the surface of the collided-from object the colliding object has penetrated. | |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | ref () const |
Explicitly increments the reference count. | |
int | unref () const |
Explicitly decrements the reference count. | |
void | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
Static Public Member Functions | |
TypeHandle | get_class_type () |
void | init_type () |
Private Types | |
enum | Flags { F_has_into_intersection_point = 0x0001, F_has_into_surface_normal = 0x0002, F_has_from_surface_normal = 0x0004, F_has_into_depth = 0x0008, F_has_from_depth = 0x0010, F_has_from_velocity = 0x0020 } |
Private Member Functions | |
void | test_intersection (CollisionHandler *record, const CollisionTraverser *trav) const |
This is intended to be called only by the CollisionTraverser. | |
void | compute_from_surface_normal () |
Computes the "from" surface normal by converting the "into" surface normal into the colliding object's space. | |
Private Attributes | |
ConstPointerTo< CollisionSolid > | _from |
ConstPointerTo< CollisionSolid > | _into |
PointerTo< CollisionNode > | _from_node |
PointerTo< PandaNode > | _into_node |
NodePath | _into_node_path |
LMatrix4f | _from_space |
LMatrix4f | _into_space |
LMatrix4f | _wrt_space |
LMatrix4f | _inv_wrt_space |
int | _flags |
LVector3f | _from_velocity |
LPoint3f | _into_intersection_point |
LVector3f | _into_surface_normal |
LVector3f | _from_surface_normal |
float | _into_depth |
float | _from_depth |
Static Private Attributes | |
TypeHandle | _type_handle |
Friends | |
class | CollisionTraverser |
One of these is created for each collision detected by a CollisionTraverser, to be dealt with by the CollisionHandler.
A CollisionEntry provides slots for a number of data values (such as intersection point and normal) that might or might not be known for each collision. It is up to the handler to determine what information is known and to do the right thing with it.
Definition at line 63 of file collisionEntry.h.
|
Definition at line 126 of file collisionEntry.h. |
|
Definition at line 31 of file collisionEntry.I. |
|
Definition at line 34 of file collisionEntry.cxx. |
|
Computes the "from" surface normal by converting the "into" surface normal into the colliding object's space.
Definition at line 88 of file collisionEntry.cxx. |
|
Reimplemented from TypedReferenceCount. Definition at line 156 of file collisionEntry.h. |
|
Reimplemented from TypedReferenceCount. Definition at line 145 of file collisionEntry.h. |
|
Returns the CollisionSolid pointer for the particular solid that triggered this collision.
Definition at line 46 of file collisionEntry.I. References _into, INLINE, and NULL. Referenced by set_from_surface_normal(), and CollisionPolygon::test_intersection_from_ray(). |
|
Returns how "deep" the collision was from the collided-from object; that is, how far from the surface of the collided-from object the colliding object has penetrated. It is an error to call this if has_from_depth() returns false. Definition at line 567 of file collisionEntry.I. |
|
Returns the intersection point in the coordinate space of the colliding object. It is an error to call this if has_from_intersection_point() returns false. Definition at line 356 of file collisionEntry.I. References _flags, F_has_into_depth, and INLINE. |
|
Returns the node that contains the CollisionSolid that triggered this collision. This will be a node that has been added to a CollisionTraverser via add_collider(). Definition at line 109 of file collisionEntry.I. Referenced by CollisionHandlerEvent::begin_group(), CollisionTraverser::compare_collider_to_node(), and CollisionPolygon::test_intersection_from_ray(). |
|
Returns the global coordinate space of the CollisionNode returned by get_from_node(), as of the time of the collision. This will be equivalent to a wrt() from the node to render. Definition at line 128 of file collisionEntry.I. References _into_space, and INLINE. |
|
Returns the surface normal of the collided-into object at the point of the collision, in the space of the collided-from object. It is an error to call this if has_from_surface_normal() returns false. Definition at line 455 of file collisionEntry.I. |
|
Returns the instantaneous velocity of the "from" object, in its own coordinate space. This represents the delta between its current position and its position last frame. Definition at line 267 of file collisionEntry.I. References _flags, _into_surface_normal, and F_has_into_surface_normal. |
|
Returns the CollisionSolid pointer for the particular solid was collided into. This pointer might be NULL if the collision was into a piece of visible geometry, instead of a normal CollisionSolid collision; see has_into(). Definition at line 90 of file collisionEntry.I. References _from_space, and INLINE. Referenced by CollisionSphere::make_copy(), CollisionSegment::make_copy(), and CollisionRay::make_copy(). |
|
Returns how "deep" the collision was into the collided-into object; that is, how far into the surface of the collided-into object the colliding object has penetrated. It is an error to call this if has_into_depth() returns false. Definition at line 513 of file collisionEntry.I. |
|
Returns the intersection point in the coordinate space of the collided-into object. It is an error to call this if has_into_intersection_point() returns false. Definition at line 317 of file collisionEntry.I. References _flags, F_has_from_surface_normal, and F_has_into_surface_normal. Referenced by has_from_velocity(). |
|
Returns the node that contains the CollisionSolid that was collided into. This returns a PandaNode pointer instead of something more specific, because it might be either a CollisionNode or a GeomNode. Also see get_into_node_path(). Definition at line 151 of file collisionEntry.I. References _inv_wrt_space, and INLINE. Referenced by CollisionHandlerEvent::begin_group(). |
|
Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collided into. This is the same node returned by get_into_node(), represented as a NodePath; however, it may be more useful because the NodePath can resolve the particular instance of the node, if there is more than one. Definition at line 176 of file collisionEntry.I. References _flags, F_has_from_velocity, and INLINE. Referenced by CollisionPolygon::test_intersection_from_ray(). |
|
Returns the global coordinate space of the CollisionNode or GeomNode returned by get_into_node(), as of the time of the collision.
Definition at line 193 of file collisionEntry.I. References _from_velocity. |
|
Returns the surface normal of the collided-into object at the point of the collision. It is an error to call this if has_into_surface_normal() returns false. Definition at line 405 of file collisionEntry.I. References _from_depth, has_from_depth(), INLINE, and nassertr. |
|
Definition at line 217 of file collisionEntry.I. Referenced by has_from_velocity(). |
|
Returns the current reference count.
Definition at line 183 of file referenceCount.I. Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture(). |
|
Reimplemented from TypedReferenceCount. Definition at line 153 of file collisionEntry.h. |
|
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). Definition at line 71 of file typedObject.I. References TypeHandle::get_name(), TypedObject::get_type(), and INLINE. |
|
Definition at line 205 of file collisionEntry.I. Referenced by CollisionPolygon::test_intersection_from_ray(). |
|
Returns true if the collision entry knows how "deep" the collision was from the collided-from object; that is, how far from the surface of the collided-from object the colliding object has penetrated.
Definition at line 546 of file collisionEntry.I. Referenced by get_into_surface_normal(). |
|
Returns true if the detected collision knows its intersection point in the coordinate space of the colliding object, false otherwise.
Definition at line 335 of file collisionEntry.I. |
|
Returns true if the detected collision knows the surface normal of the collided-into object at the point of the collision, false otherwise.
Definition at line 436 of file collisionEntry.I. |
|
Returns true if the "from" object had an indicated velocity, false otherwise.
Definition at line 248 of file collisionEntry.I. References get_into_intersection_point(), get_inv_wrt_space(), and INLINE. |
|
Returns true if the "into" solid is, in fact, a CollisionSolid, and its pointer is known (in which case get_into() may be called to retrieve it). If this returns false, the collision was detected into a GeomNode, and there is no CollisionSolid pointer to be retrieved. Definition at line 69 of file collisionEntry.I. References _from_node, and INLINE. |
|
Returns true if the collision entry knows how "deep" the collision was into the collided-into object; that is, how far into the surface of the collided-into object the colliding object has penetrated.
Definition at line 492 of file collisionEntry.I. Referenced by set_into_surface_normal(). |
|
Returns true if the detected collision knows its intersection point in the coordinate space of the collided-into object, false otherwise.
Definition at line 298 of file collisionEntry.I. References _flags, _from_surface_normal, F_has_from_surface_normal, and INLINE. Referenced by set_from_velocity(). |
|
Returns true if the detected collision knows the surface normal of the collided-into object at the point of the collision, false otherwise.
Definition at line 386 of file collisionEntry.I. |
|
Reimplemented from TypedReferenceCount. Definition at line 148 of file collisionEntry.h. |
|
Returns true if the current object is the indicated type exactly.
Definition at line 101 of file typedObject.I. Referenced by PT(), and CollisionNode::xform(). |
|
|
Definition at line 59 of file collisionEntry.cxx. References _flags, _into_depth, _into_intersection_point, _into_space, _into_surface_normal, _inv_wrt_space, and _wrt_space. |
|
Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 225 of file referenceCount.I. Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering(). |
|
Definition at line 526 of file collisionEntry.I. |
|
Definition at line 418 of file collisionEntry.I. References get_from(), INLINE, NULL, PT, and CollisionSolid::test_intersection(). |
|
Indicates the velocity associated with the "from" object, in the object's coordinate space.
Definition at line 232 of file collisionEntry.I. References has_into_intersection_point(), and INLINE. Referenced by CollisionTraverser::prepare_colliders(). |
|
Definition at line 472 of file collisionEntry.I. |
|
Definition at line 280 of file collisionEntry.I. References _flags, and F_has_into_surface_normal. |
|
Definition at line 368 of file collisionEntry.I. References _into_depth, has_into_depth(), INLINE, and nassertr. |
|
This is intended to be called only by the CollisionTraverser. It requests the CollisionEntry to start the intersection test between the from and into solids stored within it, passing the result (if positive) to the indicated CollisionHandler. Definition at line 589 of file collisionEntry.I. Referenced by CollisionTraverser::compare_collider_to_node(). |
|
Does some easy checks to make sure that the reference count isn't completely bogus.
Definition at line 328 of file referenceCount.I. References INLINE. Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount(). |
|
Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 293 of file referenceCount.I. References INLINE. Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds(). |
|
Definition at line 161 of file collisionEntry.h. |
|
Definition at line 135 of file collisionEntry.h. Referenced by get_from_intersection_point(), get_from_velocity(), get_into_intersection_point(), get_into_node_path(), has_into_intersection_point(), operator=(), and set_into_intersection_point(). |
|
Definition at line 115 of file collisionEntry.h. Referenced by CollisionEntry(). |
|
Definition at line 142 of file collisionEntry.h. Referenced by get_into_surface_normal(). |
|
Definition at line 118 of file collisionEntry.h. Referenced by has_into(), and CollisionTraverser::prepare_colliders(). |
|
Definition at line 121 of file collisionEntry.h. Referenced by get_into(). |
|
Definition at line 140 of file collisionEntry.h. Referenced by has_into_intersection_point(). |
|
Definition at line 137 of file collisionEntry.h. Referenced by get_into_space(). |
|
Definition at line 116 of file collisionEntry.h. Referenced by get_from(). |
|
Definition at line 141 of file collisionEntry.h. Referenced by operator=(), and set_into_surface_normal(). |
|
Definition at line 138 of file collisionEntry.h. Referenced by operator=(). |
|
Definition at line 119 of file collisionEntry.h. |
|
Definition at line 120 of file collisionEntry.h. |
|
Definition at line 122 of file collisionEntry.h. Referenced by get_from_space(), and operator=(). |
|
Definition at line 139 of file collisionEntry.h. Referenced by get_from_velocity(), and operator=(). |
|
Definition at line 124 of file collisionEntry.h. Referenced by get_into_node(), and operator=(). |
|
Reimplemented from TypedReferenceCount. Definition at line 24 of file collisionEntry.cxx. |
|
Definition at line 123 of file collisionEntry.h. Referenced by operator=(). |