22 TypeHandle BulletConvexPointCloudShape::_type_handle;
27 BulletConvexPointCloudShape::
28 BulletConvexPointCloudShape(
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);
51 btCollisionShape *BulletConvexPointCloudShape::
60 BulletConvexPointCloudShape::
61 BulletConvexPointCloudShape(
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);
94 BulletConvexPointCloudShape::
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);
111 int BulletConvexPointCloudShape::
112 get_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);
165 void 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);
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Base class for objects that can be written to and read from Bam files.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
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.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
Similar to MutexHolder, but for a light mutex.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
const LVecBase3 & get_data3()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_int32(int32_t value)
Adds a signed 32-bit integer to the datagram.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...