Panda3D

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

## Public Member Functions
void | add_array (const PTA_LVecBase3 &points, const PTA_int &indices, bool remove_duplicate_vertices=false)
| Adds triangle information from an array of points and indices referring to these points.
void | add_geom (const Geom *geom, bool remove_duplicate_vertices=false, const TransformState *ts=TransformState::make_identity())
| Adds the geometry from the indicated Geom from the triangle mesh.
void | add_triangle (const LPoint3 &p0, const LPoint3 &p1, const LPoint3 &p2, bool remove_duplicate_vertices=false)
| Adds a triangle with the indicated coordinates.
void | do_add_triangle (const LPoint3 &p0, const LPoint3 &p1, const LPoint3 &p2, bool remove_duplicate_vertices=false)
| Adds a triangle with the indicated coordinates.
size_t | do_get_num_triangles () const
| Returns the number of triangles in this triangle mesh.
virtual TypeHandle | force_init_type ()
size_t | get_num_triangles () const
size_t | get_num_vertices () const
LVecBase3i | get_triangle (size_t index) const
virtual TypeHandle | get_type () const
LPoint3 | get_vertex (size_t index) const
PN_stdfloat | get_welding_distance () const
virtual void | output (std::ostream &out) const
void | preallocate (int num_verts, int num_indices)
| Used to reserve memory in anticipation of the given amount of vertices and indices being added to the triangle mesh.
btStridingMeshInterface * | ptr () const
void | set_welding_distance (PN_stdfloat distance)
virtual void | write (std::ostream &out, int indent_level) const
virtual void | write_datagram (BamWriter *manager, Datagram &dg)
| Writes the contents of this object to the datagram for shipping out to a Bam file.
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 TypeHandle | get_class_type ()
static void | init_type ()
static void | register_with_read_factory ()
| Tells the BamReader how to create objects of type BulletTriangleMesh.
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_triangles
| Returns the number of triangles in this triangle mesh.
| get_num_vertices
| Returns the number of vertices in this triangle mesh.
| get_triangle
| Returns the vertex indices making up the given triangle index.
| get_vertex
| Returns the vertex at the given vertex index.
| get_welding_distance
| Returns the value previously set with set_welding_distance(), or the value of 0 if none was set.
| set_welding_distance
| Sets the square of the distance at which vertices will be merged together when adding geometry with remove_duplicate_vertices set to true.
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 32 of file bulletTriangleMesh.h.

## Constructor & Destructor Documentation

## ◆ BulletTriangleMesh()

BulletTriangleMesh::BulletTriangleMesh | ( |  | ) |

Definition at line 30 of file bulletTriangleMesh.cxx.

## Member Function Documentation

## ◆ add_array()

void BulletTriangleMesh::add_array | ( | const PTA_LVecBase3 & | points,
|  | const PTA_int & | indices,
|  | bool | remove_duplicate_vertices = false )

Adds triangle information from an array of points and indices referring to these points.

This is more efficient than adding triangles one at a time.

If remove_duplicate_vertices is true, it will make sure that it does not add duplicate vertices if they already exist in the triangle mesh, within the tolerance specified by set_welding_distance(). This comes at a significant performance cost, especially for large meshes.

Definition at line 318 of file bulletTriangleMesh.cxx.

## ◆ add_geom()

void BulletTriangleMesh::add_geom | ( | const Geom * | geom,
|  | bool | remove_duplicate_vertices = false,
|  | const TransformState * | ts = TransformState::make_identity() )

Adds the geometry from the indicated Geom from the triangle mesh.

This is a one-time copy operation, and future updates to the Geom will not be reflected.

If remove_duplicate_vertices is true, it will make sure that it does not add duplicate vertices if they already exist in the triangle mesh, within the tolerance specified by set_welding_distance(). This comes at a significant performance cost, especially for large meshes.

Definition at line 204 of file bulletTriangleMesh.cxx.

References GeomVertexReader::get_data1i(), TransformState::get_mat, GeomVertexReader::is_at_end(), and TransformState::is_identity().

## ◆ add_triangle()

void BulletTriangleMesh::add_triangle | ( | const LPoint3 & | p0,
|  | const LPoint3 & | p1,
|  | const LPoint3 & | p2,
|  | bool | remove_duplicate_vertices = false )

Adds a triangle with the indicated coordinates.

If remove_duplicate_vertices is true, it will make sure that it does not add duplicate vertices if they already exist in the triangle mesh, within the tolerance specified by set_welding_distance(). This comes at a significant performance cost, especially for large meshes.

