Collection class for serialization.
More...
#include <PxCollection.h>
Collection class for serialization.
A collection is a set of PxBase objects. PxBase objects can be added to the collection regardless of other objects they depend on. Objects may be named using PxSerialObjectId values in order to resolve dependencies between objects of different collections.
Serialization and deserialization only work through collections.
A scene is typically serialized using the following steps:
- create a serialization registry
- create a collection for scene objects
- complete the scene objects (adds all dependent objects, e.g. meshes)
- serialize collection
- release collection
- release serialization registry
For example the code may look like this:
SerialStream s;
PxCollection* collection = PxSerialization::createCollection(*scene);
A scene is typically deserialized using the following steps:
- load a serialized collection into memory
- create a serialization registry
- create a collection by passing the serialized memory block
- add collected objects to scene
- release collection
- release serialization registry
For example the code may look like this:
- See Also
- PxBase, PxCreateCollection()
PxCollection::PxCollection |
( |
| ) |
|
|
inlineprotected |
virtual PxCollection::~PxCollection |
( |
| ) |
|
|
inlineprotectedvirtual |
Adds a PxBase object to the collection.
Adds a PxBase object to the collection. Optionally a PxSerialObjectId can be provided in order to resolve dependencies between collections. A PxSerialObjectId value of PX_SERIAL_OBJECT_ID_INVALID means the object remains without id. Objects can be added regardless of other objects they require. If the object is already in the collection, the ID will be set if it was PX_SERIAL_OBJECT_ID_INVALID previously, otherwise the operation fails.
- Parameters
-
[in] | object | Object to be added to the collection |
[in] | id | Optional PxSerialObjectId id |
Adds all PxBase objects and their ids of collection to this collection.
PxBase objects already in this collection are ignored. Object ids need to be conflict free, i.e. the same object may not have two different ids within the two collections.
- Parameters
-
[in] | collection | Collection to be added |
Adds an id to a member PxBase object.
If the object is already associated with an id within the collection, the id is replaced. May only be called for objects that are members of the collection. The id needs to be unique within the collection.
- Parameters
-
[in] | object | Member PxBase object |
[in] | id | PxSerialObjectId id to be given to the object |
Adds a PxBase object to the collection if its not already part of the collection.
- Deprecated:
Does the same as PxCollection::add with id = PX_SERIAL_OBJECT_ID_INVALID except it additionally checks if the serializable is already part of the collection, in which case no serializable is added.
- Parameters
-
[in] | object | object to be added to the collection |
virtual bool PxCollection::contains |
( |
PxBase & |
object | ) |
const |
|
pure virtual |
Returns whether the collection contains a certain PxBase object.
- Parameters
-
- Returns
- Whether object is contained.
Looks for a PxBase object given a PxSerialObjectId value.
If there is no PxBase object in the collection with the given id, NULL is returned.
- Parameters
-
[in] | id | PxSerialObjectId value to look for |
- Returns
- PxBase object with the given id value or NULL
Gets the PxSerialObjectId name of a PxBase object within the collection.
The PxBase object needs to be a member of the collection.
- Parameters
-
[in] | object | PxBase object to get id for |
- Returns
- PxSerialObjectId name of the object or PX_SERIAL_OBJECT_ID_INVALID if the object is unnamed
Copies member PxSerialObjectId values to a user specified buffer.
- Parameters
-
[out] | userBuffer | Array of PxSerialObjectId values |
[in] | bufferSize | Capacity of userBuffer |
[in] | startIndex | Offset into list of member PxSerialObjectId values |
- Returns
- number of members PxSerialObjectId values that have been written to the userBuffer
virtual PxU32 PxCollection::getNbIds |
( |
| ) |
const |
|
pure virtual |
Gets number of PxSerialObjectId names in this collection.
- Returns
- Number of PxSerialObjectId names in this collection
virtual PxU32 PxCollection::getNbObjects |
( |
| ) |
const |
|
pure virtual |
Gets number of PxBase objects in this collection.
- Returns
- Number of objects in this collection
virtual PxBase& PxCollection::getObject |
( |
PxU32 |
index | ) |
const |
|
pure virtual |
Gets the PxBase object of this collection given its index.
- Parameters
-
- Returns
- PxBase object at index index
virtual PxU32 PxCollection::getObjects |
( |
PxBase ** |
userBuffer, |
|
|
PxU32 |
bufferSize, |
|
|
PxU32 |
startIndex = 0 |
|
) |
| const |
|
pure virtual |
Copies member PxBase pointers to a user specified buffer.
- Parameters
-
[out] | userBuffer | Array of PxBase pointers |
[in] | bufferSize | Capacity of userBuffer |
[in] | startIndex | Offset into list of member PxBase objects |
- Returns
- number of members PxBase objects that have been written to the userBuffer
virtual void PxCollection::release |
( |
| ) |
|
|
pure virtual |
Deletes a collection object.
This function only deletes the collection object, i.e. the container class. It doesn't delete objects that are part of the collection.
- See Also
- PxCreateCollection()
virtual void PxCollection::remove |
( |
PxBase & |
object | ) |
|
|
pure virtual |
Removes a PxBase member object from the collection.
Object needs to be contained by the collection.
- Parameters
-
[in] | object | PxBase object to be removed |
virtual void PxCollection::remove |
( |
PxCollection & |
collection | ) |
|
|
pure virtual |
Removes all PxBase objects of collection from this collection.
PxBase objects not present in this collection are ignored. Ids of objects which are removed are also removed.
- Parameters
-
[in] | collection | Collection to be removed |
Removes id from a contained PxBase object.
May only be called for ids that are associated with an object in the collection.
- Parameters
-
[in] | id | PxSerialObjectId value |
The documentation for this class was generated from the following file: