26 BulletBoxShape(
const LVecBase3 &halfExtents) : _half_extents(halfExtents) {
28 btVector3 btHalfExtents = LVecBase3_to_btVector3(halfExtents);
30 _shape =
new btBoxShape(btHalfExtents);
31 _shape->setUserPointer(
this);
41 _half_extents = copy._half_extents;
42 btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents);
44 _shape =
new btBoxShape(btHalfExtents);
45 _shape->setUserPointer(
this);
51 btCollisionShape *BulletBoxShape::
60 LVecBase3 BulletBoxShape::
61 get_half_extents_without_margin()
const {
64 return btVector3_to_LVecBase3(_shape->getHalfExtentsWithoutMargin());
70 LVecBase3 BulletBoxShape::
71 get_half_extents_with_margin()
const {
74 return btVector3_to_LVecBase3(_shape->getHalfExtentsWithMargin());
83 LPoint3 p0 = solid->get_min();
84 LPoint3 p1 = solid->get_max();
86 LVecBase3 extents((p1.get_x() - p0.get_x()) / 2.0,
87 (p1.get_y() - p0.get_y()) / 2.0,
88 (p1.get_z() - p0.get_z()) / 2.0);
109 _half_extents.write_datagram(dg);
124 param->fillin(scan, manager);
133 void BulletBoxShape::
136 nassertv(_shape ==
nullptr);
140 _half_extents.read_datagram(scan);
142 _shape =
new btBoxShape(LVecBase3_to_btVector3(_half_extents));
143 _shape->setUserPointer(
this);
144 _shape->setMargin(margin);
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
A cuboid collision volume or object.
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 add_stdfloat(PN_stdfloat value)
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
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.
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.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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 ...
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.