Definition at line 162 of file bulletTriangleMesh.cxx.

References do_add_triangle().

## ◆ do_add_triangle()

void BulletTriangleMesh::do_add_triangle | ( | const LPoint3 & | p0,
|  | const LPoint3 & | p1,
|  | const LPoint3 & | p2,
|  | bool | remove_duplicate_vertices = false )

Adds a triangle with the indicated coordinates.

If remove_duplicate_vertices is true, it will make sure that it does not add duplicate vertices if they already exist in the triangle mesh, within the tolerance specified by set_welding_distance(). This comes at a significant performance cost, especially for large meshes. Assumes the lock(bullet global lock) is held by the caller

Definition at line 124 of file bulletTriangleMesh.cxx.

Referenced by add_triangle().

## ◆ do_get_num_triangles()

size_t BulletTriangleMesh::do_get_num_triangles | ( |  | ) | const

Returns the number of triangles in this triangle mesh.

Assumes the lock(bullet global lock) is held by the caller

Definition at line 82 of file bulletTriangleMesh.cxx.

Referenced by BulletTriangleMeshShape::BulletTriangleMeshShape().

## ◆ force_init_type()

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

Reimplemented from TypedWritableReferenceCount.

Definition at line 106 of file bulletTriangleMesh.h.

## ◆ get_class_type()

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

Definition at line 95 of file bulletTriangleMesh.h.

## ◆ get_type()

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

Reimplemented from TypedWritableReferenceCount.

Definition at line 103 of file bulletTriangleMesh.h.

## ◆ init_type()

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

Definition at line 98 of file bulletTriangleMesh.h.

## ◆ output()

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

Definition at line 358 of file bulletTriangleMesh.cxx.

## ◆ preallocate()

void BulletTriangleMesh::preallocate | ( | int | num_verts,
|  | int | num_indices )

Used to reserve memory in anticipation of the given amount of vertices and indices being added to the triangle mesh.

This is useful if you are about to call add_triangle() many times, to prevent unnecessary reallocations.

Definition at line 103 of file bulletTriangleMesh.cxx.

## ◆ ptr()

btStridingMeshInterface * BulletTriangleMesh::ptr | ( |  | ) | const
| inline

Definition at line 17 of file bulletTriangleMesh.I.

## ◆ register_with_read_factory()

void BulletTriangleMesh::register_with_read_factory | ( |  | ) |
| static

Tells the BamReader how to create objects of type BulletTriangleMesh.

Definition at line 406 of file bulletTriangleMesh.cxx.

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

Referenced by init_libbullet().

## ◆ write()

void BulletTriangleMesh::write | ( | std::ostream & | out,
|  | int | indent_level ) const
| virtual

Definition at line 368 of file bulletTriangleMesh.cxx.

## ◆ write_datagram()

void BulletTriangleMesh::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 TypedWritable.

Definition at line 415 of file bulletTriangleMesh.cxx.

References Datagram::add_bool(), Datagram::add_int32(), Datagram::add_stdfloat(), and get_welding_distance.

## Member Data Documentation

## ◆ get_num_triangles

size_t BulletTriangleMesh::get_num_triangles

Returns the number of triangles in this triangle mesh.

Definition at line 73 of file bulletTriangleMesh.h.

## ◆ get_num_vertices

size_t BulletTriangleMesh::get_num_vertices

Returns the number of vertices in this triangle mesh.

Definition at line 72 of file bulletTriangleMesh.h.

## ◆ get_triangle

LVecBase3i BulletTriangleMesh::get_triangle

Returns the vertex indices making up the given triangle index.

Definition at line 73 of file bulletTriangleMesh.h.

## ◆ get_vertex

LPoint3 BulletTriangleMesh::get_vertex

Returns the vertex at the given vertex index.

Definition at line 72 of file bulletTriangleMesh.h.

## ◆ get_welding_distance

PN_stdfloat BulletTriangleMesh::get_welding_distance

Returns the value previously set with set_welding_distance(), or the value of 0 if none was set.

Definition at line 70 of file bulletTriangleMesh.h.

Referenced by write_datagram().

## ◆ set_welding_distance

void BulletTriangleMesh::set_welding_distance

Sets the square of the distance at which vertices will be merged together when adding geometry with remove_duplicate_vertices set to true.

The default is 0, meaning vertices will only be merged if they have the exact same position.

Definition at line 70 of file bulletTriangleMesh.h.

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

- panda/src/bullet/bulletTriangleMesh.h
- panda/src/bullet/bulletTriangleMesh.cxx
- panda/src/bullet/bulletTriangleMesh.I