PxSerialization Class Reference
[Extensions]

Utility functions for serialization. More...

#include <PxSerialization.h>

List of all members.

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 PxCollectioncreateCollectionFromXml (PxInputData &inputData, PxCooking &cooking, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL, PxStringTable *stringTable=NULL, PxXmlMiscParameter *outArgs=NULL)
 Creates a PxCollection from XML data.
static PxCollectioncreateCollectionFromBinary (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 PxBinaryConvertercreateBinaryConverter ()
 Creates binary converter for re-targeting binary-serialized data.
static PxSerializationRegistrycreateSerializationRegistry (PxPhysics &physics)
 Creates an application managed registry for serialization.


Detailed Description

Utility functions for serialization.

See also:
PxCollection, PxSerializationRegistry

Member Function Documentation

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:

  • joints require their actors and constraint
  • rigid actors require their shapes
  • shapes require their material(s) and mesh (triangle mesh, convex mesh or height field), if any
  • articulations require their links and joints
  • aggregates require their actors
  • cloth actors require their cloth fabric

If followJoints is specified another rule is added:

  • actors require their joints

Specifying followJoints will make whole jointed actor chains being added to the collection. Following chains is interrupted whenever a object in exceptFor is encountered.

Parameters:
[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
See also:
PxCollection, PxSerialization::serializeCollectionToBinary, PxSerialization::serializeCollectionToXml, PxSerializationRegistry

static PxBinaryConverter* PxSerialization::createBinaryConverter (  )  [static]

Creates binary converter for re-targeting binary-serialized data.

Returns:
Binary converter instance.

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.

Parameters:
[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
See also:
PxCollection, PxSerialization::complete, PxSerialization::serializeCollectionToBinary, PxSerializationRegistry, PX_BINARY_SERIAL_VERSION

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.

Parameters:
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
Returns:
a pointer to a PxCollection if successful or NULL if it failed.
See also:
PxCollection, PxSerializationRegistry, PxInputData, PxStringTable, PxCooking, PxSerialization::PxXmlMiscParameter

static PxSerializationRegistry* PxSerialization::createSerializationRegistry ( PxPhysics physics  )  [static]

Creates an application managed registry for serialization.

Parameters:
[in] physics Physics SDK to generate create serialization registry
Returns:
PxSerializationRegistry instance.
See also:
PxSerializationRegistry

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.

Parameters:
[in,out] collection Collection for which names are created
[in] base Start address for PxSerialObjectId names
See also:
PxCollection

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).

Parameters:
[out] outputStream Stream to write meta data to
[in] sr PxSerializationRegistry instance with information about registered classes used for conversion.
See also:
PxOutputStream, PxSerializationRegistry

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:

  • articulation links
  • articulation joints
  • joints

A collection C can be serialized with external references collection D iff

  • C is complete relative to D (no dangling references)
  • Every object in D required by an object in C has a valid ID (no unnamed references)
  • Every subordinate object in C is required by another object in C (no orphans)

Parameters:
[in] collection Collection to be checked
[in] sr PxSerializationRegistry instance with information about registered classes.
[in] externalReferences the external References collection
Returns:
Whether the collection is serializable
See also:
PxSerialization::complete, PxSerialization::serializeCollectionToBinary, PxSerialization::serializeCollectionToXml, PxSerializationRegistry

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.

Note:
Serialization of objects in a scene that is simultaneously being simulated is not supported and leads to undefined behavior.
Parameters:
[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
Returns:
Whether serialization was successful
See also:
PxCollection, PxOutputStream, PxSerialization::complete, PxSerialization::createCollectionFromBinary, PxSerializationRegistry

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

See also:
PxSerialization.complete. Optionally the XML may contain meshes in binary cooked format for fast loading. It does this when providing a valid non-null PxCooking pointer.
Note:
Serialization of objects in a scene that is simultaneously being simulated is not supported and leads to undefined behavior.
Parameters:
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
Returns:
true if the collection is successfully serialized.
See also:
PxCollection, PxOutputStream, PxSerializationRegistry, PxCooking, PxSerialization::PxXmlMiscParameter


The documentation for this class was generated from the following file:


Copyright © 2008-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com