Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CollisionPolygon Class Reference
Inheritance diagram for CollisionPolygon:

## Public Member Functions
| CollisionPolygon (const CollisionPolygon &copy)
| CollisionPolygon (const LPoint3 *begin, const LPoint3 *end)
| CollisionPolygon (const LVecBase3 &a, const LVecBase3 &b, const LVecBase3 &c)
| CollisionPolygon (const LVecBase3 &a, const LVecBase3 &b, const LVecBase3 &c, const LVecBase3 &d)
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.
size_t | get_num_points () const
LPoint3 | get_point (size_t n) const
virtual PStatCollector & | get_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 PointerTo< PandaNode > | get_viz (const CullTraverser *trav, const CullTraverserData &data, bool bounds_only) const
| Returns a GeomNode that may be rendered to visualize the CollisionSolid.
virtual PStatCollector & | get_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.
bool | is_concave () const
bool | is_valid () const
virtual CollisionSolid * | make_copy ()
virtual void | output (std::ostream &out) const
virtual void | write (std::ostream &out, int indent_level=0) const
virtual void | write_datagram (BamWriter *manager, Datagram &me)
| Function to write the important information in the particular object to a Datagram.
virtual void | xform (const LMatrix4 &mat)
| Transforms the solid by the indicated matrix.
Public Member Functions inherited from CollisionPlane
| CollisionPlane (const CollisionPlane &copy)
| CollisionPlane (const LPlane &plane)
PN_stdfloat | dist_to_plane (const LPoint3 &point) const
void | flip ()
| Convenience method to flip the plane in-place.
LVector3 | get_normal () const
const LPlane & | get_plane () const
void | set_plane (const LPlane &plane)
Public Member Functions inherited from CollisionSolid
| CollisionSolid (const CollisionSolid &copy)
void | clear_effective_normal ()
| Removes the normal previously set by set_effective_normal().
| CPT (BoundingVolume) get_bounds() const
const LVector3 & | get_effective_normal () const
| Returns the normal that was set by set_effective_normal().
bool | get_respect_effective_normal () const
bool | has_effective_normal () const
| Returns true if a special normal was set by set_effective_normal(), false otherwise.
bool | is_tangible () const
virtual | PT (CollisionEntry) test_intersection(const CollisionEntry &entry) const
virtual | PT (PandaNode) get_viz(const CullTraverser *trav
void | set_bounds (const BoundingVolume &bounding_volume)
void | set_effective_normal (const LVector3 &effective_normal)
| Records a false normal for this CollisionSolid that will be reported by the collision system with all collisions into it, instead of its actual normal.
void | set_respect_effective_normal (bool respect_effective_normal)
void | set_tangible (bool tangible)
Public Member Functions inherited from CopyOnWriteObject
| CopyOnWriteObject (const CopyOnWriteObject &copy)
void | operator= (const CopyOnWriteObject &copy)
Public Member Functions inherited from CachedTypedWritableReferenceCount
void | cache_ref () const
| Explicitly increments the cache reference count and the normal reference count simultaneously.
void | cache_ref_only () const
| Decrements the cache reference count without affecting the normal reference count.
bool | cache_unref () const
| Explicitly decrements the cache reference count and the normal reference count simultaneously.
int | get_cache_ref_count () const
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
Public Member Functions inherited from TypedWritableReferenceCount
| TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
virtual ReferenceCount * | as_reference_count ()
| Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type.
void | operator= (const TypedWritableReferenceCount &copy)
Public Member Functions inherited from TypedWritable
| TypedWritable (const TypedWritable &copy)
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager)
| Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
vector_uchar | encode_to_bam_stream () const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object.
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
virtual void | finalize (BamReader *manager)
| Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.
UpdateSeq | get_bam_modified () const
| Returns the current bam_modified counter.
void | mark_bam_modified ()
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
void | operator= (const TypedWritable &copy)
virtual bool | require_fully_complete () const
| Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.
virtual void | update_bam_nested (BamWriter *manager)
| Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates.
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
int | get_best_parent_from_Set (const std::set< int > &) const
int | get_type_index () const
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.

## Static Public Member Functions
static void | flush_level ()
| Flushes the PStatCollectors used during traversal.
static TypeHandle | get_class_type ()
static void | init_type ()
static TypedWritable * | make_CollisionPolygon (const FactoryParams &params)
| Factory method to generate a CollisionPolygon object.
static void | register_with_read_factory ()
| Factory method to generate a CollisionPolygon object.
static bool | verify_points (const LPoint3 &a, const LPoint3 &b, const LPoint3 &c)
| Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.
static bool | verify_points (const LPoint3 &a, const LPoint3 &b, const LPoint3 &c, const LPoint3 &d)
| Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.
static bool | verify_points (const LPoint3 *begin, const LPoint3 *end)
| Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.
Static Public Member Functions inherited from CollisionPlane
static void | flush_level ()
| Flushes the PStatCollectors used during traversal.
static TypeHandle | get_class_type ()
static void | init_type ()
static TypedWritable * | make_CollisionPlane (const FactoryParams &params)
| Factory method to generate a CollisionPlane object.
static void | register_with_read_factory ()
| Factory method to generate a CollisionPlane object.
Static Public Member Functions inherited from CollisionSolid
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from CopyOnWriteObject
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from CachedTypedWritableReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedWritableReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
static | PT (TypedWritableReferenceCount) decode_from_bam_stream(vector_uchar data
Static Public Member Functions inherited from TypedWritable
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
| Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes.
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
static TypeHandle | get_class_type ()
static void | init_type ()
| This function is declared non-inline to work around a compiler bug in g++ 2.96.
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()

## Public Attributes
| get_num_points
| Returns the number of vertices of the CollisionPolygon.
| get_point
| Returns the nth vertex of the CollisionPolygon, expressed in 3-D space.
| is_concave
| Returns true if the CollisionPolygon appears to be concave, or false if it is safely convex.
| is_valid
| Returns true if the CollisionPolygon is valid (that is, it has at least three vertices), or false otherwise.
Public Attributes inherited from CollisionPlane
| get_normal
| get_plane
| set_plane
Public Attributes inherited from CollisionSolid
virtual const CullTraverserData bool bounds_only | const
virtual const CullTraverserData & | data
| get_bounds
| Returns the solid's bounding volume.
| get_collision_origin
| get_respect_effective_normal
| See set_respect_effective_normal().
| is_tangible
| Returns whether the solid is considered 'tangible' or not.
| set_bounds
| Returns the solid's bounding volume.
| set_respect_effective_normal
| This is only meaningful for CollisionSolids that will be added to a traverser as colliders.
| set_tangible
| Sets the current state of the 'tangible' flag.
Public Attributes inherited from CachedTypedWritableReferenceCount
| get_cache_ref_count
| Returns the current reference count.
Public Attributes inherited from TypedWritableReferenceCount
static BamReader * | reader = nullptr)
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.

## Additional Inherited Members
Static Public Attributes inherited from TypedWritable
static TypedWritable *const | Null = nullptr

## Detailed Description

Definition at line 29 of file collisionPolygon.h.

## Constructor & Destructor Documentation

## ◆ CollisionPolygon() [1/4]

CollisionPolygon::CollisionPolygon | ( | const LVecBase3 & | a,
|  | const LVecBase3 & | b,
|  | const LVecBase3 & | c )
| inline

Definition at line 17 of file collisionPolygon.I.

## ◆ CollisionPolygon() [2/4]

CollisionPolygon::CollisionPolygon | ( | const LVecBase3 & | a,
|  | const LVecBase3 & | b,
|  | const LVecBase3 & | c,
|  | const LVecBase3 & | d )
| inline

Definition at line 30 of file collisionPolygon.I.

## ◆ CollisionPolygon() [3/4]

CollisionPolygon::CollisionPolygon | ( | const LPoint3 * | begin,
|  | const LPoint3 * | end )
| inline

Definition at line 45 of file collisionPolygon.I.

## ◆ CollisionPolygon() [4/4]

CollisionPolygon::CollisionPolygon | ( | const CollisionPolygon & | copy | ) |

Definition at line 54 of file collisionPolygon.cxx.

## Member Function Documentation

## ◆ flush_level()

void CollisionPolygon::flush_level | ( |  | ) |
| inline static

Flushes the PStatCollectors used during traversal.

Definition at line 110 of file collisionPolygon.I.

Referenced by CollisionTraverser::traverse().

## ◆ force_init_type()

virtual TypeHandle CollisionPolygon::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from CollisionPlane.

Definition at line 172 of file collisionPolygon.h.

## ◆ get_class_type()

static TypeHandle CollisionPolygon::get_class_type | ( |  | ) |
| inline static

Definition at line 161 of file collisionPolygon.h.

## ◆ get_collision_origin()

LPoint3 CollisionPolygon::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.

Reimplemented from CollisionPlane.

Definition at line 218 of file collisionPolygon.cxx.

## ◆ get_test_pcollector()

PStatCollector & CollisionPolygon::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 CollisionPlane.

Reimplemented in CollisionGeom.

Definition at line 293 of file collisionPolygon.cxx.

## ◆ get_type()

virtual TypeHandle CollisionPolygon::get_type | ( |  | ) | const
| inline virtual

Reimplemented from CollisionPlane.

Definition at line 169 of file collisionPolygon.h.

## ◆ get_viz()

