|
|
|
A node in the scene graph that can hold any number of CollisionSolids.
More...
#include "collisionNode.h"
List of all members.
Public Member Functions |
|
| CollisionNode (const string &name) |
| int | add_solid (const CollisionSolid *solid) |
| | Adds the indicated solid to the node.
|
| void | clear_solids () |
| | Removes all solids from the node.
|
| virtual PandaNode * | combine_with (PandaNode *other) |
| | Collapses this node with the other node, if possible, and returns a pointer to the combined node, or NULL if the two nodes cannot safely be combined.
|
| virtual int | complete_pointers (TypedWritable **plist, BamReader *manager) |
| | Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
|
|
| CPT (CollisionSolid) get_solid(int n) const |
| virtual bool | cull_callback (CullTraverser *trav, CullTraverserData &data) |
| | This function will be called during the cull traversal to perform any additional operations that should be performed at cull time.
|
|
virtual TypeHandle | force_init_type () |
| int | get_collider_sort () const |
| | Returns the collider_sort value that has been set for this particular node.
|
| CollideMask | get_from_collide_mask () const |
| | Returns the current "from" CollideMask.
|
| CollideMask | get_into_collide_mask () const |
| | Returns the current "into" CollideMask.
|
| virtual CollideMask | get_legal_collide_mask () const |
| | Returns the subset of CollideMask bits that may be set for this particular type of PandaNode.
|
|
int | get_num_solids () const |
|
virtual TypeHandle | get_type () const |
| virtual bool | is_collision_node () const |
| | A simple downcast check.
|
| virtual bool | is_renderable () const |
| | Returns true if there is some value to visiting this particular node during the cull traversal for any camera, false otherwise.
|
| virtual PandaNode * | make_copy () const |
| | Returns a newly-allocated Node that is a shallow copy of this one.
|
|
| MAKE_SEQ (get_solids, get_num_solids, get_solid) |
| virtual void | output (ostream &out) const |
| | Writes a brief description of the node to the indicated output stream.
|
| virtual bool | preserve_name () const |
| | Returns true if the node's name has extrinsic meaning and must be preserved across a flatten operation, false otherwise.
|
|
| PT (CollisionSolid) modify_solid(int n) |
| void | remove_solid (int n) |
| | Removes the solid with the indicated index.
|
| void | set_collide_mask (CollideMask mask) |
| | Simultaneously sets both the "from" and "into" CollideMask values to the same thing.
|
| void | set_collider_sort (int sort) |
| | Sets a particular collider_sort value on this node.
|
| void | set_from_collide_mask (CollideMask mask) |
| | Sets the "from" CollideMask.
|
| void | set_into_collide_mask (CollideMask mask) |
| | Sets the "into" CollideMask.
|
| void | set_solid (int n, CollisionSolid *solid) |
| | Replaces the solid with the indicated index.
|
| virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
| | Writes the contents of this object to the datagram for shipping out to a Bam file.
|
| virtual void | xform (const LMatrix4 &mat) |
| | Transforms the contents of this node by the indicated matrix, if it means anything to do so.
|
Static Public Member Functions |
|
static TypeHandle | get_class_type () |
| static CollideMask | get_default_collide_mask () |
| | Returns the default into_collide_mask assigned to new CollisionNodes.
|
|
static void | init_type () |
| static void | register_with_read_factory () |
| | Tells the BamReader how to create objects of type CollisionNode.
|
Protected Member Functions |
|
| CollisionNode (const CollisionNode ©) |
| virtual void | compute_internal_bounds (CPT(BoundingVolume)&internal_bounds, int &internal_vertices, int pipeline_stage, Thread *current_thread) const |
| | Called when needed to recompute the node's _internal_bound object.
|
| void | fillin (DatagramIterator &scan, BamReader *manager) |
| | This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new CollisionNode.
|
Static Protected Member Functions |
| static TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
| | This function is called by the BamReader's factory when a new object of type CollisionNode is encountered in the Bam file.
|
Detailed Description
A node in the scene graph that can hold any number of CollisionSolids.
This may either represent a bit of static geometry in the scene that things will collide with, or an animated object twirling around in the world and running into things.
Definition at line 33 of file collisionNode.h.
Member Function Documentation
| void CollisionNode::clear_solids |
( |
| ) |
[inline] |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
Returns the number of pointers processed.
Reimplemented from TypedWritable.
Definition at line 440 of file collisionNode.cxx.
| void CollisionNode::compute_internal_bounds |
( |
CPT(BoundingVolume)& |
internal_bounds, |
|
|
int & |
internal_vertices, |
|
|
int |
pipeline_stage, |
|
|
Thread * |
current_thread |
|
) |
| const [protected, virtual] |
This function will be called during the cull traversal to perform any additional operations that should be performed at cull time.
This may include additional manipulation of render state or additional visible/invisible decisions, or any other arbitrary operation.
Note that this function will *not* be called unless set_cull_callback() is called in the constructor of the derived class. It is necessary to call set_cull_callback() to indicated that we require cull_callback() to be called.
By the time this function is called, the node has already passed the bounding-volume test for the viewing frustum, and the node's transform and state have already been applied to the indicated CullTraverserData object.
The return value is true if this node should be visible, or false if it should be culled.
Reimplemented from PandaNode.
Definition at line 211 of file collisionNode.cxx.
References WorkingNodePath::get_node_path(), and CullTraverser::traverse().
| int CollisionNode::get_collider_sort |
( |
| ) |
const [inline] |
| CollideMask CollisionNode::get_default_collide_mask |
( |
| ) |
[inline, static] |
Returns the default into_collide_mask assigned to new CollisionNodes.
Definition at line 195 of file collisionNode.I.
| CollideMask CollisionNode::get_from_collide_mask |
( |
| ) |
const [inline] |
| CollideMask CollisionNode::get_into_collide_mask |
( |
| ) |
const [inline] |
Returns the current "into" CollideMask.
In order for a collision to be detected from another object into this object, the intersection of the other object's "from" mask and this object's "into" mask must be nonzero.
Reimplemented from PandaNode.
Definition at line 67 of file collisionNode.I.
Referenced by combine_with().
| CollideMask CollisionNode::get_legal_collide_mask |
( |
| ) |
const [virtual] |
| bool CollisionNode::is_collision_node |
( |
| ) |
const [virtual] |
A simple downcast check.
Returns true if this kind of node happens to inherit from CollisionNode, false otherwise.
This is provided as a a faster alternative to calling is_of_type(CollisionNode::get_class_type()).
Reimplemented from PandaNode.
Definition at line 283 of file collisionNode.cxx.
| bool CollisionNode::is_renderable |
( |
| ) |
const [virtual] |
Returns true if there is some value to visiting this particular node during the cull traversal for any camera, false otherwise.
This will be used to optimize the result of get_net_draw_show_mask(), so that any subtrees that contain only nodes for which is_renderable() is false need not be visited.
Reimplemented from PandaNode.
Definition at line 268 of file collisionNode.cxx.
| PandaNode * CollisionNode::make_copy |
( |
| ) |
const [virtual] |
Returns a newly-allocated Node that is a shallow copy of this one.
It will be a different Node pointer, but its internal data may or may not be shared with that of the original Node.
Reimplemented from PandaNode.
Definition at line 88 of file collisionNode.cxx.
| void CollisionNode::output |
( |
ostream & |
out | ) |
const [virtual] |
Writes a brief description of the node to the indicated output stream.
This is invoked by the << operator. It may be overridden in derived classes to include some information relevant to the class.
Reimplemented from PandaNode.
Definition at line 297 of file collisionNode.cxx.
| bool CollisionNode::preserve_name |
( |
| ) |
const [virtual] |
Returns true if the node's name has extrinsic meaning and must be preserved across a flatten operation, false otherwise.
Reimplemented from PandaNode.
Definition at line 100 of file collisionNode.cxx.
| void CollisionNode::register_with_read_factory |
( |
| ) |
[static] |
| void CollisionNode::remove_solid |
( |
int |
n | ) |
[inline] |
| void CollisionNode::set_collide_mask |
( |
CollideMask |
mask | ) |
[inline] |
| void CollisionNode::set_collider_sort |
( |
int |
sort | ) |
[inline] |
Sets a particular collider_sort value on this node.
This controls the order in which colliders (that is, "from nodes") are grouped together for the collision traversal.
If there are 32 or fewer colliders added to any particular CollisionTraverser, then this value has no meaning. It is only useful if there are many colliders, which may force the CollisionTraverser to make multiple passes through the data; in that case, it may be a useful optimization to group colliders that have similar bounding volumes together (by giving them similar sort values).
Definition at line 184 of file collisionNode.I.
| void CollisionNode::set_from_collide_mask |
( |
CollideMask |
mask | ) |
|
| void CollisionNode::set_into_collide_mask |
( |
CollideMask |
mask | ) |
[inline] |
| void CollisionNode::set_solid |
( |
int |
n, |
|
|
CollisionSolid * |
solid |
|
) |
| [inline] |
| void CollisionNode::xform |
( |
const LMatrix4 & |
mat | ) |
[virtual] |
The documentation for this class was generated from the following files:
| | |