diff --git a/panda/src/collide/collisionEntry.I b/panda/src/collide/collisionEntry.I index f6cef59a29..483e0f9f7e 100644 --- a/panda/src/collide/collisionEntry.I +++ b/panda/src/collide/collisionEntry.I @@ -227,6 +227,172 @@ has_interior_point() const { return (_flags & F_has_interior_point) != 0; } +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::has_into_intersection_point +// Access: Published +// Description: Returns true if the detected collision knows its +// intersection point in the coordinate space of the +// collided-into object, false otherwise. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionEntry:: +has_into_intersection_point() const { + return has_surface_point(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::get_into_intersection_point +// Access: Published +// Description: 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. +//////////////////////////////////////////////////////////////////// +INLINE LPoint3f CollisionEntry:: +get_into_intersection_point() const { + nassert_raise("CollisionEntry::get_into_intersection_point() is deprecated. Use get_surface_point() instead."); + return get_surface_point(get_into_node_path()); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::has_from_intersection_point +// Access: Published +// Description: Returns true if the detected collision knows its +// intersection point in the coordinate space of the +// colliding object, false otherwise. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionEntry:: +has_from_intersection_point() const { + nassert_raise("CollisionEntry::has_from_intersection_point() is deprecated. Use has_surface_point() instead."); + return has_surface_point(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::get_from_intersection_point +// Access: Published +// Description: 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. +//////////////////////////////////////////////////////////////////// +INLINE LPoint3f CollisionEntry:: +get_from_intersection_point() const { + nassert_raise("CollisionEntry::get_from_intersection_point() is deprecated. Use get_surface_point() instead."); + return get_surface_point(get_from_node_path()); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::has_into_surface_normal +// Access: Published +// Description: Returns true if the detected collision knows the +// surface normal of the collided-into object at the +// point of the collision, false otherwise. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionEntry:: +has_into_surface_normal() const { + nassert_raise("CollisionEntry::has_into_surface_normal() is deprecated. Use has_surface_normal() instead."); + return has_surface_normal(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::get_into_surface_normal +// Access: Published +// Description: 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. +//////////////////////////////////////////////////////////////////// +INLINE LVector3f CollisionEntry:: +get_into_surface_normal() const { + nassert_raise("CollisionEntry::get_into_surface_normal() is deprecated. Use get_surface_normal() instead."); + return get_surface_normal(get_into_node_path()); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::has_from_surface_normal +// Access: Published +// Description: Returns true if the detected collision knows the +// surface normal of the collided-into object at the +// point of the collision, false otherwise. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionEntry:: +has_from_surface_normal() const { + nassert_raise("CollisionEntry::has_from_surface_normal() is deprecated. Use has_surface_normal() instead."); + return has_surface_normal(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::get_from_surface_normal +// Access: Published +// Description: 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. +//////////////////////////////////////////////////////////////////// +INLINE LVector3f CollisionEntry:: +get_from_surface_normal() const { + nassert_raise("CollisionEntry::get_from_surface_normal() is deprecated. Use get_surface_normal() instead."); + return get_surface_normal(get_from_node_path()); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::has_into_depth +// Access: Published +// Description: 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. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionEntry:: +has_into_depth() const { + nassert_raise("CollisionEntry::has_into_depth() is deprecated. Use has_interior_point() instead."); + return has_surface_point() && has_interior_point(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::get_into_depth +// Access: Published +// Description: 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. +//////////////////////////////////////////////////////////////////// +INLINE float CollisionEntry:: +get_into_depth() const { + nassert_raise("CollisionEntry::get_into_depth() is deprecated. Use get_interior_point() instead."); + nassertr(has_into_depth(), 0.0); + return (get_surface_point(get_into_node_path()) - get_interior_point(get_into_node_path())).length(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::has_from_depth +// Access: Published +// Description: 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. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionEntry:: +has_from_depth() const { + nassert_raise("CollisionEntry::has_from_depth() is deprecated. Use has_interior_point() instead."); + return has_surface_point() && has_interior_point(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::get_from_depth +// Access: Published +// Description: 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. +//////////////////////////////////////////////////////////////////// +INLINE float CollisionEntry:: +get_from_depth() const { + nassert_raise("CollisionEntry::get_from_depth() is deprecated. Use get_interior_point() instead."); + return (get_surface_point(get_from_node_path()) - get_interior_point(get_from_node_path())).length(); +} + //////////////////////////////////////////////////////////////////// // Function: CollisionEntry::get_wrt_space diff --git a/panda/src/collide/collisionEntry.h b/panda/src/collide/collisionEntry.h index 5723bbf580..b3e379d868 100644 --- a/panda/src/collide/collisionEntry.h +++ b/panda/src/collide/collisionEntry.h @@ -81,6 +81,28 @@ PUBLISHED: LVector3f &surface_normal, LPoint3f &interior_point) const; + + // The following methods are all deprecated in favor of the above + // methods. They are here only temporarily to ease transition. + + INLINE bool has_into_intersection_point() const; + INLINE LPoint3f get_into_intersection_point() const; + + INLINE bool has_from_intersection_point() const; + INLINE LPoint3f get_from_intersection_point() const; + + INLINE bool has_into_surface_normal() const; + INLINE LVector3f get_into_surface_normal() const; + + INLINE bool has_from_surface_normal() const; + INLINE LVector3f get_from_surface_normal() const; + + INLINE bool has_into_depth() const; + INLINE float get_into_depth() const; + + INLINE bool has_from_depth() const; + INLINE float get_from_depth() const; + void output(ostream &out) const; void write(ostream &out, int indent_level = 0) const;