PointerTo< PandaNode > CollisionPolygon::get_viz | ( | const CullTraverser * | trav,
|  | const CullTraverserData & | data,
|  | bool | bounds_only ) const
| virtual

Returns a GeomNode that may be rendered to visualize the CollisionSolid.

This is used during the cull traversal to render the CollisionNodes that have been made visible.

Definition at line 237 of file collisionPolygon.cxx.

## ◆ get_volume_pcollector()

PStatCollector & CollisionPolygon::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 CollisionPlane.

Reimplemented in CollisionGeom.

Definition at line 284 of file collisionPolygon.cxx.

## ◆ init_type()

static void CollisionPolygon::init_type | ( |  | ) |
| inline static

Definition at line 164 of file collisionPolygon.h.

## ◆ make_CollisionPolygon()

TypedWritable * CollisionPolygon::make_CollisionPolygon | ( | const FactoryParams & | params | ) |
| static

Factory method to generate a CollisionPolygon object.

Definition at line 1763 of file collisionPolygon.cxx.

References parse_params().

Referenced by register_with_read_factory().

## ◆ make_copy()

CollisionSolid * CollisionPolygon::make_copy | ( |  | ) |
| virtual

Reimplemented from CollisionPlane.

Definition at line 65 of file collisionPolygon.cxx.

## ◆ output()

void CollisionPolygon::output | ( | std::ostream & | out | ) | const
| virtual

Reimplemented from CollisionPlane.

Definition at line 301 of file collisionPolygon.cxx.

## ◆ register_with_read_factory()

void CollisionPolygon::register_with_read_factory | ( |  | ) |
| static

Factory method to generate a CollisionPolygon object.

Definition at line 1777 of file collisionPolygon.cxx.

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

Referenced by init_libcollide().

## ◆ verify_points() [1/3]

bool CollisionPolygon::verify_points | ( | const LPoint3 & | a,
|  | const LPoint3 & | b,
|  | const LPoint3 & | c )
| inline static

Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.

Definition at line 81 of file collisionPolygon.I.

References verify_points().

## ◆ verify_points() [2/3]

bool CollisionPolygon::verify_points | ( | const LPoint3 & | a,
|  | const LPoint3 & | b,
|  | const LPoint3 & | c,
|  | const LPoint3 & | d )
| inline static

Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.

Definition at line 96 of file collisionPolygon.I.

References verify_points().

## ◆ verify_points() [3/3]

bool CollisionPolygon::verify_points | ( | const LPoint3 * | begin,
|  | const LPoint3 * | end )
| static

Verifies that the indicated set of points will define a valid CollisionPolygon: that is, at least three non-collinear points, with no points repeated.

This does not check that the polygon defined is convex; that check is made later, once we have projected the points to 2-d space where the decision is easier.

Definition at line 79 of file collisionPolygon.cxx.

Referenced by verify_points(), and verify_points().

## ◆ write()

void CollisionPolygon::write | ( | std::ostream & | out,
|  | int | indent_level = 0 ) const
| virtual

Reimplemented from CollisionSolid.

Definition at line 310 of file collisionPolygon.cxx.

## ◆ write_datagram()

void CollisionPolygon::write_datagram | ( | BamWriter * | manager,
|  | Datagram & | me )
| virtual

Function to write the important information in the particular object to a Datagram.

Reimplemented from CollisionPlane.

Definition at line 1707 of file collisionPolygon.cxx.

References Datagram::add_uint16(), and CollisionPlane::write_datagram().

## ◆ xform()

void CollisionPolygon::xform | ( | const LMatrix4 & | mat | ) |
| virtual

Transforms the solid by the indicated matrix.

Reimplemented from CollisionPlane.

Definition at line 178 of file collisionPolygon.cxx.

References CollisionSolid::xform().

## Member Data Documentation

## ◆ get_num_points

size_t CollisionPolygon::get_num_points
| inline

Returns the number of vertices of the CollisionPolygon.

Definition at line 52 of file collisionPolygon.h.

## ◆ get_point

LPoint3 CollisionPolygon::get_point
| inline

Returns the nth vertex of the CollisionPolygon, expressed in 3-D space.

Definition at line 52 of file collisionPolygon.h.

## ◆ is_concave

bool CollisionPolygon::is_concave

Returns true if the CollisionPolygon appears to be concave, or false if it is safely convex.

Definition at line 66 of file collisionPolygon.h.

## ◆ is_valid

bool CollisionPolygon::is_valid

Returns true if the CollisionPolygon is valid (that is, it has at least three vertices), or false otherwise.

Definition at line 65 of file collisionPolygon.h.

The documentation for this class was generated from the following files:

- panda/src/collide/collisionPolygon.h
- panda/src/collide/collisionPolygon.cxx
- panda/src/collide/collisionPolygon.I