Panda3D
|
An infinite ray, with a specific origin and direction. More...
#include "collisionRay.h"
Public Member Functions | |
CollisionRay () | |
Creates an invalid ray. | |
CollisionRay (const LPoint3 &origin, const LVector3 &direction) | |
CollisionRay (PN_stdfloat ox, PN_stdfloat oy, PN_stdfloat oz, PN_stdfloat dx, PN_stdfloat dy, PN_stdfloat dz) | |
CollisionRay (const CollisionRay ©) | |
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 LVector3 & | get_direction () const |
const LPoint3 & | get_origin () const |
virtual TypeHandle | get_type () const |
virtual CollisionSolid * | make_copy () |
virtual void | output (ostream &out) const |
virtual | PT (CollisionEntry) test_intersection(const CollisionEntry &entry) const |
void | set_direction (const LVector3 &direction) |
void | set_direction (PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) |
bool | set_from_lens (LensNode *camera, const LPoint2 &point) |
Accepts a LensNode and a 2-d point in the range [-1,1]. | |
bool | set_from_lens (LensNode *camera, PN_stdfloat px, PN_stdfloat py) |
Accepts a LensNode and a 2-d point in the range [-1,1]. | |
void | set_origin (const LPoint3 &origin) |
void | set_origin (PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) |
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 TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Tells the BamReader how to create objects of type CollisionRay. | |
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 CollisionRay. | |
virtual | PT (BoundingVolume) compute_internal_bounds() const |
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 CollisionRay is encountered in the Bam file. |
An infinite ray, with a specific origin and direction.
It begins at its origin and continues in one direction to infinity, and it has no radius. Useful for picking from a window, or for gravity effects.
Definition at line 32 of file collisionRay.h.
CollisionRay::CollisionRay | ( | ) | [inline] |
Creates an invalid ray.
This isn't terribly useful; it's expected that the user will subsequently adjust the ray via set_origin()/set_direction() or set_from_lens().
Definition at line 25 of file collisionRay.I.
Referenced by make_from_bam().
void CollisionRay::fill_viz_geom | ( | ) | [protected, virtual] |
Fills the _viz_geom GeomNode up with Geoms suitable for rendering this solid.
Reimplemented from CollisionSolid.
Reimplemented in CollisionLine.
Definition at line 141 of file collisionRay.cxx.
References GeomVertexWriter::add_data3(), GeomVertexWriter::add_data4(), and GeomVertexFormat::get_v3cp().
void CollisionRay::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 CollisionRay.
Reimplemented from CollisionSolid.
Reimplemented in CollisionLine.
Definition at line 227 of file collisionRay.cxx.
References LVecBase3f::read_datagram().
Referenced by make_from_bam().
LPoint3 CollisionRay::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 77 of file collisionRay.cxx.
TypedWritable * CollisionRay::make_from_bam | ( | const FactoryParams & | params | ) | [static, protected] |
This function is called by the BamReader's factory when a new object of type CollisionRay is encountered in the Bam file.
It should create the CollisionRay and extract its information from the file.
Reimplemented in CollisionLine.
Definition at line 208 of file collisionRay.cxx.
References CollisionRay(), and fillin().
Referenced by register_with_read_factory().
void CollisionRay::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type CollisionRay.
Reimplemented in CollisionLine.
Definition at line 182 of file collisionRay.cxx.
References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().
bool CollisionRay::set_from_lens | ( | LensNode * | camera, |
const LPoint2 & | point | ||
) |
Accepts a LensNode and a 2-d point in the range [-1,1].
Sets the CollisionRay so that it begins at the LensNode's near plane and extends to infinity, making it suitable for picking objects from the screen given a camera and a mouse location.
Returns true if the point was acceptable, false otherwise.
Definition at line 104 of file collisionRay.cxx.
References Lens::extrude(), LVector3f::forward(), LensNode::get_lens(), CollisionSolid::mark_internal_bounds_stale(), CollisionSolid::mark_viz_stale(), and LPoint3f::origin().
Referenced by set_from_lens().
bool CollisionRay::set_from_lens | ( | LensNode * | camera, |
PN_stdfloat | px, | ||
PN_stdfloat | py | ||
) | [inline] |
Accepts a LensNode and a 2-d point in the range [-1,1].
Sets the CollisionRay so that it begins at the LensNode's near plane and extends to infinity, making it suitable for picking objects from the screen given a camera and a mouse location.
Definition at line 144 of file collisionRay.I.
References set_from_lens().
void CollisionRay::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.
Reimplemented in CollisionLine.
Definition at line 193 of file collisionRay.cxx.
References LVecBase3f::write_datagram().
void CollisionRay::xform | ( | const LMatrix4 & | mat | ) | [virtual] |
Transforms the solid by the indicated matrix.
Reimplemented from CollisionSolid.
Definition at line 61 of file collisionRay.cxx.