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 LPoint3f &a, const LPoint3f &db, float radius)
 CollisionTube (float ax, float ay, float az, float bx, float by, float bz, float radius)
 CollisionTube (const CollisionTube &copy)
virtual TypeHandle force_init_type ()
virtual LPoint3f get_collision_origin () const
 Returns the point in space deemed to be the "origin" of the solid for collision purposes.
const LPoint3fget_point_a () const
const LPoint3fget_point_b () const
float 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 LPoint3f &a)
void set_point_a (float x, float y, float z)
void set_point_b (const LPoint3f &b)
void set_point_b (float x, float y, float z)
void set_radius (float 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 LMatrix4f &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_data3f(), 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 1014 of file collisionTube.cxx.

References DatagramIterator::get_float32(), 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.

LPoint3f 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 995 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 968 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 979 of file collisionTube.cxx.

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

void CollisionTube::xform ( const LMatrix4f 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