BulletTriangleMesh

class BulletTriangleMesh

Bases: TypedWritableReferenceCount

Inheritance diagram

Inheritance diagram of BulletTriangleMesh

BulletTriangleMesh(void)
void add_array(PTA_LVecBase3 const &points, PTA_int const &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.

void add_geom(Geom const *geom, bool remove_duplicate_vertices = false, TransformState const *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.

void add_triangle(LPoint3 const &p0, LPoint3 const &p1, LPoint3 const &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.

static TypeHandle get_class_type(void)
std::size_t get_num_triangles(void) const

Returns the number of triangles in this triangle mesh.

PN_stdfloat get_welding_distance(void) const

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

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. This is useful if you are about to call add_triangle() many times, to prevent unnecessary reallocations.

void set_welding_distance(PN_stdfloat 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.

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