# panda3d.bullet.BulletTriangleMesh¶

class BulletTriangleMesh

Bases: TypedWritableReferenceCount

Inheritance diagram

__init__() → None
addArray(points: PTA_LVecBase3, indices: PTA_int, remove_duplicate_vertices: bool) → None

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 setWeldingDistance(). This comes at a significant performance cost, especially for large meshes.

addGeom(geom: Geom, remove_duplicate_vertices: bool, ts: TransformState) → None

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 setWeldingDistance(). This comes at a significant performance cost, especially for large meshes.

addTriangle(p0: LPoint3, p1: LPoint3, p2: LPoint3, remove_duplicate_vertices: bool) → None

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 setWeldingDistance(). This comes at a significant performance cost, especially for large meshes.

static getClassType() → TypeHandle
Return type

TypeHandle

getNumTriangles() → size_t

Returns the number of triangles in this triangle mesh.

Return type

size_t

getWeldingDistance() → float

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

output(out: ostream) → None
preallocate(num_verts: int, num_indices: int) → None

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 addTriangle() many times, to prevent unnecessary reallocations.

setWeldingDistance(distance: float) → None

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.

property triangles

Returns the vertex indices making up the given triangle index.

Return type
property vertices

Returns the vertex at the given vertex index.

Return type

Sequence[LPoint3]

property welding_distance
Getter

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

Setter

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.

Return type

float

write(out: ostream, indent_level: int) → None