Utility functions for serialization. More...
#include <PxSerialization.h>
Classes | |
struct | PxXmlMiscParameter |
Additional PxScene and PxPhysics options stored in XML serialized data. More... | |
Public Member Functions | |
PX_DEPRECATED PX_INLINE PxBinaryConverter * | createBinaryConverter (PxSerializationRegistry &) |
Creates binary converter for re-targeting binary-serialized data. More... | |
Static Public Member Functions | |
static bool | isSerializable (PxCollection &collection, PxSerializationRegistry &sr, const PxCollection *externalReferences=NULL) |
Returns whether the collection is serializable with the externalReferences collection. More... | |
static void | complete (PxCollection &collection, PxSerializationRegistry &sr, const PxCollection *exceptFor=NULL, bool followJoints=false) |
Adds to a collection all objects such that it can be successfully serialized. More... | |
static void | createSerialObjectIds (PxCollection &collection, const PxSerialObjectId base) |
Creates PxSerialObjectId values for unnamed objects in a collection. More... | |
static PxCollection * | createCollectionFromXml (PxInputData &inputData, PxCooking &cooking, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL, PxStringTable *stringTable=NULL, PxXmlMiscParameter *outArgs=NULL) |
Creates a PxCollection from XML data. More... | |
static PxCollection * | createCollectionFromBinary (void *memBlock, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL) |
Deserializes a PxCollection from memory. More... | |
static bool | serializeCollectionToXml (PxOutputStream &outputStream, PxCollection &collection, PxSerializationRegistry &sr, PxCooking *cooking=NULL, const PxCollection *externalRefs=NULL, PxXmlMiscParameter *inArgs=NULL) |
Serializes a physics collection to an XML output stream. More... | |
static bool | serializeCollectionToBinary (PxOutputStream &outputStream, PxCollection &collection, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL, bool exportNames=false) |
Serializes a collection to a binary stream. More... | |
static void | dumpBinaryMetaData (PxOutputStream &outputStream, PxSerializationRegistry &sr) |
Dumps the binary meta-data to a stream. More... | |
static PxBinaryConverter * | createBinaryConverter () |
Creates binary converter for re-targeting binary-serialized data. More... | |
static PxSerializationRegistry * | createSerializationRegistry (PxPhysics &physics) |
Creates an application managed registry for serialization. More... | |
Utility functions for serialization.
|
static |
Adds to a collection all objects such that it can be successfully serialized.
A collection C is complete relative to an other collection D if every object required by C is either in C or D. This function adds objects to a collection, such that it becomes complete with respect to the exceptFor collection. Completeness is needed for serialization. See PxSerialization::serializeCollectionToBinary, PxSerialization::serializeCollectionToXml.
Sdk objects require other sdk object according to the following rules:
If followJoints is specified another rule is added:
Specifying followJoints will make whole jointed actor chains being added to the collection. Following chains is interrupted whenever a object in exceptFor is encountered.
[in,out] | collection | Collection which is completed |
[in] | sr | PxSerializationRegistry instance with information about registered classes. |
[in] | exceptFor | Optional exemption collection |
[in] | followJoints | Specifies whether joints should be added for jointed actors |
|
static |
Creates binary converter for re-targeting binary-serialized data.
|
inline |
Creates binary converter for re-targeting binary-serialized data.
References createBinaryConverter().
Referenced by createBinaryConverter().
|
static |
Deserializes a PxCollection from memory.
Creates a collection from memory. If the collection has external dependencies another collection can be provided to resolve these.
The memory block provided has to be 128 bytes aligned and contain a contiguous serialized collection as written by PxSerialization::serializeCollectionToBinary. The contained binary data needs to be compatible with the current binary format version which is defined by "PX_PHYSICS_VERSION_MAJOR.PX_PHYSICS_VERSION_MINOR.PX_PHYSICS_VERSION_BUGFIX-PX_BINARY_SERIAL_VERSION". For a list of compatible sdk releases refer to the documentation of PX_BINARY_SERIAL_VERSION.
[in] | memBlock | Pointer to memory block containing the serialized collection |
[in] | sr | PxSerializationRegistry instance with information about registered classes. |
[in] | externalRefs | Collection to resolve external dependencies |
|
static |
Creates a PxCollection from XML data.
inputData | The input data containing the XML collection. |
cooking | PxCooking instance used for sdk object instantiation. |
sr | PxSerializationRegistry instance with information about registered classes. |
externalRefs | PxCollection used to resolve external references. |
stringTable | PxStringTable instance used for storing object names. |
outArgs | Optional parameters of physics and scene deserialized from XML. See PxSerialization::PxXmlMiscParameter |
|
static |
Creates an application managed registry for serialization.
[in] | physics | Physics SDK to generate create serialization registry |
|
static |
Creates PxSerialObjectId values for unnamed objects in a collection.
Creates PxSerialObjectId names for unnamed objects in a collection starting at a base value and incrementing, skipping values that are already assigned to objects in the collection.
[in,out] | collection | Collection for which names are created |
[in] | base | Start address for PxSerialObjectId names |
|
static |
Dumps the binary meta-data to a stream.
A meta-data file contains information about the SDK's internal classes and about custom user types ready for serialization. Such a file is needed to convert binary-serialized data from one platform to another (re-targeting). The converter needs meta-data files for the source and target platforms to perform conversions.
Custom user types can be supported with PxSerializationRegistry::registerBinaryMetaDataCallback (see the guide for more information).
[out] | outputStream | Stream to write meta data to |
[in] | sr | PxSerializationRegistry instance with information about registered classes used for conversion. |
|
static |
Returns whether the collection is serializable with the externalReferences collection.
Some definitions to explain whether a collection can be serialized or not:
For definitions of requires and complete see PxSerialization::complete
A serializable object is subordinate if it cannot be serialized on it's own The following objects are subordinate:
A collection C can be serialized with external references collection D iff
[in] | collection | Collection to be checked |
[in] | sr | PxSerializationRegistry instance with information about registered classes. |
[in] | externalReferences | the external References collection |
|
static |
Serializes a collection to a binary stream.
Serializes a collection to a stream. In order to resolve external dependencies the externalReferences collection has to be provided. Optionally names of objects that where set for example with PxActor::setName are serialized along with the objects.
The collection can be successfully serialized if isSerializable(collection) returns true. See isSerializable.
The implementation of the output stream needs to fulfill the requirements on the memory block input taken by PxSerialization::createCollectionFromBinary.
[out] | outputStream | into which the collection is serialized |
[in] | collection | Collection to be serialized |
[in] | sr | PxSerializationRegistry instance with information about registered classes. |
[in] | externalRefs | Collection used to resolve external dependencies |
[in] | exportNames | Specifies whether object names are serialized |
|
static |
Serializes a physics collection to an XML output stream.
The collection to be serialized needs to be complete
outputStream | Stream to save collection to. |
collection | PxCollection instance which is serialized. The collection needs to be complete with respect to the externalRefs collection. |
sr | PxSerializationRegistry instance with information about registered classes. |
cooking | Optional pointer to cooking instance. If provided, cooked mesh data is cached for fast loading. |
externalRefs | Collection containing external references. |
inArgs | Optional parameters of physics and scene serialized to XML along with the collection. See PxSerialization::PxXmlMiscParameter |