Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions

CollisionTube Class Reference

This implements a solid roughly in cylindrical shape. More...

#include "collisionTube.h"

Inheritance diagram for CollisionTube:
CollisionSolid CopyOnWriteObject CachedTypedWritableReferenceCount TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Member Functions

 CollisionTube (const LPoint3 &a, const LPoint3 &db, PN_stdfloat radius)
 CollisionTube (PN_stdfloat ax, PN_stdfloat ay, PN_stdfloat az, PN_stdfloat bx, PN_stdfloat by, PN_stdfloat bz, PN_stdfloat radius)
 CollisionTube (const CollisionTube &copy)
virtual TypeHandle force_init_type ()
virtual LPoint3 get_collision_origin () const
 Returns the point in space deemed to be the "origin" of the solid for collision purposes.
const LPoint3get_point_a () const
const LPoint3get_point_b () const
PN_stdfloat get_radius () const
virtual PStatCollectorget_test_pcollector ()
 Returns a PStatCollector that is used to count the number of intersection tests made against a solid of this type in a given frame.
virtual TypeHandle get_type () const
virtual PStatCollectorget_volume_pcollector ()
 Returns a PStatCollector that is used to count the number of bounding volume tests made against a solid of this type in a given frame.
virtual CollisionSolidmake_copy ()
virtual void output (ostream &out) const
void set_point_a (const LPoint3 &a)
void set_point_a (PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
void set_point_b (const LPoint3 &b)
void set_point_b (PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
void set_radius (PN_stdfloat radius)
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 solid by the indicated matrix.

Static Public Member Functions

static void flush_level ()
 Flushes the PStatCollectors used during traversal.
static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type CollisionTube.

Protected Member Functions

virtual void fill_viz_geom ()
 Fills the _viz_geom GeomNode up with Geoms suitable for rendering this solid.
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 CollisionTube.
virtual PT (CollisionEntry) test_intersection_from_line(const CollisionEntry &entry) const
virtual PT (CollisionEntry) test_intersection_from_parabola(const CollisionEntry &entry) const
virtual PT (CollisionEntry) test_intersection_from_segment(const CollisionEntry &entry) const
virtual PT (CollisionEntry) test_intersection_from_sphere(const CollisionEntry &entry) const
virtual PT (BoundingVolume) compute_internal_bounds() const
virtual PT (CollisionEntry) test_intersection_from_ray(const CollisionEntry &entry) const

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type CollisionTube is encountered in the Bam file.

Detailed Description

This implements a solid roughly in cylindrical shape.

It's not called a CollisionCylinder because it's not a true cylinder; specifically, it has rounded ends instead of flat ends. It looks more like a Contac pill.

Definition at line 30 of file collisionTube.h.


Member Function Documentation

void CollisionTube::fill_viz_geom ( ) [protected, virtual]

Fills the _viz_geom GeomNode up with Geoms suitable for rendering this solid.

Reimplemented from CollisionSolid.

Definition at line 473 of file collisionTube.cxx.

References GeomVertexWriter::add_data3(), GeomVertexFormat::get_v3(), LVecBase3f::length(), and LMatrix4f::set_row().

void CollisionTube::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new CollisionTube.

Reimplemented from CollisionSolid.

Definition at line 1015 of file collisionTube.cxx.

References DatagramIterator::get_stdfloat(), and LVecBase3f::read_datagram().

Referenced by make_from_bam().

void CollisionTube::flush_level ( ) [inline, static]

Flushes the PStatCollectors used during traversal.

Definition at line 75 of file collisionTube.I.

LPoint3 CollisionTube::get_collision_origin ( ) const [virtual]

Returns the point in space deemed to be the "origin" of the solid for collision purposes.

The closest intersection point to this origin point is considered to be the most significant.

Implements CollisionSolid.

Definition at line 80 of file collisionTube.cxx.

PStatCollector & CollisionTube::get_test_pcollector ( ) [virtual]

Returns a PStatCollector that is used to count the number of intersection tests made against a solid of this type in a given frame.

Reimplemented from CollisionSolid.

Definition at line 104 of file collisionTube.cxx.

PStatCollector & CollisionTube::get_volume_pcollector ( ) [virtual]

Returns a PStatCollector that is used to count the number of bounding volume tests made against a solid of this type in a given frame.

Reimplemented from CollisionSolid.

Definition at line 92 of file collisionTube.cxx.

TypedWritable * CollisionTube::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type CollisionTube is encountered in the Bam file.

It should create the CollisionTube and extract its information from the file.

Definition at line 996 of file collisionTube.cxx.

References fillin().

Referenced by register_with_read_factory().

void CollisionTube::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type CollisionTube.

Definition at line 969 of file collisionTube.cxx.

References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().

void CollisionTube::write_datagram ( BamWriter manager,
Datagram dg 
) [virtual]

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from CollisionSolid.

Definition at line 980 of file collisionTube.cxx.

References Datagram::add_stdfloat(), and LVecBase3f::write_datagram().

void CollisionTube::xform ( const LMatrix4 mat) [virtual]

Transforms the solid by the indicated matrix.

Reimplemented from CollisionSolid.

Definition at line 58 of file collisionTube.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations