22TypeHandle BulletConvexPointCloudShape::_type_handle;
27BulletConvexPointCloudShape::
28BulletConvexPointCloudShape(
const PTA_LVecBase3 &points, LVecBase3 scale) :
31 btVector3 btScale = LVecBase3_to_btVector3(scale);
34 btVector3 *btPoints =
new btVector3[points.size()];
37 PTA_LVecBase3::const_iterator it;
38 for (it=points.begin(); it!=points.end(); it++) {
39 btPoints[i] = LVecBase3_to_btVector3(*it);
44 _shape =
new btConvexPointCloudShape(btPoints, points.size(), btScale);
45 _shape->setUserPointer(
this);
51btCollisionShape *BulletConvexPointCloudShape::
60BulletConvexPointCloudShape::
61BulletConvexPointCloudShape(
const Geom *geom, LVecBase3 scale) {
63 btVector3 btScale = LVecBase3_to_btVector3(scale);
77 btVector3 *btPoints =
new btVector3[points.size()];
81 for (it=points.begin(); it!=points.end(); it++) {
82 btPoints[i] = LVecBase3_to_btVector3(*it);
87 _shape =
new btConvexPointCloudShape(btPoints, points.size(), btScale);
88 _shape->setUserPointer(
this);
94BulletConvexPointCloudShape::
100 btVector3 *btPoints = copy._shape->getUnscaledPoints();
101 int numPoints = copy._shape->getNumPoints();
102 btVector3 btScale = LVecBase3_to_btVector3(_scale);
104 _shape =
new btConvexPointCloudShape(btPoints, numPoints, btScale);
105 _shape->setUserPointer(
this);
111int BulletConvexPointCloudShape::
112get_num_points()
const {
115 return _shape->getNumPoints();
135 _scale.write_datagram(dg);
138 for (
int i = 0; i < get_num_points(); ++i){
139 btVector3_to_LVector3(_shape->getUnscaledPoints()[i]).write_datagram(dg);
156 param->fillin(scan, manager);
165void BulletConvexPointCloudShape::
170 _scale.read_datagram(scan);
174 btVector3 *btPoints =
new btVector3[num_points];
175 for (
unsigned int i = 0; i < num_points; ++i) {
177 point.read_datagram(scan);
178 btPoints[i] = LVecBase3_to_btVector3(point);
182 _shape =
new btConvexPointCloudShape(btPoints, num_points, LVecBase3_to_btVector3(_scale));
183 _shape->setUserPointer(
this);
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
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...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
A class to retrieve the individual data elements previously stored in a Datagram.
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_int32(int32_t value)
Adds a signed 32-bit integer to the datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
bool is_at_end() const
Returns true if the reader is currently at the end of the list of vertices, false otherwise.
const LVecBase3 & get_data3()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
A container for geometry primitives.
Similar to MutexHolder, but for a light mutex.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
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.
This is our own Panda specialization on the default STL vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.