Add ability to persist ghost nodes.

This commit is contained in:
Stephen Imhoff 2021-02-05 20:28:17 +00:00
parent a9f3940577
commit cc4701d299
3 changed files with 31 additions and 0 deletions

View File

@ -171,3 +171,27 @@ do_sync_b2p() {
_sync_disable = false; _sync_disable = false;
} }
} }
/**
* Tells the BamReader how to create objects of type BulletGhostNode.
*/
void BulletGhostNode::
register_with_read_factory() {
BamReader::get_factory()->register_factory(get_class_type(), make_from_bam);
}
/**
* This function is called by the BamReader's factory when a new object of
* this type is encountered in the Bam file. It should create the ghost node.
*/
TypedWritable *BulletGhostNode::
make_from_bam(const FactoryParams &params) {
BulletGhostNode *param = new BulletGhostNode;
DatagramIterator scan;
BamReader *manager;
parse_params(params, scan, manager);
param->fillin(scan, manager);
return param;
}

View File

@ -59,6 +59,12 @@ private:
void do_transform_changed(); void do_transform_changed();
public:
static void register_with_read_factory();
protected:
static TypedWritable *make_from_bam(const FactoryParams &params);
public: public:
static TypeHandle get_class_type() { static TypeHandle get_class_type() {
return _type_handle; return _type_handle;

View File

@ -189,6 +189,7 @@ init_libbullet() {
BulletDebugNode::register_with_read_factory(); BulletDebugNode::register_with_read_factory();
BulletPlaneShape::register_with_read_factory(); BulletPlaneShape::register_with_read_factory();
BulletRigidBodyNode::register_with_read_factory(); BulletRigidBodyNode::register_with_read_factory();
BulletGhostNode::register_with_read_factory();
BulletSphereShape::register_with_read_factory(); BulletSphereShape::register_with_read_factory();
BulletTriangleMesh::register_with_read_factory(); BulletTriangleMesh::register_with_read_factory();
BulletTriangleMeshShape::register_with_read_factory(); BulletTriangleMeshShape::register_with_read_factory();