36 #ifdef DO_COLLISION_RECORDING    44 CollisionVisualizer(
const std::string &name) : 
PandaNode(name), _lock(
"CollisionVisualizer") {
    58 CollisionVisualizer(
const CollisionVisualizer ©) :
    60   _lock(
"CollisionVisualizer"),
    61   _point_scale(copy._point_scale),
    62   _normal_scale(copy._normal_scale) {
    75 ~CollisionVisualizer() {
    82 void CollisionVisualizer::
    95   return new CollisionVisualizer(*
this);
   116 bool CollisionVisualizer::
   122   Data::const_iterator di;
   123   for (di = _data.begin(); di != _data.end(); ++di) {
   125     const VizInfo &viz_info = (*di).second;
   132     xform_data._net_transform = TransformState::make_identity();
   134     xform_data.apply_transform(net_transform);
   137     Solids::const_iterator si;
   138     for (si = viz_info._solids.begin(); si != viz_info._solids.end(); ++si) {
   144       const SolidInfo &solid_info = (*si).second;
   145       bool was_detected = (solid_info._detected_count > 0);
   146       PT(
PandaNode) node = solid->get_viz(trav, xform_data, !was_detected);
   147       if (node != 
nullptr) {
   152         next_data._state = get_viz_state();
   158     if (!viz_info._points.empty()) {
   159       CPT(
RenderState) empty_state = RenderState::make_empty();
   160       CPT(
RenderState) point_state = RenderState::make(RenderModeAttrib::make(RenderModeAttrib::M_unchanged, 1.0f, 
false));
   164                                   Geom::NT_stdfloat, Geom::C_point,
   165                                   InternalName::get_color(), 1,
   166                                   Geom::NT_packed_dabc, Geom::C_color,
   167                                   InternalName::get_size(), 1,
   168                                   Geom::NT_stdfloat, Geom::C_other);
   170         GeomVertexFormat::register_format(point_array_format);
   172       Points::const_iterator pi;
   173       for (pi = viz_info._points.begin(); pi != viz_info._points.end(); ++pi) {
   174         const CollisionPoint &point = (*pi);
   188           vertex.add_data3(point._surface_point);
   189           color.add_data4(1.0f, 0.0f, 0.0f, 1.0f);
   190           size.add_data1f(16.0f * _point_scale);
   191           points->add_next_vertices(1);
   192           points->close_primitive();
   194           if (point._interior_point != point._surface_point) {
   195             vertex.add_data3(point._interior_point);
   196             color.add_data4(1.0f, 1.0f, 1.0f, 1.0f);
   197             size.add_data1f(8.0f * _point_scale);
   198             points->add_next_vertices(1);
   199             points->close_primitive();
   202           PT(
Geom) geom = 
new Geom(point_vdata);
   203           geom->add_primitive(points);
   207                                xform_data.get_internal_transform(trav));
   213         if (!point._surface_normal.almost_equal(LVector3::zero())) {
   223           vertex.add_data3(point._surface_point);
   224           vertex.add_data3(point._surface_point +
   225                             point._surface_normal * _normal_scale);
   226           color.add_data4(1.0f, 0.0f, 0.0f, 1.0f);
   227           color.add_data4(1.0f, 1.0f, 1.0f, 1.0f);
   228           lines->add_next_vertices(2);
   229           lines->close_primitive();
   231           PT(
Geom) geom = 
new Geom(line_vdata);
   232           geom->add_primitive(lines);
   236                                xform_data.get_internal_transform(trav));
   254 bool CollisionVisualizer::
   255 is_renderable()
 const {
   265 void CollisionVisualizer::
   266 output(std::ostream &out)
 const {
   267   PandaNode::output(out);
   269   CollisionRecorder::output(out);
   277 void CollisionVisualizer::
   279   CollisionRecorder::begin_traversal();
   289 void CollisionVisualizer::
   291   CollisionRecorder::collision_tested(entry, detected);
   294   CPT(
TransformState) net_transform = node_path.get_net_transform();
   296   nassertv(!solid.is_null());
   299   VizInfo &viz_info = _data[std::move(net_transform)];
   301     viz_info._solids[std::move(solid)]._detected_count++;
   306                     p._surface_point, p._surface_normal, p._interior_point);
   307       viz_info._points.push_back(p);
   311     viz_info._solids[std::move(solid)]._missed_count++;
   325   if (state == 
nullptr) {
   326     state = RenderState::make
   327       (DepthOffsetAttrib::make());
   333 #endif  // DO_COLLISION_RECORDING bool has_surface_point() const
Returns true if the surface point has been specified, false otherwise.
 
bool get_all(const NodePath &space, LPoint3 &surface_point, LVector3 &surface_normal, LPoint3 &interior_point) const
Simultaneously transforms the surface point, surface normal, and interior point of the collision into...
 
A basic node of the scene graph or data graph.
 
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
 
CullHandler * get_cull_handler() const
Returns the object that will receive the culled Geoms.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
Defines a series of disconnected points.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
The abstract base class for all things that can collide with other things in the world,...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
This collects together the pieces of data that are accumulated for each node while walking the scene ...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
get_into_node_path
Returns the NodePath that represents the specific CollisionNode or GeomNode instance that was collide...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
void traverse(const NodePath &root)
Begins the traversal from the indicated node.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
The smallest atom of cull.
 
virtual void record_object(CullableObject *object, const CullTraverser *traverser)
This callback function is intended to be overridden by a derived class.
 
Similar to MutexHolder, but for a light mutex.
 
Defines a single collision event.
 
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
 
A container for geometry primitives.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
 
Defines a series of disconnected line segments.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
get_into
Returns the CollisionSolid pointer for the particular solid was collided into.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
GeometricBoundingVolume * get_view_frustum() const
Returns the bounding volume that corresponds to the view frustum, or NULL if the view frustum is not ...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
This is a special kind of GeometricBoundingVolume that fills all of space.
 
TypeHandle is the identifier used to differentiate C++ class types.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.