#include <PxSerialization.h>
Classes | |
struct | PxXmlMiscParameter |
Additional PxScene and PxPhysics options stored in XML 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. | |
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. | |
static void | createSerialObjectIds (PxCollection &collection, const PxSerialObjectId base) |
Creates PxSerialObjectId values for unnamed objects in a collection. | |
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. | |
static PxCollection * | createCollectionFromBinary (void *memBlock, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL) |
Deserializes a PxCollection from memory. | |
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. | |
static bool | serializeCollectionToBinary (PxOutputStream &outputStream, PxCollection &collection, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL, bool exportNames=false) |
Serializes a collection to a binary stream. | |
static void | dumpBinaryMetaData (PxOutputStream &outputStream, PxSerializationRegistry &sr) |
Dumps the binary meta-data to a stream. | |
static PxBinaryConverter * | createBinaryConverter () |
Creates binary converter for re-targeting binary-serialized data. | |
static PxSerializationRegistry * | createSerializationRegistry (PxPhysics &physics) |
Creates an application managed registry for serialization. |
static void PxSerialization::complete | ( | PxCollection & | collection, | |
PxSerializationRegistry & | sr, | |||
const PxCollection * | exceptFor = NULL , |
|||
bool | followJoints = false | |||
) | [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 PxBinaryConverter* PxSerialization::createBinaryConverter | ( | ) | [static] |
Creates binary converter for re-targeting binary-serialized data.
static PxCollection* PxSerialization::createCollectionFromBinary | ( | void * | memBlock, | |
PxSerializationRegistry & | sr, | |||
const PxCollection * | externalRefs = NULL | |||
) | [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 PxCollection* PxSerialization::createCollectionFromXml | ( | PxInputData & | inputData, | |
PxCooking & | cooking, | |||
PxSerializationRegistry & | sr, | |||
const PxCollection * | externalRefs = NULL , |
|||
PxStringTable * | stringTable = NULL , |
|||
PxXmlMiscParameter * | outArgs = NULL | |||
) | [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 PxSerializationRegistry* PxSerialization::createSerializationRegistry | ( | PxPhysics & | physics | ) | [static] |
Creates an application managed registry for serialization.
[in] | physics | Physics SDK to generate create serialization registry |
static void PxSerialization::createSerialObjectIds | ( | PxCollection & | collection, | |
const PxSerialObjectId | base | |||
) | [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 void PxSerialization::dumpBinaryMetaData | ( | PxOutputStream & | outputStream, | |
PxSerializationRegistry & | sr | |||
) | [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 bool PxSerialization::isSerializable | ( | PxCollection & | collection, | |
PxSerializationRegistry & | sr, | |||
const PxCollection * | externalReferences = NULL | |||
) | [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 bool PxSerialization::serializeCollectionToBinary | ( | PxOutputStream & | outputStream, | |
PxCollection & | collection, | |||
PxSerializationRegistry & | sr, | |||
const PxCollection * | externalRefs = NULL , |
|||
bool | exportNames = false | |||
) | [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 bool PxSerialization::serializeCollectionToXml | ( | PxOutputStream & | outputStream, | |
PxCollection & | collection, | |||
PxSerializationRegistry & | sr, | |||
PxCooking * | cooking = NULL , |
|||
const PxCollection * | externalRefs = NULL , |
|||
PxXmlMiscParameter * | inArgs = NULL | |||
) | [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 |