24BulletPlaneShape(LPlane plane) {
26 btVector3 btNormal = LVecBase3_to_btVector3(plane.get_normal());
28 _shape =
new btStaticPlaneShape(btNormal, plane.get_w());
29 _shape->setUserPointer(
this);
36BulletPlaneShape(
const LVector3 &normal, PN_stdfloat constant) {
38 btVector3 btNormal = LVecBase3_to_btVector3(normal);
40 _shape =
new btStaticPlaneShape(btNormal, constant);
41 _shape->setUserPointer(
this);
49 LightMutexHolder holder(BulletWorld::get_global_lock());
51 btVector3 btNormal = copy._shape->getPlaneNormal();
52 PN_stdfloat constant = (PN_stdfloat)_shape->getPlaneConstant();
54 _shape =
new btStaticPlaneShape(btNormal, constant);
55 _shape->setUserPointer(
this);
61btCollisionShape *BulletPlaneShape::
70LPlane BulletPlaneShape::
72 LightMutexHolder holder(BulletWorld::get_global_lock());
74 btVector3 normal = _shape->getPlaneNormal();
75 return LPlane(normal[0], normal[1], normal[2], (PN_stdfloat)_shape->getPlaneConstant());
81PN_stdfloat BulletPlaneShape::
82get_plane_constant()
const {
83 LightMutexHolder holder(BulletWorld::get_global_lock());
85 return (PN_stdfloat)_shape->getPlaneConstant();
91LVector3 BulletPlaneShape::
92get_plane_normal()
const {
93 LightMutexHolder holder(BulletWorld::get_global_lock());
95 return btVector3_to_LVector3(_shape->getPlaneNormal());
104 LVector3 normal = solid->get_normal();
105 PN_stdfloat constant = solid->dist_to_plane(LPoint3(0, 0, 0));
107 return new BulletPlaneShape(normal, constant);
127 get_plane_normal().write_datagram(dg);
143 param->fillin(scan, manager);
152void BulletPlaneShape::
155 nassertv(_shape ==
nullptr);
160 normal.read_datagram(scan);
164 _shape =
new btStaticPlaneShape(LVecBase3_to_btVector3(normal), constant);
165 _shape->setUserPointer(
this);
166 _shape->setMargin(margin);
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.
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.
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.
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_stdfloat(PN_stdfloat value)
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
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.
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.