define output operators
This commit is contained in:
parent
ae107325eb
commit
ce4f847029
|
|
@ -498,3 +498,9 @@ test_intersection(CollisionHandler *record,
|
|||
record->add_entry(result);
|
||||
}
|
||||
}
|
||||
|
||||
INLINE ostream &
|
||||
operator << (ostream &out, const CollisionEntry &entry) {
|
||||
entry.output(out);
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "collisionEntry.h"
|
||||
#include "dcast.h"
|
||||
#include "indent.h"
|
||||
|
||||
TypeHandle CollisionEntry::_type_handle;
|
||||
|
||||
|
|
@ -155,6 +156,63 @@ get_all(const NodePath &space, LPoint3f &surface_point,
|
|||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CollisionEntry::output
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CollisionEntry::
|
||||
output(ostream &out) const {
|
||||
out << _from_node_path;
|
||||
if (!_into_node_path.is_empty()) {
|
||||
out << " into " << _into_node_path;
|
||||
}
|
||||
if (has_surface_point()) {
|
||||
out << " at " << get_surface_point(NodePath());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CollisionEntry::write
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CollisionEntry::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level)
|
||||
<< "CollisionEntry:\n";
|
||||
if (!_from_node_path.is_empty()) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "from " << _from_node_path << "\n";
|
||||
}
|
||||
if (!_into_node_path.is_empty()) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "into " << _into_node_path;
|
||||
const ClipPlaneAttrib *cpa = get_into_clip_planes();
|
||||
if (cpa != (ClipPlaneAttrib *)NULL) {
|
||||
out << " (clipped)";
|
||||
}
|
||||
out << "\n";
|
||||
}
|
||||
if (has_surface_point()) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "at " << get_surface_point(NodePath()) << "\n";
|
||||
}
|
||||
if (has_surface_normal()) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "normal " << get_surface_normal(NodePath()) << "\n";
|
||||
}
|
||||
if (has_interior_point()) {
|
||||
indent(out, indent_level + 2)
|
||||
<< "interior " << get_interior_point(NodePath())
|
||||
<< " (depth "
|
||||
<< (get_interior_point(NodePath()) - get_surface_point(NodePath())).length()
|
||||
<< ")\n";
|
||||
}
|
||||
indent(out, indent_level + 2)
|
||||
<< "respect_prev_transform = " << get_respect_prev_transform() << "\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CollisionEntry::check_clip_planes
|
||||
// Access: Private
|
||||
|
|
|
|||
|
|
@ -103,6 +103,9 @@ PUBLISHED:
|
|||
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;
|
||||
|
||||
public:
|
||||
INLINE CPT(TransformState) get_wrt_space() const;
|
||||
INLINE CPT(TransformState) get_inv_wrt_space() const;
|
||||
|
|
@ -162,6 +165,8 @@ private:
|
|||
friend class CollisionTraverser;
|
||||
};
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const CollisionEntry &entry);
|
||||
|
||||
#include "collisionEntry.I"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue