RavEngine
Loading...
Searching...
No Matches
PxSerialization.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_SERIALIZATION_H
30#define PX_SERIALIZATION_H
35#include "PxPhysXConfig.h"
36#include "common/PxBase.h"
37#include "cooking/PxCooking.h"
38#include "foundation/PxIO.h"
39#include "common/PxTolerancesScale.h"
40#include "common/PxTypeInfo.h"
41#include "common/PxStringTable.h"
42
47#define PX_BINARY_SERIAL_VERSION "4ACDCFBFCFC047699FFC47263E9670C0"
48
49
50#if !PX_DOXYGEN
51namespace physx
52{
53#endif
54
55 class PxBinaryConverter;
56
63{
64public:
73 {
78
83
85 PxXmlMiscParameter(PxVec3& inUpVector, PxTolerancesScale inScale) : upVector(inUpVector), scale(inScale) {}
86 };
87
112 static bool isSerializable(PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalReferences = NULL);
113
141 static void complete(PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* exceptFor = NULL, bool followJoints = false);
142
153 static void createSerialObjectIds(PxCollection& collection, const PxSerialObjectId base);
154
168 static PxCollection* createCollectionFromXml(PxInputData& inputData, PxCooking& cooking, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL, PxStringTable* stringTable = NULL, PxXmlMiscParameter* outArgs = NULL);
169
187 static PxCollection* createCollectionFromBinary(void* memBlock, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL);
188
207 static bool serializeCollectionToXml(PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, PxCooking* cooking = NULL, const PxCollection* externalRefs = NULL, PxXmlMiscParameter* inArgs = NULL);
208
231 static bool serializeCollectionToBinary(PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL, bool exportNames = false );
232
248 PX_DEPRECATED static bool serializeCollectionToBinaryDeterministic(PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL, bool exportNames = false);
249
266 PX_DEPRECATED static void dumpBinaryMetaData(PxOutputStream& outputStream, PxSerializationRegistry& sr);
267
275 PX_DEPRECATED static PxBinaryConverter* createBinaryConverter();
276
286 static PxSerializationRegistry* createSerializationRegistry(PxPhysics& physics);
287};
288
289#if !PX_DOXYGEN
290} // namespace physx
291#endif
292
294#endif
Utility functions for serialization.
Definition PxSerialization.h:63
static PX_DEPRECATED bool serializeCollectionToBinaryDeterministic(PxOutputStream &outputStream, PxCollection &collection, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL, bool exportNames=false)
Serializes a collection to a binary stream.
Definition SnBinarySerialization.cpp:419
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.
Definition SnXmlSerialization.cpp:731
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.
Definition SnXmlSerialization.cpp:797
static PX_DEPRECATED void dumpBinaryMetaData(PxOutputStream &outputStream, PxSerializationRegistry &sr)
Dumps the binary meta-data to a stream.
Definition SnSerialization.cpp:338
static void createSerialObjectIds(PxCollection &collection, const PxSerialObjectId base)
Creates PxSerialObjectId values for unnamed objects in a collection.
Definition SnSerialization.cpp:287
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.
Definition SnSerialization.cpp:261
static PX_DEPRECATED PxBinaryConverter * createBinaryConverter()
Creates binary converter for re-targeting binary-serialized data.
Definition SnSerialization.cpp:415
static PxCollection * createCollectionFromBinary(void *memBlock, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL)
Deserializes a PxCollection from memory.
Definition SnBinaryDeserialization.cpp:149
static PxSerializationRegistry * createSerializationRegistry(PxPhysics &physics)
Creates an application managed registry for serialization.
Definition SnSerializationRegistry.cpp:280
static bool serializeCollectionToBinary(PxOutputStream &outputStream, PxCollection &collection, PxSerializationRegistry &sr, const PxCollection *externalRefs=NULL, bool exportNames=false)
Serializes a collection to a binary stream.
Definition SnBinarySerialization.cpp:251
static bool isSerializable(PxCollection &collection, PxSerializationRegistry &sr, const PxCollection *externalReferences=NULL)
Returns whether the collection is serializable with the externalReferences collection.
Definition SnSerialization.cpp:114
Class to define the scale at which simulation runs. Most simulation tolerances are calculated in term...
Definition PxTolerancesScale.h:53
3 Element vector class.
Definition PxVec3.h:50
#define PX_DEPRECATED
Definition PxPreprocessor.h:418
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxU64 PxSerialObjectId
ID type for PxBase objects in a PxCollection.
Definition PxSerialFramework.h:61
Additional PxScene and PxPhysics options stored in XML serialized data.
Definition PxSerialization.h:73
PxVec3 upVector
Up vector for the scene reference coordinate system.
Definition PxSerialization.h:77
PxTolerancesScale scale
Tolerances scale to be used for the scene.
Definition PxSerialization.h:82