14#ifndef __BULLET_TRIANGLE_MESH_H__
15#define __BULLET_TRIANGLE_MESH_H__
32class EXPCL_PANDABULLET BulletTriangleMesh :
public TypedWritableReferenceCount {
35 ~BulletTriangleMesh() =
default;
40 bool remove_duplicate_vertices=
false);
41 void add_array(
const PTA_LVecBase3 &points,
42 const PTA_int &indices,
43 bool remove_duplicate_vertices=
false);
45 bool remove_duplicate_vertices=
false,
54 virtual void output(std::ostream &out)
const;
55 virtual void write(std::ostream &out,
int indent_level)
const;
67 bool remove_duplicate_vertices=
false);
76 INLINE btStridingMeshInterface *ptr()
const;
79 unsigned int find_or_add_vertex(
const LVecBase3 &p);
81 btTriangleIndexVertexArray _mesh;
82 btAlignedObjectArray<btVector3> _vertices;
83 btAlignedObjectArray<unsigned int> _indices;
84 PN_stdfloat _welding_distance;
91 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
98 static void init_type() {
99 TypedWritableReferenceCount::init_type();
101 TypedWritableReferenceCount::get_class_type());
103 virtual TypeHandle get_type()
const {
104 return get_class_type();
106 virtual TypeHandle force_init_type() {
108 return get_class_type();
112 static TypeHandle _type_handle;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void 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.
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 do_add_triangle(const LPoint3 &p0, const LPoint3 &p1, const LPoint3 &p2, bool remove_duplicate_vertices=false)
Adds a triangle with the indicated coordinates.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletTriangleMesh.
get_vertex
Returns the vertex at the given vertex index.
get_num_triangles
Returns the number of triangles in this triangle mesh.
get_welding_distance
Returns the value previously set with set_welding_distance(), or the value of 0 if none was set.
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...
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.
set_welding_distance
Sets the square of the distance at which vertices will be merged together when adding geometry with r...
get_triangle
Returns the vertex indices making up the given triangle index.
get_num_vertices
Returns the number of vertices in this triangle mesh.
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
A container for geometry primitives.
TypeHandle is the identifier used to differentiate C++ class types.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.