Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
BulletTriangleMesh Class Reference
Inheritance diagram for BulletTriangleMesh:
TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

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. More...
 
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. More...
 
void add_triangle (const LPoint3 &p0, const LPoint3 &p1, const LPoint3 &p2, bool remove_duplicate_vertices=false)
 Adds a triangle with the indicated coordinates. More...
 
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. More...
 
size_t do_get_num_triangles () const
 Returns the number of triangles in this triangle mesh. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from TypedWritableReferenceCount
 TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
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(). More...
 
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. More...
 
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. More...
 
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. More...
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
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. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

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. More...
 
- 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. More...
 
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. More...
 
- 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. More...
 
 get_num_vertices
 Returns the number of vertices in this triangle mesh. More...
 
 get_triangle
 Returns the vertex indices making up the given triangle index. More...
 
 get_vertex
 Returns the vertex at the given vertex index. More...
 
 get_welding_distance
 Returns the value previously set with set_welding_distance(), or the value of 0 if none was set. More...
 
 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. More...
 
- Public Attributes inherited from TypedWritableReferenceCount
static BamReaderreader = nullptr)
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Additional Inherited Members

- Static Public Attributes inherited from TypedWritable
static TypedWritable *const Null = nullptr
 

Detailed Description

Definition at line 32 of file bulletTriangleMesh.h.

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 319 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 205 of file bulletTriangleMesh.cxx.

◆ 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 163 of file bulletTriangleMesh.cxx.

References do_add_triangle().

Referenced by BulletTriangleMeshShape::BulletTriangleMeshShape().

◆ 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 125 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 83 of file bulletTriangleMesh.cxx.

Referenced by BulletTriangleMeshShape::BulletTriangleMeshShape().

◆ 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 104 of file bulletTriangleMesh.cxx.

◆ register_with_read_factory()

void BulletTriangleMesh::register_with_read_factory ( )
static

Tells the BamReader how to create objects of type BulletTriangleMesh.

Definition at line 407 of file bulletTriangleMesh.cxx.

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

Referenced by init_libbullet().

◆ 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 416 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: